]> git.sur5r.net Git - u-boot/commitdiff
ARM: rpi: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support
authorGuillaume GARDET <guillaume.gardet@free.fr>
Tue, 25 Aug 2015 13:10:26 +0000 (15:10 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 24 Oct 2015 17:50:30 +0000 (13:50 -0400)
Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support and enable it to set
'board_rev' and 'board_name' envs.
'board_rev' can be used in scripts to determine what board we are running on
and 'board_name' for pretty printing.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
board/raspberrypi/rpi/rpi.c
include/configs/rpi-common.h

index 942badb087390fefef14ecece3fa7904680118a4..6451d1d916b103c9bea2fb40d115638ece463fb2 100644 (file)
@@ -242,10 +242,23 @@ static void set_usbethaddr(void)
        return;
 }
 
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+static void set_board_info(void)
+{
+       char str_rev[11];
+       sprintf(str_rev, "0x%X", rpi_board_rev);
+       setenv("board_rev", str_rev);
+       setenv("board_name", models[rpi_board_rev].name);
+}
+#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
+
 int misc_init_r(void)
 {
        set_fdtfile();
        set_usbethaddr();
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+       set_board_info();
+#endif
        return 0;
 }
 
index 06836cd5d8e916bd51197fdc55e9541952afcccc..58fe1f7a43591d8585c41becbe4ea4e3592e05a4 100644 (file)
 #include <config_distro_defaults.h>
 
 /* Environment */
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define ENV_DEVICE_SETTINGS \
        "stdin=serial,lcd\0" \
        "stdout=serial,lcd\0" \