8 Replies Latest reply on May 18, 2014 11:49 AM by AlexT_Intel

    How to use g_mass_storage on usb device interface in Galileo & Yocto

    swpark

      Hi,

       

      According to the Linux manual (https://communities.intel.com/servlet/JiveServlet/previewBody/22488-102-1-26046/Quark_SWDevManLx_330235_001.pdf), I'd like to use usb device port with "modprobe g_mass_storage file=/media/mmcblk0p1/sample.img", but got the message:

       

      modprobe: can't load module g_mass_storage (kernel/drivers/usb/gadget/g_mass_storage.ko): No such device

       

      What am I wrong with this? Would you give me what I need to check?

       

      Thank you,

      swpark.

        • 1. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
          AlexT_Intel

          Just to make sure - as per the same manual you refer to, you first needed to "modprobe pch_udc" before loading the g_mass_storage one. You did that, didn't you?

          • 2. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
            swpark

            Hi AlexT,

             

            Yes I did, but it keeps saying "can't load module g_mass_storage...: No such device"

            Any idea that I can try ?

             

            Thanks,

            • 3. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
              Intel_Jesus

              Hi swpark,

               

              what Linux image are you using?

               

              Regards,

              Intel_Jesus

              • 4. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
                Intel_Raad

                swpark, can you run the command "modprobe -l | grep g_mass" and post back the output please?


                • 5. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
                  swpark

                  Thank you for answering.

                   

                  Well, I got the g_mass_storage working by modifying .config when following "Basic Steps to Rebuild the Image" from Sergey's Blog - Malinov Family Web Presence

                  This is what I did.

                   

                  1. You can download the latest one from https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=23197&lang=eng&wapkw=intel+quark+bsphttps://communities.intel.com/message/222895#222895
                  2. And copy it to your build directory. In my case the file was named Board_Support_Package_Sources_for_Intel_Quark_v1.0.0.7z.
                  3. Unzip the file:7z x Board_Support_Package_Sources_for_Intel_Quark_v1.0.0.7z
                  4. Unzip meta-clanton_v0.7.5.tar.gz:tar xzvf meta-clanton_v1.0.0.tar.gz
                  5. Change directory to meta-clanton_v1.0.0:cd meta-clanton_v1.0.0
                  6. Run setup.sh:./setup.sh
                  7. Source poky/oe-init-build-env script, giving it the build directory (yocto_build) as a parameter:source poky/oe-init-build-env yocto_build
                  8. Before you build, you might need to install additional linux packages: diffstat texinfo gawk chrpath autopoint autoconf automakesudo apt-get install diffstat texinfo gawk chrpath autopoint autoconf automake
                  9. bitbake linux-yocto-clanton -c menuconfig
                    (I added verbose debugging, see attached screeshot)yocto_menuconfig.jpg
                  10. Run bitbake to build the image:bitbake image-full
                    • Note: image-full - SD card image, image-spi - SPI flash image.
                  11. Wait several hours, and if everything goes well you'll get your image in tmp/deploy/images/ directory. It will include:
                    • The Linux kernel: bzImage--3.8-r0-clanton-YYYYMMDDhhmmss.bin (YYYYMMDDhhmmss - timestamp indicating the build start time)
                    • Initial RAM FS: core-image-minimal-initramfs-clanton-YYYYMMDDhhmmss.rootfs.cpio.gz
                    • File system image: image-full-clanton-YYYYMMDDhhmmss.rootfs.ext3
                    • Kernel modules: modules--3.8-r0-clanton-YYYYMMDDhhmmss.tgz (not really needed, they are already in the file system image)
                    • Grub configuration: boot/grub/grub.conf
                  12. Copy these files to SD card renaming files as follows (resulting paths are relative to SD card's root):
                    • bzImage--3.8-r0-clanton-YYYYMMDDhhmmss.bin -> bzImage
                    • core-image-minimal-initramfs-clanton-YYYYMMDDhhmmss.rootfs.cpio.gz -> core-image-minimal-initramfs-clanton.cpio.gz
                    • image-full-clanton-YYYYMMDDhhmmss.rootfs.ext3 -> image-full-clanton.ext3
                    • boot/grub/grub.conf -> boot/grub/grub.conf
                    • Note that you can keep names or use different names for all files except of the image-full-clanton.ext3, and just update grub.conf with the correct names. The file system image must be named image-full-clanton.ext3 (initramfs will look for that) unless you update the configuration.
                  13. Insert SD card to your Galileo board, reboot it.
                  14. Once i reboot, and plug the USB cable into the other end(PC), then tried to copy many files and big size (600MB), and got following message from Galileo and PC keeps waiting.

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.620340] sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.620744] sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000002

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.620826] mmc0: req done (CMD17): 0: 00000900 00000000 00000000 00000000

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.620854] mmc0:     512 bytes transferred: 0

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.621498] mmc0: starting CMD17 arg 000043c6 flags 000000b5

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.621541] mmc0:     blksz 512 blocks 1 flags 00000200 tsac 100 ms nsac 0

                  Oct 17 09:54:03 clanton kern.debug kernel: [  712.621623] sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001

                   

                  [  942.522611] g_mass_storage gadget: full-speed config #1: Linux File-Backed Storage

                  [ 1024.267955] irq 41: nobody cared (try booting with the "irqpoll" option)

                  [ 1024.274713] Pid: 0, comm: swapper Not tainted 3.8.7-yocto-standard #1

                  [ 1024.277883] Call Trace:

                  [ 1024.277883]  [<c106d324>] __report_bad_irq.isra.6+0x24/0xa0

                  [ 1024.277883]  [<c11e16e2>] ? add_interrupt_randomness+0x132/0x160

                  [ 1024.277883]  [<c106d562>] note_interrupt+0x162/0x1b0

                  [ 1024.277883]  [<c1009017>] ? default_idle+0x17/0x30

                  [ 1024.277883]  [<c106bb90>] handle_irq_event_percpu+0x70/0x140

                  [ 1024.277883]  [<c12bef97>] ? printk+0x38/0x3a

                  [ 1024.277883]  [<c106d670>] ? handle_simple_irq+0x50/0x50

                  [ 1024.277883]  [<c106bc7c>] handle_irq_event+0x1c/0x30

                  [ 1024.277883]  [<c106d6c2>] handle_edge_irq+0x52/0xd0

                  [ 1024.277883]  <IRQ>  [<c100401a>] ? do_IRQ+0x3a/0xb0

                  [ 1024.277883]  [<c1046372>] ? hrtimer_start+0x22/0x30

                  [ 1024.277883]  [<c12c37ec>] ? common_interrupt+0x2c/0x31

                  [ 1024.277883]  [<c1009017>] ? default_idle+0x17/0x30

                  [ 1024.277883]  [<c10097ff>] ? cpu_idle+0x4f/0x60

                  [ 1024.277883]  [<c12bbb82>] ? rest_init+0x52/0x60

                  [ 1024.277883]  [<c142e946>] ? start_kernel+0x2d5/0x2db

                  [ 1024.277883]  [<c142e4a8>] ? repair_env_string+0x51/0x51

                  [ 1024.277883]  [<c142e2d1>] ? i386_start_kernel+0x9b/0xa2

                  [ 1024.277883] handlers:

                  [ 1024.277883] [<e0694260>] pch_udc_isr [pch_udc]

                  [ 1024.277883] Disabling IRQ #41

                   

                  root@clanton:/proc# more interrupts

                             CPU0

                    0:         70   IO-APIC-edge      timer

                    7:          1   IO-APIC-edge

                    8:          1   IO-APIC-edge      rtc0

                    9:          0   IO-APIC-fasteoi   acpi

                  16:      19561   IO-APIC-fasteoi   mmc0, ohci_hcd:usb2

                  17:      10184   IO-APIC-fasteoi   serial

                  19:          0   IO-APIC-fasteoi   ehci_hcd:usb1

                  40:       2074   PCI-MSI-edge      eth0

                  41:     200000   PCI-MSI-edge      pch_udc

                  NMI:          0   Non-maskable interrupts

                  LOC:      25307   Local timer interrupts

                  SPU:          0   Spurious interrupts

                  PMI:          0   Performance monitoring interrupts

                  IWI:          0   IRQ work interrupts

                  RTR:          0   APIC ICR read retries

                  TRM:          0   Thermal event interrupts

                  THR:          0   Threshold APIC interrupts

                  MCE:          0   Machine check exceptions

                  MCP:          0   Machine check polls

                  ERR:          1

                  MIS:          0

                  root@clanton:/proc# cd /proc/irq/41

                   

                  Would you give me some idea how to resolve this issue? I wonder if it's related to the hardware (Galileo), heard that there is a new version.

                   

                  Thank you,

                  Seungweon.

                  • 6. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
                    AlexT_Intel

                    So you mean that after reconfiguring kernel you're now able to load the module and it somewhat works, but now you get a different error, the one related to the IRQ, is that correct?

                     

                    Which kernel config options have you changed? I think it was more than just "verbose debugging" you listed, that one alone is unlikely to make the g_mass_storage load.

                    • 7. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
                      swpark

                      Hi AlexT_Intel,

                       

                      Yes. correct. g_mass_storage is working after I added some gadget modules, seems working. However, when copying bigger file (>600MB) and got debugging message.

                      I don't know much about the kernel configuration, but what I can tell is now, which file do you want to see? I found there are many .config files,

                       

                      spark@k42:~/Downloads/meta-clanton_v1.0.0$ find . -name .config

                      ./yocto_build/tmp/work/clanton-poky-linux-uclibc/linux-yocto-clanton/3.8-r0/package/usr/src/kernel/.config

                      ./yocto_build/tmp/work/clanton-poky-linux-uclibc/linux-yocto-clanton/3.8-r0/sysroot-destdir/usr/src/kernel/.config

                      ./yocto_build/tmp/work/clanton-poky-linux-uclibc/linux-yocto-clanton/3.8-r0/image/usr/src/kernel/.config

                      ./yocto_build/tmp/work/clanton-poky-linux-uclibc/linux-yocto-clanton/3.8-r0/packages-split/kernel-dev/usr/src/kernel/.config

                      ./yocto_build/tmp/work/clanton-poky-linux-uclibc/linux-yocto-clanton/3.8-r0/linux-clanton-standard-build/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/libav/0.8.4+gitAUTOINC+2c8ce46250ff78191fe6565876ddc4bc03fdf519-r8.0/git/build.i586-poky-linux-uclibc.i586-poky-linux-uclibc/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/busybox/1.20.2-r8/busybox-1.20.2/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/uclibc/0.9.33+gitAUTOINC+946799cd0ce0c6c803c9cb173a84f4d607bde350-r8.4/git/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/uclibc-initial/0.9.33+gitAUTOINC+946799cd0ce0c6c803c9cb173a84f4d607bde350-r8.4/git/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/linux-libc-headers/3.8-r0/linux-3.8/.config

                      ./yocto_build/tmp/work/i586-poky-linux-uclibc/wpa-supplicant/2.0-r1/wpa_supplicant-2.0/wpa_supplicant/.config

                      ./yocto_build/tmp/sysroots/clanton/usr/src/kernel/.config

                      spark@k42:~/Downloads/meta-clanton_v1.0.0$

                       

                      Thanks,

                      Seungweon.

                      • 8. Re: How to use g_mass_storage on usb device interface in Galileo & Yocto
                        AlexT_Intel

                        I see. Let's see this one: ./yocto_build/tmp/sysroots/clanton/usr/src/kernel/.config

                         

                        It may be the case that it's not Yocto- or Galileo-specific, what I'd suggest you to do is to look for g_mass_storage driver limitations and general operating conditions, maybe it's not intended for such big file transfers at all? That could help you to determinte the direction of further work - either within Yocto/Galileo (if it's specific to the board) or g_mass_storage driver itself (if it's not intended for such transfers).