Commit c23e30be authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Makefile cleanups, patch from Sam Ravnborg

parent b85223e9
......@@ -11,10 +11,10 @@
#
# This must match PAGE_OFFSET in include/asm-ppc/page.h.
KERNELLOAD =$(CONFIG_KERNEL_START)
KERNELLOAD := $(CONFIG_KERNEL_START)
LDFLAGS_BLOB := --format binary --oformat elf32-powerpc
LDFLAGS_vmlinux = -Ttext $(KERNELLOAD) -Bstatic
LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS += -Iarch/$(ARCH)
AFLAGS += -Iarch/$(ARCH)
cflags-y += -Iarch/$(ARCH) -msoft-float -pipe \
......
......@@ -17,24 +17,13 @@ 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
subdir-y := lib/ common/ images/
subdir-$(CONFIG_ALL_PPC) += of1275/
# for cleaning
subdir- += simple/ openfirmware/ prep/
tools-$(CONFIG_ALL_PPC) := addnote mknote hack-coff mkprep
tools-$(CONFIG_PPLUS) := mkbugboot mkprep
tools-$(CONFIG_4xx) := mktree
tools-$(CONFIG_LOPEC) := mkbugboot mkprep
tools-$(CONFIG_MCPN765) := mkbugboot mkprep
tools-$(CONFIG_MENF1) := mkprep
tools-$(CONFIG_MVME5100) := mkbugboot mkprep
tools-$(CONFIG_PRPMC750) := mkbugboot mkprep
tools-$(CONFIG_PRPMC800) := mkbugboot mkprep
tools-$(CONFIG_SPRUCE) := mktree
host-progs := $(addprefix utils/,$(tools-y))
host-progs := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
.PHONY: $(BOOT_TARGETS) $(bootdir-y)
......
......@@ -2,12 +2,14 @@
# This dir holds all of the images for PPC machines.
# Tom Rini January 2001
extra-y := vmlinux.gz
GZIP_FLAGS := -v9f
extra-y := vmlinux.bin vmlinux.gz
$(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) -O binary $< $(@:.gz=)
gzip $(GZIP_FLAGS) $(@:.gz=)
OBJCOPYFLAGS_vmlinux.bin := -O binary
$(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy)
$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip)
# Files generated that shall be removed upon make clean
clean-files := sImage vmapus vmlinux* miboot* zImage*
......@@ -13,17 +13,11 @@
# modified by Cort (cort@cs.nmt.edu)
#
boot: zImage
TFTPIMAGE = /tftpboot/zImage.prep
TFTPIMAGE := /tftpboot/zImage.prep
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE = $(TFTPBOOT).smp
TFTPIMAGE := $(TFTPBOOT).smp
endif
LD_ARGS = -T $(boot)/ld.script -Ttext 0x00800000 -Bstatic
OBJCOPY_ARGS = -O elf32-powerpc
LIBS = $(common)/lib.a $(bootlib)/lib.a
boot-y := head.o misc.o
boot-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
......@@ -31,56 +25,70 @@ boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
simple := $(boot)/simple
EXTRA_TARGETS := $(boot-y) ../simple/legacy.o
OBJS := $(addprefix $(obj)/,$(boot-y)) $(simple)/legacy.o
OBJCOPYFLAGS := -O elf32-powerpc
LIBS := $(common)/lib.a $(bootlib)/lib.a
# Tools
MKPREP := $(utils)/mkprep
targets := $(boot-y) dummy.o ../simple/legacy.o
OBJS := $(addprefix $(obj)/,$(boot-y)) $(simple)/legacy.o
# Extra include search dirs
CFLAGS_kbd.o += -Idrivers/char
zImage: initrd :=
zImage: $(images)/zImage.prep
@echo ' kernel: $@ is ready ($<)'
zImage.initrd: initrd := .initrd
zImage.initrd: $(images)/zImage.initrd.prep
@echo ' kernel: $@ is ready ($<)'
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
mages)/ramdisk.image.gz:
@echo ' MISSING $@'
@echo ' RAM disk image must be provided separatly'
@/bin/false
$(images)/zImage.prep: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
$(obj)/dummy.o $(MKPREP)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
OBJCOPYFLAGS_image.o := \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
$(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 $(MKPREP)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--set-section-flags=.image=contents,alloc,load,readonly,data
targets += image.o
$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz
$(call if_changed,objcopy)
OBJCOPYFLAGS_image.initrd.o := \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
$(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
--set-section-flags=.image=contents,alloc,load,readonly,data
targets += image.initrd.o
$(obj)/image.initrd.o: $(obj)/dummy.o $(images)/vmlinux.gz $(images)/ramdisk.image.gz
$(call if_changed,objcopy)
LDFLAGS_zImage.bin := -Ttext 0x00800000 -Bstatic -T
LDFLAGS_zImage.initrd.bin := -Ttext 0x00800000 -Bstatic -T
targets += zImage.bin zImage.initrd.bin
$(obj)/zImage$(initrd).bin: $(boot)/ld.script $(OBJS) $(obj)/image.o $(LIBS)
$(call if_changed,ld)
OBJCOPYFLAGS_zImage := -R .comment -R .stab -R .stabstr
OBJCOPYFLAGS_zImage.initrd := -R .comment -R .stab -R .stabstr
targets += zImage zImage.initrd
$(obj)/zImage$(initrd): %: %.bin FORCE
$(call if_changed,objcopy)
quiet_cmd_mkprep = MKPREP $@
cmd_mkprep = $(utils)/mkprep -pbp $< $@
$(images)/zImage$(initrd).prep: $(obj)/zImage$(initrd) $(utils)/mkprep FORCE
$(call cmd,mkprep)
#
# Convinient shorthands for various targets
#
floppy: zImage
dd if=$(images)/zImage.prep of=/dev/fd0H1440 bs=64b
znetboot : zImage
cp $(images)/zImage.prep $(TFTPIMAGE)
znetboot.initrd : zImage.initrd
cp $(images)/zImage.initrd.prep $(TFTPIMAGE)
znetboot.initrd : zImage$(initrd)
cp $(images)/zImage$(initrd).prep $(TFTPIMAGE)
int main(void)
{
return 0;
}
#
# arch/ppc/boot/utils/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
HOSTCFLAGS += -I$(TOPDIR)/arch/$(ARCH)/boot/include
all: FORCE
# Simple programs with 1 file and no extra CFLAGS
UTILS = addnote hack-coff mkprep mknote mkbugboot mktree \
addSystemMap addRamdDisk
$(UTILS):
$(HOSTCC) $(HOSTCFLAGS) -o $@ $@.c
clean:
rm -f $(UTILS)
......@@ -10,12 +10,10 @@ EXTRA_AFLAGS := -Wa,-m405
endif
# Start off with 'head.o', change as needed.
HEAD-y := head.o
HEAD-$(CONFIG_40x) := head_4xx.o
HEAD-$(CONFIG_8xx) := head_8xx.o
HEAD-$(CONFIG_6xx) += idle_6xx.o
extra-y := $(HEAD-y)
extra-y := head.o
extra-$(CONFIG_40x) := head_4xx.o
extra-$(CONFIG_8xx) := head_8xx.o
extra-$(CONFIG_6xx) += idle_6xx.o
obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
process.o signal.o ptrace.o align.o \
......
#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
#
# NB: cribbed from the drivers/sbus/Makefile -- PMM
obj-y += ocp.o ocp-driver.o ocp-probe.o
obj-y := ocp.o ocp-driver.o ocp-probe.o
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