PXE support updates
cover PXE support updates
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticize do_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend support
common/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/10 pxe: Use ethact setting for pxe
From: Rob Herring <[email protected]>
Get the MAC address using eth_getenv_enetaddr_by_index so that the MAC address of ethact is used. This enables using the a NIC other than the first one for PXE boot.
--- common/cmd_pxe.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-)
common/cmd_pxe.c +9 -25
@@ -55,37 +55,21 @@ static char *from_env(char *envvar)*/ static int format_mac_pxe (char *outbuf,size_t outbuf_len) { -size_t ethaddr_len; -char *p, *ethaddr; +uchar ethaddr[6 ]; - ethaddr =from_env ("ethaddr" ); - -if (!ethaddr) -return -ENOENT ; - - ethaddr_len =strlen (ethaddr); - -/* -* ethaddr_len + 4 gives room for "01-", ethaddr, and a NUL byte at -* the end. -*/ -if (outbuf_len < ethaddr_len +4 ) { -printf ("outbuf is too small (%d < %d)\n" , - outbuf_len, ethaddr_len +4 ); +if (outbuf_len <21 ) { +printf ("outbuf is too small (%d < 21)\n" , outbuf_len);return -EINVAL ; } -strcpy (outbuf,"01-" ); - -for (p = outbuf +3 ; *ethaddr; ethaddr++, p++) { -if (*ethaddr ==':' ) - *p ='-' ; -else - *p =tolower (*ethaddr); - } +if (!eth_getenv_enetaddr_by_index ("eth" ,eth_get_dev_index (), + ethaddr)) +return -ENOENT ; - *p ='\0' ; +sprintf (outbuf,"01-%02x-%02x-%02x-%02x-%02x-%02x" , + ethaddr[0 ], ethaddr[1 ], ethaddr[2 ], + ethaddr[3 ], ethaddr[4 ], ethaddr[5 ]);return 1 ; }
Signature · 1 line
1.7.10.4
Joe Hershberger
AppliedPATCH 1/10 pxe: Use ethact setting for pxe
Quoted 7 lines · Rob Herring
From: Rob Herring <[email protected]>
Get the MAC address using
eth_getenv_enetaddr_by_indexso that the MAC address of ethact is used. This enables using the a NIC other than the first one for PXE boot.Signed-off-by Rob Herring <[email protected]>
Applied series, Thanks.
-Joe
PATCH 2/10 pxe: make string parameters const
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert a bunch of string parameters to be const.
--- common/cmd_pxe.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
common/cmd_pxe.c +12 -12
@@ -31,7 +31,7 @@* environment. It always returns what getenv does, so it can be used in * place of getenv without changing error handling otherwise. */ -static char *from_env (char *envvar) +static char *from_env (const char *envvar) {char *ret;
@@ -115,14 +115,14 @@ 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_getfile)(const char *file_path,char *file_addr); -static int do_get_tftp (char *file_path,char *file_addr) +static int do_get_tftp (const char *file_path,char *file_addr) {char *tftp_argv[] = {"tftp" ,NULL ,NULL ,NULL }; tftp_argv[1 ] = file_addr; - tftp_argv[2 ] = file_path; + tftp_argv[2 ] = (void *)file_path;if (do_tftpb (NULL ,0 ,3 , tftp_argv))return -ENOENT ;
@@ -132,12 +132,12 @@ static int do_get_tftp(char *file_path, char *file_addr)static char *fs_argv[5 ]; -static int do_get_ext2 (char *file_path,char *file_addr) +static int do_get_ext2 (const char *file_path,char *file_addr) {#ifdef CONFIG_CMD_EXT2 fs_argv[0 ] ="ext2load" ; fs_argv[3 ] = file_addr; - fs_argv[4 ] = file_path; + fs_argv[4 ] = (void *)file_path;if (!do_ext2load (NULL ,0 ,5 , fs_argv))return 1 ;
@@ -145,12 +145,12 @@ static int do_get_ext2(char *file_path, char *file_addr)return -ENOENT ; } -static int do_get_fat (char *file_path,char *file_addr) +static int do_get_fat (const char *file_path,char *file_addr) {#ifdef CONFIG_CMD_FAT fs_argv[0 ] ="fatload" ; fs_argv[3 ] = file_addr; - fs_argv[4 ] = file_path; + fs_argv[4 ] = (void *)file_path;if (!do_fat_fsload (NULL ,0 ,5 , fs_argv))return 1 ;
@@ -166,7 +166,7 @@ static int do_get_fat(char *file_path, char *file_addr)* * Returns 1 for success, or < 0 on error. */ -static int get_relfile (char *file_path,void *file_addr) +static int get_relfile (const char *file_path,void *file_addr) {size_t path_len;char relfile[MAX_TFTP_PATH_LEN +1 ];
@@ -205,7 +205,7 @@ static int get_relfile(char *file_path, void *file_addr)* * Returns 1 on success, or < 0 for error. */ -static int get_pxe_file (char *file_path,void *file_addr) +static int get_pxe_file (const char *file_path,void *file_addr) {unsigned long config_file_size;char *tftp_filesize;
@@ -242,7 +242,7 @@ static int get_pxe_file(char *file_path, void *file_addr)* * Returns 1 on success or < 0 on error. */ -static int get_pxelinux_path (char *file,void *pxefile_addr_r) +static int get_pxelinux_path (const char *file,void *pxefile_addr_r) {size_t base_len =strlen (PXELINUX_DIR );char path[MAX_TFTP_PATH_LEN +1 ];
@@ -382,7 +382,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])* * Returns 1 on success or < 0 on error. */ -static int get_relfile_envaddr (char *file_path,char *envaddr_name) +static int get_relfile_envaddr (const char *file_path,const char *envaddr_name) {unsigned long file_addr;char *envaddr;
Signature · 1 line
1.7.10.4
PATCH 3/10 pxe: fix handling of different localboot values
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add support for value of -1 For localboot. A value of -1 means return to u-boot prompt.
The localboot value is often 0, so we need to distinguish the value from localboot being selected. A value of greater than or equal to 0 means attempt local boot command.
If localboot is selected, we don't want to try other entries.
--- common/cmd_pxe.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
common/cmd_pxe.c +18 -17
@@ -437,6 +437,7 @@ struct pxe_label {char *fdt;int attempted;int localboot; +int localboot_val;struct list_head list; };
@@ -575,7 +576,7 @@ static int label_localboot(struct pxe_label *label)* If the label specifies an 'append' line, its contents will overwrite that * of the 'bootargs' environment variable. */ -static void label_boot (struct pxe_label *label) +static int label_boot (struct pxe_label *label) {char *bootm_argv[] = {"bootm" ,NULL ,NULL ,NULL ,NULL };int bootm_argc =3 ;
@@ -585,21 +586,22 @@ static void label_boot(struct pxe_label *label) label->attempted =1 ;if (label->localboot) { -label_localboot (label); -return ; +if (label->localboot_val >=0 ) +label_localboot (label); +return 0 ; }if (label->kernel ==NULL ) {printf ("No kernel given, skipping %s\n" , label->name); -return ; +return 1 ; }if (label->initrd) {if (get_relfile_envaddr (label->initrd,"ramdisk_addr_r" ) <0 ) {printf ("Skipping %s for failure retrieving initrd\n" , label->name); -return ; +return 1 ; } bootm_argv[2 ] =getenv ("ramdisk_addr_r" );
@@ -610,7 +612,7 @@ static void label_boot(struct pxe_label *label)if (get_relfile_envaddr (label->kernel,"kernel_addr_r" ) <0 ) {printf ("Skipping %s for failure retrieving kernel\n" , label->name); -return ; +return 1 ; }if (label->append)
@@ -638,7 +640,7 @@ static void label_boot(struct pxe_label *label)if (get_relfile_envaddr (label->fdt,"fdt_addr_r" ) <0 ) {printf ("Skipping %s for failure retrieving fdt\n" , label->name); -return ; +return 1 ; } }else bootm_argv[3 ] =getenv ("fdt_addr" );
@@ -647,6 +649,7 @@ static void label_boot(struct pxe_label *label) bootm_argc =4 ;do_bootm (NULL ,0 , bootm_argc, bootm_argv); +return 1 ; }/*
@@ -887,7 +890,6 @@ static int parse_integer(char **c, int *dst) {struct token t;char *s = *c; -unsigned long temp;get_token (c, &t,L_SLITERAL );
@@ -896,12 +898,7 @@ static int parse_integer(char **c, int *dst)return -EINVAL ; } -if (strict_strtoul (t.val,10 , &temp) <0 ) { -printf ("Expected unsigned integer: %s\n" , t.val); -return -EINVAL ; - } - - *dst = (int )temp; + *dst =simple_strtol (t.val,NULL ,10 );free (t.val);
@@ -1092,7 +1089,8 @@ static int parse_label(char **c, struct pxe_menu *cfg)break ;case T_LOCALBOOT : - err =parse_integer (c, &label->localboot); + label->localboot =1 ; + err =parse_integer (c, &label->localboot_val);break ;case T_EOL :
@@ -1350,8 +1348,11 @@ static void handle_pxe_menu(struct pxe_menu *cfg)* we give up. */ -if (err ==1 ) -label_boot (choice); +if (err ==1 ) { + err =label_boot (choice); +if (!err) +return ; + }else if (err != -ENOENT )return ;
Signature · 1 line
1.7.10.4
PATCH 4/10 bootz: un-staticize do_bootz
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Make do_bootz available for other functions like do_bootm is.
--- common/cmd_bootm.c | 2 +- include/command.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
common/cmd_bootm.c +1 -1
@@ -1612,7 +1612,7 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,return 0 ; } -static int do_bootz (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +int do_bootz (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {bootm_headers_t images;
include/command.h +2 -0
@@ -110,6 +110,8 @@ static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd) }#endif +extern int do_bootz (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +extern int common_diskboot (cmd_tbl_t *cmdtp,const char *intf,int argc,char *const argv[]);
Signature · 1 line
1.7.10.4
PATCH 5/10 pxe: use bootz instead of bootm when enabled
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Standard pxelinux servers would use zImage rather than u-boot image format, so use bootz instead of bootm if enabled.
--- common/cmd_pxe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
common/cmd_pxe.c +9 -1
@@ -579,6 +579,7 @@ static int label_localboot(struct pxe_label *label)static int label_boot (struct pxe_label *label) {char *bootm_argv[] = {"bootm" ,NULL ,NULL ,NULL ,NULL }; +char initrd_str[22 ];int bootm_argc =3 ;label_print (label);
@@ -604,7 +605,10 @@ static int label_boot(struct pxe_label *label)return 1 ; } - bootm_argv[2 ] =getenv ("ramdisk_addr_r" ); + bootm_argv[2 ] = initrd_str; +strcpy (bootm_argv[2 ],getenv ("ramdisk_addr_r" )); +strcat (bootm_argv[2 ],":" ); +strcat (bootm_argv[2 ],getenv ("filesize" )); }else { bootm_argv[2 ] ="-" ; }
@@ -648,7 +652,11 @@ static int label_boot(struct pxe_label *label)if (bootm_argv[3 ]) bootm_argc =4 ; +#ifdef CONFIG_CMD_BOOTZ +do_bootz (NULL ,0 , bootm_argc, bootm_argv); +#else do_bootm (NULL ,0 , bootm_argc, bootm_argv); +#endif return 1 ; }
Signature · 1 line
1.7.10.4
PATCH 5/10 pxe: use bootz instead of bootm when enabled
Dear Rob Herring,
Quoted 4 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Standard pxelinux servers would use zImage rather than u-boot image format, so use bootz instead of bootm if enabled.
Why would this be the case? We should encourage the use of a checksum-protected image format, i. e. the default setting should be for FIT images, followed by legacy U-Boot images, and fall back on archaic formats like zImage only when there is really no other way.
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 On a clear disk you can seek forever.
PATCH 5/10 pxe: use bootz instead of bootm when enabled
Quoted 5 lines · Wolfgang Denk
Dear Rob Herring,
Quoted 2 lines · In message <[email protected]> you wrote:
From: Rob Herring <[email protected]>
Quoted 8 lines
Quoted 2 lines
Standard pxelinux servers would use zImage rather than u-boot image format, so use bootz instead of bootm if enabled.
Why would this be the case? We should encourage the use of a checksum-protected image format, i. e. the default setting should be for FIT images, followed by legacy U-Boot images, and fall back on archaic formats like zImage only when there is really no other way.
There is no way for the client to tell the server what kind of client it is and therefore what kind of image to serve. There is the dhcp client id string, but that can't be used in situations were you don't control the dhcp server setup. That problem is also the reason for patch 9 where you can't distinguish between x86 and ARM for "default".
When we have systems that boot from UEFI, they will certainly not use u-boot image formats and we don't want to have different setup based on the client/bootloader type.
I can actually just make this run-time rather than compile time. When do_bootm returns when it fails to find a valid u-boot image, I can just call do_bootz.
Rob
PATCH v2 1/1 pxe: try bootz if bootm fails to find a valid image
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Standard pxelinux servers will typically use a zImage rather than u-boot image format, so fallback to bootz if bootm fails.
---
v2:
- Only fall back to bootz when bootm fails instead of being either or option.
common/cmd_pxe.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
common/cmd_pxe.c +10 -1
@@ -579,6 +579,7 @@ static int label_localboot(struct pxe_label *label)static int label_boot (struct pxe_label *label) {char *bootm_argv[] = {"bootm" ,NULL ,NULL ,NULL ,NULL }; +char initrd_str[22 ];int bootm_argc =3 ;label_print (label);
@@ -604,7 +605,10 @@ static int label_boot(struct pxe_label *label)return 1 ; } - bootm_argv[2 ] =getenv ("ramdisk_addr_r" ); + bootm_argv[2 ] = initrd_str; +strcpy (bootm_argv[2 ],getenv ("ramdisk_addr_r" )); +strcat (bootm_argv[2 ],":" ); +strcat (bootm_argv[2 ],getenv ("filesize" )); }else { bootm_argv[2 ] ="-" ; }
@@ -649,6 +653,11 @@ static int label_boot(struct pxe_label *label) bootm_argc =4 ;do_bootm (NULL ,0 , bootm_argc, bootm_argv); + +#ifdef CONFIG_CMD_BOOTZ +/* Try booting a zImage if do_bootm returns */ +do_bootz (NULL ,0 , bootm_argc, bootm_argv); +#endif return 1 ; }
Signature · 1 line
1.7.10.4
Joe Hershberger
AppliedPATCH v2 1/1 pxe: try bootz if bootm fails to find a valid image
Quoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
Standard pxelinux servers will typically use a zImage rather than u-boot image format, so fallback to bootz if bootm fails.
Signed-off-by Rob Herring <[email protected]>
Applied, Thanks.
-Joe
PATCH 6/10 pxe: always display a menu when present
In reply to Rob HerringFrom: Rob Herring <[email protected]>
The prompt flag is for displaying a "boot:" prompt in pxelinux. This doesn't make sense for u-boot as we don't support the pxelinux command interface. So we should just ignore prompt statements and always show the menu if a menu is present.
--- common/cmd_pxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/cmd_pxe.c +2 -1
@@ -1154,6 +1154,7 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level) err =0 ;switch (t.type) {case T_MENU : + cfg->prompt =1 ; err =parse_menu (&p, cfg, b, nest_level);break ;
@@ -1183,7 +1184,7 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level)break ;case T_PROMPT : - err =parse_integer (&p, &cfg->prompt); +eol_or_eof (&p);break ;case T_EOL :
Signature · 1 line
1.7.10.4
PATCH 7/10 pxe: simplify menu display and selection
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Menus with lots of entries and long append lines are hard to read. Just show a numbered list using the label or name and make the choice by entering the number.
--- common/cmd_pxe.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
common/cmd_pxe.c +16 -18
@@ -429,6 +429,7 @@ static int get_relfile_envaddr(const char *file_path, const char *envaddr_name)* list - lets these form a list, which a pxe_menu struct will hold. */ struct pxe_label { +char num[4 ];char *name;char *menu;char *kernel;
@@ -518,21 +519,9 @@ 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; +const char *c = label->menu ? label->menu : label->name; -printf ("%s:\t%s\n" , label->name, c); - -if (label->kernel) -printf ("\t\tkernel: %s\n" , label->kernel); - -if (label->append) -printf ("\t\tappend: %s\n" , label->append); - -if (label->initrd) -printf ("\t\tinitrd: %s\n" , label->initrd); - -if (label->fdt) -printf ("\tfdt: %s\n" , label->fdt); +printf ("%s:\t%s\n" , label->num, c); }/*
@@ -619,8 +608,10 @@ static int label_boot(struct pxe_label *label)return 1 ; } -if (label->append) +if (label->append) {setenv ("bootargs" , label->append); +printf ("append: %s\n" , label->append); + } bootm_argv[1 ] =getenv ("kernel_addr_r" );
@@ -1267,6 +1258,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)struct list_head *pos;struct menu *m;int err; +int i =1 ; +char *default_num =NULL ;/* * Create a menu and add items for all the labels.
@@ -1279,18 +1272,23 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)list_for_each (pos, &cfg->labels) { label = list_entry(pos, struct pxe_label, list); -if (menu_item_add (m, label->name, label) !=1 ) { +sprintf (label->num,"%d" , i++); +if (menu_item_add (m, label->num, label) !=1 ) {menu_destroy (m);return NULL ; } +if (cfg->default_label && + (strcmp (label->name, cfg->default_label) ==0 )) + default_num = label->num; + }/* * After we've created items for each label in the menu, set the * menu's default label if one was specified. */ -if (cfg->default_label) { - err =menu_default_set (m, cfg->default_label); +if (default_num) { + err =menu_default_set (m, default_num);if (err !=1 ) {if (err != -ENOENT ) {menu_destroy (m);
Signature · 1 line
1.7.10.4
PATCH 8/10 pxe: add support for ontimeout token
In reply to Rob HerringFrom: Rob Herring <[email protected]>
ontimeout is similar to default, but is the selection on menu timeout. This is how cobbler sets a default. The label default is supposed to be the default selection when <enter> is pressed. If both default and ontimeout are set, last one parsed wins.
--- common/cmd_pxe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
common/cmd_pxe.c +5 -4
@@ -671,6 +671,7 @@ enum token_type {T_PROMPT ,T_INCLUDE ,T_FDT , +T_ONTIMEOUT , T_INVALID };
@@ -699,6 +700,7 @@ static const struct token keywords[] = { {"initrd", T_INITRD}, {"include", T_INCLUDE}, {"fdt", T_FDT}, + {"ontimeout", T_ONTIMEOUT,}, {NULL, T_INVALID} };
@@ -996,10 +998,8 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg,switch (t.type) {case T_DEFAULT : -if (cfg->default_label) -free (cfg->default_label); - - cfg->default_label =strdup (label->name); +if (!cfg->default_label) + cfg->default_label =strdup (label->name);if (!cfg->default_label)return -ENOMEM ;
@@ -1158,6 +1158,7 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level)break ;case T_DEFAULT : +case T_ONTIMEOUT : err =parse_sliteral (&p, &label_name);if (label_name) {
Signature · 1 line
1.7.10.4
PATCH 9/10 pxe: add support for per arch and SoC default paths
In reply to Rob HerringFrom: Rob Herring <[email protected]>
A pxelinux server setup for "default" menu is typically an x86 binary. This does not work well with a mixed architecture setup. Extend the default search to look for default-<arch>-<soc> and then default-<arch> before falling back to just "default".
--- common/cmd_pxe.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
common/cmd_pxe.c +17 -3
@@ -26,6 +26,13 @@#define MAX_TFTP_PATH_LEN 127 +const char *pxe_default_paths[] = { +"default-" CONFIG_SYS_ARCH "-" CONFIG_SYS_SOC , +"default-" CONFIG_SYS_ARCH , +"default" , +NULL +}; +/* * Like getenv, but prints an error if envvar isn't defined in the * environment. It always returns what getenv does, so it can be used in
@@ -339,7 +346,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {char *pxefile_addr_str;unsigned long pxefile_addr_r; -int err; +int err, i =0 ; do_getfile = do_get_tftp;
@@ -362,14 +369,21 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])*/ if (pxe_uuid_path ((void *)pxefile_addr_r) >0 ||pxe_mac_path ((void *)pxefile_addr_r) >0 - ||pxe_ipaddr_paths ((void *)pxefile_addr_r) >0 - ||get_pxelinux_path ("default" , (void *)pxefile_addr_r) >0 ) { + ||pxe_ipaddr_paths ((void *)pxefile_addr_r) >0 ) {printf ("Config file found\n" );return 0 ; } +while (pxe_default_paths[i]) { +if (get_pxelinux_path (pxe_default_paths[i], (void *)pxefile_addr_r) >0 ) { +printf ("Config file found\n" ); +return 0 ; + } + i++; + } +printf ("Config file not found\n" );return 1 ;
Signature · 1 line
1.7.10.4
PATCH 10/10 pxe: add ipappend support
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Add ipappend support to pass network device information to the kernel.
--- common/cmd_pxe.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-)
common/cmd_pxe.c +44 -3
@@ -450,6 +450,7 @@ struct pxe_label {char *append;char *initrd;char *fdt; +int ipappend;int attempted;int localboot;int localboot_val;
@@ -583,7 +584,11 @@ static int label_boot(struct pxe_label *label) {char *bootm_argv[] = {"bootm" ,NULL ,NULL ,NULL ,NULL };char initrd_str[22 ]; +char mac_str[29 ] ="" ; +char ip_str[68 ] ="" ; +char *bootargs;int bootm_argc =3 ; +int len =0 ;label_print (label);
@@ -622,9 +627,39 @@ static int label_boot(struct pxe_label *label)return 1 ; } -if (label->append) { -setenv ("bootargs" , label->append); -printf ("append: %s\n" , label->append); +if (label->ipappend &0x1 ) { +sprintf (ip_str," ip=%s:%s:%s:%s" , +getenv ("ipaddr" ),getenv ("serverip" ), +getenv ("gatewayip" ),getenv ("netmask" )); + len +=strlen (ip_str); + } + +if (label->ipappend &0x2 ) { +int err; +strcpy (mac_str," BOOTIF=" ); + err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); +if (err <0 ) + mac_str[0 ] ='\0' ; + len +=strlen (mac_str); + } + +if (label->append) + len +=strlen (label->append); + +if (len) { + bootargs =malloc (len +1 ); +if (!bootargs) +return 1 ; + bootargs[0 ] ='\0' ; +if (label->append) +strcpy (bootargs, label->append); +strcat (bootargs, ip_str); +strcat (bootargs, mac_str); + +setenv ("bootargs" , bootargs); +printf ("append: %s\n" , bootargs); + +free (bootargs); } bootm_argv[1 ] =getenv ("kernel_addr_r" );
@@ -686,6 +721,7 @@ enum token_type {T_INCLUDE ,T_FDT ,T_ONTIMEOUT , +T_IPAPPEND , T_INVALID };
@@ -715,6 +751,7 @@ static const struct token keywords[] = { {"include", T_INCLUDE}, {"fdt", T_FDT}, {"ontimeout", T_ONTIMEOUT,}, + {"ipappend", T_IPAPPEND,}, {NULL, T_INVALID} };
@@ -1106,6 +1143,10 @@ static int parse_label(char **c, struct pxe_menu *cfg) err =parse_integer (c, &label->localboot_val);break ; +case T_IPAPPEND : + err =parse_integer (c, &label->ipappend); +break ; +case T_EOL :break ;
Signature · 1 line
1.7.10.4
cover PXE support updates
In reply to Rob HerringQuoted 20 lines · Rob Herring
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticizedo_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend support
Quoted 4 lines
common/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)
Is someone going to pick these patches up? The single comment by Wolfgang I've addressed.
Rob
cover PXE support updates
Hi Rob,
Quoted 21 lines · Rob Herring
Quoted 20 lines · Rob Herring
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticizedo_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend support
Quoted 7 lines
Quoted 4 lines
common/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)Is someone going to pick these patches up? The single comment by Wolfgang I've addressed.
Yes... I'll pick these up... apologies for the delays.
-Joe
cover PXE support updates
Quoted 29 lines · Joe Hershberger
Hi Rob,
Quoted 26 lines · Rob Herring
Quoted 24 lines · Rob Herring
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticizedo_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend supportcommon/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)
Quoted 4 lines
Quoted 2 lines
Is someone going to pick these patches up? The single comment by Wolfgang I've addressed.
Yes... I'll pick these up... apologies for the delays.
When can I expect to see these land?
Rob
cover PXE support updates
Hi Rob,
Quoted 31 lines · Rob Herring
Quoted 29 lines · Joe Hershberger
Hi Rob,
Quoted 26 lines · Rob Herring
Quoted 24 lines · Rob Herring
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticizedo_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend supportcommon/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Is someone going to pick these patches up? The single comment by Wolfgang I've addressed.
Yes... I'll pick these up... apologies for the delays.
When can I expect to see these land?
I've got these patches in my local repo and I'm build testing them.
I'll likely send a PR by the end of today or tomorrow.
-Joe
cover PXE support updates
Hi Rob,
Quoted 39 lines · Joe Hershberger
Hi Rob,
Quoted 36 lines · Rob Herring
Quoted 33 lines · Joe Hershberger
Hi Rob,
Quoted 21 lines · Rob Herring
Quoted 20 lines · Rob Herring
From: Rob Herring <[email protected]>
This is a series of various enhancements and fixes for u-boot pxe support. These patches are a result of testing with server side tools like Cobbler and ubuntu MAAS.
Rob
Rob Herring (10):
pxe: Use ethact setting for pxe
pxe: make string parameters const
pxe: fix handling of different localboot values
bootz: un-staticizedo_bootz
pxe: use bootz instead of bootm when enabled
pxe: always display a menu when present
pxe: simplify menu display and selection
pxe: add support for ontimeout token
pxe: add support for per arch and SoC default paths
pxe: add ipappend supportQuoted 7 lines
Quoted 4 lines
common/cmd_bootm.c | 2 +- common/cmd_pxe.c | 210 ++++++++++++++++++++++++++++++++-------------------- include/command.h | 2 + 3 files changed, 132 insertions(+), 82 deletions(-)Is someone going to pick these patches up? The single comment by Wolfgang I've addressed.
Yes... I'll pick these up... apologies for the delays.
Quoted 7 lines
Quoted 1 line
When can I expect to see these land?
I've got these patches in my local repo and I'm build testing them.
I'll likely send a PR by the end of today or tomorrow.
-Joe
I ran into some build failures on some boards from some of the patches so I'm working on fixing them.
-Joe