Commit Graph

7 Commits

Author SHA1 Message Date
Masahiro Yamada
7168965ec7 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>
2020-01-16 00:26:22 +09:00
Masahiro Yamada
65e00e04e5 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>
2020-01-16 00:26:21 +09:00
Masahiro Yamada
469e87e89f 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>
2020-01-16 00:25:22 +09:00
Masahiro Yamada
4538f41305 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>
2020-01-16 00:25:22 +09:00
Masahiro Yamada
9668097599 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>
2020-01-16 00:25:21 +09:00
Masahiro Yamada
3e17668363 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>
2020-01-16 00:24:38 +09:00
Masahiro Yamada
80e715a06c 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>
2020-01-14 10:42:44 +09:00