xref: /openbmc/linux/arch/x86/boot/compressed/Makefile (revision 17a2a9b5)
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
7fc0ce235SJan Beulichtargets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o
8db569afaSSam Ravnborg
9db569afaSSam RavnborgKBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10db569afaSSam RavnborgKBUILD_CFLAGS += -fno-strict-aliasing -fPIC
1195a38f34SH. Peter AnvinKBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
1217a2a9b5SH. Peter Anvincflags-$(CONFIG_X86_32) := -march=i386
13db569afaSSam Ravnborgcflags-$(CONFIG_X86_64) := -mcmodel=small
14db569afaSSam RavnborgKBUILD_CFLAGS += $(cflags-y)
15db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-ffreestanding)
16db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
17db569afaSSam Ravnborg
18db569afaSSam RavnborgKBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
197bf99fb6SPeter OberparleiterGCOV_PROFILE := n
20db569afaSSam Ravnborg
21db569afaSSam RavnborgLDFLAGS := -m elf_$(UTS_MACHINE)
22db569afaSSam RavnborgLDFLAGS_vmlinux := -T
23db569afaSSam Ravnborg
2402a884c0SH. Peter Anvinhostprogs-y	:= mkpiggy
2502a884c0SH. Peter Anvin
2651b26adaSLinus Torvalds$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
27db569afaSSam Ravnborg	$(call if_changed,ld)
28db569afaSSam Ravnborg	@:
29db569afaSSam Ravnborg
30099e1377SIan CampbellOBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
31db569afaSSam Ravnborg$(obj)/vmlinux.bin: vmlinux FORCE
32db569afaSSam Ravnborg	$(call if_changed,objcopy)
33db569afaSSam Ravnborg
34db569afaSSam Ravnborg
357f16a339SH. Peter Anvintargets += vmlinux.bin.all vmlinux.relocs relocs
365f11e020SH. Peter Anvinhostprogs-$(CONFIG_X86_NEED_RELOCS) += relocs
37db569afaSSam Ravnborg
38db569afaSSam Ravnborgquiet_cmd_relocs = RELOCS  $@
39db569afaSSam Ravnborg      cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $<
40db569afaSSam Ravnborg$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE
41db569afaSSam Ravnborg	$(call if_changed,relocs)
42db569afaSSam Ravnborg
43db569afaSSam Ravnborgvmlinux.bin.all-y := $(obj)/vmlinux.bin
445f11e020SH. Peter Anvinvmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
45db569afaSSam Ravnborg
465f11e020SH. Peter Anvin$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
47db569afaSSam Ravnborg	$(call if_changed,gzip)
485f11e020SH. Peter Anvin$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
49ae03c499SAlain Knaff	$(call if_changed,bzip2)
505f11e020SH. Peter Anvin$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
51ae03c499SAlain Knaff	$(call if_changed,lzma)
52db569afaSSam Ravnborg
53283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_GZIP)	:= gz
54283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
55283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_LZMA)	:= lzma
56ae03c499SAlain Knaff
5702a884c0SH. Peter Anvinquiet_cmd_mkpiggy = MKPIGGY $@
5802a884c0SH. Peter Anvin      cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
5902a884c0SH. Peter Anvin
6002a884c0SH. Peter Anvintargets += piggy.S
6102a884c0SH. Peter Anvin$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
6202a884c0SH. Peter Anvin	$(call if_changed,mkpiggy)
63