projects/linux·blob uaccess-cleanups · refs

63 lines · 1.4 KiB

1// SPDX-License-Identifier: GPL-2.0
2#include <linux/unistd.h>
3#include <linux/kernel.h>
4#include <linux/fs.h>
5#include <linux/initrd.h>
6
7#include "do_mounts.h"
8
9unsigned long initrd_start, initrd_end;
10int initrd_below_start_ok;
11static int __initdata mount_initrd = 1;
12
13phys_addr_t phys_initrd_start __initdata;
14unsigned long phys_initrd_size __initdata;
15
16static int __init no_initrd(char *str)
17{
18 pr_warn("noinitrd option is deprecated and will be removed soon\n");
19 mount_initrd = 0;
20 return 1;
21}
22
23__setup("noinitrd", no_initrd);
24
25static int __init early_initrdmem(char *p)
26{
27 phys_addr_t start;
28 unsigned long size;
29 char *endp;
30
31 start = memparse(p, &endp);
32 if (*endp == ',') {
33 size = memparse(endp + 1, NULL);
34
35 phys_initrd_start = start;
36 phys_initrd_size = size;
37 }
38 return 0;
39}
40early_param("initrdmem", early_initrdmem);
41
42static int __init early_initrd(char *p)
43{
44 return early_initrdmem(p);
45}
46early_param("initrd", early_initrd);
47
48void __init initrd_load(void)
49{
50 if (mount_initrd) {
51 create_dev("/dev/ram", Root_RAM0);
52 /*
53 * Load the initrd data into /dev/ram0.
54 */
55 if (rd_load_image()) {
56 pr_warn("using deprecated initrd support, will be removed in January 2027; "
57 "use initramfs instead or (as a last resort) /sys/firmware/initrd; "
58 "see section \"Workaround\" in "
59 "https://lore.kernel.org/lkml/[email protected]\n");
60 }
61 }
62 init_unlink("/initrd.image");
63}