Commit cc0aa21d authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Greg Kroah-Hartman

um: Fix to call read_initrd after init_bootmem

commit 5b4236e1 upstream.

Since read_initrd() invokes alloc_bootmem() for allocating
memory to load initrd image, it must be called after init_bootmem.

This makes read_initrd() called directly from setup_arch()
after init_bootmem() and mem_total_pages().

Fixes: b6323697 ("um: Setup physical memory in setup_arch()")
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 541c6784
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
static char *initrd __initdata = NULL; static char *initrd __initdata = NULL;
static int load_initrd(char *filename, void *buf, int size); static int load_initrd(char *filename, void *buf, int size);
static int __init read_initrd(void) int __init read_initrd(void)
{ {
void *area; void *area;
long long size; long long size;
...@@ -46,8 +46,6 @@ static int __init read_initrd(void) ...@@ -46,8 +46,6 @@ static int __init read_initrd(void)
return 0; return 0;
} }
__uml_postsetup(read_initrd);
static int __init uml_initrd_setup(char *line, int *add) static int __init uml_initrd_setup(char *line, int *add)
{ {
initrd = line; initrd = line;
......
...@@ -336,11 +336,17 @@ int __init linux_main(int argc, char **argv) ...@@ -336,11 +336,17 @@ int __init linux_main(int argc, char **argv)
return start_uml(); return start_uml();
} }
int __init __weak read_initrd(void)
{
return 0;
}
void __init setup_arch(char **cmdline_p) void __init setup_arch(char **cmdline_p)
{ {
stack_protections((unsigned long) &init_thread_info); stack_protections((unsigned long) &init_thread_info);
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
mem_total_pages(physmem_size, iomem_size, highmem); mem_total_pages(physmem_size, iomem_size, highmem);
read_initrd();
paging_init(); paging_init();
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment