您尚未登录。

#1 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-29 15:17:28

哇酷小二 说:

先把原来的 ko 文件夹删了, 重新安装: https://whycan.cn/t_2701.html#p21651

类似这个命令:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules_install INSTALL_MOD_PATH=/opt/buildroot-2018.08.2/output/target/

然后用 modprobe 安装驱动, 不要用 insmod



# insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1                                                                                                                                                                           
[   95.097028] Mass Storage Function, version: 2009/09/11
[   95.102354] LUN: removable file: (no medium)
[   95.106983] LUN: removable file: /dev/mmcblk0p1
[   95.111605] Number of LUNs=1
[   95.115709] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[   95.122829] g_mass_storage gadget: userspace failed to provide iSerialNumber
[   95.129946] g_mass_storage gadget: g_mass_storage ready
# [  111.714089] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
                                                                                                                                                                                                                                             
#
#
# fdisk                                                                                                                                                                                                                                     
BusyBox v1.27.2 (2017-11-16 08:24:23 CST) multi-call binary.

Usage: fdisk [-ul] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK

Change partition table

        -u              Start and End are in sectors (instead of cylinders)
        -l              Show partition table for each DISK, then exit
        -b 2048         (for certain MO disks) use 2048-byte sectors
        -C CYLINDERS    Set number of cylinders/heads/sectors
        -H HEADS        Typically 255
        -S SECTORS      Typically 63
# fdisk -l                                                                                                                                                                                                                                   
Disk /dev/mmcblk0: 120 MB, 125960192 bytes, 246016 sectors
3844 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    0,32,33     4,52,48           2048      67583      65536 32.0M  6 FAT16
Partition 1 does not end on cylinder boundary
/dev/mmcblk0p2    4,52,49     15,75,60         67584     245759     178176 87.0M 83 Linux
Partition 2 does not end on cylinder boundary
# ls
g_mass_storage.ko
# cd /                                                                                                                                                                                                                                       
# ls
bin           lib32         mnt           run           ts
dev           linuxrc       opt           sbin          usr
etc           lost+found    proc          sys           v3s-key-test
lib           media         root          tmp           var
# mount /dev/mmcblk0p1 mnt                                                                                                                                                                                                                   
[  222.320193] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
# cd mnt/                                                                                                                                                                                                                                   
# ls
System Volume Information         sun8i-v3s-licheepi-zero.dtb
sun8i-v3s-licheepi-zero-dock.dtb  zImage

可以了,感谢大佬。稍后我把细节问题发出来分享给大家!!!

#2 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-29 14:35:08

哇酷小二 说:

你的ko安装和加载操作可能有问题。

你是怎么做的?


加载驱动如下:
# ls
g_mass_storage.ko      libcomposite.ko        usb_f_mass_storage.ko
# insmod libcomposite.ko                                                                                                                                                                                                                     
# insmod usb_f_mass_storage.ko                                                                                                                                                                                                               
insmod: can't insert 'usb_f_mass_storage.ko': invalid module format
# insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1                                                                                                                                                                           
[ 2108.120204] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[ 2108.127009] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[ 2108.134083] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[ 2108.140753] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[ 2108.147735] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[ 2108.154655] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[ 2108.162164] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[ 2108.169434] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
[ 2108.179749] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[ 2108.186554] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[ 2108.193649] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[ 2108.200315] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[ 2108.207296] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[ 2108.214218] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[ 2108.221726] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[ 2108.228974] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
insmod: can't insert 'g_mass_storage.ko': unknown symbol in module, or unknown parameter

#3 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-29 14:20:01

哇酷小二 说:

有没有勾上  CONFIG_USB_F_MASS_STORAGE ?






分析过程:
$ cd A33/mainline/linux
linux $ grep fsg_common_create_luns  -r .
./drivers/usb/gadget/legacy/acm_ms.c:   status = fsg_common_create_luns(opts->common, &config);
./drivers/usb/gadget/legacy/mass_storage.c:     status = fsg_common_create_luns(opts->common, &config);
./drivers/usb/gadget/legacy/multi.c:    status = fsg_common_create_luns(fsg_opts->common, &config);
./drivers/usb/gadget/legacy/nokia.c:    status = fsg_common_create_luns(fsg_opts->common, &fsg_config);
./drivers/usb/gadget/function/f_mass_storage.h:int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg);
./drivers/usb/gadget/function/f_mass_storage.c:int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg)
./drivers/usb/gadget/function/f_mass_storage.c:EXPORT_SYMBOL_GPL(fsg_common_create_luns);





linux$ cat ./drivers/usb/gadget/function/Makefile  |grep f_mass_storage
usb_f_mass_storage-y            := f_mass_storage.o storage_common.o
obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o


