Compare commits
60 Commits
master
...
master-ris
Author | SHA1 | Date |
---|---|---|
David Abdurachmanov | cc7e05b47a | |
David Abdurachmanov | 35bf0004b6 | |
David Abdurachmanov | 6848b8c211 | |
David Abdurachmanov | d354a60762 | |
David Abdurachmanov | 8f589f71e3 | |
David Abdurachmanov | c05c9a2db0 | |
David Abdurachmanov | fe367fe99a | |
David Abdurachmanov | 70d2045031 | |
David Abdurachmanov | 964c83d011 | |
David Abdurachmanov | ec8b6389cf | |
David Abdurachmanov | fbdd0d0c77 | |
David Abdurachmanov | 5186624912 | |
David Abdurachmanov | cb2612aa04 | |
David Abdurachmanov | 81fcb577f1 | |
David Abdurachmanov | 47f52c146b | |
David Abdurachmanov | bb6b35ba8b | |
David Abdurachmanov | 4ac22964ab | |
David Abdurachmanov | 12e45d3b64 | |
David Abdurachmanov | 8fbcc5a382 | |
David Abdurachmanov | ad3de44704 | |
David Abdurachmanov | 1abb99241a | |
David Abdurachmanov | d2cc99b787 | |
David Abdurachmanov | 0600cc956f | |
David Abdurachmanov | 2b10fe613a | |
David Abdurachmanov | c026d2881e | |
David Abdurachmanov | 27068a5bf6 | |
David Abdurachmanov | 4caac69d44 | |
David Abdurachmanov | 2499c1d49a | |
David Abdurachmanov | b37aa919da | |
David Abdurachmanov | 39828c439d | |
David Abdurachmanov | 96ba5aabb5 | |
David Abdurachmanov | c2f204c668 | |
David Abdurachmanov | aaf7235ecb | |
David Abdurachmanov | e3b3eec4c9 | |
David Abdurachmanov | 70e5155e0a | |
David Abdurachmanov | 24e8ba91b7 | |
David Abdurachmanov | dd5b903d3b | |
David Abdurachmanov | 27c9eecc4a | |
David Abdurachmanov | 5d662178ca | |
David Abdurachmanov | a29ada2896 | |
David Abdurachmanov | 2602a671e9 | |
David Abdurachmanov | b62e49859d | |
David Abdurachmanov | c7647e64da | |
David Abdurachmanov | de3f529caf | |
David Abdurachmanov | a87326e86a | |
David Abdurachmanov | 8a5a414e3c | |
David Abdurachmanov | b8d8a2c629 | |
David Abdurachmanov | 85b660c788 | |
David Abdurachmanov | 2e821a1b29 | |
David Abdurachmanov | 5ca523f5a9 | |
David Abdurachmanov | f8612e71c8 | |
David Abdurachmanov | 2fc7774edf | |
David Abdurachmanov | f0e754c7e3 | |
David Abdurachmanov | 162c2f023b | |
David Abdurachmanov | 2225e1aa63 | |
David Abdurachmanov | af139e3d4c | |
David Abdurachmanov | 92694119a7 | |
David Abdurachmanov | 60e6ad3bb8 | |
David Abdurachmanov | 073d9f7cdf | |
David Abdurachmanov | b39fdd19d6 |
|
@ -0,0 +1,267 @@
|
|||
diff --git a/cmd/booti.c b/cmd/booti.c
|
||||
index 841eff10..60bb4920 100644
|
||||
--- a/cmd/booti.c
|
||||
+++ b/cmd/booti.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
/*
|
||||
* Image booting support
|
||||
*/
|
||||
@@ -23,6 +24,12 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
ulong ld;
|
||||
ulong relocated_addr;
|
||||
ulong image_size;
|
||||
+ uint8_t *temp;
|
||||
+ ulong dest;
|
||||
+ ulong dest_end;
|
||||
+ unsigned long comp_len;
|
||||
+ unsigned long decomp_len;
|
||||
+ int ctype;
|
||||
|
||||
ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
|
||||
images, 1);
|
||||
@@ -37,6 +44,33 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
|
||||
}
|
||||
|
||||
+ temp = map_sysmem(ld, 0);
|
||||
+ ctype = image_decomp_type(temp, 2);
|
||||
+ if (ctype > 0) {
|
||||
+ dest = env_get_ulong("kernel_comp_addr_r", 16, 0);
|
||||
+ comp_len = env_get_ulong("filesize", 16, 0);
|
||||
+ if (!dest || !comp_len) {
|
||||
+ puts("kernel_comp_addr_r or filesize is not provided!\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ if (dest < gd->ram_base || dest > gd->ram_top) {
|
||||
+ puts("kernel_comp_addr_r is outside of DRAM range!\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ debug("kernel image compression type %d size = 0x%08lx address = 0x%08lx\n",
|
||||
+ ctype, comp_len, (ulong)dest);
|
||||
+ decomp_len = comp_len * 10;
|
||||
+ ret = image_decomp(ctype, 0, ld, IH_TYPE_KERNEL,
|
||||
+ (void *)dest, (void *)ld, comp_len,
|
||||
+ decomp_len, &dest_end);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ /* dest_end contains the uncompressed Image size */
|
||||
+ memmove((void *) ld, (void *)dest, dest_end);
|
||||
+ }
|
||||
+ unmap_sysmem((void *)ld);
|
||||
+
|
||||
ret = booti_setup(ld, &relocated_addr, &image_size, false);
|
||||
if (ret != 0)
|
||||
return 1;
|
||||
@@ -99,10 +133,14 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
#ifdef CONFIG_SYS_LONGHELP
|
||||
static char booti_help_text[] =
|
||||
"[addr [initrd[:size]] [fdt]]\n"
|
||||
- " - boot Linux 'Image' stored at 'addr'\n"
|
||||
+ " - boot Linux flat or compressed 'Image' stored at 'addr'\n"
|
||||
"\tThe argument 'initrd' is optional and specifies the address\n"
|
||||
"\tof an initrd in memory. The optional parameter ':size' allows\n"
|
||||
"\tspecifying the size of a RAW initrd.\n"
|
||||
+ "\tCurrently only booting from gz, bz2, lzma and lz4 compression\n"
|
||||
+ "\ttypes are supported. In order to boot from any of these compressed\n"
|
||||
+ "\timages, user have to set kernel_comp_addr_r and filesize enviornment\n"
|
||||
+ "\tvariables beforehand.\n"
|
||||
#if defined(CONFIG_OF_LIBFDT)
|
||||
"\tSince booting a Linux kernel requires a flat device-tree, a\n"
|
||||
"\tthird argument providing the address of the device-tree blob\n"
|
||||
diff --git a/common/image.c b/common/image.c
|
||||
index f17fa40c..cbd6c494 100644
|
||||
--- a/common/image.c
|
||||
+++ b/common/image.c
|
||||
@@ -197,6 +197,14 @@ struct table_info {
|
||||
const table_entry_t *table;
|
||||
};
|
||||
|
||||
+static const struct comp_magic_map image_comp[] = {
|
||||
+ { IH_COMP_BZIP2, "bzip2", {0x42, 0x5a},},
|
||||
+ { IH_COMP_GZIP, "gzip", {0x1f, 0x8b},},
|
||||
+ { IH_COMP_LZMA, "lzma", {0x5d, 0x00},},
|
||||
+ { IH_COMP_LZO, "lzo", {0x89, 0x4c},},
|
||||
+ { IH_COMP_NONE, "none", {}, },
|
||||
+};
|
||||
+
|
||||
static const struct table_info table_info[IH_COUNT] = {
|
||||
{ "architecture", IH_ARCH_COUNT, uimage_arch },
|
||||
{ "compression", IH_COMP_COUNT, uimage_comp },
|
||||
@@ -402,6 +410,21 @@ static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
||||
printf(" Uncompressing %s\n", name);
|
||||
}
|
||||
|
||||
+int image_decomp_type(const unsigned char *buf, ulong len)
|
||||
+{
|
||||
+ const struct comp_magic_map *cmagic = image_comp;
|
||||
+
|
||||
+ if (len < 2)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ for (; cmagic->comp_id > 0; cmagic++) {
|
||||
+ if (!memcmp(buf, cmagic->magic, 2))
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return cmagic->comp_id;
|
||||
+}
|
||||
+
|
||||
int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||
void *load_buf, void *image_buf, ulong image_len,
|
||||
uint unc_len, ulong *load_end)
|
||||
diff --git a/doc/README.distro b/doc/README.distro
|
||||
index ab6e6f4e..67b49e1e 100644
|
||||
--- a/doc/README.distro
|
||||
+++ b/doc/README.distro
|
||||
@@ -246,6 +246,18 @@ kernel_addr_r:
|
||||
|
||||
A size of 16MB for the kernel is likely adequate.
|
||||
|
||||
+kernel_comp_addr_r:
|
||||
+ Optional. This is only required if user wants to boot Linux from a compressed
|
||||
+ Image(.gz, .bz2, .lzma, .lzo) using booti command. It represents the location
|
||||
+ in RAM where the compressed Image will be decompressed temporarily. Once the
|
||||
+ decompression is complete, decompressed data will be moved kernel_addr_r for
|
||||
+ booting.
|
||||
+
|
||||
+filesize:
|
||||
+ Optional. This is only required if user wants to boot Linux from a compressed
|
||||
+ Image using booti command. It represents the size of the compressed file. The
|
||||
+ size has to at least the size of loaded image for decompression to succeed.
|
||||
+
|
||||
pxefile_addr_r:
|
||||
|
||||
Mandatory. The location in RAM where extlinux.conf will be loaded to prior
|
||||
diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
|
||||
index 7807f5b2..df2c5ad8 100644
|
||||
--- a/doc/board/sifive/fu540.rst
|
||||
+++ b/doc/board/sifive/fu540.rst
|
||||
@@ -138,6 +138,10 @@ load uImage.
|
||||
=> setenv netmask 255.255.252.0
|
||||
=> setenv serverip 10.206.4.143
|
||||
=> setenv gateway 10.206.4.1
|
||||
+
|
||||
+If you want to use a flat kernel image such as Image file
|
||||
+
|
||||
+.. code-block:: none
|
||||
=> tftpboot ${kernel_addr_r} /sifive/fu540/Image
|
||||
ethernet@10090000: PHY present at 0
|
||||
ethernet@10090000: Starting autonegotiation...
|
||||
@@ -177,6 +181,57 @@ load uImage.
|
||||
1.2 MiB/s
|
||||
done
|
||||
Bytes transferred = 8867100 (874d1c hex)
|
||||
+
|
||||
+Or if you want to use a compressed kernel image file such as Image.gz
|
||||
+
|
||||
+.. code-block:: none
|
||||
+ => tftpboot ${kernel_addr_r} /sifive/fu540/Image.gz
|
||||
+ ethernet@10090000: PHY present at 0
|
||||
+ ethernet@10090000: Starting autonegotiation...
|
||||
+ ethernet@10090000: Autonegotiation complete
|
||||
+ ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3c00)
|
||||
+ Using ethernet@10090000 device
|
||||
+ TFTP from server 10.206.4.143; our IP address is 10.206.7.133
|
||||
+ Filename '/sifive/fu540/Image.gz'.
|
||||
+ Load address: 0x84000000
|
||||
+ Loading: #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ #################################################################
|
||||
+ ##########################################
|
||||
+ 1.2 MiB/s
|
||||
+ done
|
||||
+ Bytes transferred = 4809458 (4962f2 hex)
|
||||
+ =>setenv kernel_comp_addr_r 0x90000000
|
||||
+ =>setenv filesize 0x500000
|
||||
+
|
||||
+By this time, correct kernel image is loaded and required enviornment variables
|
||||
+are set. You can proceed to load the ramdisk and device tree from the tftp server
|
||||
+as well.
|
||||
+
|
||||
+.. code-block:: none
|
||||
=> tftpboot ${ramdisk_addr_r} /sifive/fu540/uRamdisk
|
||||
ethernet@10090000: PHY present at 0
|
||||
ethernet@10090000: Starting autonegotiation...
|
||||
diff --git a/include/image.h b/include/image.h
|
||||
index f4d2aaf5..823c187b 100644
|
||||
--- a/include/image.h
|
||||
+++ b/include/image.h
|
||||
@@ -447,6 +447,15 @@ typedef struct table_entry {
|
||||
char *lname; /* long (output) name to print for messages */
|
||||
} table_entry_t;
|
||||
|
||||
+/*
|
||||
+ * Compression type and magic number mapping table.
|
||||
+ */
|
||||
+struct comp_magic_map {
|
||||
+ int comp_id;
|
||||
+ const char *name;
|
||||
+ unsigned char magic[2];
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* get_table_entry_id() scans the translation table trying to find an
|
||||
* entry that matches the given short name. If a matching entry is
|
||||
@@ -851,6 +860,18 @@ static inline int image_check_target_arch(const image_header_t *hdr)
|
||||
}
|
||||
#endif /* USE_HOSTCC */
|
||||
|
||||
+/**
|
||||
+ * image_decomp_type() - Find out compression type of an image
|
||||
+ *
|
||||
+ * @buf: Address in U-Boot memory where image is loaded.
|
||||
+ * @len: Length of the compressed image.
|
||||
+ * @return compression type or IH_COMP_NONE if not compressed.
|
||||
+ *
|
||||
+ * Note: Only following compression types are supported now.
|
||||
+ * lzo, lzma, gzip, bzip2
|
||||
+ */
|
||||
+int image_decomp_type(const unsigned char *buf, ulong len);
|
||||
+
|
||||
/**
|
||||
* image_decomp() - decompress an image
|
||||
*
|
||||
diff --git a/lib/Kconfig b/lib/Kconfig
|
||||
index b8a8509d..53661baf 100644
|
||||
--- a/lib/Kconfig
|
||||
+++ b/lib/Kconfig
|
||||
@@ -397,6 +397,11 @@ config GZIP
|
||||
help
|
||||
This enables support for GZIP compression algorithm.
|
||||
|
||||
+config BZIP2
|
||||
+ bool "Enable bzip2 decompression support"
|
||||
+ help
|
||||
+ This enables support for BZIP2 compression algorithm.
|
||||
+
|
||||
config ZLIB
|
||||
bool
|
||||
default y
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
|
||||
index 33776f03..42ec49eb 100644
|
||||
--- a/configs/qemu-riscv64_smode_defconfig
|
||||
+++ b/configs/qemu-riscv64_smode_defconfig
|
||||
@@ -13,3 +13,7 @@ CONFIG_CMD_NVEDIT_EFI=y
|
||||
# CONFIG_CMD_MII is not set
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_BOOTARGS=y
|
||||
+CONFIG_BOOTARGS="console=ttyS0 earlycon"
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"
|
||||
diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
|
||||
index 790da976..dff48057 100644
|
||||
--- a/configs/sifive_fu540_defconfig
|
||||
+++ b/configs/sifive_fu540_defconfig
|
||||
@@ -11,3 +11,5 @@ CONFIG_DISPLAY_CPUINFO=y
|
||||
CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_OF_PRIOR_STAGE=y
|
||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_BOOTARGS=y
|
||||
+CONFIG_BOOTARGS="console=ttySIF0 earlycon"
|
|
@ -0,0 +1,24 @@
|
|||
diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
|
||||
index a7b0e06a..99f8111a 100644
|
||||
--- a/configs/qemu-riscv64_smode_defconfig
|
||||
+++ b/configs/qemu-riscv64_smode_defconfig
|
||||
@@ -14,3 +14,8 @@ 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
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"
|
||||
diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
|
||||
index 7d38ec9a..b120537d 100644
|
||||
--- a/configs/sifive_fu540_defconfig
|
||||
+++ b/configs/sifive_fu540_defconfig
|
||||
@@ -13,3 +13,6 @@ CONFIG_DISPLAY_BOARDINFO=y
|
||||
CONFIG_OF_SEPARATE=y
|
||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_DM_MTD=y
|
||||
+CONFIG_USE_BOOTARGS=y
|
||||
+CONFIG_BOOTARGS="console=ttySIF0 earlycon"
|
||||
+CONFIG_NR_CPUS=32
|
|
@ -0,0 +1,4 @@
|
|||
qemu-riscv64
|
||||
qemu-riscv64_smode
|
||||
ae350_rv64
|
||||
sifive_fu540
|
|
@ -0,0 +1,31 @@
|
|||
diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h
|
||||
index fa9b9af9..bc831a84 100644
|
||||
--- a/include/configs/qemu-riscv.h
|
||||
+++ b/include/configs/qemu-riscv.h
|
||||
@@ -56,6 +56,7 @@
|
||||
"initrd_high=0xffffffffffffffff\0" \
|
||||
"kernel_addr_r=0x84000000\0" \
|
||||
"fdt_addr_r=0x88000000\0" \
|
||||
+ "fdt_addr=0x88000000\0" \
|
||||
"scriptaddr=0x88100000\0" \
|
||||
"pxefile_addr_r=0x88200000\0" \
|
||||
"ramdisk_addr_r=0x88300000\0" \
|
||||
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
|
||||
index 736ceb1f..59cf0281 100644
|
||||
--- a/include/configs/sifive-fu540.h
|
||||
+++ b/include/configs/sifive-fu540.h
|
||||
@@ -36,13 +36,10 @@
|
||||
"initrd_high=0xffffffffffffffff\0" \
|
||||
"kernel_addr_r=0x84000000\0" \
|
||||
"fdt_addr_r=0x88000000\0" \
|
||||
+ "fdt_addr=0x88000000\0" \
|
||||
"scriptaddr=0x88100000\0" \
|
||||
"pxefile_addr_r=0x88200000\0" \
|
||||
"ramdisk_addr_r=0x88300000\0" \
|
||||
BOOTENV
|
||||
|
||||
-#define CONFIG_PREBOOT \
|
||||
- "setenv fdt_addr ${fdtcontroladdr};" \
|
||||
- "fdt addr ${fdtcontroladdr};"
|
||||
-
|
||||
#endif /* __CONFIG_H */
|
|
@ -0,0 +1,146 @@
|
|||
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
|
||||
index a636346b..9e2af76a 100644
|
||||
--- a/cmd/pxe_utils.c
|
||||
+++ b/cmd/pxe_utils.c
|
||||
@@ -250,7 +250,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
|
||||
@@ -270,6 +270,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);
|
||||
|
||||
@@ -301,7 +304,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.
|
||||
*/
|
||||
@@ -314,6 +319,22 @@ static int label_localboot(struct pxe_label *label)
|
||||
if (!localcmd)
|
||||
return -ENOENT;
|
||||
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
if (label->append) {
|
||||
char bootargs[CONFIG_SYS_CBSIZE];
|
||||
|
||||
@@ -340,6 +361,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)
|
||||
{
|
||||
@@ -406,19 +430,28 @@ 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;
|
||||
}
|
||||
|
||||
+ 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));
|
||||
|
||||
@@ -570,6 +603,7 @@ enum token_type {
|
||||
T_KERNEL,
|
||||
T_LINUX,
|
||||
T_APPEND,
|
||||
+ T_ADDAPPEND,
|
||||
T_INITRD,
|
||||
T_LOCALBOOT,
|
||||
T_DEFAULT,
|
||||
@@ -605,6 +639,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},
|
||||
@@ -1028,6 +1063,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/cmd/pxe_utils.h b/cmd/pxe_utils.h
|
||||
index a38ac81a..a6770679 100644
|
||||
--- a/cmd/pxe_utils.h
|
||||
+++ b/cmd/pxe_utils.h
|
||||
@@ -28,6 +28,7 @@
|
||||
* 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.
|
||||
@@ -40,6 +41,7 @@ struct pxe_label {
|
||||
char *kernel;
|
||||
char *config;
|
||||
char *append;
|
||||
+ char *addappend;
|
||||
char *initrd;
|
||||
char *fdt;
|
||||
char *fdtdir;
|
|
@ -0,0 +1,24 @@
|
|||
diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h
|
||||
index 801d2f5c..0bcadb0f 100644
|
||||
--- a/include/configs/qemu-riscv.h
|
||||
+++ b/include/configs/qemu-riscv.h
|
||||
@@ -59,6 +59,7 @@
|
||||
"scriptaddr=0x88100000\0" \
|
||||
"pxefile_addr_r=0x88200000\0" \
|
||||
"ramdisk_addr_r=0x88300000\0" \
|
||||
+ "kernel_comp_addr_r=0x90000000\0" \
|
||||
BOOTENV
|
||||
#endif
|
||||
|
||||
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
|
||||
index 4fef86c1..864bb051 100644
|
||||
--- a/include/configs/sifive-fu540.h
|
||||
+++ b/include/configs/sifive-fu540.h
|
||||
@@ -39,6 +39,7 @@
|
||||
"scriptaddr=0x88100000\0" \
|
||||
"pxefile_addr_r=0x88200000\0" \
|
||||
"ramdisk_addr_r=0x88300000\0" \
|
||||
+ "kernel_comp_addr_r=0x90000000\0" \
|
||||
BOOTENV
|
||||
|
||||
#endif /* __CONFIG_H */
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Name: uboot-tools
|
||||
Version: 2020.01
|
||||
Release: 1%{?candidate:.%{candidate}}%{?dist}
|
||||
Release: 1%{?candidate:.%{candidate}}.0.riscv64%{?dist}
|
||||
Summary: U-Boot utilities
|
||||
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
||||
URL: http://www.denx.de/wiki/U-Boot
|
||||
|
@ -13,6 +13,7 @@ Source2: arm-chromebooks
|
|||
Source3: aarch64-boards
|
||||
Source4: aarch64-chromebooks
|
||||
Source5: 10-devicetree.install
|
||||
Source6: riscv64-boards
|
||||
|
||||
# Fedoraisms patches
|
||||
# Needed to find DT on boot partition that's not the first partition
|
||||
|
@ -29,6 +30,32 @@ Patch8: arm-tegra-defaine-fdtfile-for-all-devices.patch
|
|||
Patch9: zynqmp-Add-support-for-u-boot.itb-generation-with-ATF.patch
|
||||
Patch10: zynqmp-Do-not-assing-MIO34-that-early-on-zcu100.patch
|
||||
|
||||
# PXE depends on fdt_addr (mandatory)
|
||||
# fdt_addr is an address to DTB in HW (e.g. ROM)
|
||||
# While off-chip NVM QSPI Flash is mapped to the memory our DTB comes from
|
||||
# FSBL or OpenSBI (most likely).
|
||||
# Both (FSBL and OpenSBI) incl. the latest DTB directly from the kernel build.
|
||||
# Thus we have to set fdt_addr to the save value as fdt_addr_r which matches
|
||||
# the location where OpenSBI will place embedded DTB.
|
||||
Patch20: riscv64-set-fdt_addr.patch
|
||||
|
||||
# Set bootargs (console and earlycon)
|
||||
# Set CPUs to 32 (same as Linux)
|
||||
Patch21: riscv-set-bootargs-nrcpus-preboot.patch
|
||||
|
||||
# Not upstream
|
||||
# Adds support for Image.gz to booti (RFC/RFT)
|
||||
# See: https://patchwork.ozlabs.org/patch/1174807/
|
||||
Patch22: image-add-image.gz-parsing-support-in-booti.patch
|
||||
|
||||
# Not upstream
|
||||
# Add 'addappend' label to PXE/EXTLINUX configuration
|
||||
Patch23: uboot-addappend.patch
|
||||
|
||||
# Not upstream
|
||||
# Define kernel_comp_addr_r and filesize for booti Image.gz support
|
||||
Patch24: uboot-riscv-def-kernel_comp_addr_r.patch
|
||||
|
||||
BuildRequires: bc
|
||||
BuildRequires: dtc
|
||||
BuildRequires: make
|
||||
|
@ -88,10 +115,20 @@ BuildArch: noarch
|
|||
u-boot bootloader binaries for armv7 boards
|
||||
%endif
|
||||
|
||||
%ifarch riscv64
|
||||
%package -n uboot-images-riscv64
|
||||
Summary: u-boot bootloader images for riscv64 boards
|
||||
Requires: uboot-tools
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n uboot-images-riscv64
|
||||
u-boot bootloader binaries for riscv64 boards
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n u-boot-%{version}%{?candidate:-%{candidate}}
|
||||
|
||||
cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 .
|
||||
cp %SOURCE1 %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE6 .
|
||||
|
||||
%build
|
||||
mkdir builds
|
||||
|
@ -101,7 +138,7 @@ mkdir builds
|
|||
%{?enable_devtoolset7:%{enable_devtoolset7}}
|
||||
%endif
|
||||
|
||||
%ifarch aarch64 %{arm}
|
||||
%ifarch aarch64 %{arm} riscv64
|
||||
for board in $(cat %{_arch}-boards)
|
||||
do
|
||||
echo "Building board: $board"
|
||||
|
@ -195,6 +232,19 @@ do
|
|||
done
|
||||
%endif
|
||||
|
||||
%ifarch riscv64
|
||||
for board in $(cat %{_arch}-boards)
|
||||
do
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/uboot/$(echo $board)/
|
||||
for file in u-boot.bin u-boot-nodtb.bin
|
||||
do
|
||||
if [ -f builds/$(echo $board)/$(echo $file) ]; then
|
||||
install -p -m 0644 builds/$(echo $board)/$(echo $file) $RPM_BUILD_ROOT%{_datadir}/uboot/$(echo $board)/
|
||||
fi
|
||||
done
|
||||
done
|
||||
%endif
|
||||
|
||||
for tool in bmp_logo dumpimage env/fw_printenv fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr gen_ethaddr_crc img2srec mkenvimage mkimage mksunxiboot ncb proftool sunxi-spl-image-builder ubsha1 xway-swap-bytes
|
||||
do
|
||||
install -p -m 0755 builds/tools/$tool $RPM_BUILD_ROOT%{_bindir}
|
||||
|
@ -248,7 +298,19 @@ cp -p board/warp7/README builds/docs/README.warp7
|
|||
%{_datadir}/uboot/*
|
||||
%endif
|
||||
|
||||
%ifarch riscv64
|
||||
%files -n uboot-images-riscv64
|
||||
%{_datadir}/uboot/*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jan 7 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> 2020.01-1.0.riscv64
|
||||
- Add support for RISC-V (riscv64)
|
||||
- Define filesize and kernel_comp_addr_r for QEMU virt and SiFive FU540 boards
|
||||
to support Image.gz with booti
|
||||
- Add 'addappend' label to PXE/EXTLINUX configuration
|
||||
- Match CONFIG_NR_CPUS to Linux configuration (32)
|
||||
|
||||
* Tue Jan 7 2020 Peter Robinson <pbrobinson@fedoraproject.org> 2020.01-1
|
||||
- 2020.01
|
||||
|
||||
|
|
Loading…
Reference in New Issue