Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfs-7.0-rc1.initrd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs initrd removal from Christian Brauner:
"Remove the deprecated linuxrc-based initrd code path and related dead
code. The linuxrc initrd path was deprecated in 2020 and this series
completes its removal. If we see real-life regressions we'll revert.

The core change removes handle_initrd() and init_linuxrc() — the
entire flow that ran /linuxrc from an initrd, pivoted roots, and
handed off to the real root filesystem. With that gone, initrd_load()
becomes void (no longer short-circuits prepare_namespace()),
rd_load_image() is simplified to always load /initrd.image instead of
taking a path, and rd_load_disk() is deleted.

The /proc/sys/kernel/real-root-dev sysctl and its backing variable are
removed since they only existed for linuxrc to communicate the real
root device back to the kernel.

The no-op load_ramdisk= and prompt_ramdisk= parameters are dropped,
and noinitrd and ramdisk_start= gain deprecation warnings.

Initramfs is entirely unaffected. The non-linuxrc initrd path
(root=/dev/ram0) is preserved but now carries a deprecation warning
targeting January 2027 removal"

* tag 'vfs-7.0-rc1.initrd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
init: remove /proc/sys/kernel/real-root-dev
initrd: remove deprecated code path (linuxrc)
init: remove deprecated "load_ramdisk" and "prompt_ramdisk" command line parameters

