1# 2# linux/arch/x86/boot/compressed/Makefile 3# 4# create a compressed vmlinux image from the original vmlinux 5# 6 7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ 8 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 9 10KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 11KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 12KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 13cflags-$(CONFIG_X86_32) := -march=i386 14cflags-$(CONFIG_X86_64) := -mcmodel=small 15KBUILD_CFLAGS += $(cflags-y) 16KBUILD_CFLAGS += -mno-mmx -mno-sse 17KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 18KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 19 20KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 21GCOV_PROFILE := n 22 23LDFLAGS := -m elf_$(UTS_MACHINE) 24LDFLAGS_vmlinux := -T 25 26hostprogs-y := mkpiggy 27HOST_EXTRACFLAGS += -I$(srctree)/tools/include 28 29VMLINUX_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 32 33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 34 35ifeq ($(CONFIG_EFI_STUB), y) 36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 37endif 38 39$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 40 $(call if_changed,ld) 41 @: 42 43OBJCOPYFLAGS_vmlinux.bin := -R .comment -S 44$(obj)/vmlinux.bin: vmlinux FORCE 45 $(call if_changed,objcopy) 46 47targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs 48 49CMD_RELOCS = arch/x86/tools/relocs 50quiet_cmd_relocs = RELOCS $@ 51 cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $< 52$(obj)/vmlinux.relocs: vmlinux FORCE 53 $(call if_changed,relocs) 54 55vmlinux.bin.all-y := $(obj)/vmlinux.bin 56vmlinux.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 71suffix-$(CONFIG_KERNEL_GZIP) := gz 72suffix-$(CONFIG_KERNEL_BZIP2) := bz2 73suffix-$(CONFIG_KERNEL_LZMA) := lzma 74suffix-$(CONFIG_KERNEL_XZ) := xz 75suffix-$(CONFIG_KERNEL_LZO) := lzo 76suffix-$(CONFIG_KERNEL_LZ4) := lz4 77 78quiet_cmd_mkpiggy = MKPIGGY $@ 79 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) 80 81targets += piggy.S 82$(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE 83 $(call if_changed,mkpiggy) 84