1# 2# linux/arch/x86/boot/compressed/Makefile 3# 4# create a compressed vmlinux image from the original vmlinux 5# 6 7targets := vmlinux vmlinux.bin vmlinux.bin.gz head_$(BITS).o misc.o piggy.o 8 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 11cflags-$(CONFIG_X86_64) := -mcmodel=small 12KBUILD_CFLAGS += $(cflags-y) 13KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 14KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 15 16KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 17 18LDFLAGS := -m elf_$(UTS_MACHINE) 19LDFLAGS_vmlinux := -T 20 21$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE 22 $(call if_changed,ld) 23 @: 24 25OBJCOPYFLAGS_vmlinux.bin := -R .comment -S 26$(obj)/vmlinux.bin: vmlinux FORCE 27 $(call if_changed,objcopy) 28 29 30targets += vmlinux.bin.all vmlinux.relocs relocs 31hostprogs-$(CONFIG_X86_32) += relocs 32 33quiet_cmd_relocs = RELOCS $@ 34 cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $< 35$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE 36 $(call if_changed,relocs) 37 38vmlinux.bin.all-y := $(obj)/vmlinux.bin 39vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs 40quiet_cmd_relocbin = BUILD $@ 41 cmd_relocbin = cat $(filter-out FORCE,$^) > $@ 42$(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE 43 $(call if_changed,relocbin) 44 45ifeq ($(CONFIG_X86_32),y) 46 47ifdef CONFIG_RELOCATABLE 48$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE 49 $(call if_changed,gzip) 50else 51$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 52 $(call if_changed,gzip) 53endif 54LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T 55 56else 57$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 58 $(call if_changed,gzip) 59 60LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T 61endif 62 63$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE 64 $(call if_changed,ld) 65