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 7db569afaSSam Ravnborgtargets := vmlinux vmlinux.bin vmlinux.bin.gz head_$(BITS).o misc_$(BITS).o piggy.o 8db569afaSSam Ravnborg 9db569afaSSam RavnborgKBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 10db569afaSSam RavnborgKBUILD_CFLAGS += -fno-strict-aliasing -fPIC 11db569afaSSam Ravnborgcflags-$(CONFIG_X86_64) := -mcmodel=small 12db569afaSSam RavnborgKBUILD_CFLAGS += $(cflags-y) 13db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-ffreestanding) 14db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 15db569afaSSam Ravnborg 16db569afaSSam RavnborgKBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 17db569afaSSam Ravnborg 18db569afaSSam RavnborgLDFLAGS := -m elf_$(UTS_MACHINE) 19db569afaSSam RavnborgLDFLAGS_vmlinux := -T 20db569afaSSam Ravnborg 21db569afaSSam Ravnborg$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc_$(BITS).o $(obj)/piggy.o FORCE 22db569afaSSam Ravnborg $(call if_changed,ld) 23db569afaSSam Ravnborg @: 24db569afaSSam Ravnborg 25db569afaSSam Ravnborg$(obj)/vmlinux.bin: vmlinux FORCE 26db569afaSSam Ravnborg $(call if_changed,objcopy) 27db569afaSSam Ravnborg 28db569afaSSam Ravnborg 290530bf37SThomas Gleixnerifeq ($(CONFIG_X86_32),y) 30db569afaSSam Ravnborgtargets += vmlinux.bin.all vmlinux.relocs 31db569afaSSam Ravnborghostprogs-y := relocs 32db569afaSSam Ravnborg 33db569afaSSam Ravnborgquiet_cmd_relocs = RELOCS $@ 34db569afaSSam Ravnborg cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $< 35db569afaSSam Ravnborg$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE 36db569afaSSam Ravnborg $(call if_changed,relocs) 37db569afaSSam Ravnborg 38db569afaSSam Ravnborgvmlinux.bin.all-y := $(obj)/vmlinux.bin 39db569afaSSam Ravnborgvmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs 40db569afaSSam Ravnborgquiet_cmd_relocbin = BUILD $@ 41db569afaSSam Ravnborg cmd_relocbin = cat $(filter-out FORCE,$^) > $@ 42db569afaSSam Ravnborg$(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE 43db569afaSSam Ravnborg $(call if_changed,relocbin) 44db569afaSSam Ravnborg 45db569afaSSam Ravnborgifdef CONFIG_RELOCATABLE 46db569afaSSam Ravnborg$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE 47db569afaSSam Ravnborg $(call if_changed,gzip) 480530bf37SThomas Gleixnerelse 49db569afaSSam Ravnborg$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 50db569afaSSam Ravnborg $(call if_changed,gzip) 510530bf37SThomas Gleixnerendif 52db569afaSSam RavnborgLDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T 53db569afaSSam Ravnborg 54db569afaSSam Ravnborgelse 55db569afaSSam Ravnborg$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 56db569afaSSam Ravnborg $(call if_changed,gzip) 57db569afaSSam Ravnborg 58db569afaSSam RavnborgLDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T 59db569afaSSam Ravnborgendif 60db569afaSSam Ravnborg 61db569afaSSam Ravnborg 62db569afaSSam Ravnborg$(obj)/piggy.o: $(obj)/vmlinux_$(BITS).scr $(obj)/vmlinux.bin.gz FORCE 63db569afaSSam Ravnborg $(call if_changed,ld) 64