Boot command line support
Subsystems (5)
HI,
as barebox is some times a second stage bootloader it could be intresting to pass some information
I'm currently working on two support
the atags for arm and the cmdline
The cmline could be static or dynamic
so it will be easy to customise a boot sequence and etc...
this first patch will just add static cmdline
later I'll send dynamic support and arm boot ABI
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 string: add skip_spaces support
need by parse_args for the command line parsing
--- include/linux/string.h | 1 + lib/string.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
include/linux/string.h +1 -0
@@ -59,6 +59,7 @@ extern char * _strchr(const char *,int);#ifndef __HAVE_ARCH_STRRCHRextern char *_strrchr (const char *,int );#endif +extern char *skip_spaces (const char *);#ifndef __HAVE_ARCH_STRSTRextern char *_strstr (const char *,const char *);#endif
lib/string.c +14 -0
@@ -214,6 +214,20 @@ char * _strrchr(const char * s, int c)#endif EXPORT_SYMBOL (_strrchr); +/** +* skip_spaces - Removes leading whitespace from @str. +* @str: The string to be stripped. +* +* Returns a pointer to the first non-whitespace character in @str. +*/ +char *skip_spaces (const char *str) +{ +while (isspace (*str)) + ++str; +return (char *)str; +} +EXPORT_SYMBOL (skip_spaces); +#ifndef __HAVE_ARCH_STRLEN/** * strlen - Find the length of a string
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 add command line boot support
In reply to Jean-Christophe PLAGNIOL-VILLARDfor now just support static boot command support
--- arch/arm/lib/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 4 + arch/ppc/boards/pcm030/barebox.lds.S | 4 + arch/sandbox/board/barebox.lds.S | 4 + arch/sandbox/lib/barebox.lds.S | 4 + arch/x86/lib/barebox.lds.S | 9 ++- common/Kconfig | 11 ++ common/Makefile | 1 + common/params.c | 158 +++++++++++++++++++++++++++++ common/startup.c | 74 +++++++++++++- include/asm-generic/barebox.lds.h | 2 + include/init.h | 28 +++++ 12 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 common/params.c
arch/arm/lib/barebox.lds.S +4 -0
@@ -64,6 +64,10 @@ SECTIONS .barebox_cmd : { BAREBOX_CMDS } __barebox_cmd_end = .; + __setup_start = .; + .initsetup : { INIT_SETUP } + __setup_end = .; + __barebox_initcalls_start = .; .barebox_initcalls : { INITCALLS } __barebox_initcalls_end = .;
arch/blackfin/boards/ipe337/barebox.lds.S +4 -0
@@ -75,6 +75,10 @@ SECTIONS .barebox_initcalls : { INITCALLS } ___barebox_initcalls_end = .; + __setup_start = .; + .initsetup : { INIT_SETUP } + __setup_end = .; + ___usymtab_start = .; __usymtab : { BAREBOX_SYMS } ___usymtab_end = .;
arch/ppc/boards/pcm030/barebox.lds.S +4 -0
@@ -107,6 +107,10 @@ SECTIONS __barebox_initcalls_end = .; __initcall_entries = (__barebox_initcalls_end - __barebox_initcalls_start) >> 2; + __setup_start = .; + .initsetup : { INIT_SETUP } + __setup_end = .; + __usymtab_start = .; __usymtab : { BAREBOX_SYMS } __usymtab_end = .;
arch/sandbox/board/barebox.lds.S +4 -0
@@ -75,6 +75,10 @@ SECTIONS __barebox_initcalls : { INITCALLS } __barebox_initcalls_end = .; . = ALIGN(64); + __setup_start = .; + .initsetup : { INIT_SETUP } + __setup_end = .; + . = ALIGN(64); __barebox_cmd_start = .; __barebox_cmd : { BAREBOX_CMDS } __barebox_cmd_end = .;
arch/sandbox/lib/barebox.lds.S +4 -0
@@ -75,6 +75,10 @@ SECTIONS __barebox_initcalls : { INITCALLS } __barebox_initcalls_end = .; . = ALIGN(64); + __setup_start = .; + .initsetup : { INIT_SETUP } + __setup_end = .; + . = ALIGN(64); __barebox_cmd_start = .; __barebox_cmd : { BAREBOX_CMDS } __barebox_cmd_end = .;
arch/x86/lib/barebox.lds.S +8 -1
@@ -177,7 +177,14 @@ SECTIONS . = ALIGN(4); } > barebox - .__usymtab : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) { + .initsetup : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) { + __setup_start = .; + INIT_SETUP + __setup_end = .; + . = ALIGN(4); + } > barebox + + .__usymtab : AT ( LOADADDR(.initsetup) + SIZEOF (.initsetup) ) { __usymtab_start = .; BAREBOX_SYMS __usymtab_end = .;
common/Kconfig +11 -0
@@ -224,8 +224,19 @@ choice bool "Simple parser" help simple shell. No if/then, no return values from commands, no loops + endchoice +config BOOT_CMDLINE + bool "barebox boot command string" + help + +config CMDLINE + string "Default barebox command string" + depends on BOOT_CMDLINE + default "" + help + config GLOB bool prompt "hush globbing support"
common/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_DIGEST) += digest.o obj-y += env.o obj-$(CONFIG_CMD_BOOTM) += image.o obj-y += startup.o +obj-$(CONFIG_BOOT_CMDLINE) += params.o obj-y += misc.o obj-y += memsize.o obj-$(CONFIG_MENU) += menu.o
common/params.c new file +158 -0
158 lines not on this page · raw message
common/startup.c +73 -1
101 lines not on this page · raw message
include/asm-generic/barebox.lds.h +2 -0
@@ -7,6 +7,8 @@#define PRE_IMAGE #endif +#define INIT_SETUP KEEP(*(.init_setup)) +#define INITCALLS \ KEEP(*(.initcall.0)) \ KEEP(*(.initcall.1)) \
include/init.h +28 -0
@@ -44,6 +44,34 @@ typedef int (*initcall_t)(void);*/ #define __bare_init __section(.text_bare_init.text) +#define __initconst __section(.rodata) + +struct obs_kernel_param { +const char *str; +int (*setup_func)(char *); +}; + +/* +* Only for really core code. See moduleparam.h for the normal way. +* +* Force the alignment so the compiler doesn't space elements of the +* obs_kernel_param "array" too far apart in .init.setup. +*/ +#define __setup_param (str, unique_id, fn) \ + static const char __setup_str_##unique_id[] __initconst \ + __aligned(1) = str; \ + static struct obs_kernel_param __setup_##unique_id \ + __used __section(.init_setup) \ + __attribute__((aligned((sizeof(long))))) \ + = { __setup_str_##unique_id, fn} + +#define __setup (str, fn) \ + __setup_param(str, fn, fn) + +/* Called on module insert or kernel boot */ +extern int parse_args (const char *name, +char *args, +int (*unknown)(char *param,char *val));#endif #endif /* _INIT_H */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/3] add command line boot support
Hi J,
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
for now just support static boot command support
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 4 + arch/ppc/boards/pcm030/barebox.lds.S | 4 + arch/sandbox/board/barebox.lds.S | 4 + arch/sandbox/lib/barebox.lds.S | 4 + arch/x86/lib/barebox.lds.S | 9 ++- common/Kconfig | 11 ++ common/Makefile | 1 + common/params.c | 158 +++++++++++++++++++++++++++++ common/startup.c | 74 +++++++++++++- include/asm-generic/barebox.lds.h | 2 + include/init.h | 28 +++++ 12 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 common/params.c
Except for the inlined comments I'm generally ok with this patch. The more interesting part will be how the calling convention for barebox as a second stage loader is and how you preserve the registers used for commandline/atag passing during startup.
An idea which comes to my mind is that we could introduce a CONFIG_BAREBOX_SECOND_STAGE which switches to a completely different startup process. This startup process could then assume that sdram is already initialized and that we do not have to call board_init_lowlevel.
Another interesting thing is how will barebox behave if called as a second stage loader but without valid atags?
common/Kconfig choice · line 232
Quoted 5 lines
common/Kconfig +3
-0+config BOOT_CMDLINE + bool "barebox boot command string" + help
This is useful if you intend to use barebox as a second stage bootloader and want to pass kernel like command line parameters to barebox. Otherwise say no here.
Quoted 47 lines
common/Kconfig +7
-0+ +config CMDLINE + string "Default barebox command string" + depends on BOOT_CMDLINE + default "" + help + config GLOB bool prompt "hush globbing support"common/Makefile +1
-0@@ -16,6 +16,7 @@ obj-$(CONFIG_DIGEST) += digest.o obj-y += env.o obj-$(CONFIG_CMD_BOOTM) += image.o obj-y += startup.o +obj-$(CONFIG_BOOT_CMDLINE) += params.o obj-y += misc.o obj-y += memsize.o obj-$(CONFIG_MENU) += menu.ocommon/params.c new file +19
-0@@ -0,0 +1,158 @@ +/* Helpers for initial module or kernel cmdline parsing +Copyright (C) 2001 Rusty Russell. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include <malloc.h> +#include <linux/kernel.h>
common/params.c line 29
Quoted 10 lines
common/params.c new file +10
-0+#include <linux/string.h> +#include <errno.h> +#include <linux/err.h> +#include <linux/ctype.h> + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt, a...) +#endif
Please use the regular 'debug' function here.
common/params.c line 36
Quoted 7 lines
common/params.c new file +7
-0+ +/* This just allows us to keep track of which parameters are kmalloced. */ +struct kmalloced_param { +struct list_head list; +char val[]; +}; +static LIST_HEAD (kmalloced_params);
This seems unused.
Quoted 293 lines
common/params.c new file +122
-0+ +static inline char dash2underscore (char c) +{ +if (c =='-' ) +return '_' ; +return c; +} + +static inline int parameq (const char *input,const char *paramname) +{ +unsigned int i; +for (i =0 ;dash2underscore (input[i]) == paramname[i]; i++) +if (input[i] =='\0' ) +return 1 ; +return 0 ; +} + +static int parse_one (char *param, +char *val, +int (*handle_unknown)(char *param,char *val)) +{ +if (handle_unknown) { +DEBUGP ("Unknown argument: calling %p\n" , handle_unknown); +return handle_unknown (param, val); + } + +DEBUGP ("Unknown argument `%s'\n" , param); +return -ENOENT ; +} + +/* You can use " around spaces, but can't escape ". */ +/* Hyphens and underscores equivalent in parameter names. */ +static char *next_arg (char *args,char **param,char **val) +{ +unsigned int i, equals =0 ; +int in_quote =0 , quoted =0 ; +char *next; + +if (*args =='"' ) { + args++; + in_quote =1 ; + quoted =1 ; + } + +for (i =0 ; args[i]; i++) { +if (isspace (args[i]) && !in_quote) +break ; +if (equals ==0 ) { +if (args[i] =='=' ) + equals = i; + } +if (args[i] =='"' ) + in_quote = !in_quote; + } + + *param = args; +if (!equals) + *val =NULL ; +else { + args[equals] ='\0' ; + *val = args + equals +1 ; + +/* Don't include quotes in value. */ +if (**val =='"' ) { + (*val)++; +if (args[i-1 ] =='"' ) + args[i-1 ] ='\0' ; + } +if (quoted && args[i-1 ] =='"' ) + args[i-1 ] ='\0' ; + } + +if (args[i]) { + args[i] ='\0' ; + next = args + i +1 ; + }else + next = args + i; + +/* Chew up trailing spaces. */ +return skip_spaces (next); +} + +/* Args looks like "foo=bar,bar2 baz=fuz wiz". */ +int parse_args (const char *name, +char *args, +int (*unknown)(char *param,char *val)) +{ +char *param, *val; + +DEBUGP ("Parsing ARGS: %s\n" , args); + +/* Chew leading spaces */ + args =skip_spaces (args); + +while (*args) { +int ret; + + args =next_arg (args, ¶m, &val); + ret =parse_one (param, val, unknown); +switch (ret) { +case -ENOENT : +printk (KERN_ERR "%s: Unknown parameter `%s'\n" , + name, param); +return ret; +case -ENOSPC : +printk (KERN_ERR +"%s: `%s' too large for parameter `%s'\n" , + name, val ?:"" , param); +return ret; +case 0 : +break ; +default : +printk (KERN_ERR +"%s: `%s' invalid for parameter `%s'\n" , + name, val ?:"" , param); +return ret; + } + } + +/* All parsed OK. */ +return 0 ; +}common/startup.c +73
-1@@ -41,6 +41,7 @@#include <reloc.h> #include <asm-generic/memory_layout.h> #include <asm/sections.h> +#include <asm/setup.h> extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[], __barebox_initcalls_end[];@@ -103,6 +104,15 @@ static int register_default_env(void)device_initcall (register_default_env);#endif +#ifdef CONFIG_BOOT_CMDLINE +static int __init bootmode (char *mode) +{ +printf ("boot=%s\n" , mode); +return 0 ; +} +__setup ("boot=" , bootmode); +#endif +static int mount_root (void ) {mount ("none" ,"ramfs" ,"/" );@@ -112,6 +122,67 @@ static int mount_root(void) }fs_initcall (mount_root); +#ifdef CONFIG_BOOT_CMDLINE +extern const struct obs_kernel_param __setup_start[], __setup_end[]; + +static int __init obsolete_checksetup (char *line) +{ +const struct obs_kernel_param *p; + + p = __setup_start; +do { +int n =strlen (p->str); +if (!strncmp (line, p->str, n)) { +if (!p->setup_func) { +printk (KERN_WARNING "Parameter %s is obsolete," +" ignored\n" , p->str); +return 1 ; + }else if (p->setup_func (line + n)) +return 1 ; + } + p++; + }while (p < __setup_end); + +return 0 ; +} + +/* +* Unknown boot options get handed to init, unless they look like +* unused parameters (modprobe will find them in /proc/cmdline). +*/ +static int __init unknown_bootoption (char *param,char *val) +{ +/* Change NUL term back to "=", to make "param" the whole string. */ +if (val) { +/* param=val or param="val"? */ +if (val == param+strlen (param)+1 ) + val[-1 ] ='=' ; +else if (val == param+strlen (param)+2 ) { + val[-2 ] ='=' ; +memmove (val-1 , val,strlen (val)+1 ); + val--; + }else +BUG (); + } + +/* Handle obsolete-style parameters */ +obsolete_checksetup (param); +return 0 ; +} + +void __init parse_param (void ) +{ +static __initdata char tmp_cmdline[COMMAND_LINE_SIZE ]; + +strlcpy (tmp_cmdline,CONFIG_CMDLINE ,COMMAND_LINE_SIZE ); +parse_args ("Booting Barebox" , tmp_cmdline, unknown_bootoption); +} +#else +static void inline parse_param (void ) +{ +} +#endif +void start_barebox (void ) {initcall_t *initcall;@@ -128,6 +199,8 @@ void start_barebox (void) init_data_ptr = &__early_init_data_begin;#endif /* CONFIG_HAS_EARLY_INIT */ +parse_param (); +for (initcall = __barebox_initcalls_start; initcall < __barebox_initcalls_end; initcall++) {PUTHEX_LL (*initcall);@@ -180,4 +253,3 @@ void shutdown_barebox(void)arch_shutdown ();#endif } -include/asm-generic/barebox.lds.h +2
-0@@ -7,6 +7,8 @@#define PRE_IMAGE #endif +#define INIT_SETUP KEEP(*(.init_setup)) +#define INITCALLS \ KEEP(*(.initcall.0)) \ KEEP(*(.initcall.1)) \include/init.h +28
-0@@ -44,6 +44,34 @@ typedef int (*initcall_t)(void);*/ #define __bare_init __section(.text_bare_init.text) +#define __initconst __section(.rodata) + +struct obs_kernel_param { +const char *str; +int (*setup_func)(char *); +}; + +/* +* Only for really core code. See moduleparam.h for the normal way. +* +* Force the alignment so the compiler doesn't space elements of the +* obs_kernel_param "array" too far apart in .init.setup. +*/ +#define __setup_param (str, unique_id, fn) \ + static const char __setup_str_##unique_id[] __initconst \ + __aligned(1) = str; \ + static struct obs_kernel_param __setup_##unique_id \ + __used __section(.init_setup) \ + __attribute__((aligned((sizeof(long))))) \ + = { __setup_str_##unique_id, fn} + +#define __setup (str, fn) \ + __setup_param(str, fn, fn) + +/* Called on module insert or kernel boot */ +extern int parse_args (const char *name, +char *args, +int (*unknown)(char *param,char *val));#endif #endif /* _INIT_H */ Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/3] add command line boot support
Hi Sascha,
Quoted 22 lines · Sascha Hauer
Hi J,
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
for now just support static boot command support
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 4 + arch/ppc/boards/pcm030/barebox.lds.S | 4 + arch/sandbox/board/barebox.lds.S | 4 + arch/sandbox/lib/barebox.lds.S | 4 + arch/x86/lib/barebox.lds.S | 9 ++- common/Kconfig | 11 ++ common/Makefile | 1 + common/params.c | 158 +++++++++++++++++++++++++++++ common/startup.c | 74 +++++++++++++- include/asm-generic/barebox.lds.h | 2 + include/init.h | 28 +++++ 12 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 common/params.c
Quoted 4 lines
Except for the inlined comments I'm generally ok with this patch. The more interesting part will be how the calling convention for barebox as a second stage loader is and how you preserve the registers used for commandline/atag passing during startup.
I take a look and no need to do something special we just have to put the data in the .data section as we will supposed to be call from memmory directly evenif we may ned to relocate our self
Quoted 6 lines
An idea which comes to my mind is that we could introduce a
CONFIG_BAREBOX_SECOND_STAGEwhich switches to a completely different startup process. This startup process could then assume that sdram is already initialized and that we do not have to callboard_init_lowlevel.
I get in mind to keep it maybe as we can run the lowlevel init from cache as a peekpoke table to reconfigure the board if needed
Quoted 2 lines
Another interesting thing is how will barebox behave if called as a second stage loader but without valid atags?
I think to use in this case the default config and let the boards to get a callback to overwrite it
I'll try to push patch soon to show the solution
I get in mind to maybe use the device tree also not sure yet
Quoted 10 lines
common/Kconfig choice · line 232
Quoted 6 lines
common/Kconfig +3
-0+config BOOT_CMDLINE + bool "barebox boot command string" + helpThis is useful if you intend to use barebox as a second stage bootloader and want to pass kernel like command line parameters to barebox. Otherwise say no here.
as you can have built_in cmdline you can use it also as a first stage
Quoted 23 lines
Quoted 23 lines
(quoted diff) +22
-0+ +config CMDLINE + string "Default barebox command string" + depends on BOOT_CMDLINE + default "" + help + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include <malloc.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <errno.h> +#include <linux/err.h> +#include <linux/ctype.h>
Quoted 8 lines
common/params.c line 29
Quoted 6 lines
common/params.c new file +6
-0+ +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt, a...) +#endif Please use the regular 'debug' function here.
ok
Quoted 10 lines
common/params.c line 36
Quoted 8 lines
common/params.c new file +7
-0+ +/* This just allows us to keep track of which parameters are kmalloced. */ +struct kmalloced_param { +struct list_head list; +char val[]; +}; +static LIST_HEAD (kmalloced_params);This seems unused.
yeah forget to remove it
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/3] add command line boot support
Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
Hi Sascha,
Quoted 22 lines · Sascha Hauer
Hi J,
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
for now just support static boot command support
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 4 + arch/ppc/boards/pcm030/barebox.lds.S | 4 + arch/sandbox/board/barebox.lds.S | 4 + arch/sandbox/lib/barebox.lds.S | 4 + arch/x86/lib/barebox.lds.S | 9 ++- common/Kconfig | 11 ++ common/Makefile | 1 + common/params.c | 158 +++++++++++++++++++++++++++++ common/startup.c | 74 +++++++++++++- include/asm-generic/barebox.lds.h | 2 + include/init.h | 28 +++++ 12 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 common/params.c
Quoted 7 lines
Quoted 4 lines
Except for the inlined comments I'm generally ok with this patch. The more interesting part will be how the calling convention for barebox as a second stage loader is and how you preserve the registers used for commandline/atag passing during startup.
I take a look and no need to do something special we just have to put the data in the .data section as we will supposed to be call from memmory directly evenif we may ned to relocate our self
Nothing special? Then how does barebox know where to find the command line?
Quoted 17 lines
Quoted 6 lines
An idea which comes to my mind is that we could introduce a
CONFIG_BAREBOX_SECOND_STAGEwhich switches to a completely different startup process. This startup process could then assume that sdram is already initialized and that we do not have to callboard_init_lowlevel.I get in mind to keep it maybe as we can run the lowlevel init from cache as a peekpoke table to reconfigure the board if needed
Quoted 2 lines
Another interesting thing is how will barebox behave if called as a second stage loader but without valid atags?
I think to use in this case the default config and let the boards to get a callback to overwrite it
I'll try to push patch soon to show the solution
I get in mind to maybe use the device tree also not sure yetQuoted 3 lines
Quoted 3 lines
Quoted 8 lines
Quoted 7 lines
common/Kconfig choice · line 232
Quoted 3 lines
common/Kconfig +3
-0+config BOOT_CMDLINE + bool "barebox boot command string" + helpThis is useful if you intend to use barebox as a second stage bootloader and want to pass kernel like command line parameters to barebox. Otherwise say no here.
as you can have
built_incmdline you can use it also as a first stage
Yes, but this really serves no purpose, does it?
Quoted 47 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +22
-0+ +config CMDLINE + string "Default barebox command string" + depends on BOOT_CMDLINE + default "" + help + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include <malloc.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <errno.h> +#include <linux/err.h> +#include <linux/ctype.h>Quoted 8 lines
common/params.c line 29
Quoted 6 lines
common/params.c new file +6
-0+ +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt, a...) +#endif Please use the regular 'debug' function here.
ok
Quoted 10 lines
common/params.c line 36
Quoted 8 lines
common/params.c new file +7
-0+ +/* This just allows us to keep track of which parameters are kmalloced. */ +struct kmalloced_param { +struct list_head list; +char val[]; +}; +static LIST_HEAD (kmalloced_params);This seems unused.
yeah forget to remove it
Best Regards,
J.
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/3] add command line boot support
Quoted 30 lines · Sascha Hauer
Quoted 29 lines · Jean-Christophe PLAGNIOL-VILLARD
Hi Sascha,
Quoted 26 lines · Sascha Hauer
Hi J,
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
for now just support static boot command support
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/lib/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 4 + arch/ppc/boards/pcm030/barebox.lds.S | 4 + arch/sandbox/board/barebox.lds.S | 4 + arch/sandbox/lib/barebox.lds.S | 4 + arch/x86/lib/barebox.lds.S | 9 ++- common/Kconfig | 11 ++ common/Makefile | 1 + common/params.c | 158 +++++++++++++++++++++++++++++ common/startup.c | 74 +++++++++++++- include/asm-generic/barebox.lds.h | 2 + include/init.h | 28 +++++ 12 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 common/params.cExcept for the inlined comments I'm generally ok with this patch. The more interesting part will be how the calling convention for barebox as a second stage loader is and how you preserve the registers used for commandline/atag passing during startup.
Quoted 6 lines
Quoted 3 lines
I take a look and no need to do something special we just have to put the data in the .data section as we will supposed to be call from memmory directly evenif we may ned to relocate our self
Nothing special? Then how does barebox know where to find the command line?
yeah I agree I'll send a patch i'll be more clear
Quoted 25 lines
Quoted 25 lines
Quoted 7 lines
An idea which comes to my mind is that we could introduce a
CONFIG_BAREBOX_SECOND_STAGEwhich switches to a completely different startup process. This startup process could then assume that sdram is already initialized and that we do not have to callboard_init_lowlevel.I get in mind to keep it maybe as we can run the lowlevel init from cache as a peekpoke table to reconfigure the board if needed
Quoted 2 lines
Another interesting thing is how will barebox behave if called as a second stage loader but without valid atags?
I think to use in this case the default config and let the boards to get a callback to overwrite it
I'll try to push patch soon to show the solution
I get in mind to maybe use the device tree also not sure yetQuoted 10 lines
common/Kconfig choice · line 232
Quoted 6 lines
common/Kconfig +3
-0+config BOOT_CMDLINE + bool "barebox boot command string" + helpThis is useful if you intend to use barebox as a second stage bootloader and want to pass kernel like command line parameters to barebox. Otherwise say no here.
Quoted 3 lines
Quoted 1 line
as you can have
built_incmdline you can use it also as a first stageYes, but this really serves no purpose, does it?
yeah it's as you can dynamse the board via the static cmdline
and other part without modifying the code
and you will be able to dynamise the shell as I'm prepaaring a patch to export them in the shell too
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 __setup test
In reply to Jean-Christophe PLAGNIOL-VILLARD--- common/startup.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
common/startup.c +11 -3
@@ -105,12 +105,20 @@ device_initcall(register_default_env);#endif #ifdef CONFIG_BOOT_CMDLINE -static int __init bootmode (char *mode) +static __initdata char bootmode[COMMAND_LINE_SIZE ]; + +static int __init setup_bootmode (char *mode) +{ +strcpy (bootmode, mode); +return 0 ; +} +__setup ("boot=" , setup_bootmode); +static int bootmode_print (void ) { -printf ("boot=%s\n" , mode); +printf ("boot=%s\n" , bootmode);return 0 ; } -__setup ("boot=" , bootmode); +device_initcall (bootmode_print);#endif static int mount_root (void )
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi,
I was talking of this patch serie
Best Regards,
J.
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
HI,
as barebox is some times a second stage bootloader it could be intresting to pass some information
I'm currently working on two support
the atags for arm and the cmdlineThe cmline could be static or dynamic
so it will be easy to customise a boot sequence and etc...this first patch will just add static cmdline
later I'll send dynamic support and arm boot ABI
Quoted 8 lines
Best Regards,
J._______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox