146 lines
4.8 KiB
Diff
146 lines
4.8 KiB
Diff
diff --git a/cmd/pxe.c b/cmd/pxe.c
|
|
index 2059975446..d2aa7086cf 100644
|
|
--- a/cmd/pxe.c
|
|
+++ b/cmd/pxe.c
|
|
@@ -467,6 +467,7 @@ static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const ch
|
|
* name - the name of the menu as given on the 'menu label' line.
|
|
* kernel - the path to the kernel file to use for this label.
|
|
* append - kernel command line to use when booting this label
|
|
+ * addappend - additional kernel command line options
|
|
* initrd - path to the initrd to use for this label.
|
|
* attempted - 0 if we haven't tried to boot this label, 1 if we have.
|
|
* localboot - 1 if this label specified 'localboot', 0 otherwise.
|
|
@@ -479,6 +480,7 @@ struct pxe_label {
|
|
char *kernel;
|
|
char *config;
|
|
char *append;
|
|
+ char *addappend;
|
|
char *initrd;
|
|
char *fdt;
|
|
char *fdtdir;
|
|
@@ -533,7 +535,7 @@ static struct pxe_label *label_create(void)
|
|
|
|
/*
|
|
* Free the memory used by a pxe_label, including that used by its name,
|
|
- * kernel, append and initrd members, if they're non NULL.
|
|
+ * kernel, append, addappend and initrd members, if they're non NULL.
|
|
*
|
|
* So - be sure to only use dynamically allocated memory for the members of
|
|
* the pxe_label struct, unless you want to clean it up first. These are
|
|
@@ -553,6 +555,9 @@ static void label_destroy(struct pxe_label *label)
|
|
if (label->append)
|
|
free(label->append);
|
|
|
|
+ if (label->addappend)
|
|
+ free(label->addappend);
|
|
+
|
|
if (label->initrd)
|
|
free(label->initrd);
|
|
|
|
@@ -584,7 +589,9 @@ static void label_print(void *data)
|
|
* environment variable is defined. Its contents will be executed as U-Boot
|
|
* command. If the label specified an 'append' line, its contents will be
|
|
* used to overwrite the contents of the 'bootargs' environment variable prior
|
|
- * to running 'localcmd'.
|
|
+ * to running 'localcmd'. If the label specified an 'addappend' line, it's
|
|
+ * contents will be appended to the 'bootargs' environment variable priot to
|
|
+ * running 'localcmd'.
|
|
*
|
|
* Returns 1 on success or < 0 on error.
|
|
*/
|
|
@@ -601,9 +608,27 @@ static int label_localboot(struct pxe_label *label)
|
|
char bootargs[CONFIG_SYS_CBSIZE];
|
|
|
|
cli_simple_process_macros(label->append, bootargs);
|
|
+
|
|
env_set("bootargs", bootargs);
|
|
}
|
|
|
|
+ if (label->addappend) {
|
|
+ char newbootargs[CONFIG_SYS_CBSIZE] = "";
|
|
+ char addappend[CONFIG_SYS_CBSIZE];
|
|
+
|
|
+ strncat(newbootargs, env_get("bootargs"), CONFIG_SYS_CBSIZE - 1);
|
|
+
|
|
+ cli_simple_process_macros(label->addappend, addappend);
|
|
+
|
|
+ if (strlen(newbootargs) + 1 < CONFIG_SYS_CBSIZE)
|
|
+ strcat(newbootargs, " ");
|
|
+ strncat(newbootargs, addappend,
|
|
+ CONFIG_SYS_CBSIZE - strlen(newbootargs) - 1);
|
|
+
|
|
+ env_set("bootargs", newbootargs);
|
|
+ }
|
|
+
|
|
+
|
|
debug("running: %s\n", localcmd);
|
|
|
|
return run_command_list(localcmd, strlen(localcmd), 0);
|
|
@@ -623,6 +648,9 @@ 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.
|
|
+ *
|
|
+ * If the label specifies an 'addappend' line, it's contents will be appended
|
|
+ * to the 'bootargs' environment variable.
|
|
*/
|
|
static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
|
|
{
|
|
@@ -687,18 +715,26 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
|
|
}
|
|
#endif
|
|
|
|
- if ((label->ipappend & 0x3) || label->append) {
|
|
+ if ((label->ipappend & 0x3) || label->append || label->addappend) {
|
|
char bootargs[CONFIG_SYS_CBSIZE] = "";
|
|
char finalbootargs[CONFIG_SYS_CBSIZE];
|
|
|
|
- if (strlen(label->append ?: "") +
|
|
+ if (strlen(label->append ?: "") + strlen(label->addappend ?: "") +
|
|
strlen(ip_str) + strlen(mac_str) + 1 > sizeof(bootargs)) {
|
|
- printf("bootarg overflow %zd+%zd+%zd+1 > %zd\n",
|
|
+ printf("bootarg overflow %zd+%zd+%zd+%zd+1 > %zd\n",
|
|
strlen(label->append ?: ""),
|
|
+ strlen(label->addappend ?: ""),
|
|
strlen(ip_str), strlen(mac_str),
|
|
sizeof(bootargs));
|
|
return 1;
|
|
} else {
|
|
+ if (label->addappend) {
|
|
+ strncat(bootargs, env_get("bootargs"), CONFIG_SYS_CBSIZE - 1);
|
|
+ if (strlen(bootargs) + 1 < CONFIG_SYS_CBSIZE)
|
|
+ strcat(bootargs, " ");
|
|
+ strncat(bootargs, label->addappend,
|
|
+ CONFIG_SYS_CBSIZE - strlen(bootargs) - 1);
|
|
+ }
|
|
if (label->append)
|
|
strncpy(bootargs, label->append,
|
|
sizeof(bootargs));
|
|
@@ -849,6 +885,7 @@ enum token_type {
|
|
T_KERNEL,
|
|
T_LINUX,
|
|
T_APPEND,
|
|
+ T_ADDAPPEND,
|
|
T_INITRD,
|
|
T_LOCALBOOT,
|
|
T_DEFAULT,
|
|
@@ -884,6 +921,7 @@ static const struct token keywords[] = {
|
|
{"linux", T_LINUX},
|
|
{"localboot", T_LOCALBOOT},
|
|
{"append", T_APPEND},
|
|
+ {"addappend", T_ADDAPPEND},
|
|
{"initrd", T_INITRD},
|
|
{"include", T_INCLUDE},
|
|
{"devicetree", T_FDT},
|
|
@@ -1308,6 +1346,10 @@ static int parse_label(char **c, struct pxe_menu *cfg)
|
|
|
|
break;
|
|
|
|
+ case T_ADDAPPEND:
|
|
+ err = parse_sliteral(c, &label->addappend);
|
|
+ break;
|
|
+
|
|
case T_INITRD:
|
|
if (!label->initrd)
|
|
err = parse_sliteral(c, &label->initrd);
|