2008-01-30 13:32:30 +01:00
#
# linux/arch/x86/boot/compressed/Makefile
#
# create a compressed vmlinux image from the original vmlinux
#
2009-01-04 22:46:17 +01:00
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$( BITS) .o misc.o piggy.o
2008-01-30 13:32:30 +01:00
KBUILD_CFLAGS := -m$( BITS) -D__KERNEL__ $( LINUX_INCLUDE) -O2
KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
cflags-$(CONFIG_X86_64) := -mcmodel= small
KBUILD_CFLAGS += $( cflags-y)
KBUILD_CFLAGS += $( call cc-option,-ffreestanding)
KBUILD_CFLAGS += $( call cc-option,-fno-stack-protector)
KBUILD_AFLAGS := $( KBUILD_CFLAGS) -D__ASSEMBLY__
LDFLAGS := -m elf_$( UTS_MACHINE)
LDFLAGS_vmlinux := -T
2008-01-30 13:33:38 +01:00
$(obj)/vmlinux : $( src ) /vmlinux_ $( BITS ) .lds $( obj ) /head_ $( BITS ) .o $( obj ) /misc .o $( obj ) /piggy .o FORCE
2008-01-30 13:32:30 +01:00
$( call if_changed,ld)
@:
2008-02-13 20:54:58 +00:00
OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
2008-01-30 13:32:30 +01:00
$(obj)/vmlinux.bin : vmlinux FORCE
$( call if_changed,objcopy)
2008-09-04 06:19:45 -07:00
targets += vmlinux.bin.all vmlinux.relocs relocs
hostprogs-$(CONFIG_X86_32) += relocs
2008-01-30 13:32:30 +01:00
quiet_cmd_relocs = RELOCS $@
cmd_relocs = $( obj) /relocs $< > $@ ; $( obj) /relocs --abs-relocs $<
$(obj)/vmlinux.relocs : vmlinux $( obj ) /relocs FORCE
$( call if_changed,relocs)
vmlinux.bin.all-y := $( obj) /vmlinux.bin
vmlinux.bin.all-$(CONFIG_RELOCATABLE) += $( obj) /vmlinux.relocs
quiet_cmd_relocbin = BUILD $@
cmd_relocbin = cat $( filter-out FORCE,$^) > $@
$(obj)/vmlinux.bin.all : $( vmlinux .bin .all -y ) FORCE
$( call if_changed,relocbin)
2008-09-04 06:19:45 -07:00
i f e q ( $( CONFIG_X 86_ 32) , y )
2008-01-30 13:32:30 +01:00
i f d e f C O N F I G _ R E L O C A T A B L E
$(obj)/vmlinux.bin.gz : $( obj ) /vmlinux .bin .all FORCE
$( call if_changed,gzip)
2009-01-04 22:46:17 +01:00
$(obj)/vmlinux.bin.bz2 : $( obj ) /vmlinux .bin .all FORCE
$( call if_changed,bzip2)
$(obj)/vmlinux.bin.lzma : $( obj ) /vmlinux .bin .all FORCE
$( call if_changed,lzma)
2006-12-07 02:14:04 +01:00
e l s e
2008-01-30 13:32:30 +01:00
$(obj)/vmlinux.bin.gz : $( obj ) /vmlinux .bin FORCE
$( call if_changed,gzip)
2009-01-04 22:46:17 +01:00
$(obj)/vmlinux.bin.bz2 : $( obj ) /vmlinux .bin FORCE
$( call if_changed,bzip2)
$(obj)/vmlinux.bin.lzma : $( obj ) /vmlinux .bin FORCE
$( call if_changed,lzma)
2006-12-07 02:14:04 +01:00
e n d i f
2008-01-30 13:32:30 +01:00
LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
e l s e
2009-01-04 22:46:17 +01:00
2008-01-30 13:32:30 +01:00
$(obj)/vmlinux.bin.gz : $( obj ) /vmlinux .bin FORCE
$( call if_changed,gzip)
2009-01-04 22:46:17 +01:00
$(obj)/vmlinux.bin.bz2 : $( obj ) /vmlinux .bin FORCE
$( call if_changed,bzip2)
$(obj)/vmlinux.bin.lzma : $( obj ) /vmlinux .bin FORCE
$( call if_changed,lzma)
2008-01-30 13:32:30 +01:00
LDFLAGS_piggy.o := -r --format binary --oformat elf64-x86-64 -T
e n d i f
2009-01-04 22:46:17 +01:00
suffix_$(CONFIG_KERNEL_GZIP) = gz
suffix_$(CONFIG_KERNEL_BZIP2) = bz2
suffix_$(CONFIG_KERNEL_LZMA) = lzma
$(obj)/piggy.o : $( obj ) /vmlinux .scr $( obj ) /vmlinux .bin .$( suffix_y ) FORCE
2008-01-30 13:32:30 +01:00
$( call if_changed,ld)