Flying embedded S5P4418 development board to achieve simulation U disk tutorial under Linux

Can Feiling embedded ARM Cortex-A9 S5P4418 development board meet the function of U disk? In fact, by modifying the kernel configuration and file system related content, the simulated U disk function can be implemented on the OK4418 development board. The simulated U disk can help us achieve the development board and Windows (currently only verified under XP system) operating system Data exchange.

When the development board is separated from Windows XP, it runs a data collection program, writes the collected data into a file and saves it in eMMC. When the Windows XP system needs to read the data collected by the development board, it only needs to connect the development board to the Windows XP computer through a USB cable. At this time, the development board is equivalent to a U disk. eMMC data file.

The configuration of the software and hardware environment developed this time is as follows:

Hardware platform: Feiling OK4418 development board

Software system: Linux3.4.39

Compiler version: arm-cortex_a9-eabi-4.7-eglibc-2.18

The specific steps are as follows:

1. Kernel configuration:

Configure the File-backed Storage Gadget in the configuration option USB Gadget Drivers as the module compilation method

make menuconfig

Device Drivers --->

[*] USB support --->

<*> USB Gadget Support --->

<*> USB Gadget Drivers (Android Composite Gadget) --->

Choose one of the following two options

( ) File-backed Storage Gadget (DEPRECATED) ——获得模块——》g_file_storage.ko

    ( ) Mass Storage Gadget      ——获得模块——》g_mass_storage.ko

The module path is kernel-3.4.39 / drivers / usb / gadget

make uImage generates a new kernel

2. Preparation:

Use the newly generated kernel to program the system image, and copy the generated module to the development board file system

Generate mounted image file in ubuntu virtual machine

dd if=/dev/zero of=udisk32M.img bs=1k count=32768

mkfs.vfat udisk32M.img

Copy udisk32M.img to the development board file system

3. Use:

insmod g_file_storage.ko file = udisk32M.img stall = 0 removable = 1 (the same effect as g_mass_storage.ko)

mknod / dev / loop0 b 7 0 (this step may not be required)

mount -o loop /home/udisk32M.img /tmp

Just connect to OTG

4. Verification

1) Write the mdev.conf file to the / tmp directory on the development board, the command is as follows

cp ./etc/mdev.conf ./tmp

Reinsert the USB cable connected to the development board on the computer. In the mobile hard disk, we can see the mdev.conf file, which can be accessed on the computer system.

In order to verify that the development board writes a file to the simulated U disk, the file can be accessed on the XP system.

2) The computer system writes a file to the simulated U disk, and the development board can access the file;

Write the wwtARM.txt file on the USB flash drive of the XP system

Remount the file system image to the / tmp directory

#umount tmp

#mount -o loop /home/udisk32M.img /tmp

On the development board, you can access the wwtARM.txt file written by the XP system to the U disk in the / tmp directory.

Guess you like

Origin blog.51cto.com/14771134/2486533