- May 01, 2021
-
-
Masahiro Yamada authored
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>
-
- Jan 15, 2020
-
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
Specify the dependency directly in the Makefile. Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org> Reviewed-by:
Greg Thelen <gthelen@google.com>
-
- Jan 14, 2020
-
-
Masahiro Yamada authored
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>
-
Masahiro Yamada authored
There is no tool named "gen_initramfs". The correct name is "gen_init_cpio". Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org> Reviewed-by:
Greg Thelen <gthelen@google.com>
-
Masahiro Yamada authored
This is assigned, but not referenced. Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org> Reviewed-by:
Greg Thelen <gthelen@google.com>
-
- Jan 03, 2020
-
-
Masahiro Yamada authored
Prior to commit 858805b3 ("kbuild: add $(BASH) to run scripts with bash-extension"), this shell script was almost always run by bash since bash is usually installed on the system by default. Now, this script is run by sh, which might be a symlink to dash. On such distributions, the following code emits an error: local dev=`LC_ALL=C ls -l "${location}"` You can reproduce the build error, for example by setting CONFIG_INITRAMFS_SOURCE="/dev". GEN usr/initramfs_data.cpio.gz ./usr/gen_initramfs_list.sh: 131: local: 1: bad variable name make[1]: *** [usr/Makefile:61: usr/initramfs_data.cpio.gz] Error 2 This is because `LC_ALL=C ls -l "${location}"` contains spaces. Surrounding it with double-quotes fixes the error. Fixes: 858805b3 ("kbuild: add $(BASH) to run scripts with bash-extension") Reported-by:
Jory A. Pratt <anarchy@gentoo.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Aug 22, 2018
-
-
Masahiro Yamada authored
scripts/gen_initramfs_list.sh is only invoked from usr/Makefile. Move it so that all tools to create initramfs are self-contained in the usr/ directory. Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com>
-
Andrzej Pietrasiewicz authored
Some LANG values (e.g. pl_PL.UTF-8) cause the sort command to output files before their parent directories, which makes them inaccessible for the kernel. In other words, when the kernel populates the rootfs, it is unable to create files whose parent directories have not been yet created. This patch makes sorting use the default (LANG=C) locale, which results in correctly laid out initramfs images (parent directories before files). Signed-off-by:
Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com>
-
- Mar 25, 2018
-
-
Michael Forney authored
* Use BREs where EREs aren't necessary. * Pass -E instead of -r to use EREs. This will be standardized in the next POSIX revision[0]. GNU sed supports this since 4.2 (May 2009), and busybox since 1.22.0 (Jan 2014). * Use the [:space:] character class instead of ` \t` in bracket expressions. In bracket expressions, POSIX says that <backslash> loses its special meaning, so a conforming implementation cannot expand \t to <tab>[1]. * In BREs, use interval expressions (\{n,m\}) instead of non-standard features like \+ and \?. * Use a loop instead of -s flag. There are still plenty of other cases of non-standard sed invocations (use of ERE features in BREs, in-place editing), but this fixes some core ones. [0] http://austingroupbugs.net/view.php?id=528 [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05 Signed-off-by:
Michael Forney <forney@google.com> Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com>
-
- Jul 06, 2017
-
-
Rob Landley authored
scripts/gen_initramfs_list.sh: teach INITRAMFS_ROOT_UID and INITRAMFS_ROOT_GID that -1 means "current user". Teach INITRAMFS_ROOT_UID and INITRAMFS_ROOT_GID that -1 means "current user". Link: http://lkml.kernel.org/r/2df3a9fb-4378-fa16-679d-99e788926c05@landley.net Signed-off-by:
Rob Landley <rob@landley.net> Cc: Michal Marek <mmarek@suse.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Jul 02, 2017
-
-
Bjørn Forsman authored
kbuild runs "find" on each entry in CONFIG_INITRAMFS_SOURCE that is a directory. The order of the file listing output by "find" matter for build reproducability, hence this patch applies "sort" to get deterministic results. Without this patch, two different machines with identical initramfs directory input may produce differing initramfs cpio archives (different hash) due to the different order of the files within the archive. Signed-off-by:
Bjørn Forsman <bjorn.forsman@gmail.com> Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com>
-
- Sep 23, 2016
-
-
Michal Marek authored
Special characters are problematic in depfiles, but we can fix colons easily. Reported-by:
Florian Fainelli <f.fainelli@gmail.com> Signed-off-by:
Michal Marek <mmarek@suse.com>
-
- Aug 20, 2014
-
-
Michal Marek authored
The Makefiles call the respective interpreter explicitly, but this makes it easier to use the scripts manually. Signed-off-by:
Michal Marek <mmarek@suse.cz>
-
- Mar 04, 2014
-
-
Daniel M. Weeks authored
LZ4 as implemented in the kernel differs from the default method now used by the reference implementation of LZ4. Until the in-kernel method is updated to support the new default, passing the legacy flag (-l) to the compressor is necessary. Without this flag the kernel-generated, LZ4-compressed initramfs is junk. Kyungsik said: : It seems that lz4 supports legacy format with the same option as lz4c : does. Just looking at the first few bytes of lz4 compressed image, we can : see whether it is new format or not. : : It shows new format magic number without this patch. New format magic : number is 0x184d2204. : : $ hexdump -C ./initramfs_data.cpio.lz4 |more : 00000000 04 22 4d 18 64 70 b9 69 (Little Endian) : ... : : Currently kernel supports legacy format only. Signed-off-by:
Daniel M. Weeks <dan@danweeks.net> Cc: Michal Marek <mmarek@suse.cz> Acked-by:
Kyungsik Lee <kyungsik.lee@lge.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Nov 13, 2013
-
-
P J P authored
When expert configuration option(CONFIG_EXPERT) is enabled, menuconfig offers a choice of compression algorithm to compress initial ramfs image; This choice is stored into CONFIG_RD_* variables. But usr/Makefile uses earlier INITRAMFS_COMPRESSION_* macros to build initial ramfs file. Since none of them is defined, resulting 'initramfs_data.cpio' file remains un-compressed. This patch updates the Makefile to use CONFIG_RD_* variables and adds support for LZ4 compression algorithm. Also updates the 'gen_initramfs_list.sh' script to check whether a selected compression command is accessible or not. And fall-back to default gzip(1) compression when it is not. Signed-off-by:
P J P <prasad@redhat.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- May 12, 2011
-
-
Jamey Sharp authored
Replace bashisms with POSIX-compatible shell scripting. Notably, de-duplicate '/' using a sed command from elsewhere in the same script rather than "${name//\/\///}". Commit by Jamey Sharp and Josh Triplett. Signed-off-by:
Jamey Sharp <jamey@minilop.net> Signed-off-by:
Josh Triplett <josh@joshtriplett.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Michal Marek <mmarek@suse.cz>
-
- Apr 18, 2011
-
-
Michal Marek authored
gen_init_cpio gets the current time and uses it for each symlink, special file, and directory. Grab the current time once and make it possible to override it with the KBUILD_BUILD_TIMESTAMP variable for reproducible builds. Signed-off-by:
Michal Marek <mmarek@suse.cz>
-
Michal Marek authored
The timestamps recorded in the .gz files add no value. Signed-off-by:
Michal Marek <mmarek@suse.cz>
-
- Mar 31, 2011
-
-
Lucas De Marchi authored
Fixes generated by 'codespell' and manually reviewed. Signed-off-by:
Lucas De Marchi <lucas.demarchi@profusion.mobi>
-
- Jan 13, 2011
-
-
Lasse Collin authored
This implements the API defined in <linux/decompress/generic.h> which is used for kernel, initramfs, and initrd decompression. This patch together with the first patch is enough for XZ-compressed initramfs and initrd; XZ-compressed kernel will need arch-specific changes. The buffering requirements described in decompress_unxz.c are stricter than with gzip, so the relevant changes should be done to the arch-specific code when adding support for XZ-compressed kernel. Similarly, the heap size in arch-specific pre-boot code may need to be increased (30 KiB is enough). The XZ decompressor needs memmove(), memeq() (memcmp() == 0), and memzero() (memset(ptr, 0, size)), which aren't available in all arch-specific pre-boot environments. I'm including simple versions in decompress_unxz.c, but a cleaner solution would naturally be nicer. Signed-off-by:
Lasse Collin <lasse.collin@tukaani.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Alain Knaff <alain@knaff.lu> Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com> Cc: Phillip Lougher <phillip@lougher.demon.co.uk> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- May 27, 2010
-
-
Albin Tonnerre authored
Add the necessary parts to be enable the use of LZO-compressed initramfs build into the kernel. Signed-off-by:
Albin Tonnerre <albin.tonnerre@free-electrons.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Mar 23, 2010
-
-
Jason Gunthorpe authored
Expand the dependency set used for the initrd to include the CONFIG_INITRAMFS_SOURCE file and the generator script itself. Otherwise changing the initramfs file list does not rebuild the CPIO. Signed-off-by:
Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by:
Michal Marek <mmarek@suse.cz>
-
- Apr 11, 2009
-
-
When gen_initramfs_list is used to generate make dependencies, it includes symbolic links, for which make tracks the link target. Any change to that target will cause an initramfs rebuild, even if the symlink points to something outside of the initramfs directory. If the target happens to be /tmp, the rebuild occurs for each kernel build, since gen_initramfs_list uses mktemp... Proposed way to fix it is to omit symbolic links from generated dependencies, but this has a small drawback: changing perm/owner on a symlink will go unnoticed. Signed-off-by:
Maxime Bizon <mbizon@freebox.fr> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
- Feb 19, 2009
-
-
Alain Knaff authored
Impact: Bugfix, silent build failures Fix a bug in gen_initramfs_list.sh: in case of failure, it left an empty output file behind, messing up the next make. Signed-off-by:
Alain Knaff <alain@knaff.lu> Signed-off-by:
H. Peter Anvin <hpa@linux.intel.com>
-
- Jan 07, 2009
-
-
Impact: Resolves build failures in some configurations Makes it possible to disable CONFIG_RD_GZIP . In that case, the built-in initramfs will be compressed by whatever compressor is available (bzip2 or lzma) or left uncompressed if none is available. It also removes a couple of warnings which occur when no ramdisk compression at all is chosen. It also restores the select ZLIB_INFLATE in drivers/block/Kconfig which somehow came missing. This is needed to activate compilation of the stuff in zlib_deflate. Signed-off-by:
Alain Knaff <alain@knaff.lu> Signed-off-by:
H. Peter Anvin <hpa@zytor.com>
-
- Apr 28, 2008
-
-
Felix Fietkau authored
On a Mac OS X machine the output of ls -l is different from a standard Linux machine. Use readlink instead of parsing a hardcoded field number from the ls output. Signed-off-by:
Felix Fietkau <nbd@openwrt.org> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
- Jul 16, 2007
-
-
Sometimes it is useful to squash all uid's/gid's to 0:0 regardless of current owner. For example, in build systems that get run as arbitrary users (uClinux-dist). This adds a special "squash" keyword so you can do '-g squash -u squash' and have ownership squashed to root. Signed-off-by:
Mike Frysinger <vapier@gentoo.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org>
-
- May 02, 2007
-
-
If the find(1) in scripts/gen_initramfs_list.sh generates any errors, it will cause gen_initramfs_list.sh to fail (because of "set -e"), however the errors from find are not printed to the user. This is rather confusing: ~/src/powerpc$ make O=~/build/powerpc-cell32/ make[2]: *** [usr/initramfs_data.cpio.gz] Error 1 make[1]: *** [usr] Error 2 make[1]: *** Waiting for unfinished jobs.... make[1]: *** wait: No child processes. Stop. make: *** [_all] Error 2 It is much easier to work out what the problem is if we let the errors from find hit the console, eg: ~/src/powerpc$ make O=~/build/powerpc-cell32/ find: /home/michael/initramfs-source/home: Permission denied find: /home/michael/initramfs-source/lost+found: Permission denied find: /home/michael/initramfs-source/opt: Permission denied find: /home/michael/initramfs-source/root: Permission denied make[2]: *** [usr/initramfs_data.cpio.gz] Error 1 make[1]: *** [usr] Error 2 make[1]: *** Waiting for unfinished jobs.... make[1]: *** wait: No child processes. Stop. make: *** [_all] Error 2 Signed-off-by:
Michael Ellerman <michael@ellerman.id.au> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
Make kbuild handle compressed cpio initramfs-es. An already compressed cpio is copied directly to usr/, while a non-compressed cpio is filtered through gzip (no changes here) on its way to usr/. If the user has created a compressed cpio by other means, this saves him from uncompressing it, just to be compressed again by kbuild. Signed-off-by:
Alex Landau <landau.alex@gmail.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
- Feb 06, 2007
-
-
Oleg Verych authored
Replacing overhead of using some (external) programs instead of good old `sh'. Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: William Stearns <wstearns@pobox.com> Cc: Martin Schlemmer <azarah@nosferatu.za.org> Signed-off-by:
Oleg Verych <olecom@flower.upol.cz> Acked-by:
Mark Lord <lkml@rtr.ca> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Nov 25, 2006
-
-
Thomas Chou authored
Fix bug 7401. Handle more than one source dir or file list to the initramfs gen scripts. The Kconfig help for INITRAMFS_SOURCE claims that you can specify multiple space-separated sources in order to allow unprivileged users to build an image. There are two bugs in the current implementation that prevent this from working. First, we pass "file1 dir2" to the gen_initramfs_list.sh script, which it obviously can't open. Second, gen_initramfs_list.sh -l outputs multiple definitions for deps_initramfs -- one for each argument. Signed-off-by:
Thomas Chou <thomas@wytron.com.tw> Cc: Sam Ravnborg <sam@ravnborg.org> Acked-by:
Matthew Wilcox <matthew@wil.cx> Signed-off-by:
Andrew Morton <akpm@osdl.org> Signed-off-by:
Linus Torvalds <torvalds@osdl.org>
-
- Apr 30, 2006
-
-
Sam Ravnborg authored
Create correct dependencies when specifying your own file with list of files etc. to include in initramfs. Reported by: Andre Noll <maan@skl-net.de> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
- Apr 11, 2006
-
-
Sam Ravnborg authored
initramfs.cpio.gz being build in usr/ and included in the kernel was not rebuild when the included files changed. To fix this the following was done: - let gen_initramfs.sh generate a list of files and directories included in the initramfs - gen_initramfs generate the gzipped cpio archive so we could simplify the kbuild file (Makefile) - utilising the kbuild infrastructure so when uid/gid root mapping changes the initramfs will be rebuild With this change we have a much more robust initramfs generation. Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
-
- Apr 16, 2005
-
-
Linus Torvalds authored
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
-