cmd: pxe_utils: sysboot: add label override support
PATCH v2 1/1 cmd: pxe_utils: sysboot: add label override support
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.
This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
if "pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.
---
Changes in v2:
- Use !strcmp() instead of strcmp()==0
- Add "pxe_label_override" documentation
boot/pxe_utils.c | 15 +++++++++++++++ doc/README.pxe | 6 ++++++ 2 files changed, 21 insertions(+)
boot/pxe_utils.c +15 -0
@@ -1349,9 +1349,11 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)struct pxe_label *label;struct list_head *pos;struct menu *m; +char *label_override;int err;int i =1 ;char *default_num =NULL ; +char *override_num =NULL ;/* * Create a menu and add items for all the labels.
@@ -1361,6 +1363,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)if (!m)return NULL ; + label_override =env_get ("pxe_label_override" ); +list_for_each (pos, &cfg->labels) { label = list_entry(pos, struct pxe_label, list);
@@ -1372,6 +1376,17 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)if (cfg->default_label && (strcmp (label->name, cfg->default_label) ==0 )) default_num = label->num; +if (label_override && !strcmp (label->name, label_override)) + override_num = label->num; + } + + +if (label_override) { +if (override_num) + default_num = override_num; +else +printf ("Missing override pxe label: %s\n" , + label_override); }/*
doc/README.pxe +6 -0
@@ -92,6 +92,12 @@ pxe boot fdtoverlay_addr_r - location in RAM at which 'pxe boot' will temporarily store fdt overlay(s) before applying them to the fdt blob stored at 'fdt_addr_r'. + pxe_label_override - override label to be used, if exists, instead of the + default label. This will allow consumers to choose a pxe label at + runtime instead of having to prompt the user. If "pxe_label_override" is set + but does not exist in the pxe menu, pxe would fallback to the default label if + given, and no failure is returned but rather a warning message. + pxe file format =============== The pxe file format is nearly a subset of the PXELINUX file format; see
Signature · 1 line
2.25.1
Hi Amjad,
Quoted 21 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.Signed-off-by Amjad Ouled-Ameur <[email protected]>---
Quoted 7 lines
Changes in v2:
- Use !strcmp() instead of strcmp()==0
- Add "pxe_label_override" documentationboot/pxe_utils.c | 15 +++++++++++++++ doc/README.pxe | 6 ++++++ 2 files changed, 21 insertions(+)
Can I suggest converting the doc to rST?
Regards,
Simon
Hi,
Is there any news about this patch please ?
Regards,
Amjad
Quoted 37 lines · Simon Glass
Hi Amjad,
Quoted 20 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.Signed-off-by Amjad Ouled-Ameur <[email protected]>---
Quoted 7 lines
Changes in v2:
- Use !strcmp() instead of strcmp()==0
- Add "pxe_label_override" documentationboot/pxe_utils.c | 15 +++++++++++++++ doc/README.pxe | 6 ++++++ 2 files changed, 21 insertions(+)Reviewed-by Simon Glass <[email protected]>Can I suggest converting the doc to rST?
Regards,
Simon
Quoted 13 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
Quoted 6 lines
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.Signed-off-by Amjad Ouled-Ameur <[email protected]>
Good and useful idea! why still not accepted ?!
Regards,
Art
Quoted 21 lines · Art Nikpal
Quoted 18 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.
Quoted 8 lines
Quoted 1 line
Signed-off-by Amjad Ouled-Ameur <[email protected]>Reviewed-by Artem Lapkin <[email protected]>Good and useful idea! why still not accepted ?!
Regards,
Art
Was mistakenly assigned to trini instead of me. I will pull in to my tree. Thanks.
Ramon
Quoted 27 lines · Ramon Fried
Quoted 25 lines · Art Nikpal
Quoted 13 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
Quoted 6 lines
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.Signed-off-by Amjad Ouled-Ameur <[email protected]>Reviewed-by Artem Lapkin <[email protected]>
Quoted 7 lines
Quoted 4 lines
Good and useful idea! why still not accepted ?!
Regards,
ArtWas mistakenly assigned to trini instead of me. I will pull in to my tree. Thanks.
Ramon
Applied to u-boot-net/next
Thanks.
Quoted 90 lines · Amjad Ouled-Ameur
This will allow consumers to choose a pxe label at runtime instead of having to prompt the user. One good use-case for this, is choosing whether or not to apply a dtbo depending on the hardware configuration. e.g: for TI's AM335x EVM, it would be convenient to apply a particular dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the pxe menu should have 2 labels, one with the dtbo and the other without, then the "
pxe_label_override" env variable should point to the label with the dtbo at runtime only when the jumper is on PRUSS mode.This change can be used for different use-cases and bring more flexibilty to consumers who use sysboot/pxe_utils.
if "
pxe_label_override" is set but does not exist in the pxe menu, the code should fallback to the default label if given, and no failure is returned but rather a warning message.Signed-off-by Amjad Ouled-Ameur <[email protected]>---
Changes in v2:
- Use !strcmp() instead of strcmp()==0
- Add "pxe_label_override" documentationboot/pxe_utils.c | 15 +++++++++++++++ doc/README.pxe | 6 ++++++ 2 files changed, 21 insertions(+)boot/pxe_utils.c +15
-0@@ -1349,9 +1349,11 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)struct pxe_label *label;struct list_head *pos;struct menu *m; +char *label_override;int err;int i =1 ;char *default_num =NULL ; +char *override_num =NULL ;/* * Create a menu and add items for all the labels. @@ -1361,6 +1363,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)if (!m)return NULL ; + label_override =env_get ("pxe_label_override" ); +list_for_each (pos, &cfg->labels) { label = list_entry(pos, struct pxe_label, list);@@ -1372,6 +1376,17 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)if (cfg->default_label && (strcmp (label->name, cfg->default_label) ==0 )) default_num = label->num; +if (label_override && !strcmp (label->name, label_override)) + override_num = label->num; + } + + +if (label_override) { +if (override_num) + default_num = override_num; +else +printf ("Missing override pxe label: %s\n" , + label_override); }/* doc/README.pxe +6
-1@@ -92,6 +92,12 @@ pxe boot fdtoverlay_addr_r - location in RAM at which 'pxe boot' will temporarily store fdt overlay(s) before applying them to the fdt blob stored at 'fdt_addr_r'. + pxe_label_override - override label to be used, if exists, instead of the + default label. This will allow consumers to choose a pxe label at + runtime instead of having to prompt the user. If "pxe_label_override" is set + but does not exist in the pxe menu, pxe would fallback to the default label if + given, and no failure is returned but rather a warning message. + pxe file format =============== The pxe file format is nearly a subset of the PXELINUX file format; see --
Quoted 2 lines
2.25.1