Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementation Method Linux-USB Gadget Framework –The Linux-USB Gadget Framework makes it easy for peripherals and other devices embedding GNU/Linux system.

Similar presentations


Presentation on theme: "Implementation Method Linux-USB Gadget Framework –The Linux-USB Gadget Framework makes it easy for peripherals and other devices embedding GNU/Linux system."— Presentation transcript:

1 Implementation Method Linux-USB Gadget Framework –The Linux-USB Gadget Framework makes it easy for peripherals and other devices embedding GNU/Linux system software to act in the USB "device" (slave) role. The drivers implementing and using that API combine to make a useful driver framework for Linux systems that implement USB peripherals. File-backed Storage feature of Linux-USB Gadget Framework –implements the USB Mass Storage class, appearing to the host as a SCSI disk drive. This uses a file or block device as a backing store for the drive.

2 Configure Kernel Gadget is built in Linux-2.6 version We only need to configure, rebuild and install the 2.6 kernel, then we can get the gadget functions in the OS. The configure parameters related to gadget and its back-backed storage feature –CONFIG_USB_GADGET=y –CONFIG_USB_GADGET_DEBUG_FILES=y –CONFIG_USB_GADGET_PXA2XX=y –CONFIG_USB_PXA2XX=y –CONFIG_USB_PXA2XX_SMALL=y –CONFIG_USB_FILE_STORAGE=m

3 Stargate Export ‘disk’ device Create the device file for the ‘disk’ device –For usb flash storage mknod /dev/sda b 8 0 mknod /dev/sda1 b 8 1 Change its permission –Chmod 666 /dev/sda* Export it to usb slave interface –modprobe g_file_storage file=/dev/sda Remove it from usb slave interface –modprobe –r g_file_storage

4 Stargate Exports Its Root Image Find it root image partition (device) –cat /proc/mtd, you can see the devices of mtd –It is /dev/mtdblock1 in my testing stargate Export it to usb slave interface –modprobe g_file_storage file=/dev/mtdblock1

5 Other linux to see the content Pay attention to the filesystem exported by stargate usb slave interface For ext3 (et. usb flash storage) or other filesystem that are supported by linux(fedora), linux(fedora) will prompt up the usb disk automatically For jffs2 (the stargate root image); because other linux(fedora) doesn’t directly support the jffs2 filesystem, we need to do more things in order to show the content from stargate.

6 linux(fedora) shows jffs2 filesystem Using fake mtd device to show jffs2 –modprobe jffs2 –modprobe mtdcore –modprobe mtdchar –modprobe mtdram total_size=32512 erase_size=256 –modprobe mtdblock –mknod /dev/mtdblock b 31 0 –chmod 666 /dev/mtdblock –dd if=/dev/sda of=/dev/mtdblock –mount -t jffs2 /dev/mtdblock /mnt/usb Then we can see the root filesystem of stargate, which is in /mnt/usb directory on linux(fedora)

7 Write Back to Stargate For ext3 or other filesystems that linux(fedora) supports –You can directly write and change the content in the mounted volume. What you did will be saved to stargate directly. For jfss2 filesystem that linux(fedora) doesn’t support –We use faked MTD device (which is actually the memory in fedora) to handle jffs2 filesystem. So, what you have written is stored in the faked MTD device (the memory). If you want to save the changes to stargate, you need to copy the image back to stargate. –On fedora, run ‘dd if=/dev/mtdblock of=/dev/sda’, then the whole jffs2 root image will be copied back to stargate –Pay attention that the image you will copy is the whole filesystem, not only the things you wrote, but also other files in the image.

8 Upgrade Stargate OS through Its USb Slave Interface You can use the method mentioned in previous page to upgrade the OS on the stargate by the usb slave interface. It is fast and convenient. This is a good feature comes from this project. However, if you upload a wrong kernel image, the stargate cannot boot the linux kernel successfully. What can you do? You can still boot stargate to its bootldr command interface. And there are commands to let you transfer root image from PC to stargate by its serial port. Therefore, you can recover the system on stargate.

9 Testing System Architecture Stargate connects to other linux by using its slave interface via a usb cable A usb flash storage attach to the usb host interface of Stargate Other linux use its USB host interface StargateLinux USB Slave inteface USB Host Interface USB Host Interface USB Flash Storage


Download ppt "Implementation Method Linux-USB Gadget Framework –The Linux-USB Gadget Framework makes it easy for peripherals and other devices embedding GNU/Linux system."

Similar presentations


Ads by Google