History log of /linux-master/usr/gen_initramfs.sh
Revision Date Author Comments
# 77a88274 29-Apr-2021 Masahiro Yamada <masahiroy@kernel.org>

kbuild: replace LANG=C with LC_ALL=C

LANG gives a weak default to each LC_* in case it is not explicitly
defined. LC_ALL, if set, overrides all other LC_* variables.

LANG < LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ... < LC_ALL

This is why documentation such as [1] suggests to set LC_ALL in build
scripts to get the deterministic result.

LANG=C is not strong enough to override LC_* that may be set by end
users.

[1]: https://reproducible-builds.org/docs/locales/

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Matthias Maennich <maennich@google.com>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp)
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7168965e 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

gen_initramfs.sh: remove intermediate cpio_list on errors

This script sets the -e option, so it exits on any error, in which
case it exits without cleaning up the intermediate cpio_list.

Make sure to delete it on exit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 65e00e04 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

initramfs: refactor the initramfs build rules

Currently, usr/gen_initramfs.sh takes care of all the use-cases:

[1] generates a cpio file unless CONFIG_INITRAMFS_SOURCE points to
a single cpio archive

[2] If CONFIG_INITRAMFS_SOURCE is the path to a cpio archive,
use it as-is.

[3] Compress the cpio file according to CONFIG_INITRAMFS_COMPRESSION_*
unless it is passed a compressed archive.

To simplify the script, move [2] and [3] to usr/Makefile.

If CONFIG_INITRAMFS_SOURCE is the path to a cpio archive, there is
no need to run this shell script.

For the cpio archive compression, you can re-use the rules from
scripts/Makefile.lib .

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 469e87e8 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

gen_initramfs.sh: always output cpio even without -o option

Currently, this script outputs a cpio file when -o option is
given, but otherwise a text file in the format recognized by
gen_init_cpio.

This behavior is unclear. Make it always output a cpio file.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 4538f413 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

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>


# 96680975 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

initramfs: generate dependency list and cpio at the same time

Currently, this script is run twice, for the dependency list, and then
for the cpio archive.

The first one is re-run every time although its build log is suppressed
so nobody notices it.

Make it work more efficiently by generating the cpio and the dependency
list at the same time.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 3e176683 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile

Specify the dependency directly in the Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Greg Thelen <gthelen@google.com>


# 80e715a0 04-Jan-2020 Masahiro Yamada <masahiroy@kernel.org>

initramfs: rename gen_initramfs_list.sh to gen_initramfs.sh

The comments in usr/Makefile wrongly refer to the script name (twice).

Line 37:
# The dependency list is generated by gen_initramfs.sh -l

Line 54:
# 4) Arguments to gen_initramfs.sh changes

There does not exist such a script.

I was going to fix the comments, but after some consideration, I thought
"gen_initramfs.sh" would be more suitable than "gen_initramfs_list.sh"
because it generates an initramfs image in the common usage.

The script generates a list that can be fed to gen_init_cpio only when
it is directly run without -o or -l option.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>