Skip to content

Commit

Permalink
kbuild: add cmd_file_size
Browse files Browse the repository at this point in the history
Some architectures support self-extracting kernel, which embeds the
compressed vmlinux.

It has 4 byte data at the end so the decompressor can know the vmlinux
size beforehand.

GZIP natively has it in the trailer, but for the other compression
algorithms, the hand-crafted trailer is added.

It is unneeded to generate such _corrupted_ compressed files because
it is possible to pass the size data as a separate file.

For example, the assembly code:

     .incbin "compressed-vmlinux-with-size-data"

can be transformed to:

     .incbin "compressed-vmlinux"
     .incbin "size-data"

My hope is, after some reworks of the decompressors, the macros
cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}_with_size will go away.

This new macro, cmd_file_size, will be useful to generate a separate
size-data file.

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
  • Loading branch information
masahir0y committed Jan 13, 2022
1 parent 53e7b5d commit c4d7f40
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ printf "%08x\n" $$dec_size | \
} \
)

quiet_cmd_file_size = GEN $@
cmd_file_size = $(size_append) > $@

quiet_cmd_bzip2 = BZIP2 $@
cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@

Expand Down

0 comments on commit c4d7f40

Please sign in to comment.