2019-05-19 13:07:45 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2017-08-20 10:52:22 +02:00
|
|
|
#
|
|
|
|
|
# linux/arch/parisc/boot/compressed/Makefile
|
|
|
|
|
#
|
|
|
|
|
# create a compressed self-extracting vmlinux image from the original vmlinux
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
KCOV_INSTRUMENT := n
|
|
|
|
|
GCOV_PROFILE := n
|
|
|
|
|
UBSAN_SANITIZE := n
|
|
|
|
|
|
2021-10-31 02:57:21 +09:00
|
|
|
OBJECTS := head.o real2.o firmware.o misc.o piggy.o
|
2017-08-20 10:52:22 +02:00
|
|
|
targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
|
|
|
|
|
targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
|
2021-10-31 02:57:21 +09:00
|
|
|
targets += $(OBJECTS) sizes.h
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
|
|
|
|
|
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
2020-05-08 11:35:43 +02:00
|
|
|
KBUILD_CFLAGS += -fno-strict-aliasing
|
2018-10-15 22:14:01 +02:00
|
|
|
KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf
|
2017-09-22 21:57:11 +02:00
|
|
|
KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
|
2017-08-20 10:52:22 +02:00
|
|
|
ifndef CONFIG_64BIT
|
|
|
|
|
KBUILD_CFLAGS += -mfast-indirect-calls
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
LDFLAGS_vmlinux := -X -e startup --as-needed -T
|
2021-10-31 02:57:21 +09:00
|
|
|
$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
|
2017-08-20 10:52:22 +02:00
|
|
|
$(call if_changed,ld)
|
|
|
|
|
|
|
|
|
|
sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
|
|
|
|
|
|
|
|
|
|
quiet_cmd_sizes = GEN $@
|
|
|
|
|
cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
|
|
|
|
|
|
2021-09-05 11:50:56 +02:00
|
|
|
$(obj)/sizes.h: vmlinux FORCE
|
2017-08-20 10:52:22 +02:00
|
|
|
$(call if_changed,sizes)
|
|
|
|
|
|
|
|
|
|
AFLAGS_head.o += -I$(objtree)/$(obj) -DBOOTLOADER
|
|
|
|
|
$(obj)/head.o: $(obj)/sizes.h
|
|
|
|
|
|
|
|
|
|
CFLAGS_misc.o += -I$(objtree)/$(obj)
|
|
|
|
|
$(obj)/misc.o: $(obj)/sizes.h
|
|
|
|
|
|
|
|
|
|
AFLAGS_real2.o += -DBOOTLOADER
|
|
|
|
|
|
|
|
|
|
CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
|
|
|
|
|
$(obj)/vmlinux.lds: $(obj)/sizes.h
|
|
|
|
|
|
2019-08-01 13:42:18 +02:00
|
|
|
OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
|
|
|
|
|
$(obj)/vmlinux.bin: vmlinux FORCE
|
2017-08-20 10:52:22 +02:00
|
|
|
$(call if_changed,objcopy)
|
|
|
|
|
|
|
|
|
|
suffix-$(CONFIG_KERNEL_GZIP) := gz
|
|
|
|
|
suffix-$(CONFIG_KERNEL_BZIP2) := bz2
|
|
|
|
|
suffix-$(CONFIG_KERNEL_LZ4) := lz4
|
|
|
|
|
suffix-$(CONFIG_KERNEL_LZMA) := lzma
|
|
|
|
|
suffix-$(CONFIG_KERNEL_LZO) := lzo
|
|
|
|
|
suffix-$(CONFIG_KERNEL_XZ) := xz
|
|
|
|
|
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
|
2017-08-20 10:52:22 +02:00
|
|
|
$(call if_changed,gzip)
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
|
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>
2022-01-10 03:15:27 +09:00
|
|
|
$(call if_changed,bzip2_with_size)
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
|
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>
2022-01-10 03:15:27 +09:00
|
|
|
$(call if_changed,lz4_with_size)
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
|
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>
2022-01-10 03:15:27 +09:00
|
|
|
$(call if_changed,lzma_with_size)
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
|
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>
2022-01-10 03:15:27 +09:00
|
|
|
$(call if_changed,lzo_with_size)
|
2022-01-10 03:15:28 +09:00
|
|
|
$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
|
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>
2022-01-10 03:15:27 +09:00
|
|
|
$(call if_changed,xzkern_with_size)
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
|
2021-09-05 11:50:56 +02:00
|
|
|
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
|
2017-08-20 10:52:22 +02:00
|
|
|
$(call if_changed,ld)
|