From ee4cab9e587442f95e4fb3442355ca1eb56d9495 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 29 Apr 2012 20:13:53 +0200 Subject: booting: more flexible Linux bootargs generation We currently use the environment variable 'bootargs' to get the Linux bootargs. This patch allows for a more flexible bootargs generation using global variables. With it the Linux bootargs are concatenated from multiple variables. This allows to replace parts of the bootargs string without having to reconstruct it completely. With this bootargs can be constructed like: global linux.bootargs.base="console=ttyS0,115200" global linux.bootargs.ip="ip=dhcp" global linux.mtdparts="physmap-flash.0:512K(nor0.barebox),-(root)" This will then automatically be combined into a kernel bootargs string during boot. If the 'linux.bootargs.' variables are all empty the old standard 'bootargs' way will be used. Signed-off-by: Sascha Hauer --- include/boot.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/boot.h b/include/boot.h index a17bf25a4c..3ce0de125b 100644 --- a/include/boot.h +++ b/include/boot.h @@ -5,6 +5,7 @@ #include #include #include +#include struct image_data { /* simplest case. barebox has already loaded the os here */ @@ -71,4 +72,19 @@ static inline int bootm_verbose(struct image_data *data) } #endif +#ifdef CONFIG_FLEXIBLE_BOOTARGS +const char *linux_bootargs_get(void); +int linux_bootargs_overwrite(const char *bootargs); +#else +static inline const char *linux_bootargs_get(void) +{ + return getenv("bootargs"); +} + +static inline int linux_bootargs_overwrite(const char *bootargs) +{ + return setenv("bootargs", bootargs); +} +#endif + #endif /* __BOOT_H */ -- cgit v1.2.3