blob: 189fa1dbefcc27ece79bac59fc2d11b83d09e38f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
2# linux/arch/i386/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
Eric W. Biederman968de4f2006-12-07 02:14:04 +01007targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o \
8 vmlinux.bin.all vmlinux.relocs
Linus Torvalds1da177e2005-04-16 15:20:36 -07009EXTRA_AFLAGS := -traditional
10
Eric W. Biederman968de4f2006-12-07 02:14:04 +010011LDFLAGS_vmlinux := -T
Eric W. Biederman968de4f2006-12-07 02:14:04 +010012hostprogs-y := relocs
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
H. Peter Anvin4fd06962007-07-11 12:18:56 -070014CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
15 -fno-strict-aliasing -fPIC \
16 $(call cc-option,-ffreestanding) \
17 $(call cc-option,-fno-stack-protector)
18LDFLAGS := -m elf_i386
19
Eric W. Biederman968de4f2006-12-07 02:14:04 +010020$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 $(call if_changed,ld)
22 @:
23
24$(obj)/vmlinux.bin: vmlinux FORCE
25 $(call if_changed,objcopy)
26
Eric W. Biederman968de4f2006-12-07 02:14:04 +010027quiet_cmd_relocs = RELOCS $@
Vivek Goyal6a044b32006-12-07 02:14:04 +010028 cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $<
Eric W. Biederman968de4f2006-12-07 02:14:04 +010029$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE
30 $(call if_changed,relocs)
31
32vmlinux.bin.all-y := $(obj)/vmlinux.bin
33vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs
34quiet_cmd_relocbin = BUILD $@
35 cmd_relocbin = cat $(filter-out FORCE,$^) > $@
36$(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE
37 $(call if_changed,relocbin)
38
39ifdef CONFIG_RELOCATABLE
40$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
41 $(call if_changed,gzip)
42else
Linus Torvalds1da177e2005-04-16 15:20:36 -070043$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
44 $(call if_changed,gzip)
Eric W. Biederman968de4f2006-12-07 02:14:04 +010045endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
48
Eric W. Biederman968de4f2006-12-07 02:14:04 +010049$(obj)/piggy.o: $(src)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 $(call if_changed,ld)