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 \
8 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
10 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
11 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
12 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
13 cflags-$(CONFIG_X86_32) := -march=i386
14 cflags-$(CONFIG_X86_64) := -mcmodel=small
15 KBUILD_CFLAGS += $(cflags-y)
16 KBUILD_CFLAGS += -mno-mmx -mno-sse
17 KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
18 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
20 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
23 LDFLAGS := -m elf_$(UTS_MACHINE)
26 hostprogs-y := mkpiggy
27 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
29 VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
30 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
33 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
35 ifeq ($(CONFIG_EFI_STUB), y)
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
39 $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
43 OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
44 $(obj)/vmlinux.bin: vmlinux FORCE
45 $(call if_changed,objcopy)
47 targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
49 CMD_RELOCS = arch/x86/tools/relocs
50 quiet_cmd_relocs = RELOCS $@
51 cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
52 $(obj)/vmlinux.relocs: vmlinux FORCE
53 $(call if_changed,relocs)
55 vmlinux.bin.all-y := $(obj)/vmlinux.bin
56 vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
58 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
59 $(call if_changed,gzip)
60 $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
61 $(call if_changed,bzip2)
62 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
63 $(call if_changed,lzma)
64 $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
65 $(call if_changed,xzkern)
66 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
67 $(call if_changed,lzo)
68 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
69 $(call if_changed,lz4)
71 suffix-$(CONFIG_KERNEL_GZIP) := gz
72 suffix-$(CONFIG_KERNEL_BZIP2) := bz2
73 suffix-$(CONFIG_KERNEL_LZMA) := lzma
74 suffix-$(CONFIG_KERNEL_XZ) := xz
75 suffix-$(CONFIG_KERNEL_LZO) := lzo
76 suffix-$(CONFIG_KERNEL_LZ4) := lz4
78 quiet_cmd_mkpiggy = MKPIGGY $@
79 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
82 $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
83 $(call if_changed,mkpiggy)