Commit 2d4de969 authored by Paul Mackerras's avatar Paul Mackerras Committed by Tom Rini

PPC32: Update boot wrapper Makefiles.

We can't now use make -C in conjunction with Rules.make because
the rules for making .o files break if we do.  This updates the
boot wrapper Makefiles so that we don't use make -C, instead we
use call descend plus various other new features in Rules.make.
parent ae13016e
......@@ -64,7 +64,7 @@ drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
drivers-$(CONFIG_4xx) += arch/ppc/4xx_io/
drivers-$(CONFIG_8260) += arch/ppc/8260_io/
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
makeboot = $(call descend,arch/ppc/boot,$(1))
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
......@@ -74,14 +74,14 @@ AFLAGS_vmlinux.lds.o := -Upowerpc
bzImage: zImage
$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
+@$(call makeboot,$@)
%_config: arch/ppc/configs/%_defconfig
rm -f .config arch/ppc/defconfig
cp -f arch/ppc/configs/$(@:config=defconfig) .config
archclean:
@$(MAKEBOOT) clean
+@$(call makeboot,clean)
archmrproper:
......
......@@ -10,25 +10,16 @@
# modified by Cort (cort@cs.nmt.edu)
#
GZIP_FLAGS = -v9f
CFLAGS += -fno-builtin -D__BOOTER__ -I$(TOPDIR)/arch/$(ARCH)/boot/include
AFLAGS += -D__BOOTER__
OBJCOPY_ARGS = -O elf32-powerpc
MKIMAGE := ./utils/mkimage.wrapper
lib/lib.a: lib/zlib.c
$(MAKE) -C lib
subdir-y := simple
subdir-$(CONFIG_ALL_PPC) := openfirmware prep
images/vmlinux.gz: $(TOPDIR)/vmlinux
$(MAKE) -C images vmlinux.gz
HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
# Subdirs and tools needed for each. Assume we always need to go into
# 'simple' unless told otherwise.
subdir-y := lib common simple
subdir-$(CONFIG_ALL_PPC) := openfirmware prep
tools-$(CONFIG_ALL_PPC) := addnote mknote hack-coff mkprep
tools-$(CONFIG_PPLUS) := mkbugboot mkprep
tools-$(CONFIG_4xx) := mktree
......@@ -40,49 +31,24 @@ tools-$(CONFIG_PRPMC750) := mkbugboot mkprep
tools-$(CONFIG_PRPMC800) := mkbugboot mkprep
tools-$(CONFIG_SPRUCE) := mktree
# These are dirs we don't want to go into on BOOT_TARGETS. We have them for
# the 'depend' stage.
NONBOOT := lib common
all-tools := addnote mknote hack-coff mkprep mkbugboot mktree
# These are the subdirs we want to use
BOOTDIRS = $(filter-out $(NONBOOT), $(subdir-y))
host-progs := $(addprefix utils/,$(tools-y))
makeof1275:
$(MAKE) -C of1275
# This will make the tools we need. We do it like this to ensure that we use
# HOSTCC. -- Tom
maketools:
$(MAKE) -C utils $(tools-y)
# The targets all boards support for boot images.
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
include $(TOPDIR)/Rules.make
$(BOOT_TARGETS): vmapus lib/lib.a images/vmlinux.gz makeof1275 maketools
ifneq ($(BOOTDIRS),)
for d in $(BOOTDIRS); do $(MAKE) -C $$d $@; done
endif
zImage zImage.initrd znetboot znetboot.initrd: $(subdir-y)
vmapus: $(TOPDIR)/vmlinux
ifdef CONFIG_APUS
$(STRIP) $(TOPDIR)/vmlinux -o images/vmapus
gzip $(GZIP_FLAGS) images/vmapus
endif
simple openfirmware prep: lib common images
openfirmware prep: of1275
# Make an image for PPCBoot
pImage: images/vmlinux.gz
$(MKIMAGE) -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
-n 'Linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)' \
-d $< images/vmlinux.PPCBoot
ln -sf vmlinux.PPCBoot images/pImage
lib common of1275 images: FORCE
+@$(call descend,$(obj)/$@,)
vmlinux.sm: $(TOPDIR)/vmlinux utils/addSystemMap
./utils/addSystemMap $(TOPDIR)/System.map $(TOPDIR)/vmlinux images/vmlinux.sm
openfirmware prep simple: FORCE
+@$(call descend,$(obj)/$@,$(MAKECMDGOALS))
# These are subdirs with files not normally rm'ed. -- Tom
clean:
$(MAKE) -C images clean
$(MAKE) -C utils clean
$(MAKE) -C openfirmware clean
CLEAN_FILES += $(addprefix $(obj)/utils,$(all-tools))
include $(TOPDIR)/Rules.make
clean: FORCE
+@$(call descend,$(obj)/images,clean)
......@@ -8,7 +8,12 @@
# Tom Rini January 2001
#
coffcrt0.o:
$(CC) $(AFLAGS) -DXCOFF -traditional -c -o coffcrt0.o crt0.S
L_TARGET := lib.a
obj-y := string.o util.o misc-common.o
obj-$(CONFIG_ALL_PPC) += mpc10x_memory.o
obj-$(CONFIG_LOPEC) += mpc10x_memory.o
obj-$(CONFIG_PAL4) += cpc700_memory.o
obj-$(CONFIG_SERIAL_8250_CONSOLE) += ns16550.o
include $(TOPDIR)/Rules.make
......@@ -2,11 +2,16 @@
# This dir holds all of the images for PPC machines.
# Tom Rini January 2001
all: $(obj)/vmlinux.gz
include $(TOPDIR)/Rules.make
vmlinux.gz: $(TOPDIR)/vmlinux
$(OBJCOPY) --strip-all -S -O binary $(TOPDIR)/vmlinux vmlinux
gzip -vf9 vmlinux
GZIP_FLAGS = -v9f
$(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) -S -O binary vmlinux $(obj)/vmlinux
gzip $(GZIP_FLAGS) $(obj)/vmlinux
clean:
rm -f sImage vmapus vmlinux* miboot* zImage* zvmlinux*
rm -f $(obj)/sImage $(obj)/vmapus $(obj)/vmlinux* $(obj)/miboot*
rm -f $(obj)/zImage* z$(obj)/vmlinux*
......@@ -2,7 +2,7 @@
# Makefile of1275 stuff
#
L_TARGET := of1275.a
L_TARGET := lib.a
obj-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \
ofstdio.o read.o release.o write.o
......
......@@ -10,24 +10,37 @@
# Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
# rules.
EXTRA_TARGETS := start.o misc.o crt0.o coffcrt0.o coffmain.o chrpmain.o \
newworldmain.o common.o
boot: zImage
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
COFF_LD_ARGS = -T ../ld.script -e _start -Ttext 0x00500000 -Bstatic
CHRP_LD_ARGS = -T ../ld.script -e _start -Ttext 0x00400000
NEWWORLD_LD_ARGS = -T ../ld.script -e _start -Ttext 0x01000000
COFF_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
CHRP_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00800000
NEWWORLD_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x01000000
COMMONOBJS = start.o misc.o ../common/string.o common.o
COFFOBJS = ../common/coffcrt0.o $(COMMONOBJS) coffmain.o
CHRPOBJS = ../common/crt0.o $(COMMONOBJS) chrpmain.o
NEWWORLDOBJS = ../common/crt0.o $(COMMONOBJS) newworldmain.o
COMMONOBJS = $(obj)/start.o $(obj)/misc.o $(obj)/common.o
COFFOBJS = $(obj)/coffcrt0.o $(COMMONOBJS) $(obj)/coffmain.o
CHRPOBJS = $(obj)/crt0.o $(COMMONOBJS) $(obj)/chrpmain.o
NEWWORLDOBJS = $(obj)/crt0.o $(COMMONOBJS) $(obj)/newworldmain.o
EXTRA_TARGETS := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS)
LIBS = $(TOPDIR)/lib/lib.a ../lib/lib.a ../of1275/of1275.a
LIBS = lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
ADDNOTE := ../utils/addnote
MKNOTE := ../utils/mknote
SIZE := ../utils/size
OFFSET := ../utils/offset
HACKCOFF := ../utils/hack-coff
ADDNOTE := $(utils)/addnote
MKNOTE := $(utils)/mknote
SIZE := $(utils)/size
OFFSET := $(utils)/offset
HACKCOFF := $(utils)/hack-coff
ifdef CONFIG_SMP
END := .smp
......@@ -38,12 +51,12 @@ endif
TFTPIMAGE=/tftpboot/zImage.
../common/coffcrt0.o:
$(MAKE) -C ../common coffcrt0.o
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
image.o: ../images/vmlinux.gz ../common/dummy.o
$(OBJCOPY) ../common/dummy.o $@ -R .comment \
--add-section=.image=../images/vmlinux.gz \
$(obj)/image.o: $(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(obj)/dummy.o $@ -R .comment \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data
ifdef CONFIG_XMON
$(OBJCOPY) $@ $@ \
......@@ -52,86 +65,93 @@ ifdef CONFIG_XMON
endif
# Place the ramdisk in the initrd image.
image-initrd.o: image.o ../images/ramdisk.image.gz
$(OBJCOPY) image.o $@ \
--add-section=.ramdisk=../images/ramdisk.image.gz \
$(obj)/image-initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz
$(OBJCOPY) $(obj)/image.o $@ \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
# Create the note section for New-World PowerMacs.
note: $(MKNOTE)
$(MKNOTE) > note
znetboot: vmlinux.coff vmlinux.elf-pmac zImage
cp ../images/vmlinux.coff $(TFTPIMAGE).pmac$(END)
cp ../images/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END)elf
cp ../images/zImage.chrp $(TFTPIMAGE).chrp$(END)
znetboot.initrd: vmlinux.initrd.coff vmlinux.initrd.elf-pmac
cp ../images/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
cp ../images/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
cp ../images/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
$(obj)/note: $(MKNOTE)
$(MKNOTE) > $(obj)/note
znetboot: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac $(images)/zImage.chrp
cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END)elf
cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
znetboot.initrd: $(images)/vmlinux.initrd.coff \
$(images)/vmlinux.initrd.elf-pmac \
$(images)/zImage.initrd.chrp
cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=$(images)/vmlinux.gz \
$(obj)/dummy.o $@
$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=initrd=$(images)/ramdisk.image.gz \
$(images)/miboot.image $@
miboot.image: ../common/dummy.o ../images/vmlinux.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=../images/vmlinux.gz \
../common/dummy.o ../images/$@
$(obj)/coffcrt0.o: $(common)/crt0.S
$(CC) $(AFLAGS) -DXCOFF -traditional -c -o $@ $(common)/crt0.S
miboot.initrd.image: miboot.image ../images/ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=initrd=../images/ramdisk.image.gz \
../images/miboot.image ../images/$@
$(obj)/crt0.o: $(common)/crt0.S
$(CC) $(AFLAGS) -traditional -c -o $@ $(common)/crt0.S
coffboot: $(COFFOBJS) image.o $(LIBS)
$(obj)/coffboot: $(COFFOBJS) $(obj)/image.o $(LIBS)
$(LD) -o $@ $(COFF_LD_ARGS) $^
$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
coffboot.initrd: $(COFFOBJS) image-initrd.o $(LIBS)
$(obj)/coffboot.initrd: $(COFFOBJS) $(obj)/image-initrd.o $(LIBS)
$(LD) -o $@ $(COFF_LD_ARGS) $^
$(OBJCOPY) $@ $@ -R .comment
vmlinux.coff: coffboot $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot ../images/$@
$(HACKCOFF) ../images/$@
rm -f coffboot
ln -sf vmlinux.coff ../images/zImage.pmac
vmlinux.initrd.coff: coffboot.initrd $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd ../images/$@
$(HACKCOFF) ../images/$@
rm -f coffboot.initrd
ln -sf vmlinux.initrd.coff ../images/zImage.initrd.pmac
vmlinux.elf-pmac: $(NEWWORLDOBJS) $(LIBS) image.o
$(LD) $(NEWWORLD_LD_ARGS) -o ../images/$@ $^
vmlinux.initrd.elf-pmac: $(NEWWORLDOBJS) $(LIBS) image-initrd.o
$(LD) $(NEWWORLD_LD_ARGS) -o ../images/$@ $^
zImage.chrp: $(CHRPOBJS) image.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $^
zImage.initrd.chrp: $(CHRPOBJS) image-initrd.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $^
zImage: vmlinux.coff vmlinux.elf-pmac zImage.chrp miboot.image $(ADDNOTE) \
note
$(OBJCOPY) ../images/vmlinux.elf-pmac ../images/vmlinux.elf-pmac \
--add-section=.note=note -R .comment -R .ramdisk
$(OBJCOPY) ../images/zImage.chrp ../images/zImage.chrp \
-R .comment -R .ramdisk
cp ../images/zImage.chrp ../images/zImage.chrp-rs6k
$(ADDNOTE) ../images/zImage.chrp-rs6k
zImage.initrd: vmlinux.initrd.coff vmlinux.initrd.elf-pmac zImage.initrd.chrp \
miboot.initrd.image $(ADDNOTE) note
$(OBJCOPY) ../images/vmlinux.initrd.elf-pmac \
../images/vmlinux.initrd.elf-pmac --add-section=.note=note \
-R .comment
$(OBJCOPY) ../images/zImage.initrd.chrp ../images/zImage.initrd.chrp \
-R .comment
cp ../images/zImage.initrd.chrp ../images/zImage.initrd.chrp-rs6k
$(ADDNOTE) ../images/zImage.initrd.chrp-rs6k
$(images)/vmlinux.coff: $(obj)/coffboot
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot $@
$(HACKCOFF) $@
ln -sf vmlinux.coff $(images)/zImage.pmac
clean:
rm -f note
$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot.initrd $@
$(HACKCOFF) $@
ln -sf vmlinux.initrd.coff $(images)/zImage.initrd.pmac
include $(TOPDIR)/Rules.make
$(images)/vmlinux.elf-pmac: $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o $(obj)/note
$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o
$(OBJCOPY) $@ $@ \
--add-section=.note=$(obj)/note -R .comment -R .ramdisk
$(images)/vmlinux.initrd.elf-pmac: $(NEWWORLDOBJS) $(LIBS) \
$(obj)/image-initrd.o $(obj)/note
$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) \
$(obj)/image-initrd.o
$(OBJCOPY) $@ $@ \
--add-section=.note=$(obj)/note -R .comment
$(images)/zImage.chrp: $(CHRPOBJS) $(obj)/image.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o $@ $^
$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
$(images)/zImage.initrd.chrp: $(CHRPOBJS) $(obj)/image-initrd.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o $@ $^
$(OBJCOPY) $@ $@ -R .comment
$(images)/zImage.chrp-rs6k: $(images)/zImage.chrp
cp $(images)/zImage.chrp $@
$(ADDNOTE) $@
$(images)/zImage.initrd.chrp-rs6k: $(images)/zImage.initrd.chrp
cp $(images)/zImage.initrd.chrp $@
$(ADDNOTE) $@
zImage: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac \
$(images)/zImage.chrp $(images)/miboot.image
zImage.initrd: $(images)/vmlinux.initrd.coff $(images)/vmlinux.initrd.elf-pmac\
$(images)/zImage.initrd.chrp $(images)/miboot.initrd.image
clean:
rm -f $(obj)/note $(obj)/image.o $(obj)/coffboot $(obj)/coffboot.initrd
......@@ -13,65 +13,79 @@
# modified by Cort (cort@cs.nmt.edu)
#
boot: zImage
TFTPIMAGE = /tftpboot/zImage.prep
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE = $(TFTPBOOT).smp
endif
LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
boot-y := head.o ../simple/legacy.o misc.o \
../common/util.o ../common/string.o \
../common/misc-common.o \
../common/mpc10x_memory.o
LD_ARGS = -T $(boot)/ld.script -Ttext 0x00800000 -Bstatic
OBJCOPY_ARGS = -O elf32-powerpc
LIBS = ../lib/lib.a
LIBS = $(common)/lib.a $(bootlib)/lib.a
boot-$(CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
boot-y := head.o misc.o
boot-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
EXTRA_TARGETS := $(boot-y)
EXTRA_TARGETS := $(boot-y) ../simple/legacy.o
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
simple := $(boot)/simple
OBJS := $(addprefix $(obj)/,$(boot-y)) $(simple)/legacy.o
# Tools
MKPREP := ../utils/mkprep
SIZE := ../utils/size
OFFSET := ../utils/offset
MKPREP := $(utils)/mkprep
SIZE := $(utils)/size
OFFSET := $(utils)/offset
# Extra include search dirs
CFLAGS_kbd.o += -I$(TOPDIR)/drivers/char
CFLAGS_kbd.o += -Idrivers/char
all: zImage
zImage: $(images)/zImage.prep
zImage.initrd: $(images)/zImage.initrd.prep
zImage: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o \
$(MKPREP)
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
$(images)/zImage.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $@ ../images/$@.prep
rm -f $@
zImage.initrd: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz $(MKPREP) \
../common/dummy.o
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $(obj)/zImage $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/zImage $(obj)/zImage \
-R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $(obj)/zImage $@
rm -f $(obj)/zImage
$(images)/zImage.initrd.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.ramdisk=../images/ramdisk.image.gz \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $@ ../images/$@.prep
rm -f $@
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $(obj)/zImage.initrd $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/zImage.initrd $(obj)/zImage.initrd \
-R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $(obj)/zImage.initrd $@
rm -f $(obj)/zImage.initrd
floppy: zImage
dd if=../images/zImage.prep of=/dev/fd0H1440 bs=64b
dd if=$(images)/zImage.prep of=/dev/fd0H1440 bs=64b
znetboot : zImage
cp ../images/zImage.prep $(TFTPIMAGE)
cp $(images)/zImage.prep $(TFTPIMAGE)
znetboot.initrd : zImage.initrd
cp ../images/zImage.initrd.prep $(TFTPIMAGE)
include $(TOPDIR)/Rules.make
cp $(images)/zImage.initrd.prep $(TFTPIMAGE)
......@@ -24,9 +24,11 @@
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# Normally, we use the 'misc-simple.c' file for decompress_kernel and
boot: zImage
# Normally, we use the 'misc.c' file for decompress_kernel and
# whatnot. Sometimes we need to override this however.
MISC := ../common/misc-simple.o
MISC := misc.o
ifeq ($(CONFIG_IBM_OPENBIOS),y)
ZIMAGE := zImage-TREE
ZIMAGEINITRD := zImage.initrd-TREE
......@@ -38,6 +40,14 @@ ifeq ($(CONFIG_EMBEDDEDBOOT),y)
TFTPIMAGE := /tftpboot/zImage.embedded
MISC := misc-embedded.o
endif
ifeq ($(CONFIG_EBONY),y)
ZIMAGE := zImage-TREE
ZIMAGEINITRD := zImage.initrd-TREE
EXTRA := direct.o
END := ebony
ENTRYPOINT := 0x01000000
TFTPIMAGE := /tftpboot/zImage.$(END)
endif
ifeq ($(CONFIG_EV64260),y)
EXTRA := direct.o misc-ev64260.o
TFTPIMAGE := /tftpboot/zImage.ev64260
......@@ -72,11 +82,8 @@ endif
ifeq ($(CONFIG_PPLUS),y)
EXTRA := legacy.o
endif
ifeq ($(CONFIG_LOPEC),y)
EXTRA += ../common/mpc10x_memory.o
endif
ifeq ($(CONFIG_PAL4),y)
EXTRA := direct.o ../common/cpc700_memory.o
EXTRA := direct.o
endif
ifeq ($(CONFIG_PCORE)$(CONFIG_POWERPMC250),y)
ZIMAGE := zImage-STRIPELF
......@@ -122,21 +129,25 @@ endif
# Default linker args. Link at 0x00800000 or 0x00400000 by default, but
# allow it to be overridden.
ifeq ($(CONFIG_BOOT_LOAD_BOOL),y)
LD_ARGS := -T ../ld.script -Ttext $(CONFIG_BOOT_LOAD) \
-Bstatic
LD_ARGS := -T $(boot)/ld.script \
-Ttext $(CONFIG_BOOT_LOAD) -Bstatic
else
LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
ifeq ($(CONFIG_8260)$(CONFIG_4xx)$(CONFIG_8xx),y)
LD_ARGS := -T ../ld.script -Ttext 0x00400000 -Bstatic
LD_ARGS = -T $(boot)/ld.script \
-Ttext 0x00800000 -Bstatic
ifeq ($(CONFIG_8260)$(CONFIG_40x)$(CONFIG_8xx),y)
LD_ARGS := -T $(boot)/ld.script -Ttext 0x00400000 \
-Bstatic
endif
ifeq ($(CONFIG_440),y)
LD_ARGS := -T $(boot)/ld.script -Ttext 0x01000000 \
-Bstatic
endif
endif
OBJCOPY_ARGS := -O elf32-powerpc
# head.o and ../common/relocate.o must be at the start.
boot-y := head.o ../common/relocate.o $(EXTRA) \
$(MISC) ../common/misc-common.o \
../common/string.o ../common/util.o
boot-$(CONFIG_4xx) += embed_config.o
# head.o and relocate.o must be at the start.
boot-y := head.o relocate.o $(EXTRA) $(MISC)
boot-$(CONFIG_40x) += embed_config.o
boot-$(CONFIG_8xx) += embed_config.o
boot-$(CONFIG_8260) += embed_config.o
boot-$(CONFIG_BSEIP) += iic.o
......@@ -149,84 +160,97 @@ boot-$(CONFIG_8xx) += m8xx_tty.o
boot-$(CONFIG_8260) += m8260_tty.o
boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
endif
boot-$(CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
images := $(boot)/images
EXTRA_TARGETS := $(boot-y)
LIBS := ../lib/lib.a
LIBS := $(common)/lib.a $(bootlib)/lib.a
include $(TOPDIR)/Rules.make
OBJS := $(addprefix $(obj)/,$(boot-y))
# Tools
MKBUGBOOT := ../utils/mkbugboot
MKPREP := ../utils/mkprep
MKTREE := ../utils/mktree
MKBUGBOOT := $(utils)/mkbugboot
MKPREP := $(utils)/mkprep
MKTREE := $(utils)/mktree
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
zvmlinux: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o
$(obj)/zvmlinux: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
$(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
-R .ramdisk -R .sysmap
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
-R .stabstr -R .ramdisk -R .sysmap
zvmlinux.initrd: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz \
../common/dummy.o
$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=.ramdisk=../images/ramdisk.image.gz \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
-R .sysmap
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
-R .stabstr -R .sysmap
# Sort-of dummy rules, that let us format the image we want.
zImage: $(ZIMAGE) zvmlinux
cp -f zvmlinux ../images/zImage.elf
rm -f zvmlinux
zImage: $(images)/$(ZIMAGE) $(obj)/zvmlinux
cp -f $(obj)/zvmlinux $(images)/zImage.elf
rm -f $(obj)/zvmlinux
zImage.initrd: $(ZIMAGEINITRD) zvmlinux.initrd
cp -f zvmlinux.initrd ../images/zImage.initrd.elf
rm -f zvmlinux.initrd
zImage.initrd: $(images)/$(ZIMAGEINITRD) $(obj)/zvmlinux.initrd
cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf
rm -f $(obj)/zvmlinux.initrd
znetboot: zImage
ifneq ($(ZNETBOOT),)
cp ../images/$(ZNETBOOT) $(TFTPIMAGE)
cp $(images)/$(ZNETBOOT) $(TFTPIMAGE)
else
cp ../images/zImage.* $(TFTPIMAGE)
cp $(images)/zImage.* $(TFTPIMAGE)
endif
znetboot.initrd: zImage.initrd
ifneq ($(ZNETBOOTRD),)
cp ../images/$(ZNETBOOTRD) $(TFTPIMAGE)
cp $(images)/$(ZNETBOOTRD) $(TFTPIMAGE)
else
cp ../images/zImage.* $(TFTPIMAGE)
cp $(images)/zImage.* $(TFTPIMAGE)
endif
zImage-STRIPELF: zvmlinux
dd if=zvmlinux of=../images/zImage.$(END) skip=64 bs=1k
$(images)/zImage-STRIPELF: $(obj)/zvmlinux
dd if=$(obj)/zvmlinux of=$(images)/zImage.$(END) skip=64 bs=1k
zImage.initrd-STRIPELF: zvmlinux.initrd
dd if=zvmlinux.initrd of=../images/zImage.initrd.$(END) skip=64 bs=1k
$(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(END) \
skip=64 bs=1k
zImage-TREE: zvmlinux
$(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT)
$(images)/zImage-TREE: $(obj)/zvmlinux
$(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(END) $(ENTRYPOINT)
zImage.initrd-TREE: zvmlinux.initrd
$(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT)
$(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd
$(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(END) \
$(ENTRYPOINT)
zImage-MENF1: zvmlinux
$(MKPREP) -pbp zvmlinux ../images/zImage.menf1
$(images)/zImage-MENF1: $(obj)/zvmlinux
$(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.menf1
zImage.initrd-MENF1: zvmlinux.initrd
$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.menf1
$(images)/zImage.initrd-MENF1: $(obj)/zvmlinux.initrd
$(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.menf1
zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp zvmlinux ../images/zImage.pplus
$(MKBUGBOOT) zvmlinux ../images/zImage.bugboot
$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.pplus
$(MKBUGBOOT) $(obj)/zvmlinux $(images)/zImage.bugboot
zImage.initrd-PPLUS: zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.pplus
$(MKBUGBOOT) zvmlinux.initrd ../images/zImage.initrd.bugboot
include $(TOPDIR)/Rules.make
$(images)/zImage.initrd-PPLUS: $(obj)/zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.pplus
$(MKBUGBOOT) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.bugboot
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