2019-08-25 10:49:17 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-05-20 13:59:10 -07:00
|
|
|
/*
|
2008-02-04 22:31:08 -08:00
|
|
|
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
2005-05-20 13:59:10 -07:00
|
|
|
*/
|
|
|
|
|
2012-10-08 03:27:32 +01:00
|
|
|
#include <linux/init.h>
|
2018-10-30 15:09:49 -07:00
|
|
|
#include <linux/memblock.h>
|
2012-10-08 03:27:32 +01:00
|
|
|
#include <linux/initrd.h>
|
|
|
|
#include <asm/types.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <os.h>
|
2005-05-20 13:59:10 -07:00
|
|
|
|
2021-12-08 16:11:22 +01:00
|
|
|
#include "um_arch.h"
|
|
|
|
|
2005-05-20 13:59:10 -07:00
|
|
|
/* Changed by uml_initrd_setup, which is a setup */
|
|
|
|
static char *initrd __initdata = NULL;
|
|
|
|
|
2017-04-27 12:15:10 +09:00
|
|
|
int __init read_initrd(void)
|
2005-05-20 13:59:10 -07:00
|
|
|
{
|
2021-12-08 16:11:22 +01:00
|
|
|
unsigned long long size;
|
2005-05-20 13:59:10 -07:00
|
|
|
void *area;
|
2007-05-06 14:51:41 -07:00
|
|
|
|
2021-12-08 16:11:22 +01:00
|
|
|
if (!initrd)
|
2007-05-06 14:51:41 -07:00
|
|
|
return 0;
|
|
|
|
|
2021-12-08 16:11:22 +01:00
|
|
|
area = uml_load_file(initrd, &size);
|
2019-03-11 23:30:31 -07:00
|
|
|
if (!area)
|
2007-05-06 14:51:41 -07:00
|
|
|
return 0;
|
|
|
|
|
2005-05-20 13:59:10 -07:00
|
|
|
initrd_start = (unsigned long) area;
|
|
|
|
initrd_end = initrd_start + size;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init uml_initrd_setup(char *line, int *add)
|
|
|
|
{
|
|
|
|
initrd = line;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__uml_setup("initrd=", uml_initrd_setup,
|
|
|
|
"initrd=<initrd image>\n"
|
|
|
|
" This is used to boot UML from an initrd image. The argument is the\n"
|
|
|
|
" name of the file containing the image.\n\n"
|
|
|
|
);
|