PXE parsing fixes and local file support
cover PXE parsing fixes and local file support
From: Rob Herring <[email protected]>
The first 6 patches are menu file parsing fixes found in testing ubuntu/ debian generated menu files. The menu display is cleaned up to display the friendly menu label string and boot the default image on timeout as is typical for a PC bootloader.
The last patch adds support for parsing local disk files on ext2 or fat filesystems. This is essentially syslinux/extlinux emulation and simply reuses the existing pxe support.
Rob
Rob Herring (7):
menu: only timeout when menu is displayed
pxe: support include files at top-level
pxe: add support for label menu text
pxe: support linux entries for labels
pxe: support absolute paths
pxe: parse initrd file from append string
pxe: add support for parsing local syslinux files
common/cmd_pxe.c | 198 +++++++++++++++++++++++++++++++++++++++++++++++------- common/menu.c | 36 +--------- doc/README.pxe | 3 - include/common.h | 6 ++ 4 files changed, 184 insertions(+), 59 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/7 menu: only timeout when menu is displayed
From: Rob Herring <[email protected]>
Make the menu timeout apply only when prompt flag is set and after the menu is displayed. This allows auto boot to work no matter whether prompt is set or cleared. Use the default selection if the menu times out.
This also fixes the timeout value given to readline_into_buffer to be seconds instead of 10th of seconds.
Old behavior:
if prompt
display menu and wait for choice
else
wait for timeout
if key pressed
display menu and wait for choice
else
exit command
New behavior:
if prompt
display menu
if key pressed
wait for choice
else
boot default entry on timeout
else
boot default entry
--- common/menu.c | 36 ++++-------------------------------- 1 files changed, 4 insertions(+), 32 deletions(-)
common/menu.c +4 -32
@@ -171,32 +171,6 @@ static inline struct menu_item *menu_item_by_key(struct menu *m, }/* -* Wait for the user to hit a key according to the timeout set for the menu. -* Returns 1 if the user hit a key, or 0 if the timeout expired. -*/ -static inline int menu_interrupted (struct menu *m) -{ -if (!m->timeout) -return 0 ; - -if (abortboot (m->timeout/10 )) -return 1 ; - -return 0 ; -} - -/* -* Checks whether or not the default menu item should be used without -* prompting for a user choice. If the menu is set to always prompt, or the -* user hits a key during the timeout period, return 0. Otherwise, return 1 to -* indicate we should use the default menu item. -*/ -static inline int menu_use_default (struct menu *m) -{ -return !m->prompt && !menu_interrupted (m); -} - -/* * Set *choice to point to the default item's data, if any default item was * set, and returns 1. If no default item was set, returns -ENOENT. */
@@ -231,7 +205,7 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)menu_display (m); readret =readline_into_buffer ("Enter choice: " , cbuf, - m->timeout); + m->timeout /10 );if (readret >=0 ) { choice_item =menu_item_by_key (m, cbuf);
@@ -240,10 +214,8 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)printf ("%s not found\n" , cbuf); m->timeout =0 ; } - }else { -puts ("^C\n" ); -return -EINTR ; - } + }else +return menu_default_choice (m, choice); } *choice = choice_item->data;
@@ -300,7 +272,7 @@ int menu_get_choice(struct menu *m, void **choice)if (!m || !choice)return -EINVAL ; -if (menu_use_default (m)) +if (!m->prompt)return menu_default_choice (m, choice);return menu_interactive_choice (m, choice);
Signature · 1 line
1.7.5.4
Wolfgang Denk
AppliedPATCH 1/7 menu: only timeout when menu is displayed
Dear Rob Herring,
Quoted 31 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Make the menu timeout apply only when prompt flag is set and after the menu is displayed. This allows auto boot to work no matter whether prompt is set or cleared. Use the default selection if the menu times out.
This also fixes the timeout value given to
readline_into_bufferto be seconds instead of 10th of seconds.Old behavior:
if prompt
display menu and wait for choice
else
wait for timeout
if key pressed
display menu and wait for choice
else
exit commandNew behavior:
if prompt
display menu
if key pressed
wait for choice
else
boot default entry on timeout
else
boot default entry
Quoted 4 lines
Signed-off-by Rob Herring <[email protected]>--- common/menu.c | 36 ++++-------------------------------- 1 files changed, 4 insertions(+), 32 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 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 We fight only when there is no other choice. We prefer the ways of peaceful contact. -- Kirk, "Spectre of the Gun", stardate 4385.3
PATCH 2/7 pxe: support include files at top-level
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Include files outside of a menu were not getting included and parsed.
--- common/cmd_pxe.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
common/cmd_pxe.c +5 -0
@@ -1110,6 +1110,11 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level)break ; +case T_INCLUDE : + err =handle_include (&p, b +strlen (b) +1 , cfg, + nest_level +1 ); +break ; +case T_PROMPT : err =parse_integer (&p, &cfg->prompt);break ;
Signature · 1 line
1.7.5.4
PATCH v2 1/1 pxe: support include files at top-level
From: Rob Herring <[email protected]>
Include files outside of a menu were not getting included and parsed.
---
v2:
- ensure include file load address is aligned
common/cmd_pxe.c | 5 +++++ 1 file changed, 5 insertions(+)
common/cmd_pxe.c +5 -0
@@ -1110,6 +1110,11 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level)break ; +case T_INCLUDE : + err =handle_include (&p, b +ALIGN (strlen (b),4 ), cfg, + nest_level +1 ); +break ; +case T_PROMPT : err =parse_integer (&p, &cfg->prompt);break ;
Signature · 1 line
1.7.9.5
Wolfgang Denk
AppliedPATCH v2 1/1 pxe: support include files at top-level
Dear Rob Herring,
Quoted 11 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Include files outside of a menu were not getting included and parsed.
Signed-off-by Rob Herring <[email protected]>---
v2:
- ensure include file load address is alignedcommon/cmd_pxe.c | 5 +++++ 1 file changed, 5 insertions(+)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 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 Imagination is more important than knowledge. -- Albert Einstein
PATCH 3/7 pxe: add support for label menu text
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Use a menu string if present, otherwise use the kernel string.
--- common/cmd_pxe.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
common/cmd_pxe.c +9 -4
@@ -409,6 +409,7 @@ static int get_relfile_envaddr(char *file_path, char *envaddr_name)*/ struct pxe_label {char *name; +char *menu;char *kernel;char *append;char *initrd;
@@ -491,17 +492,18 @@ static void label_destroy(struct pxe_label *label)static void label_print (void *data) {struct pxe_label *label = data; +const char *c = label->menu ? label->menu : label->kernel; -printf ("Label: %s\n" , label->name); +printf ("%s:\t%s\n" , label->name, c);if (label->kernel) -printf ("\tkernel: %s\n" , label->kernel); +printf ("\t\tkernel: %s\n" , label->kernel);if (label->append) -printf ("\tappend: %s\n" , label->append); +printf ("\t\tappend: %s\n" , label->append);if (label->initrd) -printf ("\tinitrd: %s\n" , label->initrd); +printf ("\t\tinitrd: %s\n" , label->initrd); }/*
@@ -970,6 +972,9 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg,return -ENOMEM ;break ; +case T_LABEL : +parse_sliteral (c, &label->menu); +break ;default :printf ("Ignoring malformed menu command: %.*s\n" , (int )(*c - s), s);
Signature · 1 line
1.7.5.4
Wolfgang Denk
AppliedPATCH 3/7 pxe: add support for label menu text
Dear Rob Herring,
Quoted 8 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Use a menu string if present, otherwise use the kernel string.
Signed-off-by Rob Herring <[email protected]>--- common/cmd_pxe.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 ultimate barrier is one's viewpoint.
- Terry Pratchett, _The Dark Side of the Sun_PATCH 4/7 pxe: support linux entries for labels
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Kernels can be specified using "linux" or "kernel" entry. The difference is kernel is supposed to detect the type of file, but for u-boot both are treated the same.
--- common/cmd_pxe.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
common/cmd_pxe.c +3 -0
@@ -628,6 +628,7 @@ enum token_type {T_TIMEOUT ,T_LABEL ,T_KERNEL , +T_LINUX ,T_APPEND ,T_INITRD , T_LOCALBOOT,
@@ -656,6 +657,7 @@ static const struct token keywords[] = { {"prompt", T_PROMPT}, {"label", T_LABEL}, {"kernel", T_KERNEL}, + {"linux", T_LINUX}, {"localboot", T_LOCALBOOT}, {"append", T_APPEND}, {"initrd", T_INITRD},
@@ -1024,6 +1026,7 @@ static int parse_label(char **c, struct pxe_menu *cfg)break ;case T_KERNEL : +case T_LINUX : err =parse_sliteral (c, &label->kernel);break ;
Signature · 1 line
1.7.5.4
Wolfgang Denk
AppliedPATCH 4/7 pxe: support linux entries for labels
Dear Rob Herring,
Quoted 10 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Kernels can be specified using "linux" or "kernel" entry. The difference is kernel is supposed to detect the type of file, but for u-boot both are treated the same.
Signed-off-by Rob Herring <[email protected]>--- common/cmd_pxe.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 A stone was placed at a ford in a river with the inscription: "When this stone is covered it is dangerous to ford here."
PATCH 5/7 pxe: support absolute paths
In reply to Rob HerringFrom: Rob Herring <[email protected]>
If the file path starts with a '/', then don't pre-pend the bootfile path. This fixes a problem with running 'pxe boot' multiple times where the bootfile path gets pre-pended to itself each time.
--- common/cmd_pxe.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
common/cmd_pxe.c +12 -11
@@ -96,24 +96,24 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)* in. If bootfile isn't defined in the environment, return NULL, which should * be interpreted as "don't prepend anything to paths". */ -static int get_bootfile_path (char *bootfile_path,size_t bootfile_path_size) +static int get_bootfile_path (const char *file_path,char *bootfile_path, +size_t bootfile_path_size) {char *bootfile, *last_slash; -size_t path_len; +size_t path_len =0 ; + +if (file_path[0 ] =='/' ) + goto ret; bootfile =from_env ("bootfile" ); -if (!bootfile) { - bootfile_path[0 ] ='\0' ; -return 1 ; - } +if (!bootfile) + goto ret; last_slash =strrchr (bootfile,'/' ); -if (last_slash ==NULL ) { - bootfile_path[0 ] ='\0' ; -return 1 ; - } +if (last_slash ==NULL ) + goto ret; path_len = (last_slash - bootfile) +1 ;
@@ -126,6 +126,7 @@ static int get_bootfile_path(char *bootfile_path, size_t bootfile_path_size)strncpy (bootfile_path, bootfile, path_len); + ret: bootfile_path[path_len] ='\0' ;return 1 ;
@@ -147,7 +148,7 @@ static int get_relfile(char *file_path, void *file_addr)char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL };int err; - err =get_bootfile_path (relfile,sizeof (relfile)); + err =get_bootfile_path (file_path, relfile,sizeof (relfile));if (err <0 )return err;
Signature · 1 line
1.7.5.4
Wolfgang Denk
AppliedPATCH 5/7 pxe: support absolute paths
Dear Rob Herring,
Quoted 10 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
If the file path starts with a '/', then don't pre-pend the bootfile path. This fixes a problem with running 'pxe boot' multiple times where the bootfile path gets pre-pended to itself each time.
Signed-off-by Rob Herring <[email protected]>--- common/cmd_pxe.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 Pain is a thing of the mind. The mind can be controlled. -- Spock, "Operation -- Annihilate!" stardate 3287.2
PATCH 6/7 pxe: parse initrd file from append string
In reply to Rob HerringFrom: Rob Herring <[email protected]>
For syslinux, the initrd can be set in the append string as "initrd=<file>", so try to find it there if we haven't already set the initrd.
--- common/cmd_pxe.c | 15 ++++++++++++++- doc/README.pxe | 3 --- 2 files changed, 14 insertions(+), 4 deletions(-)
common/cmd_pxe.c +14 -1
@@ -999,6 +999,7 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg,static int parse_label (char **c,struct pxe_menu *cfg) {struct token t; +int len;char *s = *c;struct pxe_label *label;int err;
@@ -1033,10 +1034,22 @@ static int parse_label(char **c, struct pxe_menu *cfg)case T_APPEND : err =parse_sliteral (c, &label->append); +if (label->initrd) +break ; + s =strstr (label->append,"initrd=" ); +if (!s) +break ; + s +=7 ; + len = (int )(strchr (s,' ' ) - s); + label->initrd =malloc (len +1 ); +strncpy (label->initrd, s, len); + label->initrd[len] ='\0' ; +break ;case T_INITRD : - err =parse_sliteral (c, &label->initrd); +if (!label->initrd) + err =parse_sliteral (c, &label->initrd);break ;case T_LOCALBOOT :
doc/README.pxe +0 -3
@@ -224,9 +224,6 @@ PXELINUX and U-boot's pxe support. - U-boot's pxe expects U-boot uimg's as kernels. Anything that would work with the 'bootm' command in U-boot could work with the 'pxe boot' command. -- U-boot's pxe doesn't recognize initrd options in the append command - you - must specify initrd files using the initrd command. - - U-boot's pxe only recognizes a single file on the initrd command line. It could be extended to support multiple.
Signature · 1 line
1.7.5.4
Wolfgang Denk
AppliedPATCH 6/7 pxe: parse initrd file from append string
Dear Rob Herring,
Quoted 11 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
For syslinux, the initrd can be set in the append string as "initrd=<file>", so try to find it there if we haven't already set the initrd.
Signed-off-by Rob Herring <[email protected]>--- common/cmd_pxe.c | 15 ++++++++++++++- doc/README.pxe | 3 --- 2 files changed, 14 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 First study the enemy. Seek weakness. -- Romulan Commander, "Balance of Terror", stardate 1709.2
PATCH 7/7 pxe: add support for parsing local syslinux files
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
--- common/cmd_pxe.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++--- include/common.h | 6 ++ 2 files changed, 137 insertions(+), 8 deletions(-)
common/cmd_pxe.c +131 -8
@@ -132,6 +132,49 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,return 1 ; } +static int (*do_getfile)(char *file_path,char *file_addr); + +static int do_get_tftp (char *file_path,char *file_addr) +{ +char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL }; + + tftp_argv[1 ] = file_addr; + tftp_argv[2 ] = file_path; + +if (do_tftpb (NULL ,0 ,3 , tftp_argv)) +return -ENOENT ; + +return 1 ; +} + +static char *fs_argv[5 ]; + +static int do_get_ext2 (char *file_path,char *file_addr) +{ + fs_argv[0 ] ="ext2load" ; + fs_argv[3 ] = file_addr; + fs_argv[4 ] = file_path; + +if (do_ext2load (NULL ,0 ,5 , fs_argv)) +return -ENOENT ; + +return 1 ; +} + +static int do_get_fat (char *file_path,char *file_addr) +{ + fs_argv[0 ] ="fatload" ; + fs_argv[3 ] = file_addr; + fs_argv[4 ] = file_path; + +if (do_fat_fsload (NULL ,0 ,5 , fs_argv)) +return -ENOENT ; + +return 1 ; +} + + +/* * As in pxelinux, paths to files referenced from files we retrieve are * relative to the location of bootfile. get_relfile takes such a path and
@@ -145,7 +188,6 @@ static int get_relfile(char *file_path, void *file_addr)size_t path_len;char relfile[MAX_TFTP_PATH_LEN +1 ];char addr_buf[10 ]; -char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL };int err; err =get_bootfile_path (file_path, relfile,sizeof (relfile));
@@ -170,13 +212,7 @@ static int get_relfile(char *file_path, void *file_addr)sprintf (addr_buf,"%p" , file_addr); - tftp_argv[1 ] = addr_buf; - tftp_argv[2 ] = relfile; - -if (do_tftpb (NULL ,0 ,3 , tftp_argv)) -return -ENOENT ; - -return 1 ; +return do_getfile (relfile, addr_buf); }/*
@@ -322,6 +358,8 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])void *pxefile_addr_r;int err; + do_getfile = do_get_tftp; +if (argc !=1 )return CMD_RET_USAGE ;
@@ -1331,6 +1369,8 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])struct pxe_menu *cfg;char *pxefile_addr_str; + do_getfile = do_get_tftp; +if (argc ==1 ) { pxefile_addr_str =from_env ("pxefile_addr_r" );if (!pxefile_addr_str)
@@ -1391,3 +1431,86 @@ U_BOOT_CMD("get - try to retrieve a pxe file using tftp\npxe " "boot [pxefile_addr_r] - boot from the pxe file at pxefile_addr_r\n" ); + +/* +* Boots a system using a local disk syslinux/extlinux file +* +* Returns 0 on success, 1 on error. +*/ +int do_sysboot (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +unsigned long pxefile_addr_r; +struct pxe_menu *cfg; +char *pxefile_addr_str; +char *filename; +int prompt =0 ; + +if (strstr (argv[1 ],"-p" )) { + prompt =1 ; + argc--; + argv++; + } + +if (argc <4 ) +return cmd_usage (cmdtp); + +if (argc <5 ) { + pxefile_addr_str =from_env ("pxefile_addr_r" ); +if (!pxefile_addr_str) +return 1 ; + }else { + pxefile_addr_str = argv[4 ]; + } + +if (argc <6 ) + filename =getenv ("bootfile" ); +else { + filename = argv[5 ]; +setenv ("bootfile" , filename); + } + +if (strstr (argv[3 ],"ext2" )) + do_getfile = do_get_ext2; +else if (strstr (argv[3 ],"fat" )) + do_getfile = do_get_fat; +else { +printf ("Invalid filesystem: %s\n" , argv[3 ]); +return 1 ; + } + fs_argv[1 ] = argv[1 ]; + fs_argv[2 ] = argv[2 ]; + +if (strict_strtoul (pxefile_addr_str,16 , &pxefile_addr_r) <0 ) { +printf ("Invalid pxefile address: %s\n" , pxefile_addr_str); +return 1 ; + } + +if (get_pxe_file (filename, (void *)pxefile_addr_r) <0 ) { +printf ("Error reading config file\n" ); +return 1 ; + } + + cfg =parse_pxefile ((char *)(pxefile_addr_r)); + +if (cfg ==NULL ) { +printf ("Error parsing config file\n" ); +return 1 ; + } + +if (prompt) + cfg->prompt =1 ; + +handle_pxe_menu (cfg); + +destroy_pxe_menu (cfg); + +return 0 ; +} + +U_BOOT_CMD ( + sysboot,7 ,1 , do_sysboot, +"command to get and boot from syslinux files" , +"[-p] <interface> <dev[:part]> <ext2|fat> [addr] [filename]\n" +" - load and parse syslinux menu file 'filename' from ext2 or fat\n" +" filesystem on 'dev' on 'interface' to address 'addr'" +);
include/common.h +6 -0
@@ -307,6 +307,12 @@ void doc_probe(unsigned long physadr);/* common/cmd_net.c */ int do_tftpb (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +/* common/cmd_fat.c */ +int do_fat_fsload (cmd_tbl_t *,int ,int ,char *const []); + +/* common/cmd_ext2.c */ +int do_ext2load (cmd_tbl_t *,int ,int ,char *const []); +/* common/cmd_nvedit.c */ int env_init (void );void env_relocate (void );
Signature · 1 line
1.7.5.4
PATCH 7/7 pxe: add support for parsing local syslinux files
Hi Rob,
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>
I attempted to apply this patch but it failed.
Applying: pxe: add support for parsing local syslinux files
error: patch failed: common/cmd_pxe.c:322
error: common/cmd_pxe.c: patch does not apply
fatal: sha1 information is lacking or useless (common/cmd_pxe.c). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge.
Patch failed at 0007.
Please rebase the series and resend.
Thanks,
-Joe
PATCH 7/7 pxe: add support for parsing local syslinux files
Quoted 21 lines · Joe Hershberger
Hi Rob,
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>I attempted to apply this patch but it failed.
Applying: pxe: add support for parsing local syslinux files
error: patch failed:common/cmd_pxe.c:322
error:common/cmd_pxe.c: patch does not apply
fatal: sha1 information is lacking or useless (common/cmd_pxe.c). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge.
Patch failed at 0007.
Quoted 1 line
Please rebase the series and resend.
I rebased to Wolfgang's current master without any conflicts, so I'm puzzled why this failed for you. I was originally based on this commit plus a few otherwise unrelated highbank fixes:
commit 7cb30b13f12077c7eec8ce2419cd96cd65ace8e2
Merge: 636f77a 85c344e
Author: Wolfgang Denk <[email protected]>
Date: Fri Mar 23 21:59:16 2012 +0100
Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
* 'master' of git://git.denx.de/u-boot-cfi-flash:
cfi: fix the incomplete erased status check in buffer write
What base were you applying these to?
Rob
PATCH 7/7 pxe: add support for parsing local syslinux files
Hi Rob,
Quoted 33 lines · Rob Herring
Quoted 21 lines · Joe Hershberger
Hi Rob,
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>I attempted to apply this patch but it failed.
Applying: pxe: add support for parsing local syslinux files
error: patch failed:common/cmd_pxe.c:322
error:common/cmd_pxe.c: patch does not apply
fatal: sha1 information is lacking or useless (common/cmd_pxe.c). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge.
Patch failed at 0007.Quoted 1 line
Please rebase the series and resend.
I rebased to Wolfgang's current master without any conflicts, so I'm puzzled why this failed for you. I was originally based on this commit plus a few otherwise unrelated highbank fixes:
commit
7cb30b13f12077c7eec8ce2419cd96cd65ace8e2
Merge: 636f77a 85c344e
Author: Wolfgang Denk <[email protected]>
Date: ? Fri Mar 23 21:59:16 2012 +0100
Quoted 6 lines
? ?Merge branch 'master' of
git://git.denx.de/u-boot-cfi-flash? ?* 'master' of
git://git.denx.de/u-boot-cfi-flash:
? ? ?cfi: fix the incomplete erased status check in buffer writeWhat base were you applying these to?
I just tried again on u-boot.git/master...
Quoted 1 line
git checkout origin/master
Note: moving to "origin/master" which isn't a local branch If you want to create a new branch from this checkout, you may do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new_branch_name>
HEAD is now at b86a475... MAKEALL: Report boards with errors vs warnings
Quoted 1 line
git am < bundle-2943.mbox
Applying: menu: only timeout when menu is displayed
Applying: pxe: support include files at top-level
Applying: pxe: add support for label menu text
Applying: pxe: support linux entries for labels
Applying: pxe: support absolute paths
Applying: pxe: parse initrd file from append string
Applying: pxe: add support for parsing local syslinux files
error: patch failed: common/cmd_pxe.c:322
error: common/cmd_pxe.c: patch does not apply
Patch failed@0007.
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".
I'm attempting to apply these patches in patchwork:
http://patchwork.ozlabs.org/patch/149281/
http://patchwork.ozlabs.org/patch/149280/
http://patchwork.ozlabs.org/patch/149282/
http://patchwork.ozlabs.org/patch/149283/
http://patchwork.ozlabs.org/patch/149284/
http://patchwork.ozlabs.org/patch/149286/
http://patchwork.ozlabs.org/patch/149285/
in that order... is that incorrect?
Thanks
-Joe
PATCH 7/7 pxe: add support for parsing local syslinux files
Hi Rob,
Quoted 77 lines · Joe Hershberger
Hi Rob,
Quoted 33 lines · Rob Herring
Quoted 21 lines · Joe Hershberger
Hi Rob,
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>I attempted to apply this patch but it failed.
Applying: pxe: add support for parsing local syslinux files
error: patch failed:common/cmd_pxe.c:322
error:common/cmd_pxe.c: patch does not apply
fatal: sha1 information is lacking or useless (common/cmd_pxe.c). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge.
Patch failed at 0007.Quoted 1 line
Please rebase the series and resend.
I rebased to Wolfgang's current master without any conflicts, so I'm puzzled why this failed for you. I was originally based on this commit plus a few otherwise unrelated highbank fixes:
commit
7cb30b13f12077c7eec8ce2419cd96cd65ace8e2
Merge: 636f77a 85c344e
Author: Wolfgang Denk <[email protected]>
Date: ? Fri Mar 23 21:59:16 2012 +0100Quoted 6 lines
? ?Merge branch 'master' of
git://git.denx.de/u-boot-cfi-flash? ?* 'master' of
git://git.denx.de/u-boot-cfi-flash:
? ? ?cfi: fix the incomplete erased status check in buffer writeWhat base were you applying these to?
I just tried again on u-boot.git/master...
Quoted 1 line
git checkout origin/master
Note: moving to "origin/master" which isn't a local branch If you want to create a new branch from this checkout, you may do so (now or later) by using -b with the checkout command again. Example:
?git checkout -b <new_branch_name>
HEAD is now at b86a475... MAKEALL: Report boards with errors vs warningsQuoted 1 line
git am < bundle-2943.mbox
Applying: menu: only timeout when menu is displayed
Applying: pxe: support include files at top-level
Applying: pxe: add support for label menu text
Applying: pxe: support linux entries for labels
Applying: pxe: support absolute paths
Applying: pxe: parse initrd file from append string
Applying: pxe: add support for parsing local syslinux files
error: patch failed:common/cmd_pxe.c:322
error:common/cmd_pxe.c: patch does not apply
Patch failed at 0007.
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".I'm attempting to apply these patches in patchwork:
http://patchwork.ozlabs.org/patch/149281/
http://patchwork.ozlabs.org/patch/149280/
http://patchwork.ozlabs.org/patch/149282/
http://patchwork.ozlabs.org/patch/149283/
http://patchwork.ozlabs.org/patch/149284/
http://patchwork.ozlabs.org/patch/149286/
http://patchwork.ozlabs.org/patch/149285/
Quoted 4 lines
in that order... is that incorrect?
Thanks
-Joe
Any luck figuring out why the patch at
http://patchwork.ozlabs.org/patch/149285/ will not apply? Perhaps just rebase (since that works for you) and resend.
Thanks,
-Joe
PATCH v2 1/1 pxe: add support for parsing local syslinux files
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
---
v2:
- rebase to current mainline
- fix compile if ext2 or fat is disabled
common/cmd_pxe.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++---- include/common.h | 6 +++ 2 files changed, 139 insertions(+), 8 deletions(-)
common/cmd_pxe.c +133 -8
@@ -132,6 +132,51 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,return 1 ; } +static int (*do_getfile)(char *file_path,char *file_addr); + +static int do_get_tftp (char *file_path,char *file_addr) +{ +char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL }; + + tftp_argv[1 ] = file_addr; + tftp_argv[2 ] = file_path; + +if (do_tftpb (NULL ,0 ,3 , tftp_argv)) +return -ENOENT ; + +return 1 ; +} + +static char *fs_argv[5 ]; + +static int do_get_ext2 (char *file_path,char *file_addr) +{ +#ifdef CONFIG_CMD_EXT2 + fs_argv[0 ] ="ext2load" ; + fs_argv[3 ] = file_addr; + fs_argv[4 ] = file_path; + +if (!do_ext2load (NULL ,0 ,5 , fs_argv)) +return 1 ; +#endif +return -ENOENT ; +} + +static int do_get_fat (char *file_path,char *file_addr) +{ +#ifdef CONFIG_CMD_FAT + fs_argv[0 ] ="fatload" ; + fs_argv[3 ] = file_addr; + fs_argv[4 ] = file_path; + +if (!do_fat_fsload (NULL ,0 ,5 , fs_argv)) +return 1 ; +#endif +return -ENOENT ; +} + + +/* * As in pxelinux, paths to files referenced from files we retrieve are * relative to the location of bootfile. get_relfile takes such a path and
@@ -145,7 +190,6 @@ static int get_relfile(char *file_path, void *file_addr)size_t path_len;char relfile[MAX_TFTP_PATH_LEN +1 ];char addr_buf[10 ]; -char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL };int err; err =get_bootfile_path (file_path, relfile,sizeof (relfile));
@@ -170,13 +214,7 @@ static int get_relfile(char *file_path, void *file_addr)sprintf (addr_buf,"%p" , file_addr); - tftp_argv[1 ] = addr_buf; - tftp_argv[2 ] = relfile; - -if (do_tftpb (NULL ,0 ,3 , tftp_argv)) -return -ENOENT ; - -return 1 ; +return do_getfile (relfile, addr_buf); }/*
@@ -322,6 +360,8 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])unsigned long pxefile_addr_r;int err; + do_getfile = do_get_tftp; +if (argc !=1 )return CMD_RET_USAGE ;
@@ -1331,6 +1371,8 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])struct pxe_menu *cfg;char *pxefile_addr_str; + do_getfile = do_get_tftp; +if (argc ==1 ) { pxefile_addr_str =from_env ("pxefile_addr_r" );if (!pxefile_addr_str)
@@ -1391,3 +1433,86 @@ U_BOOT_CMD("get - try to retrieve a pxe file using tftp\npxe " "boot [pxefile_addr_r] - boot from the pxe file at pxefile_addr_r\n" ); + +/* +* Boots a system using a local disk syslinux/extlinux file +* +* Returns 0 on success, 1 on error. +*/ +int do_sysboot (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +unsigned long pxefile_addr_r; +struct pxe_menu *cfg; +char *pxefile_addr_str; +char *filename; +int prompt =0 ; + +if (strstr (argv[1 ],"-p" )) { + prompt =1 ; + argc--; + argv++; + } + +if (argc <4 ) +return cmd_usage (cmdtp); + +if (argc <5 ) { + pxefile_addr_str =from_env ("pxefile_addr_r" ); +if (!pxefile_addr_str) +return 1 ; + }else { + pxefile_addr_str = argv[4 ]; + } + +if (argc <6 ) + filename =getenv ("bootfile" ); +else { + filename = argv[5 ]; +setenv ("bootfile" , filename); + } + +if (strstr (argv[3 ],"ext2" )) + do_getfile = do_get_ext2; +else if (strstr (argv[3 ],"fat" )) + do_getfile = do_get_fat; +else { +printf ("Invalid filesystem: %s\n" , argv[3 ]); +return 1 ; + } + fs_argv[1 ] = argv[1 ]; + fs_argv[2 ] = argv[2 ]; + +if (strict_strtoul (pxefile_addr_str,16 , &pxefile_addr_r) <0 ) { +printf ("Invalid pxefile address: %s\n" , pxefile_addr_str); +return 1 ; + } + +if (get_pxe_file (filename, (void *)pxefile_addr_r) <0 ) { +printf ("Error reading config file\n" ); +return 1 ; + } + + cfg =parse_pxefile ((char *)(pxefile_addr_r)); + +if (cfg ==NULL ) { +printf ("Error parsing config file\n" ); +return 1 ; + } + +if (prompt) + cfg->prompt =1 ; + +handle_pxe_menu (cfg); + +destroy_pxe_menu (cfg); + +return 0 ; +} + +U_BOOT_CMD ( + sysboot,7 ,1 , do_sysboot, +"command to get and boot from syslinux files" , +"[-p] <interface> <dev[:part]> <ext2|fat> [addr] [filename]\n" +" - load and parse syslinux menu file 'filename' from ext2 or fat\n" +" filesystem on 'dev' on 'interface' to address 'addr'" +);
include/common.h +6 -0
@@ -325,6 +325,12 @@ void doc_probe(unsigned long physadr);/* common/cmd_net.c */ int do_tftpb (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +/* common/cmd_fat.c */ +int do_fat_fsload (cmd_tbl_t *,int ,int ,char *const []); + +/* common/cmd_ext2.c */ +int do_ext2load (cmd_tbl_t *,int ,int ,char *const []); +/* common/cmd_nvedit.c */ int env_init (void );void env_relocate (void );
Signature · 1 line
1.7.9.5
PATCH v2 1/1 pxe: add support for parsing local syslinux files
Hi Rob,
Quoted 11 lines · Rob Herring
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>---
v2:
- rebase to current mainline
- fix compile if ext2 or fat is disabled
It applies now.
Thanks,
-Joe
Wolfgang Denk
AppliedPATCH v2 1/1 pxe: add support for parsing local syslinux files
In reply to Rob HerringDear Rob Herring,
Quoted 7 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed.
Signed-off-by Rob Herring <[email protected]>
Quoted 8 lines
---
v2:
- rebase to current mainline
- fix compile if ext2 or fat is disabledcommon/cmd_pxe.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++---- include/common.h | 6 +++ 2 files changed, 139 insertions(+), 8 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 8 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 When a child is taught ... its programmed with simple instructions -- and at some point, if its mind develops properly, it exceeds the sum of what it was taught, thinks independently. -- Dr. Richard Daystrom, "The Ultimate Computer", stardate 4731.3.