ARM: uniphier: do not modify bootcmd environment variable at run-time
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 19 Dec 2018 11:03:13 +0000 (20:03 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 29 Dec 2018 02:38:33 +0000 (11:38 +0900)
Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/mach-uniphier/board_late_init.c
configs/uniphier_ld4_sld8_defconfig
configs/uniphier_v7_defconfig
configs/uniphier_v8_defconfig
include/configs/uniphier.h

index 1b871c62ced280acf0fe0f4730a38595e3c9f296..972dbe8ae55380e8c270904334873f838669a8f4 100644 (file)
@@ -66,20 +66,20 @@ int board_late_init(void)
        switch (uniphier_boot_device_raw()) {
        case BOOT_DEVICE_MMC1:
                printf("eMMC Boot");
-               env_set("bootcmd", "run bootcmd_mmc0; run distro_bootcmd");
+               env_set("bootdev", "emmc");
                break;
        case BOOT_DEVICE_NAND:
                printf("NAND Boot");
-               env_set("bootcmd", "run bootcmd_ubifs0; run distro_bootcmd");
+               env_set("bootdev", "nand");
                nand_denali_wp_disable();
                break;
        case BOOT_DEVICE_NOR:
                printf("NOR Boot");
-               env_set("bootcmd", "run tftpboot; run distro_bootcmd");
+               env_set("bootdev", "nor");
                break;
        case BOOT_DEVICE_USB:
                printf("USB Boot");
-               env_set("bootcmd", "run bootcmd_usb0; run distro_bootcmd");
+               env_set("bootdev", "usb");
                break;
        default:
                printf("Unknown");
index 6b9e22ac0eeddd85f3b5d6307c7d237f4cc47741..bede166efa7f90ed3ba9475380ee8fd8f510dfd7 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_ARCH_UNIPHIER_LD4_SLD8=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
index 4c06f272b14e53e69f3a36a05e571dcae06b28fd..be4ab7c0cf2715557bc3c5b318c7637a9184e03a 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_SPL=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
index f8f9bdf05c3790ed5b54b2b67b2798582d7c386b..6f7c269f84962df18af64e5bf79ea6e3f80de5bf 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_UNIPHIER_V8_MULTI=y
 CONFIG_MICRO_SUPPORT_CARD=y
 CONFIG_NR_DRAM_BANKS=3
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_BOOTCOMMAND="run ${bootdev}boot"
 CONFIG_LOGLEVEL=6
 CONFIG_CMD_CONFIG=y
 CONFIG_CMD_IMLS=y
index 70f8712b60cd103ec4607abb2e077e1bc81358f7..7d14c31e0f00413ce27f1d460876a0827164f7eb 100644 (file)
        "initrd_high=0xffffffffffffffff\0"                      \
        "scriptaddr=0x85000000\0"                               \
        "nor_base=0x42000000\0"                                 \
+       "emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
+       "nandboot=run bootcmd_ubifs0\0" \
+       "norboot=run tftpboot\0" \
+       "usbboot=run bootcmd_usb0\0" \
        "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&"    \
                "tftpboot $tmp_addr $second_image && " \
                "setexpr tmp_addr $nor_base + 0x70000 && " \