Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame^] | 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 head_$(BITS).o misc_$(BITS).o piggy.o |
| 8 | |
| 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
| 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
| 11 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
| 12 | KBUILD_CFLAGS += $(cflags-y) |
| 13 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
| 14 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) |
| 15 | |
| 16 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 17 | |
| 18 | LDFLAGS := -m elf_$(UTS_MACHINE) |
| 19 | LDFLAGS_vmlinux := -T |
| 20 | |
| 21 | $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc_$(BITS).o $(obj)/piggy.o FORCE |
| 22 | $(call if_changed,ld) |
| 23 | @: |
| 24 | |
| 25 | $(obj)/vmlinux.bin: vmlinux FORCE |
| 26 | $(call if_changed,objcopy) |
| 27 | |
| 28 | |
Thomas Gleixner | 9b88467 | 2007-10-11 11:13:43 +0200 | [diff] [blame] | 29 | ifeq ($(CONFIG_X86_32),y) |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame^] | 30 | targets += vmlinux.bin.all vmlinux.relocs |
| 31 | hostprogs-y := relocs |
| 32 | |
| 33 | quiet_cmd_relocs = RELOCS $@ |
| 34 | cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $< |
| 35 | $(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE |
| 36 | $(call if_changed,relocs) |
| 37 | |
| 38 | vmlinux.bin.all-y := $(obj)/vmlinux.bin |
| 39 | vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs |
| 40 | quiet_cmd_relocbin = BUILD $@ |
| 41 | cmd_relocbin = cat $(filter-out FORCE,$^) > $@ |
| 42 | $(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE |
| 43 | $(call if_changed,relocbin) |
| 44 | |
| 45 | ifdef CONFIG_RELOCATABLE |
| 46 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE |
| 47 | $(call if_changed,gzip) |
Eric W. Biederman | 968de4f | 2006-12-07 02:14:04 +0100 | [diff] [blame] | 48 | else |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame^] | 49 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
| 50 | $(call if_changed,gzip) |
Eric W. Biederman | 968de4f | 2006-12-07 02:14:04 +0100 | [diff] [blame] | 51 | endif |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame^] | 52 | LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T |
| 53 | |
| 54 | else |
| 55 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
| 56 | $(call if_changed,gzip) |
| 57 | |
| 58 | LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T |
| 59 | endif |
| 60 | |
| 61 | |
| 62 | $(obj)/piggy.o: $(obj)/vmlinux_$(BITS).scr $(obj)/vmlinux.bin.gz FORCE |
| 63 | $(call if_changed,ld) |