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 | |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 8 | |
| 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
| 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
H. Peter Anvin | 95a38f3 | 2009-04-01 17:35:00 -0700 | [diff] [blame^] | 11 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 12 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
| 13 | KBUILD_CFLAGS += $(cflags-y) |
| 14 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
| 15 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) |
| 16 | |
| 17 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 18 | |
| 19 | LDFLAGS := -m elf_$(UTS_MACHINE) |
| 20 | LDFLAGS_vmlinux := -T |
| 21 | |
Ian Campbell | 778cb92 | 2008-01-30 13:33:38 +0100 | [diff] [blame] | 22 | $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 23 | $(call if_changed,ld) |
| 24 | @: |
| 25 | |
Ian Campbell | 099e137 | 2008-02-13 20:54:58 +0000 | [diff] [blame] | 26 | OBJCOPYFLAGS_vmlinux.bin := -R .comment -S |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 27 | $(obj)/vmlinux.bin: vmlinux FORCE |
| 28 | $(call if_changed,objcopy) |
| 29 | |
| 30 | |
H. Peter Anvin | 7f16a33 | 2008-09-04 06:19:45 -0700 | [diff] [blame] | 31 | targets += vmlinux.bin.all vmlinux.relocs relocs |
| 32 | hostprogs-$(CONFIG_X86_32) += relocs |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 33 | |
| 34 | quiet_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 | |
| 39 | vmlinux.bin.all-y := $(obj)/vmlinux.bin |
| 40 | vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $(obj)/vmlinux.relocs |
| 41 | quiet_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 | |
H. Peter Anvin | 7f16a33 | 2008-09-04 06:19:45 -0700 | [diff] [blame] | 46 | ifeq ($(CONFIG_X86_32),y) |
| 47 | |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 48 | ifdef CONFIG_RELOCATABLE |
| 49 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE |
| 50 | $(call if_changed,gzip) |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 51 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin.all FORCE |
| 52 | $(call if_changed,bzip2) |
| 53 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE |
| 54 | $(call if_changed,lzma) |
Eric W. Biederman | 968de4f | 2006-12-07 02:14:04 +0100 | [diff] [blame] | 55 | else |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 56 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
| 57 | $(call if_changed,gzip) |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 58 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE |
| 59 | $(call if_changed,bzip2) |
| 60 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE |
| 61 | $(call if_changed,lzma) |
Eric W. Biederman | 968de4f | 2006-12-07 02:14:04 +0100 | [diff] [blame] | 62 | endif |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 63 | LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T |
| 64 | |
| 65 | else |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 66 | |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 67 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE |
| 68 | $(call if_changed,gzip) |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 69 | $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE |
| 70 | $(call if_changed,bzip2) |
| 71 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE |
| 72 | $(call if_changed,lzma) |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 73 | |
| 74 | LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T |
| 75 | endif |
| 76 | |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 77 | suffix_$(CONFIG_KERNEL_GZIP) = gz |
| 78 | suffix_$(CONFIG_KERNEL_BZIP2) = bz2 |
| 79 | suffix_$(CONFIG_KERNEL_LZMA) = lzma |
| 80 | |
| 81 | $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE |
Sam Ravnborg | db569af | 2008-01-30 13:32:30 +0100 | [diff] [blame] | 82 | $(call if_changed,ld) |