0fcd9133790c566423b313fccef95a0768bd0d07
[deliverable/linux.git] / arch / x86 / boot / compressed / Makefile
1 #
2 # linux/arch/x86/boot/compressed/Makefile
3 #
4 # create a compressed vmlinux image from the original vmlinux
5 #
6
7 targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
8 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
9
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)
19
20 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
21 GCOV_PROFILE := n
22
23 LDFLAGS := -m elf_$(UTS_MACHINE)
24 LDFLAGS_vmlinux := -T
25
26 hostprogs-y := mkpiggy
27 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
28
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 \
31 $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o
32
33 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34
35 ifeq ($(CONFIG_EFI_STUB), y)
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
37 endif
38
39 $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
40 $(call if_changed,ld)
41 @:
42
43 OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
44 $(obj)/vmlinux.bin: vmlinux FORCE
45 $(call if_changed,objcopy)
46
47 targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
48
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)
54
55 vmlinux.bin.all-y := $(obj)/vmlinux.bin
56 vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
57
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)
70
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
77
78 quiet_cmd_mkpiggy = MKPIGGY $@
79 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
80
81 targets += piggy.S
82 $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
83 $(call if_changed,mkpiggy)
This page took 0.058249 seconds and 4 git commands to generate.