xref: /openbmc/linux/arch/x86/boot/compressed/Makefile (revision 12871c56)
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
730314804SLasse Collintargets := 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
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
2512871c56SMatt FlemingHOST_EXTRACFLAGS += -I$(srctree)/tools/include
2602a884c0SH. Peter Anvin
27291f3632SMatt FlemingVMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
28291f3632SMatt Fleming	$(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
29291f3632SMatt Fleming	$(obj)/piggy.o
30291f3632SMatt Fleming
31291f3632SMatt Flemingifeq ($(CONFIG_EFI_STUB), y)
32291f3632SMatt Fleming	VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
33291f3632SMatt Flemingendif
34291f3632SMatt Fleming
35291f3632SMatt Fleming$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
36db569afaSSam Ravnborg	$(call if_changed,ld)
37db569afaSSam Ravnborg	@:
38db569afaSSam Ravnborg
39099e1377SIan CampbellOBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
40db569afaSSam Ravnborg$(obj)/vmlinux.bin: vmlinux FORCE
41db569afaSSam Ravnborg	$(call if_changed,objcopy)
42db569afaSSam Ravnborg
43db569afaSSam Ravnborg
447f16a339SH. Peter Anvintargets += vmlinux.bin.all vmlinux.relocs relocs
455f11e020SH. Peter Anvinhostprogs-$(CONFIG_X86_NEED_RELOCS) += relocs
46db569afaSSam Ravnborg
47db569afaSSam Ravnborgquiet_cmd_relocs = RELOCS  $@
48db569afaSSam Ravnborg      cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $<
49db569afaSSam Ravnborg$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE
50db569afaSSam Ravnborg	$(call if_changed,relocs)
51db569afaSSam Ravnborg
52db569afaSSam Ravnborgvmlinux.bin.all-y := $(obj)/vmlinux.bin
535f11e020SH. Peter Anvinvmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
54db569afaSSam Ravnborg
555f11e020SH. Peter Anvin$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
56db569afaSSam Ravnborg	$(call if_changed,gzip)
575f11e020SH. Peter Anvin$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
58ae03c499SAlain Knaff	$(call if_changed,bzip2)
595f11e020SH. Peter Anvin$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
60ae03c499SAlain Knaff	$(call if_changed,lzma)
6130314804SLasse Collin$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
6230314804SLasse Collin	$(call if_changed,xzkern)
6313510997SAlbin Tonnerre$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
6413510997SAlbin Tonnerre	$(call if_changed,lzo)
65db569afaSSam Ravnborg
66283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_GZIP)	:= gz
67283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
68283ab1c0SH. Peter Anvinsuffix-$(CONFIG_KERNEL_LZMA)	:= lzma
6930314804SLasse Collinsuffix-$(CONFIG_KERNEL_XZ)	:= xz
7013510997SAlbin Tonnerresuffix-$(CONFIG_KERNEL_LZO) 	:= lzo
71ae03c499SAlain Knaff
7202a884c0SH. Peter Anvinquiet_cmd_mkpiggy = MKPIGGY $@
7302a884c0SH. Peter Anvin      cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
7402a884c0SH. Peter Anvin
7502a884c0SH. Peter Anvintargets += piggy.S
7602a884c0SH. Peter Anvin$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
7702a884c0SH. Peter Anvin	$(call if_changed,mkpiggy)
78