blob: 92fdd35bd93e4fca0ac3b7a2d6ed7736f8094897 [file] [log] [blame]
Sam Ravnborgdb569af2008-01-30 13:32:30 +01001#
2# linux/arch/x86/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
Ian Campbell778cb922008-01-30 13:33:38 +01007targets := vmlinux vmlinux.bin vmlinux.bin.gz head_$(BITS).o misc.o piggy.o
Sam Ravnborgdb569af2008-01-30 13:32:30 +01008
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
11cflags-$(CONFIG_X86_64) := -mcmodel=small
12KBUILD_CFLAGS += $(cflags-y)
13KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
14KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
15
16KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
17
18LDFLAGS := -m elf_$(UTS_MACHINE)
19LDFLAGS_vmlinux := -T
20
Ian Campbell778cb922008-01-30 13:33:38 +010021$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
Sam Ravnborgdb569af2008-01-30 13:32:30 +010022 $(call if_changed,ld)
23 @:
24
Ian Campbell099e1372008-02-13 20:54:58 +000025OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
Sam Ravnborgdb569af2008-01-30 13:32:30 +010026$(obj)/vmlinux.bin: vmlinux FORCE
27 $(call if_changed,objcopy)
28
29
Thomas Gleixner9b884672007-10-11 11:13:43 +020030ifeq ($(CONFIG_X86_32),y)
Sam Ravnborgdb569af2008-01-30 13:32:30 +010031targets += vmlinux.bin.all vmlinux.relocs
32hostprogs-y := relocs
33
34quiet_cmd_relocs = RELOCS $@
35 cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $<
36$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE
37 $(call if_changed,relocs)
38
39vmlinux.bin.all-y := $(obj)/vmlinux.bin
40vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs
41quiet_cmd_relocbin = BUILD $@
42 cmd_relocbin = cat $(filter-out FORCE,$^) > $@
43$(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE
44 $(call if_changed,relocbin)
45
46ifdef CONFIG_RELOCATABLE
47$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
48 $(call if_changed,gzip)
Eric W. Biederman968de4f2006-12-07 02:14:04 +010049else
Sam Ravnborgdb569af2008-01-30 13:32:30 +010050$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
51 $(call if_changed,gzip)
Eric W. Biederman968de4f2006-12-07 02:14:04 +010052endif
Sam Ravnborgdb569af2008-01-30 13:32:30 +010053LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
54
55else
56$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
57 $(call if_changed,gzip)
58
59LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T
60endif
61
62
Ian Campbellf18c0e72008-01-30 13:33:38 +010063$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
Sam Ravnborgdb569af2008-01-30 13:32:30 +010064 $(call if_changed,ld)