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