initramfs: add default_cpio_list, and delete -d option support
When CONFIG_INITRAMFS_SOURCE is empty, the Makefile passes the -d option to gen_initramfs.sh to create the default initramfs, which contains /dev, /dev/console, and /root. This commit simplifies the default behavior; remove the -d option, and add the default cpio list. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
9668097599
commit
4538f41305
@ -25,7 +25,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
|
|||||||
|
|
||||||
hostprogs-y := gen_init_cpio
|
hostprogs-y := gen_init_cpio
|
||||||
ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
|
ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
|
||||||
$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
|
$(shell echo $(CONFIG_INITRAMFS_SOURCE)),$(srctree)/$(src)/default_cpio_list)
|
||||||
ramfs-args := \
|
ramfs-args := \
|
||||||
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
|
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
|
||||||
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
|
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
|
||||||
|
6
usr/default_cpio_list
Normal file
6
usr/default_cpio_list
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
# This is a very simple, default initramfs
|
||||||
|
|
||||||
|
dir /dev 0755 0 0
|
||||||
|
nod /dev/console 0600 0 0 c 5 1
|
||||||
|
dir /root 0700 0 0
|
@ -28,7 +28,6 @@ $0 [-o <file>] [-l <dep_list>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
|
|||||||
<cpio_source> File list or directory for cpio archive.
|
<cpio_source> File list or directory for cpio archive.
|
||||||
If <cpio_source> is a .cpio file it will be used
|
If <cpio_source> is a .cpio file it will be used
|
||||||
as direct input to initramfs.
|
as direct input to initramfs.
|
||||||
-d Output the default cpio list.
|
|
||||||
|
|
||||||
All options except -o and -l may be repeated and are interpreted
|
All options except -o and -l may be repeated and are interpreted
|
||||||
sequentially and immediately. -u and -g states are preserved across
|
sequentially and immediately. -u and -g states are preserved across
|
||||||
@ -43,18 +42,6 @@ field() {
|
|||||||
shift $1 ; echo $1
|
shift $1 ; echo $1
|
||||||
}
|
}
|
||||||
|
|
||||||
default_initramfs() {
|
|
||||||
cat <<-EOF >> ${output}
|
|
||||||
# This is a very simple, default initramfs
|
|
||||||
|
|
||||||
dir /dev 0755 0 0
|
|
||||||
nod /dev/console 0600 0 0 c 5 1
|
|
||||||
dir /root 0700 0 0
|
|
||||||
# file /kinit usr/kinit/kinit 0755 0 0
|
|
||||||
# slink /init kinit 0755 0 0
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
filetype() {
|
filetype() {
|
||||||
local argv1="$1"
|
local argv1="$1"
|
||||||
|
|
||||||
@ -263,9 +250,6 @@ while [ $# -gt 0 ]; do
|
|||||||
[ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
|
[ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
"-d") # display default initramfs list
|
|
||||||
default_initramfs
|
|
||||||
;;
|
|
||||||
"-h")
|
"-h")
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user