blob: e398bb5d63bb2656570999fffe4d1729928430b3 [file] [log] [blame]
Sam Ravnborgdb569af2008-01-30 13:32:30 +01001#
2# linux/arch/x86/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
Lasse Collin30314802011-01-12 17:01:24 -08007targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
Sam Ravnborgdb569af2008-01-30 13:32:30 +01008
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
H. Peter Anvin95a38f32009-04-01 17:35:00 -070011KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
H. Peter Anvin17a2a9b2009-12-25 15:40:38 -080012cflags-$(CONFIG_X86_32) := -march=i386
Sam Ravnborgdb569af2008-01-30 13:32:30 +010013cflags-$(CONFIG_X86_64) := -mcmodel=small
14KBUILD_CFLAGS += $(cflags-y)
15KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
16KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
17
18KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
Peter Oberparleiter7bf99fb2009-06-17 16:28:09 -070019GCOV_PROFILE := n
Sam Ravnborgdb569af2008-01-30 13:32:30 +010020
21LDFLAGS := -m elf_$(UTS_MACHINE)
22LDFLAGS_vmlinux := -T
23
H. Peter Anvin02a884c2009-05-08 17:42:16 -070024hostprogs-y := mkpiggy
Matt Fleming12871c52012-02-28 13:37:22 +000025HOST_EXTRACFLAGS += -I$(srctree)/tools/include
H. Peter Anvin02a884c2009-05-08 17:42:16 -070026
Matt Fleming291f3632011-12-12 21:27:52 +000027VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
28 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
29 $(obj)/piggy.o
30
31ifeq ($(CONFIG_EFI_STUB), y)
32 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
33endif
34
35$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
Sam Ravnborgdb569af2008-01-30 13:32:30 +010036 $(call if_changed,ld)
37 @:
38
Ian Campbell099e1372008-02-13 20:54:58 +000039OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
Sam Ravnborgdb569af2008-01-30 13:32:30 +010040$(obj)/vmlinux.bin: vmlinux FORCE
41 $(call if_changed,objcopy)
42
H. Peter Anvin6520fe52012-05-08 21:22:24 +030043targets += vmlinux.bin.all vmlinux.relocs
Sam Ravnborgdb569af2008-01-30 13:32:30 +010044
H. Peter Anvin6520fe52012-05-08 21:22:24 +030045CMD_RELOCS = arch/x86/tools/relocs
Sam Ravnborgdb569af2008-01-30 13:32:30 +010046quiet_cmd_relocs = RELOCS $@
H. Peter Anvin6520fe52012-05-08 21:22:24 +030047 cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
48$(obj)/vmlinux.relocs: vmlinux FORCE
Sam Ravnborgdb569af2008-01-30 13:32:30 +010049 $(call if_changed,relocs)
50
51vmlinux.bin.all-y := $(obj)/vmlinux.bin
H. Peter Anvin5f11e022009-05-05 22:53:11 -070052vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
Sam Ravnborgdb569af2008-01-30 13:32:30 +010053
H. Peter Anvin5f11e022009-05-05 22:53:11 -070054$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
Sam Ravnborgdb569af2008-01-30 13:32:30 +010055 $(call if_changed,gzip)
H. Peter Anvin5f11e022009-05-05 22:53:11 -070056$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
Alain Knaffae03c492009-01-04 22:46:17 +010057 $(call if_changed,bzip2)
H. Peter Anvin5f11e022009-05-05 22:53:11 -070058$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
Alain Knaffae03c492009-01-04 22:46:17 +010059 $(call if_changed,lzma)
Lasse Collin30314802011-01-12 17:01:24 -080060$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
61 $(call if_changed,xzkern)
Albin Tonnerre13510992010-01-08 14:42:45 -080062$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
63 $(call if_changed,lzo)
Sam Ravnborgdb569af2008-01-30 13:32:30 +010064
H. Peter Anvin283ab1c2009-05-08 15:32:47 -070065suffix-$(CONFIG_KERNEL_GZIP) := gz
66suffix-$(CONFIG_KERNEL_BZIP2) := bz2
67suffix-$(CONFIG_KERNEL_LZMA) := lzma
Lasse Collin30314802011-01-12 17:01:24 -080068suffix-$(CONFIG_KERNEL_XZ) := xz
Albin Tonnerre13510992010-01-08 14:42:45 -080069suffix-$(CONFIG_KERNEL_LZO) := lzo
Alain Knaffae03c492009-01-04 22:46:17 +010070
H. Peter Anvin02a884c2009-05-08 17:42:16 -070071quiet_cmd_mkpiggy = MKPIGGY $@
72 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
73
74targets += piggy.S
75$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
76 $(call if_changed,mkpiggy)