fdt: add fdtcmd env var to allow post processing of device tree before boot
PATCH v2 1/1 fdt: add fdtcmd env var to allow post processing of device tree before boot
Added the 'fdtcmd' environment variable as a way to provide 'fdt' commands that the user can supply to manipulate the device tree after ft_board_setup() and before the tree is handled to the kernel.
The idea is that users may want to add or manipulate nodes w/changing the u-boot binary. The current point in the code we do this we have yet to determine the final size and have yet to do the final fixup of the initrd information.
If its desirable for the 'fdtcmd' support to have the proper initrd information a bit of code reorder will be in order.
---
Moved 'fdt boardsetup' into the 'fdtcmd' environment by default thus removing the explicit ft_board_setup call and moving slightly towards the direction of having things be a bit more script driven.
- k
common/env_common.c | 3 +++ common/environment.c | 3 +++ common/fdt_support.c | 21 +++++++++++++++++++++ include/fdt_support.h | 1 + lib_ppc/bootm.c | 5 +---- 5 files changed, 29 insertions(+), 4 deletions(-)
common/env_common.c +3 -0
@@ -127,6 +127,9 @@ uchar default_environment[] = {#if defined(CONFIG_PCI_BOOTDELAY ) && (CONFIG_PCI_BOOTDELAY >0 ) "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0"#endif +#ifdef CONFIG_OF_BOARD_SETUP + "fdtcmd=" "fdt boardsetup" "\0" +#endif #ifdef CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS#endif
common/environment.c +3 -0
@@ -174,6 +174,9 @@ env_t environment __PPCENV__ = {#if defined(CONFIG_PCI_BOOTDELAY ) && (CONFIG_PCI_BOOTDELAY >0 ) "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0"#endif +#ifdef CONFIG_OF_BOARD_SETUP + "fdtcmd=" "fdt boardsetup" "\0" +#endif #ifdef CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS#endif
common/fdt_support.c +21 -0
@@ -30,6 +30,10 @@#include <fdt_support.h> #include <exports.h> +#ifdef CFG_HUSH_PARSER +#include <hush.h> +#endif +/* * Global data (for the gd->bd) */
@@ -529,3 +533,20 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev) fdt_strerror(err)); }#endif /* defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) */ + +int ft_env_setup (void *blob) +{ +int rcode =0 ; + + working_fdt = blob; + +#ifndef CFG_HUSH_PARSER +if (run_command (getenv ("fdtcmd" ),0 ) <0 ) + rcode =1 ; +#else +if (parse_string_outer (getenv ("fdtcmd" ), +FLAG_PARSE_SEMICOLON |FLAG_EXIT_FROM_LOOP ) !=0 ) + rcode =1 ; +#endif +return rcode; +}
include/fdt_support.h +1 -0
@@ -67,6 +67,7 @@ void ft_board_setup(void *blob, bd_t *bd);void ft_cpu_setup (void *blob,bd_t *bd);void ft_pci_setup (void *blob,bd_t *bd);#endif +int ft_env_setup (void *blob);#endif /* ifdef CONFIG_OF_LIBFDT */ #endif /* ifndef __FDT_SUPPORT_H */
lib_ppc/bootm.c +1 -4
@@ -190,10 +190,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],fdt_error ("/chosen node create failed" ); goto error; } -#ifdef CONFIG_OF_BOARD_SETUP -/* Call the board-specific fixup routine */ -ft_board_setup (of_flat_tree, gd->bd); -#endif +ft_env_setup (of_flat_tree); }/* Fixup the fdt memreserve now that we know how big it is */
Signature · 1 line
1.5.5.1
PATCH v2 1/1 fdt: add fdtcmd env var to allow post processing of device tree before boot
Quoted 16 lines · Kumar Gala
Added the 'fdtcmd' environment variable as a way to provide 'fdt' commands
that the user can supply to manipulate the device tree afterft_board_setup()and before the tree is handled to the kernel.The idea is that users may want to add or manipulate nodes w/ changing the
u-boot binary. The current point in the code we do this we have yet to
determine the final size and have yet to do the final fixup of the initrd
information.If its desirable for the 'fdtcmd' support to have the proper initrd information a bit of code reorder will be in order.
Quoted 8 lines
Signed-off-by Kumar Gala <[email protected]>---
Moved 'fdt boardsetup' into the 'fdtcmd' environment by default thus removing the
explicitft_board_setupcall and moving slightly towards the direction of having
things be a bit more script driven.
One of my intents was that this would be a stop gap until we have the "new script" method worked out. Also the idea is that would be compatible with the usage we are talking about and we'd just expand the default settings of 'fdtcmd' as part of the "new script" bootm method.
- k
PATCH v2 1/1 fdt: add fdtcmd env var to allow post processing of device tree before boot
In reply to Kumar GalaQuoted 11 lines · In message <[email protected]> you wrote:
Added the 'fdtcmd' environment variable as a way to provide 'fdt' commands that the user can supply to manipulate the device tree after
ft_board_setup()and before the tree is handled to the kernel.The idea is that users may want to add or manipulate nodes w/changing the u-boot binary. The current point in the code we do this we have yet to determine the final size and have yet to do the final fixup of the initrd information.
If its desirable for the 'fdtcmd' support to have the proper initrd information a bit of code reorder will be in order.
The current state of the bootm implementation is bad enough, but adding such a callback opens just another few cans of worms. Sorry, but I do not want to see that in mainline.
Best regards,
Wolfgang Denk
Signature · 9 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The project was large enough and management communication poor enough
to prompt many members of the team to see themselves as contestants
making brownie points, rather than as builders making programming
products. Each suboptimized his piece to meet his targets; few
stopped to think about the total effect on the customer.
- Fred Brooks, "The Mythical Man Month"PATCH v2 1/1 fdt: add fdtcmd env var to allow post processing of device tree before boot
Quoted 15 lines · Wolfgang Denk
In message <[email protected]>
Quoted 13 lines · you
Added the 'fdtcmd' environment variable as a way to provide 'fdt' commands
that the user can supply to manipulate the device tree afterft_board_setup()and before the tree is handled to the kernel.The idea is that users may want to add or manipulate nodes w/ changing the
u-boot binary. The current point in the code we do this we have yet to
determine the final size and have yet to do the final fixup of the initrd
information.
Quoted 6 lines
Quoted 2 lines
If its desirable for the 'fdtcmd' support to have the proper initrd information a bit of code reorder will be in order.
The current state of the bootm implementation is bad enough, but adding such a callback opens just another few cans of worms. Sorry, but I do not want to see that in mainline.
I dont see how this is different than the proposal of moving to a script based mechanism for doing a large portion of what bootm does today.
I get not wanting to add the the complexity that is bootm. But I dont think the script mechanism is the right answer either.
- k