diff --git a/riscv-nr-cpus-32.patch b/riscv-set-bootargs-nrcpus.patch similarity index 50% rename from riscv-nr-cpus-32.patch rename to riscv-set-bootargs-nrcpus.patch index 9d816e6..0e7df0e 100644 --- a/riscv-nr-cpus-32.patch +++ b/riscv-set-bootargs-nrcpus.patch @@ -1,18 +1,22 @@ diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig -index 42ec49eb..e9b025a2 100644 +index a7b0e06a..8b70b7e0 100644 --- a/configs/qemu-riscv64_smode_defconfig +++ b/configs/qemu-riscv64_smode_defconfig -@@ -17,3 +17,4 @@ CONFIG_USE_BOOTARGS=y - CONFIG_BOOTARGS="console=ttyS0 earlycon" - CONFIG_USE_PREBOOT=y - CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;" +@@ -14,3 +14,6 @@ CONFIG_CMD_NVEDIT_EFI=y + CONFIG_OF_PRIOR_STAGE=y + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_DM_MTD=y ++CONFIG_USE_BOOTARGS=y ++CONFIG_BOOTARGS="console=ttyS0 earlycon" +CONFIG_NR_CPUS=32 diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig -index dff48057..cf506dcf 100644 +index 7d38ec9a..b120537d 100644 --- a/configs/sifive_fu540_defconfig +++ b/configs/sifive_fu540_defconfig -@@ -13,3 +13,4 @@ CONFIG_OF_PRIOR_STAGE=y +@@ -13,3 +13,6 @@ CONFIG_DISPLAY_BOARDINFO=y + CONFIG_OF_SEPARATE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_USE_BOOTARGS=y - CONFIG_BOOTARGS="console=ttySIF0 earlycon" + CONFIG_DM_MTD=y ++CONFIG_USE_BOOTARGS=y ++CONFIG_BOOTARGS="console=ttySIF0 earlycon" +CONFIG_NR_CPUS=32 diff --git a/uboot-addappend.patch b/uboot-addappend.patch index c14a1ca..e69de29 100644 --- a/uboot-addappend.patch +++ b/uboot-addappend.patch @@ -1,145 +0,0 @@ -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); diff --git a/uboot-tools.spec b/uboot-tools.spec index 9fcd92b..f24b220 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -41,27 +41,21 @@ Patch11: bcm283x-dts-Rename-U-Boot-file.patch Patch20: riscv64-set-fdt_addr.patch # Set bootargs (console and earlycon) -# Fix fdt by use cp.l on QEMU (fixed in 5.4, corruption of DTB happens in -# kernel) -# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.4-rc2&id=922b0375fc93fb1a20c5617e37c389c26bbccb70 -# https://patchwork.kernel.org/patch/11165207/ -Patch21: riscv-bootargs-preboot.patch +# Set CPUs to 32 (same as Linux) +Patch21: riscv-set-bootargs-nrcpus.patch # Not upstream # Adds support for Image.gz to booti (RFC/RFT) # See: https://patchwork.ozlabs.org/patch/1174807/ -Patch23: image-add-image.gz-parsing-support-in-booti.patch +Patch22: image-add-image.gz-parsing-support-in-booti.patch # Not upstream # Add 'addappend' label to PXE/EXTLINUX configuration -Patch25: uboot-addappend.patch +Patch23: uboot-addappend.patch # Not upstream # Define kernel_comp_addr_r and filesize for booti Image.gz support -Patch26: uboot-riscv-def-kernel_comp_addr_r.patch - -# Match CPU number with what in Linux config -Patch28: riscv-nr-cpus-32.patch +Patch24: uboot-riscv-def-kernel_comp_addr_r.patch BuildRequires: bc BuildRequires: dtc