Skip to contentSkip to conversation

arm: add relocate initrd support

RFC New yalin wang 1 participant 1 message Oct 10, 2015

Subsystems (3)
lore
Share & tools
lore

yalin wang

author
#0 lore raw

RFC v2 1/1 arm: add relocate initrd support

Add support for initrd on ARM arch, in case
mem= boot option change the memory size or the initrd are not placed in low memory region, we need copy the initrd to low memory region.

---
 arch/arm/include/asm/fixmap.h |  1 +
 arch/arm/kernel/setup.c       | 70 +++++++++++++++++++++++++++++++++++++++++++
 drivers/of/fdt.c              |  2 ++
 include/linux/initrd.h        |  1 +
 init/do_mounts_initrd.c       |  2 ++
 5 files changed, 76 insertions(+)
arch/arm/include/asm/fixmap.h +1 -0
index 58cfe9f..18ad90f 100644
@@ -10,6 +10,7 @@
 
 enum fixed_addresses {
 	FIX_EARLYCON_MEM_BASE,
+	FIX_RELOCATE_INITRD,
 	__end_of_permanent_fixed_addresses,
 
 	FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses,
arch/arm/kernel/setup.c +70 -0

82 lines not on this page · raw message

drivers/of/fdt.c +2 -0
index 0749656..3287ecb 100644
@@ -777,6 +777,8 @@ static void __init early_init_dt_check_for_initrd(unsigned long node)
 		return;
 	end = of_read_number(prop, len/4);
 
+	initrd_start_phys = start;
+	initrd_end_phys = end;
 	initrd_start = (unsigned long)__va(start);
 	initrd_end = (unsigned long)__va(end);
 	initrd_below_start_ok = 1;
include/linux/initrd.h +1 -0
index 55289d2..0698f37 100644
@@ -15,6 +15,7 @@ extern int initrd_below_start_ok;
 
 /* free_initrd_mem always gets called with the next two as arguments.. */
 extern unsigned long initrd_start, initrd_end;
+extern phys_addr_t initrd_start_phys, initrd_end_phys;
 extern void free_initrd_mem(unsigned long, unsigned long);
 
 extern unsigned int real_root_dev;
init/do_mounts_initrd.c +2 -0
index 3e0878e..cb07338 100644
@@ -21,6 +21,8 @@
 #include "do_mounts.h"
 
 unsigned long initrd_start, initrd_end;
+phys_addr_t initrd_start_pyhs __initdata;
+phys_addr_t initrd_end_phys __initdata;
 int initrd_below_start_ok;
 unsigned int real_root_dev;	/* do_proc_dointvec cannot handle kdev_t */
 static int __initdata mount_initrd = 1;
Signature · 1 line
1.9.1