brintos

brintos / linux-shallow public Read only

0
0
Text · 2.5 KiB · 65ffd0b Raw
64 lines · plain
1# SPDX-License-Identifier: GPL-2.02 3# to be include'd by arch/$(ARCH)/boot/Makefile after setting4# EFI_ZBOOT_PAYLOAD, EFI_ZBOOT_BFD_TARGET, EFI_ZBOOT_MACH_TYPE and5# EFI_ZBOOT_FORWARD_CFI6 7quiet_cmd_copy_and_pad = PAD     $@8      cmd_copy_and_pad = cp $< $@; \9			 truncate -s $$(hexdump -s16 -n4 -e '"%u"' $<) $@10 11# Pad the file to the size of the uncompressed image in memory, including BSS12$(obj)/vmlinux.bin: $(obj)/$(EFI_ZBOOT_PAYLOAD) FORCE13	$(call if_changed,copy_and_pad)14 15comp-type-$(CONFIG_KERNEL_GZIP)		:= gzip16comp-type-$(CONFIG_KERNEL_LZ4)		:= lz417comp-type-$(CONFIG_KERNEL_LZMA)		:= lzma18comp-type-$(CONFIG_KERNEL_LZO)		:= lzo19comp-type-$(CONFIG_KERNEL_XZ)		:= xzkern20comp-type-$(CONFIG_KERNEL_ZSTD)		:= zstd2221 22# in GZIP, the appended le32 carrying the uncompressed size is part of the23# format, but in other cases, we just append it at the end for convenience,24# causing the original tools to complain when checking image integrity.25# So disregard it when calculating the payload size in the zimage header.26zboot-method-y                         := $(comp-type-y)_with_size27zboot-size-len-y                       := 428 29zboot-method-$(CONFIG_KERNEL_GZIP)     := gzip30zboot-size-len-$(CONFIG_KERNEL_GZIP)   := 031 32$(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE33	$(call if_changed,$(zboot-method-y))34 35# avoid eager evaluation to prevent references to non-existent build artifacts36OBJCOPYFLAGS_vmlinuz.o = -I binary -O $(EFI_ZBOOT_BFD_TARGET) $(EFI_ZBOOT_OBJCOPY_FLAGS) \37			  --rename-section .data=.gzdata,load,alloc,readonly,contents38$(obj)/vmlinuz.o: $(obj)/vmlinuz FORCE39	$(call if_changed,objcopy)40 41aflags-zboot-header-$(EFI_ZBOOT_FORWARD_CFI) := \42		-DPE_DLL_CHAR_EX=IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT43 44AFLAGS_zboot-header.o += -DMACHINE_TYPE=IMAGE_FILE_MACHINE_$(EFI_ZBOOT_MACH_TYPE) \45			 -DZBOOT_EFI_PATH="\"$(realpath $(obj)/vmlinuz.efi.elf)\"" \46			 -DZBOOT_SIZE_LEN=$(zboot-size-len-y) \47			 -DCOMP_TYPE="\"$(comp-type-y)\"" \48			 $(aflags-zboot-header-y)49 50$(obj)/zboot-header.o: $(srctree)/drivers/firmware/efi/libstub/zboot-header.S FORCE51	$(call if_changed_rule,as_o_S)52 53ZBOOT_DEPS := $(obj)/zboot-header.o $(objtree)/drivers/firmware/efi/libstub/lib.a54 55LDFLAGS_vmlinuz.efi.elf := -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds56$(obj)/vmlinuz.efi.elf: $(obj)/vmlinuz.o $(ZBOOT_DEPS) FORCE57	$(call if_changed,ld)58 59OBJCOPYFLAGS_vmlinuz.efi := -O binary60$(obj)/vmlinuz.efi: $(obj)/vmlinuz.efi.elf FORCE61	$(call if_changed,objcopy)62 63targets += zboot-header.o vmlinux.bin vmlinuz vmlinuz.o vmlinuz.efi.elf vmlinuz.efi64