+23 -160
+5 -7
Documentation/admin-guide/kernel-parameters.txt
··· 3477 3477 Enable Live Update Orchestrator (LUO). 3478 3478 Default: off. 3479 3479 3480 - load_ramdisk= [RAM] [Deprecated] 3481 - 3482 3480 lockd.nlm_grace_period=P [NFS] Assign grace period. 3483 3481 Format: <integer> 3484 3482 ··· 4482 4484 Note that this argument takes precedence over 4483 4485 the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option. 4484 4486 4485 - noinitrd [RAM] Tells the kernel not to load any configured 4486 - initial RAM disk. 4487 + noinitrd [Deprecated,RAM] Tells the kernel not to load any configured 4488 + initial RAM disk. Currently this parameter applies to 4489 + initrd only, not to initramfs. But it applies to both 4490 + in EFI mode. 4487 4491 4488 4492 nointremap [X86-64,Intel-IOMMU,EARLY] Do not enable interrupt 4489 4493 remapping. ··· 5442 5442 Param: <number> - step/bucket size as a power of 2 for 5443 5443 statistical time based profiling. 5444 5444 5445 - prompt_ramdisk= [RAM] [Deprecated] 5446 - 5447 5445 prot_virt= [S390] enable hosting protected virtual machines 5448 5446 isolated from the hypervisor (if hardware supports 5449 5447 that). If enabled, the default kernel base address ··· 5498 5500 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes 5499 5501 See Documentation/admin-guide/blockdev/ramdisk.rst. 5500 5502 5501 - ramdisk_start= [RAM] RAM disk image start address 5503 + ramdisk_start= [Deprecated,RAM] RAM disk image start address 5502 5504 5503 5505 random.trust_cpu=off 5504 5506 [KNL,EARLY] Disable trusting the use of the CPU's
-6
Documentation/admin-guide/sysctl/kernel.rst
··· 1235 1235 == =========================================================================== 1236 1236 1237 1237 1238 - real-root-dev 1239 - ============= 1240 - 1241 - See Documentation/admin-guide/initrd.rst. 1242 - 1243 - 1244 1238 reboot-cmd (SPARC only) 1245 1239 ======================= 1246 1240
+1 -1
arch/arm/configs/neponset_defconfig
··· 9 9 CONFIG_ZBOOT_ROM_TEXT=0x80000 10 10 CONFIG_ZBOOT_ROM_BSS=0xc1000000 11 11 CONFIG_ZBOOT_ROM=y 12 - CONFIG_CMDLINE="console=ttySA0,38400n8 cpufreq=221200 rw root=/dev/mtdblock2 mtdparts=sa1100:512K(boot),1M(kernel),2560K(initrd),4M(root) load_ramdisk=1 prompt_ramdisk=0 mem=32M noinitrd initrd=0xc0800000,3M" 12 + CONFIG_CMDLINE="console=ttySA0,38400n8 cpufreq=221200 rw root=/dev/mtdblock2 mtdparts=sa1100:512K(boot),1M(kernel),2560K(initrd),4M(root) mem=32M noinitrd initrd=0xc0800000,3M" 13 13 CONFIG_FPE_NWFPE=y 14 14 CONFIG_PM=y 15 15 CONFIG_MODULES=y
-2
include/linux/initrd.h
··· 3 3 #ifndef __LINUX_INITRD_H 4 4 #define __LINUX_INITRD_H 5 5 6 - #define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */ 7 - 8 6 /* starting block # of image */ 9 7 extern int rd_image_start; 10 8
-1
include/uapi/linux/sysctl.h
··· 92 92 KERN_DOMAINNAME=8, /* string: domainname */ 93 93 94 94 KERN_PANIC=15, /* int: panic timeout */ 95 - KERN_REALROOTDEV=16, /* real root device to mount after initrd */ 96 95 97 96 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */ 98 97 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
+1 -10
init/do_mounts.c
··· 34 34 35 35 dev_t ROOT_DEV; 36 36 37 - static int __init load_ramdisk(char *str) 38 - { 39 - pr_warn("ignoring the deprecated load_ramdisk= option\n"); 40 - return 1; 41 - } 42 - __setup("load_ramdisk=", load_ramdisk); 43 - 44 37 static int __init readonly(char *str) 45 38 { 46 39 if (*str) ··· 477 484 if (saved_root_name[0]) 478 485 ROOT_DEV = parse_root_device(saved_root_name); 479 486 480 - if (initrd_load(saved_root_name)) 481 - goto out; 487 + initrd_load(); 482 488 483 489 if (root_wait) 484 490 wait_for_root(saved_root_name); 485 491 mount_root(saved_root_name); 486 - out: 487 492 devtmpfs_mount(); 488 493 init_mount(".", "/", NULL, MS_MOVE, NULL); 489 494 init_chroot(".");
+4 -14
init/do_mounts.h
··· 23 23 } 24 24 25 25 #ifdef CONFIG_BLK_DEV_RAM 26 - 27 - int __init rd_load_disk(int n); 28 - int __init rd_load_image(char *from); 29 - 26 + int __init rd_load_image(void); 30 27 #else 31 - 32 - static inline int rd_load_disk(int n) { return 0; } 33 - static inline int rd_load_image(char *from) { return 0; } 34 - 28 + static inline int rd_load_image(void) { return 0; } 35 29 #endif 36 30 37 31 #ifdef CONFIG_BLK_DEV_INITRD 38 - bool __init initrd_load(char *root_device_name); 32 + void __init initrd_load(void); 39 33 #else 40 - static inline bool initrd_load(char *root_device_name) 41 - { 42 - return false; 43 - } 44 - 34 + static inline void initrd_load(void) { } 45 35 #endif 46 36 47 37 /* Ensure that async file closing finished to prevent spurious errors. */
+8 -99
init/do_mounts_initrd.c
··· 2 2 #include <linux/unistd.h> 3 3 #include <linux/kernel.h> 4 4 #include <linux/fs.h> 5 - #include <linux/minix_fs.h> 6 - #include <linux/romfs_fs.h> 7 5 #include <linux/initrd.h> 8 - #include <linux/sched.h> 9 - #include <linux/freezer.h> 10 - #include <linux/kmod.h> 11 - #include <uapi/linux/mount.h> 12 6 13 7 #include "do_mounts.h" 14 8 15 9 unsigned long initrd_start, initrd_end; 16 10 int initrd_below_start_ok; 17 - static unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ 18 11 static int __initdata mount_initrd = 1; 19 12 20 13 phys_addr_t phys_initrd_start __initdata; 21 14 unsigned long phys_initrd_size __initdata; 22 15 23 - #ifdef CONFIG_SYSCTL 24 - static const struct ctl_table kern_do_mounts_initrd_table[] = { 25 - { 26 - .procname = "real-root-dev", 27 - .data = &real_root_dev, 28 - .maxlen = sizeof(int), 29 - .mode = 0644, 30 - .proc_handler = proc_dointvec, 31 - }, 32 - }; 33 - 34 - static __init int kernel_do_mounts_initrd_sysctls_init(void) 35 - { 36 - register_sysctl_init("kernel", kern_do_mounts_initrd_table); 37 - return 0; 38 - } 39 - late_initcall(kernel_do_mounts_initrd_sysctls_init); 40 - #endif /* CONFIG_SYSCTL */ 41 - 42 16 static int __init no_initrd(char *str) 43 17 { 18 + pr_warn("noinitrd option is deprecated and will be removed soon\n"); 44 19 mount_initrd = 0; 45 20 return 1; 46 21 } ··· 45 70 } 46 71 early_param("initrd", early_initrd); 47 72 48 - static int __init init_linuxrc(struct subprocess_info *info, struct cred *new) 49 - { 50 - ksys_unshare(CLONE_FS | CLONE_FILES); 51 - console_on_rootfs(); 52 - /* move initrd over / and chdir/chroot in initrd root */ 53 - init_chdir("/root"); 54 - init_mount(".", "/", NULL, MS_MOVE, NULL); 55 - init_chroot("."); 56 - ksys_setsid(); 57 - return 0; 58 - } 59 - 60 - static void __init handle_initrd(char *root_device_name) 61 - { 62 - struct subprocess_info *info; 63 - static char *argv[] = { "linuxrc", NULL, }; 64 - extern char *envp_init[]; 65 - int error; 66 - 67 - pr_warn("using deprecated initrd support, will be removed soon.\n"); 68 - 69 - real_root_dev = new_encode_dev(ROOT_DEV); 70 - create_dev("/dev/root.old", Root_RAM0); 71 - /* mount initrd on rootfs' /root */ 72 - mount_root_generic("/dev/root.old", root_device_name, 73 - root_mountflags & ~MS_RDONLY); 74 - init_mkdir("/old", 0700); 75 - init_chdir("/old"); 76 - 77 - info = call_usermodehelper_setup("/linuxrc", argv, envp_init, 78 - GFP_KERNEL, init_linuxrc, NULL, NULL); 79 - if (!info) 80 - return; 81 - call_usermodehelper_exec(info, UMH_WAIT_PROC|UMH_FREEZABLE); 82 - 83 - /* move initrd to rootfs' /old */ 84 - init_mount("..", ".", NULL, MS_MOVE, NULL); 85 - /* switch root and cwd back to / of rootfs */ 86 - init_chroot(".."); 87 - 88 - if (new_decode_dev(real_root_dev) == Root_RAM0) { 89 - init_chdir("/old"); 90 - return; 91 - } 92 - 93 - init_chdir("/"); 94 - ROOT_DEV = new_decode_dev(real_root_dev); 95 - mount_root(root_device_name); 96 - 97 - printk(KERN_NOTICE "Trying to move old root to /initrd ... "); 98 - error = init_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); 99 - if (!error) 100 - printk("okay\n"); 101 - else { 102 - if (error == -ENOENT) 103 - printk("/initrd does not exist. Ignored.\n"); 104 - else 105 - printk("failed\n"); 106 - printk(KERN_NOTICE "Unmounting old root\n"); 107 - init_umount("/old", MNT_DETACH); 108 - } 109 - } 110 - 111 - bool __init initrd_load(char *root_device_name) 73 + void __init initrd_load(void) 112 74 { 113 75 if (mount_initrd) { 114 76 create_dev("/dev/ram", Root_RAM0); 115 77 /* 116 - * Load the initrd data into /dev/ram0. Execute it as initrd 117 - * unless /dev/ram0 is supposed to be our actual root device, 118 - * in that case the ram disk is just set up here, and gets 119 - * mounted in the normal path. 78 + * Load the initrd data into /dev/ram0. 120 79 */ 121 - if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) { 122 - init_unlink("/initrd.image"); 123 - handle_initrd(root_device_name); 124 - return true; 80 + if (rd_load_image()) { 81 + pr_warn("using deprecated initrd support, will be removed in January 2027; " 82 + "use initramfs instead or (as a last resort) /sys/firmware/initrd; " 83 + "see section \"Workaround\" in " 84 + "https://lore.kernel.org/lkml/20251010094047.3111495-1-safinaskar@gmail.com\n"); 125 85 } 126 86 } 127 87 init_unlink("/initrd.image"); 128 - return false; 129 88 }
+4 -20
init/do_mounts_rd.c
··· 18 18 static struct file *in_file, *out_file; 19 19 static loff_t in_pos, out_pos; 20 20 21 - static int __init prompt_ramdisk(char *str) 22 - { 23 - pr_warn("ignoring the deprecated prompt_ramdisk= option\n"); 24 - return 1; 25 - } 26 - __setup("prompt_ramdisk=", prompt_ramdisk); 27 - 28 21 int __initdata rd_image_start; /* starting block # of image */ 29 22 30 23 static int __init ramdisk_start_setup(char *str) 31 24 { 25 + pr_warn("ramdisk_start= option is deprecated and will be removed soon\n"); 32 26 return kstrtoint(str, 0, &rd_image_start) == 0; 33 27 } 34 28 __setup("ramdisk_start=", ramdisk_start_setup); ··· 177 183 return i_size_read(inode) >> 10; 178 184 } 179 185 180 - int __init rd_load_image(char *from) 186 + int __init rd_load_image(void) 181 187 { 182 188 int res = 0; 183 189 unsigned long rd_blocks, devblocks, nr_disks; ··· 191 197 if (IS_ERR(out_file)) 192 198 goto out; 193 199 194 - in_file = filp_open(from, O_RDONLY, 0); 200 + in_file = filp_open("/initrd.image", O_RDONLY, 0); 195 201 if (IS_ERR(in_file)) 196 202 goto noclose_input; 197 203 ··· 220 226 /* 221 227 * OK, time to copy in the data 222 228 */ 223 - if (strcmp(from, "/initrd.image") == 0) 224 - devblocks = nblocks; 225 - else 226 - devblocks = nr_blocks(in_file); 229 + devblocks = nblocks; 227 230 228 231 if (devblocks == 0) { 229 232 printk(KERN_ERR "RAMDISK: could not determine device size\n"); ··· 262 271 kfree(buf); 263 272 init_unlink("/dev/ram"); 264 273 return res; 265 - } 266 - 267 - int __init rd_load_disk(int n) 268 - { 269 - create_dev("/dev/root", ROOT_DEV); 270 - create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, n)); 271 - return rd_load_image("/dev/root"); 272 274 } 273 275 274 276 static int exit_code;