1. 13 Jan, 2022 4 commits
    • Masahiro Yamada's avatar
      arch: decompressor: remove useless vmlinux.bin.all-y · 53e7b5df
      Masahiro Yamada authored
      Presumably, arch/{parisc,s390,sh}/boot/compressed/Makefile copied
      arch/x86/boot/compressed/Makefile, but vmlinux.bin.all-y is useless
      here because it is the same as $(obj)/vmlinux.bin.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      53e7b5df
    • Masahiro Yamada's avatar
      kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} · 7ce7e984
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      7ce7e984
    • Masahiro Yamada's avatar
      kbuild: drop $(size_append) from cmd_zstd · 64d8aaa4
      Masahiro Yamada authored
      The appended file size is only used by the decompressors, which some
      architectures support.
      
      As the comment "zstd22 is used for kernel compression" says, cmd_zstd22
      is used in arch/{mips,s390,x86}/boot/compressed/Makefile.
      
      On the other hand, there is no good reason to append the file size to
      cmd_zstd since it is used for other purposes.
      
      Actually cmd_zstd is only used in usr/Makefile, where the appended file
      size is rather harmful.
      
      The initramfs with its file size appended is considered as corrupted
      data, so commit 65e00e04 ("initramfs: refactor the initramfs build
      rules") added 'override size_append := :' to make it no-op.
      
      As a conclusion, this $(size_append) should not exist here.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      64d8aaa4
    • Masahiro Yamada's avatar
      sh: rename suffix-y to suffix_y · 82977af9
      Masahiro Yamada authored
      'export suffix-y' does not work reliably because hyphens are disallowed
      in shell variables.
      
      A similar issue was fixed by commit 2bfbe788 ("kbuild: Do not use
      hyphen in exported variable name").
      
      If I do similar in dash, ARCH=sh fails to build.
      
        $ mv linux linux~
        $ cd linux~
        $ dash
        $ make O=foo/bar ARCH=sh CROSS_COMPILE=sh4-linux-gnu- defconfig all
        make[1]: Entering directory '/home/masahiro/linux~/foo/bar'
          [ snip ]
        make[4]: *** No rule to make target 'arch/sh/boot/compressed/vmlinux.bin.', needed by 'arch/sh/boot/compressed/piggy.o'.  Stop.
        make[3]: *** [/home/masahiro/linux~/arch/sh/boot/Makefile:40: arch/sh/boot/compressed/vmlinux] Error 2
        make[2]: *** [/home/masahiro/linux~/arch/sh/Makefile:194: zImage] Error 2
        make[1]: *** [/home/masahiro/linux~/Makefile:350: __build_one_by_one] Error 2
        make[1]: Leaving directory '/home/masahiro/linux~/foo/bar'
        make: *** [Makefile:219: __sub-make] Error 2
      
      The maintainer of GNU Make stated that there is no consistent way to
      export variables that do not meet the shell's naming criteria.
      (https://savannah.gnu.org/bugs/?55719)
      
      Consequently, you cannot use hyphens in exported variables.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      82977af9
  2. 08 Jan, 2022 14 commits
  3. 11 Dec, 2021 7 commits
  4. 02 Dec, 2021 8 commits
  5. 28 Nov, 2021 7 commits