1 # SPDX-License-Identifier: GPL-2.0 << 2 # 1 # 3 # linux/arch/x86/boot/compressed/Makefile !! 2 # linux/arch/i386/boot/compressed/Makefile 4 # 3 # 5 # create a compressed vmlinux image from the o 4 # create a compressed vmlinux image from the original vmlinux 6 # 5 # 7 # vmlinuz is: << 8 # decompression code (*.o) << 9 # asm globals (piggy.S), including: << 10 # vmlinux.bin.(gz|bz2|lzma|...) << 11 # << 12 # vmlinux.bin is: << 13 # vmlinux stripped of debugging and comm << 14 # vmlinux.bin.all is: << 15 # vmlinux.bin + vmlinux.relocs << 16 # vmlinux.bin.(gz|bz2|lzma|...) is: << 17 # (see scripts/Makefile.lib size_append) << 18 # compressed vmlinux.bin.all + u32 size << 19 << 20 targets := vmlinux vmlinux.bin vmlinux.bin.gz << 21 vmlinux.bin.xz vmlinux.bin.lzo vmlinux << 22 << 23 # CLANG_FLAGS must come before any cc-disable- << 24 # case of cross compiling, as it has the '--ta << 25 # avoid errors with '-march=i386', and future << 26 # be valid. << 27 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) << 28 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE << 29 KBUILD_CFLAGS += -Wundef << 30 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING << 31 cflags-$(CONFIG_X86_32) := -march=i386 << 32 cflags-$(CONFIG_X86_64) := -mcmodel=small -mno << 33 KBUILD_CFLAGS += $(cflags-y) << 34 KBUILD_CFLAGS += -mno-mmx -mno-sse << 35 KBUILD_CFLAGS += -ffreestanding -fshort-wchar << 36 KBUILD_CFLAGS += -fno-stack-protector << 37 KBUILD_CFLAGS += $(call cc-disable-warning, ad << 38 KBUILD_CFLAGS += $(call cc-disable-warning, gn << 39 KBUILD_CFLAGS += -Wno-pointer-sign << 40 KBUILD_CFLAGS += $(call cc-option,-fmacro-pref << 41 KBUILD_CFLAGS += -fno-asynchronous-unwind-tabl << 42 KBUILD_CFLAGS += -D__DISABLE_EXPORTS << 43 # Disable relocation relaxation in case the li << 44 KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)- << 45 KBUILD_CFLAGS += -include $(srctree)/include/l << 46 << 47 # sev.c indirectly includes inat-table.h which << 48 # compilation and stored in $(objtree). Add th << 49 # that the compiler finds it even with out-of- << 50 CFLAGS_sev.o += -I$(objtree)/arch/x86/lib/ << 51 << 52 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBL << 53 << 54 KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) << 55 KBUILD_LDFLAGS += $(call ld-option,--no-ld-gen << 56 # Compressed kernel should be built as PIE sin << 57 # address by the bootloader. << 58 LDFLAGS_vmlinux := -pie $(call ld-option, --no << 59 ifdef CONFIG_LD_ORPHAN_WARN << 60 LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_ << 61 endif << 62 LDFLAGS_vmlinux += -z noexecstack << 63 ifeq ($(CONFIG_LD_IS_BFD),y) << 64 LDFLAGS_vmlinux += $(call ld-option,--no-warn- << 65 endif << 66 ifeq ($(CONFIG_EFI_STUB),y) << 67 # ensure that the static EFI stub library will << 68 # never referenced explicitly from the startup << 69 LDFLAGS_vmlinux += -u efi_pe_entry << 70 endif << 71 LDFLAGS_vmlinux += -T << 72 << 73 hostprogs := mkpiggy << 74 HOST_EXTRACFLAGS += -I$(srctree)/tools/include << 75 << 76 sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGR << 77 << 78 quiet_cmd_voffset = VOFFSET $@ << 79 cmd_voffset = $(NM) $< | sed -n $(sed-vo << 80 << 81 targets += ../voffset.h << 82 << 83 $(obj)/../voffset.h: vmlinux FORCE << 84 $(call if_changed,voffset) << 85 << 86 $(obj)/misc.o: $(obj)/../voffset.h << 87 << 88 vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/ke << 89 $(obj)/misc.o $(obj)/string.o $(obj)/c << 90 $(obj)/piggy.o $(obj)/cpuflags.o << 91 << 92 vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/ << 93 vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj << 94 ifdef CONFIG_X86_64 << 95 vmlinux-objs-y += $(obj)/ident_map_64. << 96 vmlinux-objs-y += $(obj)/idt_64.o $(ob << 97 vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) << 98 vmlinux-objs-y += $(obj)/pgtable_64.o << 99 vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) << 100 endif << 101 << 102 vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o << 103 vmlinux-objs-$(CONFIG_INTEL_TDX_GUEST) += $(ob << 104 vmlinux-objs-$(CONFIG_UNACCEPTED_MEMORY) += $( << 105 << 106 vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o << 107 vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi << 108 vmlinux-libs-$(CONFIG_EFI_STUB) += $(objtree)/ << 109 6 110 $(obj)/vmlinux: $(vmlinux-objs-y) $(vmlinux-li !! 7 targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o >> 8 EXTRA_AFLAGS := -traditional >> 9 >> 10 LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 >> 11 >> 12 $(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE 111 $(call if_changed,ld) 13 $(call if_changed,ld) >> 14 @: 112 15 113 OBJCOPYFLAGS_vmlinux.bin := -R .comment -S << 114 $(obj)/vmlinux.bin: vmlinux FORCE 16 $(obj)/vmlinux.bin: vmlinux FORCE 115 $(call if_changed,objcopy) 17 $(call if_changed,objcopy) 116 18 117 targets += $(patsubst $(obj)/%,%,$(vmlinux-obj !! 19 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 118 !! 20 $(call if_changed,gzip) 119 # vmlinux.relocs is created by the vmlinux pos << 120 $(obj)/vmlinux.relocs: vmlinux << 121 @true << 122 21 123 vmlinux.bin.all-y := $(obj)/vmlinux.bin !! 22 LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T 124 vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $ << 125 23 126 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FO !! 24 $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE 127 $(call if_changed,gzip) !! 25 $(call if_changed,ld) 128 $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) F << 129 $(call if_changed,bzip2_with_size) << 130 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) << 131 $(call if_changed,lzma_with_size) << 132 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FO << 133 $(call if_changed,xzkern_with_size) << 134 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) F << 135 $(call if_changed,lzo_with_size) << 136 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) F << 137 $(call if_changed,lz4_with_size) << 138 $(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) F << 139 $(call if_changed,zstd22_with_size) << 140 << 141 suffix-$(CONFIG_KERNEL_GZIP) := gz << 142 suffix-$(CONFIG_KERNEL_BZIP2) := bz2 << 143 suffix-$(CONFIG_KERNEL_LZMA) := lzma << 144 suffix-$(CONFIG_KERNEL_XZ) := xz << 145 suffix-$(CONFIG_KERNEL_LZO) := lzo << 146 suffix-$(CONFIG_KERNEL_LZ4) := lz4 << 147 suffix-$(CONFIG_KERNEL_ZSTD) := zst << 148 << 149 quiet_cmd_mkpiggy = MKPIGGY $@ << 150 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ << 151 << 152 targets += piggy.S << 153 $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) << 154 $(call if_changed,mkpiggy) <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.