Commit 6411d22a authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: clean up arch/i386/boot, part 1

Use the Rules.make provided objcopy command and untangle piggy.o
generation.
parent 01a224b4
......@@ -140,7 +140,7 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL
export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS
export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS OBJCOPYFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
......
......@@ -25,24 +25,32 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512
EXTRA_TARGETS := vmlinux.bin bvmlinux.bin
include $(TOPDIR)/Rules.make
# ---------------------------------------------------------------------------
BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/linux/autoconf.h \
$(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
zImage: bootsect setup vmlinux.bin tools/build
tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@
bzImage: bbootsect bsetup bvmlinux.bin tools/build
tools/build -b bbootsect bsetup bvmlinux.bin $(ROOT_DEV) > $@
vmlinux.bin: compressed/vmlinux FORCE
$(call if_changed,objcopy)
bzImage: bbootsect bsetup compressed/bvmlinux tools/build
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
bvmlinux.bin: compressed/bvmlinux FORCE
$(call if_changed,objcopy)
compressed/vmlinux: $(TOPDIR)/vmlinux
compressed/vmlinux: FORCE
@$(MAKE) -C compressed vmlinux
compressed/bvmlinux: $(TOPDIR)/vmlinux
compressed/bvmlinux: FORCE
@$(MAKE) -C compressed bvmlinux
zdisk: $(BOOTIMAGE)
......
......@@ -5,7 +5,6 @@
#
HEAD = head.o
SYSTEM = $(TOPDIR)/vmlinux
OBJECTS = $(HEAD) misc.o
......@@ -21,7 +20,9 @@ BZIMAGE_OFFSET = 0x100000
ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux
EXTRA_TARGETS := vmlinux.bin vmlinux.bin.gz
include $(TOPDIR)/Rules.make
vmlinux: piggy.o $(OBJECTS)
$(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
......@@ -37,14 +38,14 @@ comma := ,
misc.o: misc.c
$(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c
piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
vmlinux.bin: $(TOPDIR)/vmlinux FORCE
$(call if_changed,objcopy)
vmlinux.bin.gz: vmlinux.bin FORCE
$(call if_changed,gzip)
piggy.o: vmlinux.bin.gz vmlinux.scr
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $< -b elf32-i386 -T vmlinux.scr
clean:
@rm -f vmlinux bvmlinux _tmp_*
@rm -f vmlinux bvmlinux vmlinux.bin vmlinux.bin.gz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment