xref: /openbmc/linux/arch/x86/boot/compressed/Makefile (revision 283ab1c0)
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
7ae03c499SAlain Knafftargets := 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
12db569afaSSam Ravnborgcflags-$(CONFIG_X86_64) := -mcmodel=small
13db569afaSSam RavnborgKBUILD_CFLAGS += $(cflags-y)
14db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-ffreestanding)
15db569afaSSam RavnborgKBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
16db569afaSSam Ravnborg
17db569afaSSam RavnborgKBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
18db569afaSSam Ravnborg
19db569afaSSam RavnborgLDFLAGS := -m elf_$(UTS_MACHINE)
20db569afaSSam RavnborgLDFLAGS_vmlinux := -T
21db569afaSSam Ravnborg
2251b26adaSLinus Torvalds$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
23db569afaSSam Ravnborg	$(call if_changed,ld)
24db569afaSSam Ravnborg	@:
25db569afaSSam Ravnborg
26099e1377SIan CampbellOBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
27db569afaSSam Ravnborg$(obj)/vmlinux.bin: vmlinux FORCE
28db569afaSSam Ravnborg	$(call if_changed,objcopy)
29db569afaSSam Ravnborg
30db569afaSSam Ravnborg
317f16a339SH. Peter Anvintargets += vmlinux.bin.all vmlinux.relocs relocs
325f11e020SH. Peter Anvinhostprogs-$(CONFIG_X86_NEED_RELOCS) += relocs
33db569afaSSam Ravnborg
34db569afaSSam Ravnborgquiet_cmd_relocs = RELOCS  $@
35db569afaSSam Ravnborg      cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $<
36db569afaSSam Ravnborg$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE
37db569afaSSam Ravnborg	$(call if_changed,relocs)
38db569afaSSam Ravnborg
39db569afaSSam Ravnborgvmlinux.bin.all-y := $(obj)/vmlinux.bin
405f11e020SH. Peter Anvinvmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
41db569afaSSam Ravnborg
425f11e020SH. Peter Anvin$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
43db569afaSSam Ravnborg	$(call if_changed,gzip)
445f11e020SH. Peter Anvin$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
45ae03c499SAlain Knaff	$(call if_changed,bzip2)
465f11e020SH. Peter Anvin$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
47ae03c499SAlain Knaff	$(call if_changed,lzma)
48db569afaSSam Ravnborg
49283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_GZIP)	:= gz
50283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
51283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_LZMA)	:= lzma
52ae03c499SAlain Knaff
535f11e020SH. Peter AnvinLDFLAGS_piggy.o := -r --format binary --oformat $(CONFIG_OUTPUT_FORMAT) -T
54283ab1c0SH. Peter Anvin$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
55db569afaSSam Ravnborg	$(call if_changed,ld)
56