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 \ ...@@ -140,7 +140,7 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL 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 CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
......
...@@ -25,24 +25,32 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA ...@@ -25,24 +25,32 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512 #RAMDISK := -DRAMDISK=512
EXTRA_TARGETS := vmlinux.bin bvmlinux.bin
include $(TOPDIR)/Rules.make
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
BOOT_INCL = $(TOPDIR)/include/linux/config.h \ BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/linux/autoconf.h \ $(TOPDIR)/include/linux/autoconf.h \
$(TOPDIR)/include/asm/boot.h $(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build zImage: bootsect setup vmlinux.bin tools/build
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
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 bvmlinux.bin: compressed/bvmlinux FORCE
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out $(call if_changed,objcopy)
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
compressed/vmlinux: $(TOPDIR)/vmlinux compressed/vmlinux: FORCE
@$(MAKE) -C compressed vmlinux @$(MAKE) -C compressed vmlinux
compressed/bvmlinux: $(TOPDIR)/vmlinux compressed/bvmlinux: FORCE
@$(MAKE) -C compressed bvmlinux @$(MAKE) -C compressed bvmlinux
zdisk: $(BOOTIMAGE) zdisk: $(BOOTIMAGE)
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# #
HEAD = head.o HEAD = head.o
SYSTEM = $(TOPDIR)/vmlinux
OBJECTS = $(HEAD) misc.o OBJECTS = $(HEAD) misc.o
...@@ -21,7 +20,9 @@ BZIMAGE_OFFSET = 0x100000 ...@@ -21,7 +20,9 @@ BZIMAGE_OFFSET = 0x100000
ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS) BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux EXTRA_TARGETS := vmlinux.bin vmlinux.bin.gz
include $(TOPDIR)/Rules.make
vmlinux: piggy.o $(OBJECTS) vmlinux: piggy.o $(OBJECTS)
$(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o $(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
...@@ -37,14 +38,14 @@ comma := , ...@@ -37,14 +38,14 @@ comma := ,
misc.o: misc.c misc.o: misc.c
$(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c
piggy.o: $(SYSTEM) vmlinux.bin: $(TOPDIR)/vmlinux FORCE
tmppiggy=_tmp_$$$$piggy; \ $(call if_changed,objcopy)
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \ vmlinux.bin.gz: vmlinux.bin FORCE
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \ $(call if_changed,gzip)
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; \ piggy.o: vmlinux.bin.gz vmlinux.scr
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk $(LD) $(LDFLAGS) -r -o piggy.o -b binary $< -b elf32-i386 -T vmlinux.scr
clean: 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