linux/scripts/package
Masahiro Yamada c3f7bed8fa kbuild: buildtar: add comments about inconsistent package generation
scripts/package/buildtar checks some kernel packages, and copies the
first image found. This may potentially produce an inconsistent (and
possibly wrong) package.

For instance, the for-loop for arm64 checks Image.{bz2,gz,lz4,lzma,lzo},
and vmlinuz.efi, then copies the first image found, which might be a
stale image created in a previous build.

When CONFIG_EFI_ZBOOT is enabled in the pristine source tree,
'make ARCH=arm64 tar-pkg' will build and copy vmlinuz.efi. This is the
expected behavior.

If you build the kernel with CONFIG_EFI_ZBOOT disabled, Image.gz will
be created, which will remain in the tree until you run 'make clean'.
Even if CONFIG_EFI_ZBOOT is turned on later, 'make ARCH=arm64 tar-pkg'
will copy stale Image.gz instead of the latest vmlinuz.efi, as Image.gz
takes precedence over vmlinuz.efi.

In summary, the code "[ -f ... ] && cp" does not consistently produce
the desired outcome.

Other packaging targets are deterministic; deb-pkg and rpm-pkg copies
${KBUILD_IMAGE}, which is determined by CONFIG options.

I removed [ -f ... ] checks from x86, alpha, parisc, and the default
because they have a single kernel image to copy. If it is missing, it
should be an error.

I did not modify the code for mips, arm64, riscv. Instead, I left some
comments. Eventually, someone may fix the code, or at the very least,
it may discourage the copy-pasting of incorrect code to another
architecture.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-05-02 19:48:26 +09:00
..
debian kbuild: deb-pkg: call more misc debhelper commands 2024-02-19 18:20:39 +09:00
builddeb kbuild: deb-pkg: call more misc debhelper commands 2024-02-19 18:20:39 +09:00
buildtar kbuild: buildtar: add comments about inconsistent package generation 2024-05-02 19:48:26 +09:00
gen-diff-patch kbuild: give up untracked files for source package builds 2023-04-11 08:58:45 +09:00
install-extmod-build kbuild: deb-pkg: do not search for 'scripts' directory under arch/ 2024-01-05 19:35:38 +09:00
kernel.spec kbuild: rpm-pkg: add dtb files in kernel rpm 2024-03-19 02:30:51 +09:00
mkdebian kbuild: deb-pkg: use more debhelper commands in builddeb 2024-01-05 19:35:38 +09:00
mkspec kbuild: rpm-pkg: generate kernel.spec in rpmbuild/SPECS/ 2023-10-03 20:49:09 +09:00
snapcraft.template kbuild: remove the last use of old cmd_src_tar rule in packaging 2023-11-28 11:38:32 +09:00