1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4  */
5 
6 #include <linux/init.h>
7 #include <linux/memblock.h>
8 #include <linux/initrd.h>
9 #include <asm/types.h>
10 #include <init.h>
11 #include <os.h>
12 
13 #include "um_arch.h"
14 
15 /* Changed by uml_initrd_setup, which is a setup */
16 static char *initrd __initdata = NULL;
17 
read_initrd(void)18 int __init read_initrd(void)
19 {
20 	unsigned long long size;
21 	void *area;
22 
23 	if (!initrd)
24 		return 0;
25 
26 	area = uml_load_file(initrd, &size);
27 	if (!area)
28 		return 0;
29 
30 	initrd_start = (unsigned long) area;
31 	initrd_end = initrd_start + size;
32 	return 0;
33 }
34 
uml_initrd_setup(char * line,int * add)35 static int __init uml_initrd_setup(char *line, int *add)
36 {
37 	initrd = line;
38 	return 0;
39 }
40 
41 __uml_setup("initrd=", uml_initrd_setup,
42 "initrd=<initrd image>\n"
43 "    This is used to boot UML from an initrd image.  The argument is the\n"
44 "    name of the file containing the image.\n\n"
45 );
46