root@guang-virtual-machine:/home/guang/licheepi/linux-zero-5.2.y# grep fsg_common_create_luns  -r
Module.symvers:0x00000000    fsg_common_create_luns    drivers/usb/gadget/function/usb_f_mass_storage    EXPORT_SYMBOL_GPL
drivers/usb/gadget/function/f_mass_storage.c:int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg)
drivers/usb/gadget/function/f_mass_storage.c:EXPORT_SYMBOL_GPL(fsg_common_create_luns);
Binary file drivers/usb/gadget/function/usb_f_mass_storage.ko matches
Binary file drivers/usb/gadget/function/usb_f_mass_storage.o matches
drivers/usb/gadget/function/f_mass_storage.h:int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg);
Binary file drivers/usb/gadget/function/f_mass_storage.o matches
Binary file drivers/usb/gadget/legacy/mass_storage.o matches
Binary file drivers/usb/gadget/legacy/g_mass_storage.o matches
drivers/usb/gadget/legacy/mass_storage.c:    status = fsg_common_create_luns(opts->common, &config);
Binary file drivers/usb/gadget/legacy/g_mass_storage.ko matches
drivers/usb/gadget/legacy/multi.c:    status = fsg_common_create_luns(fsg_opts->common, &config);
drivers/usb/gadget/legacy/nokia.c:    status = fsg_common_create_luns(fsg_opts->common, &fsg_config);
drivers/usb/gadget/legacy/acm_ms.c:    status = fsg_common_create_luns(opts->common, &config);
root@guang-virtual-machine:/home/guang/licheepi/linux-zero-5.2.y# cat ./drivers/usb/gadget/function/Makefile  |grep f_mass_storage
usb_f_mass_storage-y        := f_mass_storage.o storage_common.o
obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o
root@guang-virtual-machine:/home/guang/licheepi/linux-zero-5.2.y#

有勾选的
但是加载的时候提示这个insmod: can't insert 'usb_f_mass_storage.ko': invalid module

#4 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-29 13:37:21

没事瞎转悠hhh 说:

是的,但是我感觉4.13应该也没问题,相差应该不大

insmod: can't insert 'usb_f_mass_storage.ko': invalid module for[  928.535732] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
mat
[  928.546607] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[  928.553866] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[  928.560522] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[  928.567503] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[  928.574417] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[  928.581926] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[  928.589202] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
[  928.598633] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[  928.605436] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[  928.612510] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[  928.619187] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[  928.626169] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[  928.633107] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[  928.640619] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[  928.647871] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
insmod: can't insert 'g_mass_storage.ko': unknown symbol in module, or unknown parameter

这是什么原因?

#5 全志 SOC » 荔枝派zero SD卡模拟U盘,加载驱动模块出错,大佬们帮忙看看。 » 2020-04-29 11:08:28

云之初晓
回复: 0

kernel用的是linux-5.2
make menuconfig配置如下:
Device Driver ---->
     USB support---->
        * USB Mass Storage support

Device Driver ---->
     USB support---->
         USB Gadget Support--->
              <M> USB Gadget functions configurable through configfs
                * Generic serial bulk in/out
                * Mass storage
                *  Function filesystem
   
               [M] USB Gadget precomposed configurations
               [M] Mass storage Gadget

设备树没改动;
make ARCH=arm licheepi_zero_defconfig

加载驱动如下:
# ls
g_mass_storage.ko      libcomposite.ko        usb_f_mass_storage.ko
# insmod libcomposite.ko                                                                                                                                                                                                                     
# insmod usb_f_mass_storage.ko                                                                                                                                                                                                               
insmod: can't insert 'usb_f_mass_storage.ko': invalid module format
# insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1                                                                                                                                                                           
[ 2108.120204] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[ 2108.127009] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[ 2108.134083] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[ 2108.140753] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[ 2108.147735] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[ 2108.154655] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[ 2108.162164] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[ 2108.169434] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
[ 2108.179749] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[ 2108.186554] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[ 2108.193649] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[ 2108.200315] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[ 2108.207296] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[ 2108.214218] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[ 2108.221726] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[ 2108.228974] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
insmod: can't insert 'g_mass_storage.ko': unknown symbol in module, or unknown parameter

#6 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-29 10:27:16

insmod: can't insert 'usb_f_mass_storage.ko': invalid module for[  928.535732] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
mat
[  928.546607] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[  928.553866] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[  928.560522] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[  928.567503] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[  928.574417] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[  928.581926] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[  928.589202] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
[  928.598633] g_mass_storage: Unknown symbol fsg_common_set_sysfs (err -2)
[  928.605436] g_mass_storage: Unknown symbol fsg_common_create_luns (err -2)
[  928.612510] g_mass_storage: Unknown symbol fsg_common_set_cdev (err -2)
[  928.619187] g_mass_storage: Unknown symbol fsg_common_free_buffers (err -2)
[  928.626169] g_mass_storage: Unknown symbol fsg_common_remove_luns (err -2)
[  928.633107] g_mass_storage: Unknown symbol fsg_common_set_inquiry_string (err -2)
[  928.640619] g_mass_storage: Unknown symbol fsg_common_set_num_buffers (err -2)
[  928.647871] g_mass_storage: Unknown symbol fsg_config_from_params (err -2)
insmod: can't insert 'g_mass_storage.ko': unknown symbol in module, or unknown parameter

这是什么原因?

#7 Re: 全志 SOC » 荔枝派zero USB gadget Mass Storage设置总结(调试成功) » 2020-04-27 17:56:26

没事瞎转悠hhh 说:

......上传也挺慢的,你直接在git下吧

内核版本是"zero-5.2.y"吗?

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn