From 4fdb11dd360c4114d2221cb59299095f6cd650de Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Wed, 24 May 2017 14:14:00 -0500 Subject: [PATCH 1/2] udoo: uEnv.txt, bootz, n fixes (ported from 2017.05) Signed-off-by: Robert Nelson Signed-off-by: Steve Arnold --- configs/udoo_defconfig | 8 ++ include/configs/udoo.h | 202 +++++++++++++++++++++++++++++++++---------------- 2 files changed, 146 insertions(+), 64 deletions(-) diff --git a/configs/udoo_defconfig b/configs/udoo_defconfig index f064928b79..cb21fdc1e2 100644 --- a/configs/udoo_defconfig +++ b/configs/udoo_defconfig @@ -9,13 +9,21 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6QDL" +CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y CONFIG_SPL_EXT_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" +CONFIG_AUTOBOOT_DELAY_STR="d" +CONFIG_AUTOBOOT_STOP_STR=" " CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y +# CONFIG_CMD_IMLS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y CONFIG_CMD_SATA=y diff --git a/include/configs/udoo.h b/include/configs/udoo.h index bcce41db8a..4b83aff9c7 100644 --- a/include/configs/udoo.h +++ b/include/configs/udoo.h @@ -9,6 +9,7 @@ #ifndef __CONFIG_H #define __CONFIG_H +#include #include "mx6_common.h" #include "imx6_spl.h" @@ -51,19 +52,21 @@ #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ - "script=boot.scr\0" \ - "image=zImage\0" \ - "console=ttymxc1\0" \ + "console=ttymxc1,115200\0" \ "splashpos=m,m\0" \ + "fdtfile=undefined\0" \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ - "fdt_file=undefined\0" \ + "rdaddr=0x12A00000\0" \ + "fdt_addr_r=0x18000000\0" \ "fdt_addr=0x18000000\0" \ - "boot_fdt=try\0" \ "ip_dyn=yes\0" \ + "optargs=\0" \ + "cmdline=\0" \ "mmcdev=0\0" \ "mmcpart=1\0" \ - "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ + "mmcroot=/dev/mmcblk0p1 ro\0" \ + "mmcrootfstype=ext4 rootwait\0" \ "update_sd_firmware_filename=u-boot.imx\0" \ "update_sd_firmware=" \ "if test ${ip_dyn} = yes; then " \ @@ -78,73 +81,144 @@ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ "fi; " \ "fi\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=${mmcroot}\0" \ - "loadbootscript=" \ - "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ - "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ + "mmcargs=setenv bootargs console=${console} " \ + "${optargs} " \ + "root=${mmcroot} " \ + "rootfstype=${mmcrootfstype} " \ + "${cmdline}\0" \ + "findfdt="\ + "if test $board_rev = MX6Q ; then " \ + "setenv fdtfile imx6q-udoo.dtb; fi; " \ + "if test $board_rev = MX6DL ; then " \ + "setenv fdtfile imx6dl-udoo.dtb; fi; " \ + "if test $fdtfile = undefined; then " \ + "echo WARNING: Could not determine dtb to use; fi; \0" \ + "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ + "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}; setenv rdsize ${filesize}\0" \ + "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdt_addr} ${fdtdir}/${fdtfile}\0" \ + "mmcboot=${devtype} dev ${mmcdev}; " \ + "if ${devtype} rescan; then " \ + "echo SD/MMC found on device ${mmcdev};" \ + "setenv bootpart ${mmcdev}:1; " \ + "echo Checking for: /uEnv.txt ...;" \ + "if test -e ${devtype} ${bootpart} /uEnv.txt; then " \ + "load ${devtype} ${bootpart} ${loadaddr} /uEnv.txt;" \ + "env import -t ${loadaddr} ${filesize};" \ + "echo Loaded environment from /uEnv.txt;" \ + "echo Checking if uenvcmd is set ...;" \ + "if test -n ${uenvcmd}; then " \ + "echo Running uenvcmd ...;" \ + "run uenvcmd;" \ + "fi;" \ "fi; " \ - "else " \ - "bootz; " \ + "echo Checking for: /boot/uEnv.txt ...;" \ + "for i in 1 2 3 4 5 6 7 ; do " \ + "setenv mmcpart ${i};" \ + "setenv bootpart ${mmcdev}:${mmcpart};" \ + "if test -e ${devtype} ${bootpart} /boot/uEnv.txt; then " \ + "load ${devtype} ${bootpart} ${loadaddr} /boot/uEnv.txt;" \ + "env import -t ${loadaddr} ${filesize};" \ + "echo Loaded environment from /boot/uEnv.txt;" \ + "if test -n ${dtb}; then " \ + "setenv fdtfile ${dtb};" \ + "echo Using: dtb=${fdtfile} ...;" \ + "fi;" \ + "echo Checking if uname_r is set in /boot/uEnv.txt...;" \ + "if test -n ${uname_r}; then " \ + "echo Running uname_boot ...;" \ + "part uuid ${devtype} ${bootpart} partuuid ;" \ + "setenv mmcroot PARTUUID=${partuuid} ro;" \ + "echo Using: mmcroot=${mmcroot} ...;" \ + "run uname_boot;" \ + "fi;" \ + "fi;" \ + "done;" \ "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ + "uname_boot="\ + "setenv bootdir /boot; " \ + "setenv bootfile vmlinuz-${uname_r}; " \ + "if test -e ${devtype} ${bootpart} ${bootdir}/${bootfile}; then " \ + "echo loading ${bootdir}/${bootfile} ...; "\ + "run loadimage;" \ + "setenv fdtdir /boot/dtbs/${uname_r}; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ + "setenv fdtdir /usr/lib/linux-image-${uname_r}; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ + "setenv fdtdir /lib/firmware/${uname_r}/device-tree; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtb-${uname_r}; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtbs; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot/dtb; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ + "else " \ + "setenv fdtdir /boot; " \ + "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \ + "run loadfdt;" \ + "else " \ + "echo; echo unable to find ${fdtfile} ...; echo booting legacy ...;"\ + "run mmcargs;" \ + "echo debug: [${bootargs}] ... ;" \ + "echo debug: [bootz ${loadaddr}] ... ;" \ + "bootz ${loadaddr}; " \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ + "fi;" \ "fi; " \ - "else " \ - "bootz; " \ + "setenv rdfile initrd.img-${uname_r}; " \ + "if test -e ${devtype} ${bootpart} ${bootdir}/${rdfile}; then " \ + "echo loading ${bootdir}/${rdfile} ...; "\ + "run loadrd;" \ + "if test -n ${uuid}; then " \ + "setenv mmcroot UUID=${uuid} ro;" \ + "fi;" \ + "run mmcargs;" \ + "echo debug: [${bootargs}] ... ;" \ + "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdt_addr}] ... ;" \ + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdt_addr}; " \ + "else " \ + "run mmcargs;" \ + "echo debug: [${bootargs}] ... ;" \ + "echo debug: [bootz ${loadaddr} - ${fdt_addr}] ... ;" \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "fi;" \ "fi;\0" \ - "findfdt=" \ - "if test $board_rev = MX6Q ; then " \ - "setenv fdt_file imx6q-udoo.dtb; fi; " \ - "if test $board_rev = MX6DL ; then " \ - "setenv fdt_file imx6dl-udoo.dtb; fi; " \ - "if test $fdt_file = undefined; then " \ - "echo WARNING: Could not determine dtb to use; fi; \0" + "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "ramdisk_addr_r=0x13000000\0" \ + "ramdiskaddr=0x13000000\0" \ + "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + BOOTENV + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(MMC, mmc, 1) #define CONFIG_BOOTCOMMAND \ "run findfdt; " \ - "mmc dev ${mmcdev}; if mmc rescan; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "else " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "fi; " \ - "else run netboot; fi" + "setenv devtype mmc;" \ + "setenv mmcdev 0;" \ + "run mmcboot;" \ + "setenv mmcdev 1;" \ + "run mmcboot;" \ + "run distro_bootcmd" + +#include /* Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 1 -- 2.15.0