1db569afaSSam Ravnborg# 2db569afaSSam Ravnborg# linux/arch/x86/boot/compressed/Makefile 3db569afaSSam Ravnborg# 4db569afaSSam Ravnborg# create a compressed vmlinux image from the original vmlinux 5db569afaSSam Ravnborg# 6db569afaSSam Ravnborg 7f9b493acSKyungsik Leetargets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ 8f9b493acSKyungsik Lee vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 9db569afaSSam Ravnborg 10db569afaSSam RavnborgKBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 11db569afaSSam RavnborgKBUILD_CFLAGS += -fno-strict-aliasing -fPIC 1295a38f34SH. Peter AnvinKBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 1317a2a9b5SH. Peter Anvincflags-$(CONFIG_X86_32) := -march=i386 14db569afaSSam Ravnborgcflags-$(CONFIG_X86_64) := -mcmodel=small 15db569afaSSam RavnborgKBUILD_CFLAGS += $(cflags-y) 168b3b005dSH. Peter AnvinKBUILD_CFLAGS += -mno-mmx -mno-sse 17db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-ffreestanding) 18db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 19db569afaSSam Ravnborg 20db569afaSSam RavnborgKBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 217bf99fb6SPeter OberparleiterGCOV_PROFILE := n 22db569afaSSam Ravnborg 23db569afaSSam RavnborgLDFLAGS := -m elf_$(UTS_MACHINE) 24db569afaSSam RavnborgLDFLAGS_vmlinux := -T 25db569afaSSam Ravnborg 2602a884c0SH. Peter Anvinhostprogs-y := mkpiggy 2712871c56SMatt FlemingHOST_EXTRACFLAGS += -I$(srctree)/tools/include 2802a884c0SH. Peter Anvin 299a1cb471SJosh Triplettvmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ 303afed06aSJosh Triplett $(obj)/string.o $(obj)/cmdline.o \ 319e6abd2aSJosh Triplett $(obj)/piggy.o $(obj)/cpuflags.o 329e6abd2aSJosh Triplett 333afed06aSJosh Triplettvmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o 349e6abd2aSJosh Triplettvmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o 35291f3632SMatt Fleming 369dead5bbSMatthew Garrett$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 379dead5bbSMatthew Garrett 3874da3863SLinus Torvaldsvmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 39291f3632SMatt Fleming 409a1cb471SJosh Triplett$(obj)/vmlinux: $(vmlinux-objs-y) FORCE 41db569afaSSam Ravnborg $(call if_changed,ld) 42db569afaSSam Ravnborg @: 43db569afaSSam Ravnborg 44099e1377SIan CampbellOBJCOPYFLAGS_vmlinux.bin := -R .comment -S 45db569afaSSam Ravnborg$(obj)/vmlinux.bin: vmlinux FORCE 46db569afaSSam Ravnborg $(call if_changed,objcopy) 47db569afaSSam Ravnborg 489a1cb471SJosh Tripletttargets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs 49db569afaSSam Ravnborg 506520fe55SH. Peter AnvinCMD_RELOCS = arch/x86/tools/relocs 51db569afaSSam Ravnborgquiet_cmd_relocs = RELOCS $@ 526520fe55SH. Peter Anvin cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $< 536520fe55SH. Peter Anvin$(obj)/vmlinux.relocs: vmlinux FORCE 54db569afaSSam Ravnborg $(call if_changed,relocs) 55db569afaSSam Ravnborg 56db569afaSSam Ravnborgvmlinux.bin.all-y := $(obj)/vmlinux.bin 575f11e020SH. Peter Anvinvmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs 58db569afaSSam Ravnborg 595f11e020SH. Peter Anvin$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE 60db569afaSSam Ravnborg $(call if_changed,gzip) 615f11e020SH. Peter Anvin$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE 62ae03c499SAlain Knaff $(call if_changed,bzip2) 635f11e020SH. Peter Anvin$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE 64ae03c499SAlain Knaff $(call if_changed,lzma) 6530314804SLasse Collin$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE 6630314804SLasse Collin $(call if_changed,xzkern) 6713510997SAlbin Tonnerre$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE 6813510997SAlbin Tonnerre $(call if_changed,lzo) 69f9b493acSKyungsik Lee$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE 70f9b493acSKyungsik Lee $(call if_changed,lz4) 71db569afaSSam Ravnborg 72283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_GZIP) := gz 73283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_BZIP2) := bz2 74283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_LZMA) := lzma 7530314804SLasse Collinsuffix-$(CONFIG_KERNEL_XZ) := xz 7613510997SAlbin Tonnerresuffix-$(CONFIG_KERNEL_LZO) := lzo 77f9b493acSKyungsik Leesuffix-$(CONFIG_KERNEL_LZ4) := lz4 78ae03c499SAlain Knaff 79e6023367SJunjie MaoRUN_SIZE = $(shell objdump -h vmlinux | \ 80e6023367SJunjie Mao perl $(srctree)/arch/x86/tools/calc_run_size.pl) 8102a884c0SH. Peter Anvinquiet_cmd_mkpiggy = MKPIGGY $@ 82e6023367SJunjie Mao cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) 8302a884c0SH. Peter Anvin 8402a884c0SH. Peter Anvintargets += piggy.S 8502a884c0SH. Peter Anvin$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE 8602a884c0SH. Peter Anvin $(call if_changed,mkpiggy) 87