android_kernel_xiaomi_sm8450/arch/s390/boot
Masahiro Yamada 89c2ba9ce4
BACKPORT: UPSTREAM: kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}
GZIP-compressed files end with 4 byte data that represents the size
of the original input. The decompressors (the self-extracting kernel)
exploit it to know the vmlinux size beforehand. To mimic the GZIP's
trailer, Kbuild provides cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}.
Unfortunately these macros are used everywhere despite the appended
size data is only useful for the decompressors.

There is no guarantee that such hand-crafted trailers are safely ignored.
In fact, the kernel refuses compressed initramdfs with the garbage data.
That is why usr/Makefile overrides size_append to make it no-op.

To limit the use of such broken compressed files, this commit renames
the existing macros as follows:

  cmd_bzip2   --> cmd_bzip2_with_size
  cmd_lzma    --> cmd_lzma_with_size
  cmd_lzo     --> cmd_lzo_with_size
  cmd_lz4     --> cmd_lz4_with_size
  cmd_xzkern  --> cmd_xzkern_with_size
  cmd_zstd22  --> cmd_zstd22_with_size

To keep the decompressors working, I updated the following Makefiles
accordingly:

  arch/arm/boot/compressed/Makefile
  arch/h8300/boot/compressed/Makefile
  arch/mips/boot/compressed/Makefile
  arch/parisc/boot/compressed/Makefile
  arch/s390/boot/compressed/Makefile
  arch/sh/boot/compressed/Makefile
  arch/x86/boot/compressed/Makefile

I reused the current macro names for the normal usecases; they produce
the compressed data in the proper format.

I did not touch the following:

  arch/arc/boot/Makefile
  arch/arm64/boot/Makefile
  arch/csky/boot/Makefile
  arch/mips/boot/Makefile
  arch/riscv/boot/Makefile
  arch/sh/boot/Makefile
  kernel/Makefile

This means those Makefiles will stop appending the size data.

I dropped the 'override size_append' hack from usr/Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>

Bug: 135791357
(cherry picked from commit 7ce7e984ab2b218d6e92d5165629022fe2daf9ee
 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)
Change-Id: I3524909ef3daab85f7d22afdebc2e5bbfd5e5cf3
[szuweilin: Resolved the conflict about non-existing zstd22 in arch/s390/boot/compressed/Makefile]
Signed-off-by: SzuWei Lin <szuweilin@google.com>
(cherry picked from commit dd18c291f9a958a1e285ce0e84ec6b5879fe10ab)
2024-05-08 03:00:11 +03:00
..
compressed BACKPORT: UPSTREAM: kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} 2024-05-08 03:00:11 +03:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
als.c s390: simplify disabled_wait 2019-05-02 13:54:11 +02:00
boot.h s390 updates for the 5.4 merge window 2019-09-17 14:04:43 -07:00
cmdline.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ctype.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ebcdic.c s390/decompressor: avoid reusing uncompressed image objects 2018-06-25 10:14:39 +02:00
head_kdump.S s390/boot: make head.S and als.c be part of the decompressor only 2018-06-25 10:14:38 +02:00
head.S s390/startup: avoid save_area_sync overflow 2020-09-29 15:00:59 +02:00
install.sh s390/arch: install kernels with their proper version ID 2020-02-19 17:27:24 +01:00
ipl_parm.c s390/ipl_parm: fix program check new psw handling 2021-07-20 16:05:44 +02:00
ipl_report.c s390/ipl: add missing intersection check to ipl_report handling 2023-03-22 13:30:05 +01:00
ipl_vmparm.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
kaslr.c s390/kaslr: correct and explain randomization base generation 2020-09-29 15:00:58 +02:00
machine_kexec_reloc.c s390/kernel: build a relocatable kernel 2019-04-29 10:47:10 +02:00
Makefile s390/boot: enable .bss section for compressed kernel 2020-09-16 14:08:47 +02:00
mem_detect.c s390/mem_detect: fix tprot() program check new psw handling 2021-07-20 16:05:44 +02:00
mem.S s390/decompressor: reuse lib/mem.S for mem functions 2018-06-25 10:14:39 +02:00
pgm_check_info.c s390/startup: correct early pgm check info formatting 2020-10-02 14:40:49 +02:00
sclp_early_core.c s390/decompressor: avoid reusing uncompressed image objects 2018-06-25 10:14:39 +02:00
startup.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
string.c UPSTREAM: kasan, x86, s390: update undef CONFIG_KASAN 2021-01-19 21:47:29 -08:00
text_dma.S s390/boot: fix use of expolines in the DMA code 2021-07-28 14:35:42 +02:00
uv.c s390: mm: Fix secure storage access exception handling 2021-07-14 16:55:43 +02:00
version.c s390: enable detection of kernel version from bzImage 2019-07-23 10:43:50 +02:00