From a4a4cfc588c889873e5a31e097287abc7255e53f Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Wed, 3 Jun 2015 14:48:45 -0500 Subject: [PATCH] mx23_olinuxino: uEnv.txt, bootz, n fixes Signed-off-by: Robert Nelson --- include/configs/mx23_olinuxino.h | 120 +++++++++++++++++++++++++++++++++------ 1 file changed, 104 insertions(+), 16 deletions(-) diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h index 65203a0..1827e2b 100644 --- a/include/configs/mx23_olinuxino.h +++ b/include/configs/mx23_olinuxino.h @@ -25,6 +25,14 @@ #define CONFIG_CMD_MMC #define CONFIG_CMD_USB +#define CONFIG_CMD_FAT +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_FS_GENERIC + +/* bootz: zImage/initrd.img support */ +#define CONFIG_CMD_BOOTZ +#define CONFIG_SUPPORT_RAW_INITRD + /* Memory configuration */ #define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */ #define PHYS_SDRAM_1 0x40000000 /* Base address */ @@ -65,7 +73,7 @@ #endif /* Booting Linux */ -#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTDELAY 1 #define CONFIG_BOOTFILE "uImage" #define CONFIG_LOADADDR 0x42000000 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR @@ -86,20 +94,58 @@ "console=ttyAMA0\0" \ "fdt_file=imx23-olinuxino.dtb\0" \ "fdt_addr=0x41000000\0" \ + "fdtdir=\0" \ + "bootfile=\0" \ + "bootdir=\0" \ "boot_fdt=try\0" \ "ip_dyn=yes\0" \ + "optargs=\0" \ + "cmdline=\0" \ "mmcdev=0\0" \ "mmcpart=2\0" \ - "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ + "mmcroot=/dev/mmcblk0p2 ro\0" \ + "mmcrootfstype=ext4 rootwait fixrtc\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=${mmcroot}\0" \ + "${optargs} " \ + "root=${mmcroot} " \ + "rootfstype=${mmcrootfstype} " \ + "${cmdline}\0" \ + "loadbootenv=load mmc ${bootpart} ${loadaddr} /boot/uEnv.txt\0" \ + "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ + "env import -t ${loadaddr} ${filesize}\0" \ "loadbootscript=" \ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ "source\0" \ - "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ + "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ + "loadfdt=echo loading ${fdtdir}/${fdt_file} ...; load mmc ${bootpart} ${fdt_addr} ${fdtdir}/${fdt_file}\0" \ + "mmcboot=mmc dev ${mmcdev}; " \ + "if mmc rescan; then " \ + "echo SD/MMC found on device ${mmcdev};" \ + "echo Checking for: /boot/uEnv.txt ...;" \ + "for i in 2 3 4 5 6 7 ; do " \ + "setenv mmcpart ${i};" \ + "setenv bootpart ${mmcdev}:${mmcpart};" \ + "if test -e mmc ${bootpart} /boot/uEnv.txt; then " \ + "load mmc ${bootpart} ${loadaddr} /boot/uEnv.txt;" \ + "env import -t ${loadaddr} ${filesize};" \ + "echo Loaded environment from /boot/uEnv.txt;" \ + "if test -n ${dtb}; then " \ + "setenv fdt_file ${dtb};" \ + "echo using ${fdt_file} ...;" \ + "fi;" \ + "echo Checking if uname_r is set in /boot/uEnv.txt...;" \ + "if test -n ${uname_r}; then " \ + "setenv mmcroot /dev/mmcblk${mmcdev}p${mmcpart} ro;" \ + "if test -n ${uuid}; then " \ + "setenv mmcroot UUID=${uuid} ro;" \ + "fi;" \ + "run uname_boot;" \ + "fi;" \ + "fi;" \ + "done;" \ + "fi;\0" \ + "mmcboot_old=echo Booting from mmc ...; " \ "run mmcargs; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if run loadfdt; then " \ @@ -138,19 +184,61 @@ "fi; " \ "else " \ "bootm; " \ + "fi;\0" \ + "uname_boot="\ + "setenv bootdir /boot; " \ + "setenv bootfile vmlinuz-${uname_r}; " \ + "if test -e mmc ${bootpart} ${bootdir}/${bootfile}; then " \ + "echo loading ${bootdir}/${bootfile} ...; "\ + "run loadimage;" \ + "setenv fdtdir /boot/dtbs/${uname_r}; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /usr/lib/linux-image-${uname_r}; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /lib/firmware/${uname_r}/device-tree; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtb-${uname_r}; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtbs; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtb; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot; " \ + "if test -e mmc ${bootpart} ${fdtdir}/${fdt_file}; then " \ + "run loadfdt;" \ + "else " \ + "echo; echo unable to find ${fdt_file} ...; echo booting legacy ...;"\ + "run mmcargs;" \ + "echo debug: [${bootargs}] ... ;" \ + "echo debug: [bootz ${loadaddr}] ... ;" \ + "bootz ${loadaddr}; " \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi; " \ + "run mmcargs;" \ + "echo debug: [${bootargs}] ... ;" \ + "echo debug: [bootz ${loadaddr} - ${fdt_addr}] ... ;" \ + "bootz ${loadaddr} - ${fdt_addr}; " \ "fi;\0" #define CONFIG_BOOTCOMMAND \ - "mmc dev ${mmcdev}; if mmc rescan; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "else " \ - "if run loaduimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "fi; " \ - "else run netboot; fi" + "run mmcboot;" /* The rest of the configuration is shared */ #include -- 2.1.4