initrd/initramfs: extracted common code to init_rootfs.c file
RFC PATCH 1/1 initrd/initramfs: extracted common code to init_rootfs.c file
Extracted from initramfs to common place code that sits on top of iniramfs and initrd and initializes one or another depending on configuration.
--- init/Makefile | 5 +- init/default_rootfs.c | 52 ++++++++++++++++ init/do_mounts_initrd.c | 2 - init/init_rootfs.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++ init/initramfs.c | 156 +--------------------------------------------- init/initramfs.h | 4 ++ init/noinitramfs.c | 52 ---------------- 7 files changed, 222 insertions(+), 211 deletions(-) create mode 100644 init/default_rootfs.c create mode 100644 init/init_rootfs.c create mode 100644 init/initramfs.h delete mode 100644 init/noinitramfs.c
init/Makefile +3 -2
@@ -7,10 +7,11 @@ ccflags-y := -fno-function-sections -fno-data-sections obj-y := main.o version.o mounts.o ifneq ($(CONFIG_BLK_DEV_INITRD),y) -obj-y += noinitramfs.o +obj-y += default_rootfs.o else -obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o +obj-$(CONFIG_BLK_DEV_INITRD) += init_rootfs.o endif +obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o obj-y += init_task.o
init/default_rootfs.c new file +52 -0
52 lines not on this page · raw message
init/do_mounts_initrd.c +0 -2
@@ -21,8 +21,6 @@#include "do_mounts.h" -unsigned long initrd_start, initrd_end; -int initrd_below_start_ok;unsigned int real_root_dev;/* do_proc_dointvec cannot handle kdev_t */ static int __initdata mount_initrd =1 ;
init/init_rootfs.c new file +162 -0
162 lines not on this page · raw message
init/initramfs.c +1 -155
165 lines not on this page · raw message
init/initramfs.h new file +4 -0
@@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/init.h> + +char *__init initramfs_unpack_to_rootfs (char *buf,unsigned long len);
init/noinitramfs.c deleted +0 -52
52 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 5 lines · Vasyl Vavrychuk
Extracted from initramfs to common place code that sits on top of iniramfs and initrd and initializes one or another depending on configuration.
Signed-off-by Vasyl Vavrychuk <[email protected]>
Just nits here...
Quoted 9 lines
--- init/Makefile | 5 +- init/default_rootfs.c | 52 ++++++++++++++++ init/do_mounts_initrd.c | 2 - init/init_rootfs.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++ init/initramfs.c | 156 +--------------------------------------------- init/initramfs.h | 4 ++ init/noinitramfs.c | 52 ---------------- 7 files changed, 222 insertions(+), 211 deletions(-)
Does this change save us anything? More source code. How about object code?
Quoted 12 lines
create mode 100644 init/default_rootfs.c create mode 100644 init/init_rootfs.c create mode 100644 init/initramfs.h delete mode 100644 init/noinitramfs.cinit/default_rootfs.c new file +0
-0
init/default_rootfs.c line 2
Quoted 2 lines
init/default_rootfs.c new file +2
-0@@ -0,0 +1,52 @@ +/* +* init/noinitramfs.c
wrong source file name.
init/initramfs.h line 4
Quoted 10 lines
init/initramfs.h new file +4
-0@@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/init.h> + +char *__init initramfs_unpack_to_rootfs (char *buf,unsigned long len);
Unfortunately, the format for SPDX identifiers in C header files is thus:
/* SPDX-License-Identifier: <SPDX License Expression> */
according to Documentation/process/license-rules.rst.
thanks,
Signature · 1 line
~Randy