Add 'addappend' label to PXE/EXTLINUX configuration
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
parent
0600cc956f
commit
d2cc99b787
|
@ -0,0 +1,142 @@
|
|||
diff --git a/cmd/pxe.c b/cmd/pxe.c
|
||||
index 2059975446..a25c966afd 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)
|
||||
{
|
||||
@@ -691,10 +719,11 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
|
||||
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;
|
||||
@@ -702,6 +731,12 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
|
||||
if (label->append)
|
||||
strncpy(bootargs, label->append,
|
||||
sizeof(bootargs));
|
||||
+ if (label->addappend) {
|
||||
+ if (strlen(bootargs) + 1 < CONFIG_SYS_CBSIZE)
|
||||
+ strcat(bootargs, " ");
|
||||
+ strncat(bootargs, label->addappend,
|
||||
+ CONFIG_SYS_CBSIZE - strlen(bootargs) - 1);
|
||||
+ }
|
||||
strcat(bootargs, ip_str);
|
||||
strcat(bootargs, mac_str);
|
||||
|
||||
@@ -849,6 +884,7 @@ enum token_type {
|
||||
T_KERNEL,
|
||||
T_LINUX,
|
||||
T_APPEND,
|
||||
+ T_ADDAPPEND,
|
||||
T_INITRD,
|
||||
T_LOCALBOOT,
|
||||
T_DEFAULT,
|
||||
@@ -884,6 +920,7 @@ static const struct token keywords[] = {
|
||||
{"linux", T_LINUX},
|
||||
{"localboot", T_LOCALBOOT},
|
||||
{"append", T_APPEND},
|
||||
+ {"addappend", T_APPEND},
|
||||
{"initrd", T_INITRD},
|
||||
{"include", T_INCLUDE},
|
||||
{"devicetree", T_FDT},
|
||||
@@ -1308,6 +1345,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);
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Name: uboot-tools
|
||||
Version: 2019.10
|
||||
Release: 2%{?candidate:.%{candidate}}.0.riscv64%{?dist}
|
||||
Release: 2%{?candidate:.%{candidate}}.1.riscv64%{?dist}
|
||||
Summary: U-Boot utilities
|
||||
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
||||
URL: http://www.denx.de/wiki/U-Boot
|
||||
|
@ -63,6 +63,10 @@ Patch23: image-add-image.gz-parsing-support-in-booti.patch
|
|||
# Increase stack from 8KiB to 16KiB to avoid issues bringing up harts online
|
||||
Patch24: riscv-increase-stack-size-to-16KiB.patch
|
||||
|
||||
# Not upstream
|
||||
# Add 'addappend' label to PXE/EXTLINUX configuration
|
||||
Patch25: uboot-addappend.patch
|
||||
|
||||
BuildRequires: bc
|
||||
BuildRequires: dtc
|
||||
BuildRequires: make
|
||||
|
@ -323,6 +327,9 @@ cp -p board/warp7/README builds/docs/README.warp7
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Oct 28 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> 2019.10-2.1.riscv64
|
||||
- Add 'addappend' label to PXE/EXTLINUX configuration
|
||||
|
||||
* Thu Oct 17 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> 2019.10-2.0.riscv64
|
||||
- Add support for RISC-V (riscv64)
|
||||
|
||||
|
|
Loading…
Reference in New Issue