I would like to emulate an USB from an image file.
I am using Centos7 with the Kernel 4.11.7 installed through kernel-ml
and kernel-ml-devel
elrepo 4.11.7-1.el7.elrepo.x86_64
(actually I tried with 3.10.* 4.10.* 4.11.1 too)
We have 2 solutions:
with insmod
sudo insmod /link/to/g_mass_storage.ko file=/tmp/filebin.img stall=0 removable=y
In dmesg:
udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers
with modprobe
$ sudo modprobe g_mass_storage file=/tmp/testusb.img stall=0 removable=y modprobe: FATAL: Module g_mass_storage not found. Nothing in dmesg.
I have also tried with dummy_hcd:
$ sudo modprobe dummy_hcd modprobe: FATAL: Module dummy_hcd not found.
How can I fix this problem ?
I tried many things like recompiling the Kernel 4.11.1 by enabling everything with gadget etc...
/usr/src/kernels/4.11.7-1.el7.elrepo.x86_64 $ cat .config | grep CONFIG_USB_DUMMY_HCD
# CONFIG_USB_DUMMY_HCD is not set
Result:
After compiling the kernel, I was able to modprobe dummy_hcd
and to emulate an usb with a binary file.