pico-imx7d: Add bootmenu to choose the baseboard
authorOtavio Salvador <otavio@ossystems.com.br>
Fri, 29 Jun 2018 18:19:13 +0000 (15:19 -0300)
committerStefano Babic <sbabic@denx.de>
Mon, 23 Jul 2018 08:59:48 +0000 (10:59 +0200)
Currently the baseboards do not offer a way to autodetect which one is
in use, so we ask the user if no value has been set.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
configs/pico-imx7d_defconfig
include/configs/pico-imx7d.h

index 27e5ca910a2020f0ae01d072bfbcfa9fecdaa5b5..3eb26c75d6c50cbe16f607700ef8261e3a6eb37b 100644 (file)
@@ -12,12 +12,13 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_IMX_RDC=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
-CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd"
+CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_USB_HOST_SUPPORT=y
 CONFIG_SPL_USB_GADGET_SUPPORT=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
 # CONFIG_CMD_BOOTD is not set
+CONFIG_CMD_BOOTMENU=y
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_XIMG is not set
 CONFIG_CMD_DFU=y
index f974b79b3b1fe3180397384260bde354103d6f20..94c846a395995d968af26202c1dd419edfce9dd1 100644 (file)
                "/boot/imx7d-pico-pi.dtb ext4 0 1;" \
                "rootfs part 0 1\0" \
 
+#define BOOTMENU_ENV \
+       "bootmenu_0=Boot using PICO-PI baseboard=" \
+               "setenv fdtfile imx7d-pico-pi.dtb\0" \
+
 #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
 #define CONFIG_SYS_MMC_IMG_LOAD_PART   1
 
@@ -49,7 +53,8 @@
        "console=ttymxc4\0" \
        "fdt_high=0xffffffff\0" \
        "initrd_high=0xffffffff\0" \
-       "fdtfile=imx7d-pico-pi.dtb\0" \
+       "fdtfile=ask\0" \
+       BOOTMENU_ENV \
        "fdt_addr=0x83000000\0" \
        "fdt_addr_r=0x83000000\0" \
        "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
        "ramdiskaddr=0x83000000\0" \
        "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
        CONFIG_DFU_ENV_SETTINGS \
+       "findfdt=" \
+               "if test $fdtfile = ask ; then " \
+                       "bootmenu -1; fi;" \
+               "if test $fdtfile != ask ; then " \
+                       "saveenv; fi;\0" \
        "finduuid=part uuid mmc 0:1 uuid\0" \
        "partitions=" \
                "uuid_disk=${uuid_gpt_disk};" \