1.我們的板子想用使用ramdisk 來當rootfs ( TI Linux SDK 6.0 )
ramdisk 放置於SD卡 boot分區
2.我該如何修改uboot 讓kernel 開機可以自動載入ramdisk??
(不使用setenv 方式)
jiew:
回复 blaider wang:
Dear Blaider
1.請問這些命令是要加再uboot 哪邊??
2.或是有uenv.txt 可以參考??
3.我看am335x_evm.h 的CONFIG_EXTRA_ENV_SETTINGS
已經有你列出的命令,請問要如何修改呢??
(我現在都會固定從mmc 抓取rootfs 然後抓不到)
#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x80200000\0" \ "kloadaddr=0x80007fc0\0" \ "fdtaddr=0x80F80000\0" \ "fdt_high=0xffffffff\0" \ "rdaddr=0x81000000\0" \ "bootfile=uImage\0" \ "fdtfile=\0" \ "console=ttyO0,115200n8\0" \ "optargs=\0" \ "mtdids=" MTDIDS_DEFAULT "\0" \ "mtdparts=" MTDPARTS_DEFAULT "\0" \ "dfu_alt_info_mmc=" DFU_ALT_INFO_MMC "\0" \ "dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \ "dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \ "mmcdev=0\0" \ "mmcroot=/dev/mmcblk0p2 ro\0" \ "mmcrootfstype=ext3 rootwait\0" \ "nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \ "nandrootfstype=ubifs rootwait=1\0" \ "nandsrcaddr=0x280000\0" \ "nandimgsize=0x500000\0" \ "rootpath=/export/rootfs\0" \ "nfsopts=nolock\0" \ "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ "::off\0" \ "ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \ "ramrootfstype=ext2\0" \ "ip_method=none\0" \ "bootargs_defaults=setenv bootargs " \ "console=${console} " \ "${optargs}\0" \ "mmcargs=run bootargs_defaults;" \ "setenv bootargs ${bootargs} " \ "root=${mmcroot} " \ "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \ "nandargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${nandroot} " \ "rootfstype=${nandrootfstype}\0" \ "spiroot=/dev/mtdblock4 rw\0" \ "spirootfstype=jffs2\0" \ "spisrcaddr=0xe0000\0" \ "spiimgsize=0x362000\0" \ "spibusno=0\0" \ "spiargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${spiroot} " \ "rootfstype=${spirootfstype}\0" \ "netargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=/dev/nfs " \ "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ "ip=dhcp\0" \ "bootenv=uEnv.txt\0" \ "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \ "importbootenv=echo Importing environment from mmc …; " \ "env import -t $loadaddr $filesize\0" \ "ramargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${ramroot} " \ "rootfstype=${ramrootfstype}\0" \ "loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \ "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \ "loaduimage=ext2load mmc ${mmcdev}:2 ${kloadaddr} /boot/${bootfile}\0" \ "mmcboot=echo Booting from mmc …; " \ "run mmcargs; " \ "bootm ${kloadaddr}\0" \ "nandboot=echo Booting from nand …; " \ "run nandargs; " \ "nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \ "bootm ${loadaddr}\0" \ "spiboot=echo Booting from spi …; " \ "run spiargs; " \ "sf probe ${spibusno}:0; " \ "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \ "bootm ${loadaddr}\0" \ "netboot=echo Booting from network …; " \ "setenv autoload no; " \ "dhcp; " \ "tftp ${loadaddr} ${bootfile}; " \ "run netargs; " \ "bootm ${loadaddr}\0" \ "ramboot=echo Booting from ramdisk …; " \ "run ramargs; " \ "bootm ${loadaddr}\0" \ "findfdt="\ "if test $board_name = A335BONE; then " \ "setenv fdtfile am335x-bone.dtb; fi; " \ "if test $board_name = A33515BB; then " \ "setenv fdtfile am335x-evm.dtb; fi; " \ "if test $board_name = A335X_SK; then " \ "setenv fdtfile am335x-evmsk.dtb; fi\0" \
blaider wang:
回复 jiew:
jiew
Dear Blaider
1.請問這些命令是要加再uboot 哪邊??
2.或是有uenv.txt 可以參考??
3.我看am335x_evm.h 的CONFIG_EXTRA_ENV_SETTINGS
已經有你列出的命令,請問要如何修改呢??
(我現在都會固定從mmc 抓取rootfs 然後抓不到)
#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x80200000\0" \ "kloadaddr=0x80007fc0\0" \ "fdtaddr=0x80F80000\0" \ "fdt_high=0xffffffff\0" \ "rdaddr=0x81000000\0" \ "bootfile=uImage\0" \ "fdtfile=\0" \ "console=ttyO0,115200n8\0" \ "optargs=\0" \ "mtdids=" MTDIDS_DEFAULT "\0" \ "mtdparts=" MTDPARTS_DEFAULT "\0" \ "dfu_alt_info_mmc=" DFU_ALT_INFO_MMC "\0" \ "dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \ "dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \ "mmcdev=0\0" \ "mmcroot=/dev/mmcblk0p2 ro\0" \ "mmcrootfstype=ext3 rootwait\0" \ "nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \ "nandrootfstype=ubifs rootwait=1\0" \ "nandsrcaddr=0x280000\0" \ "nandimgsize=0x500000\0" \ "rootpath=/export/rootfs\0" \ "nfsopts=nolock\0" \ "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ "::off\0" \ "ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \ "ramrootfstype=ext2\0" \ "ip_method=none\0" \ "bootargs_defaults=setenv bootargs " \ "console=${console} " \ "${optargs}\0" \ "mmcargs=run bootargs_defaults;" \ "setenv bootargs ${bootargs} " \ "root=${mmcroot} " \ "rootfstype=${mmcrootfstype} ip=${ip_method}\0" \ "nandargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${nandroot} " \ "rootfstype=${nandrootfstype}\0" \ "spiroot=/dev/mtdblock4 rw\0" \ "spirootfstype=jffs2\0" \ "spisrcaddr=0xe0000\0" \ "spiimgsize=0x362000\0" \ "spibusno=0\0" \ "spiargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${spiroot} " \ "rootfstype=${spirootfstype}\0" \ "netargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=/dev/nfs " \ "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ "ip=dhcp\0" \ "bootenv=uEnv.txt\0" \ "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \ "importbootenv=echo Importing environment from mmc …; " \ "env import -t $loadaddr $filesize\0" \ "ramargs=setenv bootargs console=${console} " \ "${optargs} " \ "root=${ramroot} " \ "rootfstype=${ramrootfstype}\0" \ "loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \ "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \ "loaduimage=ext2load mmc ${mmcdev}:2 ${kloadaddr} /boot/${bootfile}\0" \ "mmcboot=echo Booting from mmc …; " \ "run mmcargs; " \ "bootm ${kloadaddr}\0" \ "nandboot=echo Booting from nand …; " \ "run nandargs; " \ "nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \ "bootm ${loadaddr}\0" \ "spiboot=echo Booting from spi …; " \ "run spiargs; " \ "sf probe ${spibusno}:0; " \ "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \ "bootm ${loadaddr}\0" \ "netboot=echo Booting from network …; " \ "setenv autoload no; " \ "dhcp; " \ "tftp ${loadaddr} ${bootfile}; " \ "run netargs; " \ "bootm ${loadaddr}\0" \ "ramboot=echo Booting from ramdisk …; " \ "run ramargs; " \ "bootm ${loadaddr}\0" \ "findfdt="\ "if test $board_name = A335BONE; then " \ "setenv fdtfile am335x-bone.dtb; fi; " \ "if test $board_name = A33515BB; then " \ "setenv fdtfile am335x-evm.dtb; fi; " \ "if test $board_name = A335X_SK; then " \ "setenv fdtfile am335x-evmsk.dtb; fi\0" \
blaider wang:
回复 blaider wang:
简单点就是修改一下bootcmd变量,让它自动运行
bootcmd= run loaduimagefat;run loadramdisk;run ramargs;bootm ${kloadaddr};
Jian Zhou:
回复 blaider wang:
可以参考我们wiki上的guide:
http://processors.wiki.ti.com/index.php/Creating_a_Root_File_System_for_Linux_on_OMAP35x
http://processors.wiki.ti.com/index.php/Creating_a_RAMDISK
jiew:
回复 Jian Zhou:
Dear Jian
ramdisk我早已經建好了
我是問要如何透過uEnv.txt 或是修改uboot 程式
使其可以 自動將SD卡boot 分區內的ramdisk.gz 自動mount 當作root file system
Jian Zhou:
回复 jiew:
参考过下面这个guide列出来的步骤和参数吗,可以从NAND或者SD卡启动ramdisk:
http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#Environment_Settings_for_Ramdisk