Commit 6bc50a8f69920b2d2b0c5890e2133748b62656c3

Authored by Masahiro Yamada
1 parent bea3d82620

ARM: uniphier: do not modify bootcmd environment variable at run-time

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>

Showing 5 changed files with 11 additions and 4 deletions Side-by-side Diff

arch/arm/mach-uniphier/board_late_init.c
... ... @@ -66,20 +66,20 @@
66 66 switch (uniphier_boot_device_raw()) {
67 67 case BOOT_DEVICE_MMC1:
68 68 printf("eMMC Boot");
69   - env_set("bootcmd", "run bootcmd_mmc0; run distro_bootcmd");
  69 + env_set("bootdev", "emmc");
70 70 break;
71 71 case BOOT_DEVICE_NAND:
72 72 printf("NAND Boot");
73   - env_set("bootcmd", "run bootcmd_ubifs0; run distro_bootcmd");
  73 + env_set("bootdev", "nand");
74 74 nand_denali_wp_disable();
75 75 break;
76 76 case BOOT_DEVICE_NOR:
77 77 printf("NOR Boot");
78   - env_set("bootcmd", "run tftpboot; run distro_bootcmd");
  78 + env_set("bootdev", "nor");
79 79 break;
80 80 case BOOT_DEVICE_USB:
81 81 printf("USB Boot");
82   - env_set("bootcmd", "run bootcmd_usb0; run distro_bootcmd");
  82 + env_set("bootdev", "usb");
83 83 break;
84 84 default:
85 85 printf("Unknown");
configs/uniphier_ld4_sld8_defconfig
... ... @@ -9,6 +9,7 @@
9 9 CONFIG_MICRO_SUPPORT_CARD=y
10 10 CONFIG_NR_DRAM_BANKS=3
11 11 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
  12 +CONFIG_BOOTCOMMAND="run ${bootdev}boot"
12 13 CONFIG_LOGLEVEL=6
13 14 CONFIG_SPL_NAND_SUPPORT=y
14 15 CONFIG_SPL_NOR_SUPPORT=y
configs/uniphier_v7_defconfig
... ... @@ -8,6 +8,7 @@
8 8 CONFIG_MICRO_SUPPORT_CARD=y
9 9 CONFIG_NR_DRAM_BANKS=3
10 10 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
  11 +CONFIG_BOOTCOMMAND="run ${bootdev}boot"
11 12 CONFIG_LOGLEVEL=6
12 13 CONFIG_SPL_NAND_SUPPORT=y
13 14 CONFIG_SPL_NOR_SUPPORT=y
configs/uniphier_v8_defconfig
... ... @@ -7,6 +7,7 @@
7 7 CONFIG_MICRO_SUPPORT_CARD=y
8 8 CONFIG_NR_DRAM_BANKS=3
9 9 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
  10 +CONFIG_BOOTCOMMAND="run ${bootdev}boot"
10 11 CONFIG_LOGLEVEL=6
11 12 CONFIG_CMD_CONFIG=y
12 13 CONFIG_CMD_IMLS=y
include/configs/uniphier.h
... ... @@ -171,6 +171,10 @@
171 171 "initrd_high=0xffffffffffffffff\0" \
172 172 "scriptaddr=0x85000000\0" \
173 173 "nor_base=0x42000000\0" \
  174 + "emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
  175 + "nandboot=run bootcmd_ubifs0\0" \
  176 + "norboot=run tftpboot\0" \
  177 + "usbboot=run bootcmd_usb0\0" \
174 178 "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \
175 179 "tftpboot $tmp_addr $second_image && " \
176 180 "setexpr tmp_addr $nor_base + 0x70000 && " \