Re: [PATCH v2 2/2] kbuild: Move gen_init_cpio and gen_initramfs.sh to scripts/

From: Nathan Chancellor

Date: Fri Jul 31 2026 - 15:37:28 EST


> diff --git a/usr/gen_init_cpio.c b/scripts/gen_init_cpio.c
> similarity index 100%
> rename from usr/gen_init_cpio.c
> rename to scripts/gen_init_cpio.c
> diff --git a/usr/gen_initramfs.sh b/scripts/gen_initramfs.sh
> similarity index 99%
> rename from usr/gen_initramfs.sh
> rename to scripts/gen_initramfs.sh
> index 7eba2fddf0ef..27ac1fd48001 100755
> --- a/usr/gen_initramfs.sh
> +++ b/scripts/gen_initramfs.sh

The cpio commmand in scripts/Makefile.package needs an update for this
move, otherwise modules-cpio-pkg will be broken.

Additionally, I see a number of references to "usr/gen_init" even after
this is applied:

$ git grep usr/gen_init
Documentation/driver-api/early-userspace/early_userspace_support.rst:usr/gen_init_cpio utility (run 'usr/gen_init_cpio -h' to get the
Documentation/driver-api/early-userspace/early_userspace_support.rst:usr/gen_init_cpio.
Documentation/driver-api/early-userspace/early_userspace_support.rst:usr/gen_initramfs.sh. This means that CONFIG_INITRAMFS_SOURCE
Documentation/driver-api/early-userspace/early_userspace_support.rst:usr/gen_init_cpio file directives are output. If a file is
Documentation/driver-api/early-userspace/early_userspace_support.rst:specified as an argument to usr/gen_initramfs.sh then the
Documentation/driver-api/early-userspace/early_userspace_support.rst:processed by usr/gen_init_cpio.
Documentation/driver-api/early-userspace/early_userspace_support.rst:See also 'usr/gen_initramfs.sh -h'.
Documentation/driver-api/early-userspace/early_userspace_support.rst: into initramfs either via modifying usr/gen_init_cpio.c or via the new
Documentation/filesystems/ramfs-rootfs-initramfs.rst:Run "usr/gen_init_cpio" (after the kernel build) to get a usage message
Documentation/filesystems/ramfs-rootfs-initramfs.rst:usr/gen_initramfs.sh), and proceeds to package up that directory
Documentation/filesystems/ramfs-rootfs-initramfs.rst:using the config file (by feeding it to usr/gen_init_cpio, which is created
Documentation/filesystems/ramfs-rootfs-initramfs.rst:from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
Documentation/filesystems/ramfs-rootfs-initramfs.rst: explained in buffer-format.rst, created in usr/gen_init_cpio.c, and
scripts/remove-stale-files:rm -f usr/gen_init_cpio
scripts/sbom/tests/cmd_graph/test_savedcmd_parser.py: cmd = "sh ../usr/gen_initramfs.sh -o usr/initramfs_data.cpio -l usr/.initramfs_data.cpio.d ../usr/default_cpio_list"
tools/testing/selftests/kho/vmtest.sh: "$build_dir/usr/gen_init_cpio" "$tmp_dir/cpio_list" > "$initrd"
tools/testing/selftests/nolibc/Makefile.nolibc: $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/usr/gen_init_cpio - > initramfs.cpio
usr/Kconfig: "usr/gen_init_cpio" program in the kernel tree.

Otherwise, this seems reasonable to me. Feel free to carry

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

on the respin.

--
Cheers,
Nathan