Skip to content

Commit d6579e9

Browse files
Noam Camusvineetgarc
authored andcommitted
ARC: support external initrd
Currently ARC only supports embedded initrd. This patch enables external ones too. [vgupta: Changed from "rt_start"=start/"rd_size"=sz to unified "initrd"=start,sz] Signed-off-by: Noam Camus <noamc@ezchip.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 80c1fe4 commit d6579e9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎arch/arc/mm/init.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include <linux/mm.h>
1111
#include <linux/bootmem.h>
1212
#include <linux/memblock.h>
13+
#ifdef CONFIG_BLK_DEV_INITRD
14+
#include <linux/initrd.h>
15+
#endif
1316
#include <linux/swap.h>
1417
#include <linux/module.h>
1518
#include <asm/page.h>
@@ -42,6 +45,24 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
4245
pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz));
4346
}
4447

48+
#ifdef CONFIG_BLK_DEV_INITRD
49+
static int __init early_initrd(char *p)
50+
{
51+
unsigned long start, size;
52+
char *endp;
53+
54+
start = memparse(p, &endp);
55+
if (*endp == ',') {
56+
size = memparse(endp + 1, NULL);
57+
58+
initrd_start = (unsigned long)__va(start);
59+
initrd_end = (unsigned long)__va(start + size);
60+
}
61+
return 0;
62+
}
63+
early_param("initrd", early_initrd);
64+
#endif
65+
4566
/*
4667
* First memory setup routine called from setup_arch()
4768
* 1. setup swapper's mm @init_mm
@@ -80,6 +101,12 @@ void __init setup_arch_memory(void)
80101
memblock_reserve(CONFIG_LINUX_LINK_BASE,
81102
__pa(_end) - CONFIG_LINUX_LINK_BASE);
82103

104+
#ifdef CONFIG_BLK_DEV_INITRD
105+
/*------------- reserve initrd image -----------------------*/
106+
if (initrd_start)
107+
memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
108+
#endif
109+
83110
memblock_dump_all();
84111

85112
/*-------------- node setup --------------------------------*/

0 commit comments

Comments
 (0)