usb: typec: mux: fix static inline syntax error
[platform/kernel/linux-starfive.git] / drivers / firmware / efi / libstub / Makefile.zboot
1 # SPDX-License-Identifier: GPL-2.0
2
3 # to be include'd by arch/$(ARCH)/boot/Makefile after setting
4 # EFI_ZBOOT_PAYLOAD, EFI_ZBOOT_BFD_TARGET, EFI_ZBOOT_MACH_TYPE and
5 # EFI_ZBOOT_FORWARD_CFI
6
7 quiet_cmd_copy_and_pad = PAD     $@
8       cmd_copy_and_pad = cp $< $@ && \
9                          truncate -s $(shell hexdump -s16 -n4 -e '"%u"' $<) $@
10
11 # Pad the file to the size of the uncompressed image in memory, including BSS
12 $(obj)/vmlinux.bin: $(obj)/$(EFI_ZBOOT_PAYLOAD) FORCE
13         $(call if_changed,copy_and_pad)
14
15 comp-type-$(CONFIG_KERNEL_GZIP)         := gzip
16 comp-type-$(CONFIG_KERNEL_LZ4)          := lz4
17 comp-type-$(CONFIG_KERNEL_LZMA)         := lzma
18 comp-type-$(CONFIG_KERNEL_LZO)          := lzo
19 comp-type-$(CONFIG_KERNEL_XZ)           := xzkern
20 comp-type-$(CONFIG_KERNEL_ZSTD)         := zstd22
21
22 # in GZIP, the appended le32 carrying the uncompressed size is part of the
23 # 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.
26 zboot-method-y                         := $(comp-type-y)_with_size
27 zboot-size-len-y                       := 4
28
29 zboot-method-$(CONFIG_KERNEL_GZIP)     := gzip
30 zboot-size-len-$(CONFIG_KERNEL_GZIP)   := 0
31
32 $(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE
33         $(call if_changed,$(zboot-method-y))
34
35 OBJCOPYFLAGS_vmlinuz.o := -I binary -O $(EFI_ZBOOT_BFD_TARGET) $(EFI_ZBOOT_OBJCOPY_FLAGS) \
36                           --rename-section .data=.gzdata,load,alloc,readonly,contents
37 $(obj)/vmlinuz.o: $(obj)/vmlinuz FORCE
38         $(call if_changed,objcopy)
39
40 aflags-zboot-header-$(EFI_ZBOOT_FORWARD_CFI) := \
41                 -DPE_DLL_CHAR_EX=IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT
42
43 AFLAGS_zboot-header.o += -DMACHINE_TYPE=IMAGE_FILE_MACHINE_$(EFI_ZBOOT_MACH_TYPE) \
44                          -DZBOOT_EFI_PATH="\"$(realpath $(obj)/vmlinuz.efi.elf)\"" \
45                          -DZBOOT_SIZE_LEN=$(zboot-size-len-y) \
46                          -DCOMP_TYPE="\"$(comp-type-y)\"" \
47                          $(aflags-zboot-header-y)
48
49 $(obj)/zboot-header.o: $(srctree)/drivers/firmware/efi/libstub/zboot-header.S FORCE
50         $(call if_changed_rule,as_o_S)
51
52 ZBOOT_DEPS := $(obj)/zboot-header.o $(objtree)/drivers/firmware/efi/libstub/lib.a
53
54 LDFLAGS_vmlinuz.efi.elf := -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds
55 $(obj)/vmlinuz.efi.elf: $(obj)/vmlinuz.o $(ZBOOT_DEPS) FORCE
56         $(call if_changed,ld)
57
58 OBJCOPYFLAGS_vmlinuz.efi := -O binary
59 $(obj)/vmlinuz.efi: $(obj)/vmlinuz.efi.elf FORCE
60         $(call if_changed,objcopy)
61
62 targets += zboot-header.o vmlinux.bin vmlinuz vmlinuz.o vmlinuz.efi.elf vmlinuz.efi