From 044fc14bcbcd2a344a2e63c083852fb4af82b96d Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 24 Oct 2012 07:28:17 +0000 Subject: am335x_evm: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support We add CONFIG_ENV_VARS_UBOOT_CONFIG, CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG and CONFIG_BOARD_LATE_INIT to set the variables and then fdtfile and findfdt to make us of this. It is now possible to do 'run findfdt' to have fdtfile be set to the value of the dtb file to load for the board we are running on. Signed-off-by: Tom Rini --- board/ti/am335x/board.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'board') diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 5d279ecdbc..1f0b1a72d1 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -299,6 +299,26 @@ int board_init(void) return 0; } +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + char safe_string[HDR_NAME_LEN + 1]; + + /* Now set variables based on the header. */ + strncpy(safe_string, (char *)header.name, sizeof(header.name)); + safe_string[sizeof(header.name)] = 0; + setenv("board_name", safe_string); + + strncpy(safe_string, (char *)header.version, sizeof(header.version)); + safe_string[sizeof(header.version)] = 0; + setenv("board_rev", safe_string); +#endif + + return 0; +} +#endif + #ifdef CONFIG_DRIVER_TI_CPSW static void cpsw_control(int enabled) { -- cgit v1.2.3