linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Thelen <gthelen@google.com>, Sam Ravnborg <sam@ravnborg.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 10/13] initramfs: add default_cpio_list, and delete -d option support
Date: Sun,  5 Jan 2020 00:02:35 +0900	[thread overview]
Message-ID: <20200104150238.19834-11-masahiroy@kernel.org> (raw)
In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org>

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>
---

Changes in v2: None

 usr/Makefile          |  2 +-
 usr/default_cpio_list |  6 ++++++
 usr/gen_initramfs.sh  | 16 ----------------
 3 files changed, 7 insertions(+), 17 deletions(-)
 create mode 100644 usr/default_cpio_list

diff --git a/usr/Makefile b/usr/Makefile
index 3ae8b45bfc61..9256a5b189ee 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -25,7 +25,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
 
 hostprogs-y := gen_init_cpio
 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  := \
         $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
         $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
diff --git a/usr/default_cpio_list b/usr/default_cpio_list
new file mode 100644
index 000000000000..37b3864066e8
--- /dev/null
+++ b/usr/default_cpio_list
@@ -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
diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh
index 49a4e22147b5..e6808a8c3b2b 100755
--- a/usr/gen_initramfs.sh
+++ b/usr/gen_initramfs.sh
@@ -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.
 		       If <cpio_source> is a .cpio file it will be used
 		       as direct input to initramfs.
-	-d             Output the default cpio list.
 
 All options except -o and -l may be repeated and are interpreted
 sequentially and immediately.  -u and -g states are preserved across
@@ -43,18 +42,6 @@ field() {
 	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() {
 	local argv1="$1"
 
@@ -263,9 +250,6 @@ while [ $# -gt 0 ]; do
 			[ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
 			shift
 			;;
-		"-d")	# display default initramfs list
-			default_initramfs
-			;;
 		"-h")
 			usage
 			exit 0
-- 
2.17.1


  parent reply	other threads:[~2020-01-04 15:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 15:02 [PATCH v2 00/13] initramfs: a lot of cleanups Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 01/13] initramfs: replace klibcdirs in Makefile with FORCE Masahiro Yamada
2020-01-06  7:33   ` Greg Thelen
2020-01-07 10:46   ` Masahiro Yamada
2020-01-07 17:13     ` hpa
2020-01-04 15:02 ` [PATCH v2 02/13] gen_initramfs_list.sh: remove unused variable 'default_list' Masahiro Yamada
2020-01-06  7:34   ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 03/13] gen_initramfs_list.sh: fix the tool name in the comment Masahiro Yamada
2020-01-06  7:34   ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 04/13] initramfs: rename gen_initramfs_list.sh to gen_initramfs.sh Masahiro Yamada
2020-01-06  7:43   ` Greg Thelen
2020-01-06 10:26     ` Masahiro Yamada
2020-01-07  3:02       ` Ben Hutchings
2020-01-07  3:21       ` hpa
2020-01-04 15:02 ` [PATCH v2 05/13] initramfs: remove redundant dependency on BLK_DEV_INITRD Masahiro Yamada
2020-01-06  7:44   ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 06/13] initramfs: make compression options not depend on INITRAMFS_SOURCE Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 07/13] initramfs: make initramfs compression choice non-optional Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 08/13] initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile Masahiro Yamada
2020-01-06  7:51   ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 09/13] initramfs: generate dependency list and cpio at the same time Masahiro Yamada
2020-01-04 15:02 ` Masahiro Yamada [this message]
2020-01-04 15:02 ` [PATCH v2 11/13] gen_initramfs.sh: always output cpio even without -o option Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 12/13] initramfs: refactor the initramfs build rules Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 13/13] gen_initramfs.sh: remove intermediate cpio_list on errors Masahiro Yamada
2020-01-21 15:59 ` [PATCH v2 00/13] initramfs: a lot of cleanups Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200104150238.19834-11-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=gthelen@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).