您的位置:首页 > 运维架构 > Linux

L137从usb设备启动

2009-08-21 13:28 225 查看
 

USB pendrive procedure

For the USB pendrive you should create two partitions:

a FAT16 that contains the Linux kernel file uImage

a ext2 that contains the entire Linux filesystem

sudo /sbin/parted /dev/sda mkpartfs primary fat16 0 30M mkpartfs primary ext2 31M 2048M

If the Linux distribution has an automount feature, after running this command additional icons in your desktop and (maybe) file browser screens should appear in the screen. If it does not have the automount feature, the partition(s) must be mounted manually in a previously created directory (the example below assumes disk and disk-1).

mount -t vfat /dev/sda1 /media/disk
mount -t ext2 /dev/sda2 /media/disk-1

Copy the target filesystem to the ext2 partition.

sudo cp -Rf /home/<useracct>/workdir/filesys /media/disk-1

The <useracct> is your login.

Copy the Linux kernel file uImage to the first partition

If using the default Linux kernel provided with the installation:

sudo cp /opt/OMAPL137_arm_1_00_00_07/REL_LSP_02_20_00_05/PSP_02_20_00_05/bin/uImage /media/disk

If using a compiled Linux kernel: (sections 4.2 and 5.3 of <LSP_02.20_OMAP-L137_User_Guide.pdf> and the errata at this page)

sudo cp <lsp_install_dir>/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /media/disk

Similarly to the MMC/SD case, all modules should be properly copied onto the target filesystem.

If using the default Linux kernel provided with the installation:

sudo cp -Rf /opt/OMAPL137_arm_1_00_00_07/REL_LSP_02_20_00_05/PSP_02_20_00_05/bin/kernel_modules/* /media/disk-1

Or if using a compiled Linux kernel the modules can be installed directly to the target filesystem (section 5.3 of <LSP_02.20_OMAP-L137_User_Guide.pdf>):

make modules modules_install INSTALL_MOD_PATH=/media/disk-1 ARCH=arm CROSS_COMPILE=arm_v5t_le-

-----------------------------------------------------------------------------------------

The script below works with an USB pendrive that should meet the requirements below. Check the <LSP_02.20_OMAP-L137_User_Guide.pdf> and this topic for additional details.
U-boot must be rebuilt with USB support enabled.
The 2GB USB pendrive must be connected to USB0 only and contain two partitions: the first partition must be of type FAT16 or FAT32 and contains the uImage (Linux Kernel) file in the root directory
the second partition must be of type ext2 or ext3 and contains the target filesystem (the same contents of /home/<useracct>/workdir/filesys)

; Keep the VT window open while executing macro
showtt 1
 
; Set the synchronous mode
setsync 1
 
; needed because of the slower operations usb start and fatload
PromptUboot = 'U-Boot > '
 
; Set the title to make easier identification between boards
settitle 'OMAPL137'
 
; check if USB is alive and which devices are on
sendln 'usb start'
wait PromptUboot
 
; load the kernel image to memory
sendln 'fatload usb 0:1 0xC0700000 uimage'
wait PromptUboot
 
; set kernel command line argument
sendln 'setenv bootargs console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/sda2 rootfstype=ext2 mem=32M' ;USB BOOT
 
; choose kernel image file name
sendln 'setenv bootfile uImage'
 
; boot the board!
sendln 'bootm'
 
; end of macro file


Note: The command usb start sometimes hangs on the message scanning bus for storage devices.... If this happens to you, stop the macro from executing, reset the board and reload the script file.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux command file ext image user