Commit d6579e99bc448a351279cea7469ab64a00d25ff8

Authored by Noam Camus
Committed by Vineet Gupta
1 parent 80c1fe4c0d

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>

Showing 1 changed file with 27 additions and 0 deletions Side-by-side Diff

... ... @@ -10,6 +10,9 @@
10 10 #include <linux/mm.h>
11 11 #include <linux/bootmem.h>
12 12 #include <linux/memblock.h>
  13 +#ifdef CONFIG_BLK_DEV_INITRD
  14 +#include <linux/initrd.h>
  15 +#endif
13 16 #include <linux/swap.h>
14 17 #include <linux/module.h>
15 18 #include <asm/page.h>
... ... @@ -42,6 +45,24 @@
42 45 pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz));
43 46 }
44 47  
  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 +
45 66 /*
46 67 * First memory setup routine called from setup_arch()
47 68 * 1. setup swapper's mm @init_mm
... ... @@ -79,6 +100,12 @@
79 100 /*------------- reserve kernel image -----------------------*/
80 101 memblock_reserve(CONFIG_LINUX_LINK_BASE,
81 102 __pa(_end) - CONFIG_LINUX_LINK_BASE);
  103 +
  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
82 109  
83 110 memblock_dump_all();
84 111