2 # linux/arch/x86/boot/compressed/Makefile
4 # create a compressed vmlinux image from the original vmlinux
7 targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o
9 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
11 cflags-$(CONFIG_X86_64) := -mcmodel=small
12 KBUILD_CFLAGS += $(cflags-y)
13 KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
14 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
16 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
18 LDFLAGS := -m elf_$(UTS_MACHINE)
21 $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
25 OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
26 $(obj)/vmlinux.bin: vmlinux FORCE
27 $(call if_changed,objcopy)
30 targets += vmlinux.bin.all vmlinux.relocs relocs
31 hostprogs-$(CONFIG_X86_32) += relocs
33 quiet_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)
38 vmlinux.bin.all-y := $(obj)/vmlinux.bin
39 vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs
40 quiet_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)
45 ifeq ($(CONFIG_X86_32),y)
47 ifdef CONFIG_RELOCATABLE
48 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
49 $(call if_changed,gzip)
50 $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin.all FORCE
51 $(call if_changed,bzip2)
52 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE
53 $(call if_changed,lzma)
55 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
56 $(call if_changed,gzip)
57 $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
58 $(call if_changed,bzip2)
59 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
60 $(call if_changed,lzma)
62 LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
66 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
67 $(call if_changed,gzip)
68 $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
69 $(call if_changed,bzip2)
70 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
71 $(call if_changed,lzma)
73 LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T
76 suffix_$(CONFIG_KERNEL_GZIP) = gz
77 suffix_$(CONFIG_KERNEL_BZIP2) = bz2
78 suffix_$(CONFIG_KERNEL_LZMA) = lzma
80 $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE