Commit e7b34565 authored by Paul Mackerras's avatar Paul Mackerras

PPC32: clean up the arch/ppc/boot Makefiles.

This removes Rules.make inclusions, makes make clean work properly,
removes EXTRA_TARGETS where not needed, and fixes a couple of compile
warnings in the boot wrappers where <linux/string.h> wasn't included.
parent d4d20bce
......@@ -1314,6 +1314,17 @@ config BOOT_LOAD
depends on BOOT_LOAD_BOOL
default "0x00400000"
# If we don't have a custom load, we define one here depending.
config BOOT_LOAD
hex
depends on !BOOT_LOAD_BOOL && (40x || 8xx || 8260)
default "0x00400000"
config BOOT_LOAD
hex
depends on !BOOT_LOAD_BOOL
default "0x00800000"
endmenu
source "drivers/mtd/Kconfig"
......
......@@ -36,19 +36,13 @@ ifdef CONFIG_MORE_COMPILE_OPTIONS
CFLAGS += $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
endif
ifdef CONFIG_4xx
HEAD := arch/ppc/kernel/head_4xx.o
else
ifdef CONFIG_8xx
HEAD := arch/ppc/kernel/head_8xx.o
else
ifdef CONFIG_PPC_ISERIES
HEAD := arch/ppc/kernel/iSeries_head.o
else
HEAD := arch/ppc/kernel/head.o
endif
endif
endif
head-y := head.o
head-$(CONFIG_PPC_ISERIES) := iSeries_head.o
head-$(CONFIG_8xx) := head_8xx.o
head-$(CONFIG_4xx) := head_4xx.o
head-$(CONFIG_440) := head_44x.o
HEAD := arch/ppc/kernel/$(head-y)
core-y += arch/ppc/kernel/ arch/ppc/platforms/ \
arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
......@@ -80,7 +74,7 @@ $(BOOT_TARGETS): vmlinux
cp -f arch/ppc/configs/$(@:config=defconfig) .config
archclean:
$(MAKE) -f scripts/Makefile.clean obj=arch/ppc/boot
+$(MAKE) -f scripts/Makefile.clean obj=arch/ppc/boot
archmrproper:
......
......@@ -10,19 +10,17 @@
# modified by Cort (cort@cs.nmt.edu)
#
CFLAGS += -fno-builtin -D__BOOTER__ -I$(TOPDIR)/arch/$(ARCH)/boot/include
CFLAGS += -fno-builtin -D__BOOTER__ -Iarch/$(ARCH)/boot/include
AFLAGS += -D__BOOTER__
OBJCOPY_ARGS = -O elf32-powerpc
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
bootdir-y := simple
bootdir-$(CONFIG_ALL_PPC) := openfirmware prep
subdir-y := lib common images
subdir-$(CONFIG_ALL_PPC) += of1275
# for cleaning...
subdir- := images simple openfirmware prep \
lib common of1275
HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
# for cleaning
subdir- += simple openfirmware prep
tools-$(CONFIG_ALL_PPC) := addnote mknote hack-coff mkprep
tools-$(CONFIG_PPLUS) := mkbugboot mkprep
......@@ -39,15 +37,9 @@ all-tools := addnote mknote hack-coff mkprep mkbugboot mktree
host-progs := $(addprefix utils/,$(tools-y))
zImage zImage.initrd znetboot znetboot.initrd: $(addprefix $(obj)/,$(bootdir-y))
.PHONY: FORCE
$(obj)/simple $(obj)/openfirmware $(obj)/prep: $(obj)/lib $(obj)/common $(obj)/images
$(obj)/openfirmware $(obj)/prep: $(obj)/of1275
.PHONY: $(BOOT_TARGETS) $(bootdir-y)
$(obj)/lib $(obj)/common $(obj)/of1275 $(obj)/images: FORCE
+@$(call descend,$@,)
$(BOOT_TARGETS): $(bootdir-y)
$(obj)/openfirmware $(obj)/prep $(obj)/simple: FORCE
+@$(call descend,$@,$(MAKECMDGOALS))
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y))
+$(call descend,$(obj)/$@,$(MAKECMDGOALS))
......@@ -15,5 +15,3 @@ 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
......@@ -10,6 +10,5 @@ $(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) -O binary $< $(@:.gz=)
gzip $(GZIP_FLAGS) $(@:.gz=)
clean:
rm -f $(obj)/sImage $(obj)/vmapus $(obj)/vmlinux* $(obj)/miboot*
rm -f $(obj)/zImage* z$(obj)/vmlinux*
# Files generated that shall be removed upon make clean
clean-files := sImage vmapus vmlinux* miboot* zImage*
......@@ -5,5 +5,3 @@
L_TARGET := lib.a
obj-y := zlib.o div64.o
include $(TOPDIR)/Rules.make
......@@ -6,5 +6,3 @@ 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
include $(TOPDIR)/Rules.make
......@@ -10,13 +10,10 @@
# 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
clean-files := note coffboot coffboot.initrd
boot: zImage
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
......@@ -38,8 +35,6 @@ 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
ifdef CONFIG_SMP
......@@ -109,12 +104,12 @@ $(obj)/coffboot.initrd: $(COFFOBJS) $(obj)/image-initrd.o $(LIBS)
$(LD) -o $@ $(COFF_LD_ARGS) $^
$(OBJCOPY) $@ $@ -R .comment
$(images)/vmlinux.coff: $(obj)/coffboot
$(images)/vmlinux.coff: $(obj)/coffboot $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot $@
$(HACKCOFF) $@
ln -sf vmlinux.coff $(images)/zImage.pmac
$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot.initrd $@
$(HACKCOFF) $@
ln -sf vmlinux.initrd.coff $(images)/zImage.initrd.pmac
......@@ -139,11 +134,11 @@ $(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
$(images)/zImage.chrp-rs6k: $(images)/zImage.chrp $(ADDNOTE)
cp $(images)/zImage.chrp $@
$(ADDNOTE) $@
$(images)/zImage.initrd.chrp-rs6k: $(images)/zImage.initrd.chrp
$(images)/zImage.initrd.chrp-rs6k: $(images)/zImage.initrd.chrp $(ADDNOTE)
cp $(images)/zImage.initrd.chrp $@
$(ADDNOTE) $@
......@@ -152,6 +147,3 @@ zImage: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac \
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
......@@ -27,10 +27,6 @@ LIBS = $(common)/lib.a $(bootlib)/lib.a
boot-y := head.o misc.o
boot-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
EXTRA_TARGETS := $(boot-y) ../simple/legacy.o
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
......@@ -43,8 +39,6 @@ OBJS := $(addprefix $(obj)/,$(boot-y)) $(simple)/legacy.o
# Tools
MKPREP := $(utils)/mkprep
SIZE := $(utils)/size
OFFSET := $(utils)/offset
# Extra include search dirs
CFLAGS_kbd.o += -Idrivers/char
......@@ -55,8 +49,8 @@ zImage.initrd: $(images)/zImage.initrd.prep
$(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
$(images)/zImage.prep: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
$(obj)/dummy.o $(MKPREP)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
......@@ -68,7 +62,7 @@ $(images)/zImage.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
rm -f $(obj)/zImage
$(images)/zImage.initrd.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(images)/vmlinux.gz $(obj)/dummy.o $(MKPREP)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
......
......@@ -8,6 +8,7 @@
*/
#include <linux/types.h>
#include <linux/string.h>
#include <asm/residual.h>
#include <linux/config.h>
#include <linux/threads.h>
......
......@@ -132,23 +132,9 @@ EXTRA_AFLAGS := -Wa,-m405
EXTRA := rw4/rw4_init.o rw4/rw4_init_brd.o
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 $(boot)/ld.script \
-Ttext $(CONFIG_BOOT_LOAD) -Bstatic
else
# Linker args. This specifies where the image will be run at.
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
-Ttext $(CONFIG_BOOT_LOAD) -Bstatic
OBJCOPY_ARGS := -O elf32-powerpc
# head.o and relocate.o must be at the start.
......@@ -167,7 +153,6 @@ boot-$(CONFIG_8260) += m8260_tty.o
boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
endif
EXTRA_TARGETS := $(boot-y)
LIBS := $(common)/lib.a $(bootlib)/lib.a
OBJS := $(addprefix $(obj)/,$(boot-y))
......
......@@ -21,6 +21,7 @@
#include <linux/types.h>
#include <linux/elf.h>
#include <linux/config.h>
#include <linux/string.h>
#include <asm/page.h>
#include <asm/processor.h>
......
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