mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-02 14:32:14 +01:00
124 lines
3.2 KiB
Diff
124 lines
3.2 KiB
Diff
From: David Daney <david.daney@cavium.com>
|
|
|
|
If 'rd_name=xxx' is passed to the kernel, the named block with name
|
|
'xxx' is used for the initrd.
|
|
|
|
Signed-off-by: David Daney <david.daney@cavium.com>
|
|
Signed-off-by: Leonid Rosenboim <lrosenboim@caviumnetworks.com>
|
|
Signed-off-by: Aleksey Makarov <aleksey.makarov@auriga.com>
|
|
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
|
[forward porting to 5.4]
|
|
|
|
--- a/arch/mips/cavium-octeon/setup.c
|
|
+++ b/arch/mips/cavium-octeon/setup.c
|
|
@@ -28,6 +28,7 @@
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/libfdt.h>
|
|
#include <linux/kexec.h>
|
|
+#include <linux/initrd.h>
|
|
|
|
#include <asm/processor.h>
|
|
#include <asm/reboot.h>
|
|
@@ -298,6 +299,9 @@
|
|
|
|
extern asmlinkage void handle_int(void);
|
|
|
|
+/* If an initrd named block is specified, its name goes here. */
|
|
+static char rd_name[64] __initdata;
|
|
+
|
|
/**
|
|
* Return non zero if we are currently running in the Octeon simulator
|
|
*
|
|
@@ -877,6 +881,10 @@
|
|
max_memory = 32ull << 30;
|
|
if (*p == '@')
|
|
reserve_low_mem = memparse(p + 1, &p);
|
|
+ } else if (strncmp(arg, "rd_name=", 8) == 0) {
|
|
+ strncpy(rd_name, arg + 8, sizeof(rd_name));
|
|
+ rd_name[sizeof(rd_name) - 1] = 0;
|
|
+ goto append_arg;
|
|
#ifdef CONFIG_KEXEC
|
|
} else if (strncmp(arg, "crashkernel=", 12) == 0) {
|
|
crashk_size = memparse(arg+12, &p);
|
|
@@ -889,11 +897,15 @@
|
|
* parse_crashkernel(arg, sysinfo->system_dram_size,
|
|
* &crashk_size, &crashk_base);
|
|
*/
|
|
+ goto append_arg;
|
|
#endif
|
|
- } else if (strlen(arcs_cmdline) + strlen(arg) + 1 <
|
|
- sizeof(arcs_cmdline) - 1) {
|
|
- strcat(arcs_cmdline, " ");
|
|
- strcat(arcs_cmdline, arg);
|
|
+ } else {
|
|
+append_arg:
|
|
+ if (strlen(arcs_cmdline) + strlen(arg) + 1
|
|
+ < sizeof(arcs_cmdline) - 1) {
|
|
+ strcat(arcs_cmdline, " ");
|
|
+ strcat(arcs_cmdline, arg);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -978,6 +990,23 @@
|
|
|
|
total = 0;
|
|
crashk_end = 0;
|
|
+
|
|
+#ifdef CONFIG_BLK_DEV_INITRD
|
|
+
|
|
+ if (rd_name[0]) {
|
|
+ const struct cvmx_bootmem_named_block_desc *initrd_block;
|
|
+
|
|
+ initrd_block = cvmx_bootmem_find_named_block(rd_name);
|
|
+ if (initrd_block != NULL) {
|
|
+ initrd_start = initrd_block->base_addr + PAGE_OFFSET;
|
|
+ initrd_end = initrd_start + initrd_block->size;
|
|
+ add_memory_region(initrd_block->base_addr,
|
|
+ initrd_block->size, BOOT_MEM_INIT_RAM);
|
|
+ initrd_in_reserved = 1;
|
|
+ total += initrd_block->size;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
|
|
/*
|
|
* The Mips memory init uses the first memory location for
|
|
--- a/arch/mips/include/asm/bootinfo.h
|
|
+++ b/arch/mips/include/asm/bootinfo.h
|
|
@@ -167,4 +167,8 @@
|
|
#endif /* CONFIG_RELOCATABLE */
|
|
#endif /* CONFIG_USE_OF */
|
|
|
|
+#ifdef CONFIG_BLK_DEV_INITRD
|
|
+extern bool initrd_in_reserved;
|
|
+#endif
|
|
+
|
|
#endif /* _ASM_BOOTINFO_H */
|
|
--- a/arch/mips/kernel/setup.c
|
|
+++ b/arch/mips/kernel/setup.c
|
|
@@ -63,6 +63,10 @@
|
|
|
|
EXPORT_SYMBOL(mips_machtype);
|
|
|
|
+#ifdef CONFIG_BLK_DEV_INITRD
|
|
+bool initrd_in_reserved;
|
|
+#endif
|
|
+
|
|
static char __initdata command_line[COMMAND_LINE_SIZE];
|
|
char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
|
|
|
|
@@ -310,6 +314,12 @@
|
|
* will reserve the area used for the initrd.
|
|
*/
|
|
init_initrd();
|
|
+
|
|
+#ifdef CONFIG_BLK_DEV_INITRD
|
|
+ if (initrd_in_reserved) {
|
|
+ pr_info("Initramfs image loaded from rd_name= parameter.\n");
|
|
+ }
|
|
+#endif
|
|
|
|
/* Reserve memory occupied by kernel. */
|
|
memblock_reserve(__pa_symbol(&_text),
|