Commit 452e9f81 authored by Sam Ravnborg's avatar Sam Ravnborg

[ARM] makefile cleanup

Added prerequisite FORCE in several rules, now kbuild build a kernel even
the second time you try.
Corrected several errors to avoid errornous rebuild of targets in arch/arm
Lot's of trivial clean-up
parent 7e796024
......@@ -34,14 +34,12 @@ apcs-$(CONFIG_CPU_26) :=-mapcs-26 -mcpu=arm3
# Note that GCC is lame - it doesn't numerically define an
# architecture version macro, but instead defines a whole
# series of macros.
arch-y :=
arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 -march=armv5
arch-$(CONFIG_CPU_XSCALE) :=-D__LINUX_ARM_ARCH__=5 -march=armv4 -Wa,-mxscale #-march=armv5te
# This selects how we optimise for the processor.
tune-y :=
tune-$(CONFIG_CPU_ARM610) :=-mtune=arm610
tune-$(CONFIG_CPU_ARM710) :=-mtune=arm710
tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi
......@@ -58,123 +56,67 @@ CFLAGS_BOOT :=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Wa,
CFLAGS +=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Wa,-mno-fpu
AFLAGS +=$(apcs-y) $(arch-y) -mno-fpu -msoft-float -Wa,-mno-fpu
#Default value
DATAADDR := .
ifeq ($(CONFIG_CPU_26),y)
PROCESSOR := armo
HEAD := arch/arm/mach-arc/head.o arch/arm/kernel/init_task.o
LDFLAGS_BLOB += --oformat elf26-littlearm
ifeq ($(CONFIG_ROM_KERNEL),y)
DATAADDR = 0x02080000
TEXTADDR = 0x03800000
DATAADDR := 0x02080000
textaddr-y := 0x03800000
else
TEXTADDR = 0x02080000
textaddr-y := 0x02080000
endif
endif
ifeq ($(CONFIG_CPU_32),y)
PROCESSOR = armv
PROCESSOR := armv
HEAD := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
TEXTADDR = 0xC0008000
LDFLAGS_BLOB += --oformat elf32-littlearm
endif
ifeq ($(CONFIG_ARCH_ARCA5K),y)
MACHINE = arc
endif
ifeq ($(CONFIG_ARCH_RPC),y)
MACHINE = rpc
endif
ifeq ($(CONFIG_ARCH_EBSA110),y)
MACHINE = ebsa110
endif
ifeq ($(CONFIG_ARCH_CLPS7500),y)
MACHINE = clps7500
INCDIR = cl7500
endif
ifeq ($(CONFIG_FOOTBRIDGE),y)
MACHINE = footbridge
INCDIR = ebsa285
endif
ifeq ($(CONFIG_ARCH_CO285),y)
TEXTADDR = 0x60008000
MACHINE = footbridge
INCDIR = ebsa285
endif
ifeq ($(CONFIG_ARCH_FTVPCI),y)
MACHINE = ftvpci
INCDIR = nexuspci
endif
ifeq ($(CONFIG_ARCH_TBOX),y)
MACHINE = tbox
endif
ifeq ($(CONFIG_ARCH_SHARK),y)
MACHINE = shark
endif
textaddr-y := 0xC0008000
endif
machine-$(CONFIG_ARCH_ARCA5K) := arc
machine-$(CONFIG_ARCH_RPC) := rpc
machine-$(CONFIG_ARCH_EBSA110) := ebsa110
machine-$(CONFIG_ARCH_CLPS7500) := clps7500
incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
machine-$(CONFIG_FOOTBRIDGE) := footbridge
incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
textaddr-$(CONFIG_ARCH_CO285) := 0x60008000
machine-$(CONFIG_ARCH_CO285) := footbridge
incdir-$(CONFIG_ARCH_CO285) := ebsa285
machine-$(CONFIG_ARCH_FTVPCI) := ftvpci
incdir-$(CONFIG_ARCH_FTVPCI) := nexuspci
machine-$(CONFIG_ARCH_TBOX) := tbox
machine-$(CONFIG_ARCH_SHARK) := shark
machine-$(CONFIG_ARCH_SA1100) := sa1100
ifeq ($(CONFIG_ARCH_SA1100),y)
ifeq ($(CONFIG_SA1111),y)
# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
TEXTADDR = 0xc0208000
endif
MACHINE = sa1100
endif
ifeq ($(CONFIG_ARCH_PXA),y)
MACHINE = pxa
endif
ifeq ($(CONFIG_ARCH_L7200),y)
MACHINE = l7200
endif
ifeq ($(CONFIG_ARCH_INTEGRATOR),y)
MACHINE = integrator
endif
ifeq ($(CONFIG_ARCH_CAMELOT),y)
MACHINE = epxa10db
endif
ifeq ($(CONFIG_ARCH_CLPS711X),y)
TEXTADDR = 0xc0028000
MACHINE = clps711x
endif
ifeq ($(CONFIG_ARCH_FORTUNET),y)
TEXTADDR = 0xc0008000
endif
ifeq ($(CONFIG_ARCH_ANAKIN),y)
MACHINE = anakin
endif
ifeq ($(CONFIG_ARCH_IOP310),y)
MACHINE = iop310
endif
ifeq ($(CONFIG_ARCH_ADIFCC),y)
MACHINE = adifcc
endif
textaddr-$(CONFIG_SA1111) := 0xc0208000
endif
machine-$(CONFIG_ARCH_PXA) := pxa
machine-$(CONFIG_ARCH_L7200) := l7200
machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
machine-$(CONFIG_ARCH_CAMELOT) := epxa10db
textaddr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000
machine-$(CONFIG_ARCH_CLPS711X) := clps711x
textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
machine-$(CONFIG_ARCH_ANAKIN) := anakin
machine-$(CONFIG_ARCH_IOP310) := iop310
machine-$(CONFIG_ARCH_ADIFCC) := adifcc
MACHINE := $(machine-y)
TEXTADDR := $(textaddr-y)
ifeq ($(incdir-y),)
incdir-y := $(MACHINE)
endif
INCDIR := $(incdir-y)
export MACHINE PROCESSOR TEXTADDR GZFLAGS CFLAGS_BOOT
# Only set INCDIR if its not already defined above
# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
ifeq ($(origin INCDIR), undefined)
INCDIR :=$(MACHINE)
endif
ifeq ($(origin DATAADDR), undefined)
DATAADDR := .
endif
# Do we have FASTFPE?
FASTFPE :=arch/arm/fastfpe
ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
......@@ -194,7 +136,10 @@ drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/
libs-y += arch/arm/lib/
makeboot = $(call descend,arch/arm/boot,$(1))
# Default target when executing plain make
all: zImage
makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/arm/boot $(1)
# Update machine arch and proc symlinks if something which affects
# them changed. We use .arch and .proc to indicate when they were
......@@ -217,13 +162,17 @@ prepare: maketools
.PHONY: maketools FORCE
maketools: include/asm-arm/.arch include/asm-arm/.proc \
include/asm-arm/constants.h include/linux/version.h FORCE
+@$(call descend,arch/arm/tools, include/asm-arm/mach-types.h)
$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/arm/tools include/asm-arm/mach-types.h
# Convert bzImage to zImage
bzImage: vmlinux
$(call makeboot,arch/arm/boot/zImage)
zImage Image bootpImage: vmlinux
+@$(call makeboot,arch/arm/boot/$@)
$(call makeboot,arch/arm/boot/$@)
bzImage zinstall install: vmlinux
+@$(call makeboot,$@)
zinstall install: vmlinux
$(call makeboot,$@)
MRPROPER_FILES += \
include/asm-arm/arch include/asm-arm/.arch \
......@@ -233,15 +182,15 @@ MRPROPER_FILES += \
# We use MRPROPER_FILES and CLEAN_FILES now
archmrproper:
archclean: FORCE
+@$(call makeboot,clean)
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/arm/boot
# My testing targets (that short circuit a few dependencies)
zImg:; +@$(call makeboot, zImage)
Img:; +@$(call makeboot, Image)
i:; +@$(call makeboot, install)
zi:; +@$(call makeboot, zinstall)
bp:; +@$(call makeboot, bootpImage)
zImg:; $(call makeboot, arch/arm/boot/zImage)
Img:; $(call makeboot, arch/arm/boot/Image)
bp:; $(call makeboot, arch/arm/boot/bootpImage)
i:; $(call makeboot, install)
zi:; $(call makeboot, zinstall)
#
# Configuration targets. Use these to select a
......@@ -261,10 +210,9 @@ bp:; +@$(call makeboot, bootpImage)
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
@:
include/asm-$(ARCH)/constants.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/constants.h: include/asm-$(ARCH)/constants.h.tmp
include/asm-$(ARCH)/constants.h: arch/$(ARCH)/kernel/asm-offsets.s
@echo -n ' Generating $@'
@$(generate-asm-offsets.h) < $< > $@.tmp
@$(update-if-changed)
......@@ -13,132 +13,81 @@
# PARAMS_PHYS must be with 4MB of ZRELADDR
# INITRD_PHYS must be in RAM
ifeq ($(CONFIG_CPU_26),y)
ZRELADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
INITRD_PHYS = 0x02180000
endif
ifeq ($(CONFIG_ARCH_RPC),y)
ZRELADDR = 0x10008000
PARAMS_PHYS = 0x10000100
INITRD_PHYS = 0x18000000
endif
ifeq ($(CONFIG_ARCH_CLPS7500),y)
ZRELADDR = 0x10008000
endif
ifeq ($(CONFIG_ARCH_EBSA110),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000400
INITRD_PHYS = 0x00800000
endif
ifeq ($(CONFIG_ARCH_SHARK),y)
ZTEXTADDR = 0x08508000
ZRELADDR = 0x08008000
endif
ifeq ($(CONFIG_FOOTBRIDGE),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000100
INITRD_PHYS = 0x00800000
endif
ifeq ($(CONFIG_ARCH_INTEGRATOR),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000100
INITRD_PHYS = 0x00800000
endif
ifeq ($(CONFIG_ARCH_CAMELOT),y)
ZRELADDR = 0x00008000
endif
ifeq ($(CONFIG_ARCH_NEXUSPCI),y)
ZRELADDR = 0x40008000
endif
ifeq ($(CONFIG_ARCH_L7200),y)
ZRELADDR = 0xf0008000
endif
zreladdr-$(CONFIG_CPU_26) := 0x02080000
params_phys-$(CONFIG_CPU_26) := 0x0207c000
initrd_phys-$(CONFIG_CPU_26) := 0x02180000
zreladdr-$(CONFIG_ARCH_RPC) := 0x10008000
params_phys-$(CONFIG_ARCH_RPC) := 0x10000100
initrd_phys-$(CONFIG_ARCH_RPC) := 0x18000000
zreladdr-$(CONFIG_ARCH_CLPS7500) := 0x10008000
zreladdr-$(CONFIG_ARCH_CLPS7500) := 0x10008000
zreladdr-$(CONFIG_ARCH_EBSA110) := 0x00008000
params_phys-$(CONFIG_ARCH_EBSA110) := 0x00000400
initrd_phys-$(CONFIG_ARCH_EBSA110) := 0x00800000
ztextaddr-$(CONFIG_ARCH_SHARK) := 0x08508000
zreladdr-$(CONFIG_ARCH_SHARK) := 0x08008000
zreladdr-$(CONFIG_FOOTBRIDGE) := 0x00008000
params_phys-$(CONFIG_FOOTBRIDGE) := 0x00000100
initrd_phys-$(CONFIG_FOOTBRIDGE) := 0x00800000
zreladdr-$(CONFIG_ARCH_INTEGRATOR) := 0x00008000
params_phys-$(CONFIG_ARCH_INTEGRATOR) := 0x00000100
initrd_phys-$(CONFIG_ARCH_INTEGRATOR) := 0x00800000
zreladdr-$(CONFIG_ARCH_CAMELOT) := 0x00008000
zreladdr-$(CONFIG_ARCH_NEXUSPCI) := 0x40008000
zreladdr-$(CONFIG_ARCH_L7200) := 0xf0008000
# The standard locations for stuff on CLPS711x type processors
ifeq ($(CONFIG_ARCH_CLPS711X),y)
ZRELADDR = 0xc0028000
PARAMS_PHYS = 0xc0000100
endif
zreladdr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000
params_phys-$(CONFIG_ARCH_CLPS711X) := 0xc0000100
# Should probably have some agreement on these...
ifeq ($(CONFIG_ARCH_P720T),y)
INITRD_PHYS = 0xc0400000
endif
ifeq ($(CONFIG_ARCH_CDB89712),y)
INITRD_PHYS = 0x00700000
endif
initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000
initrd_phys-$(CONFIG_ARCH_CDB89712) := 0x00700000
zreladdr-$(CONFIG_ARCH_SA1100) := 0xc0008000
ifeq ($(CONFIG_ARCH_SA1100),y)
ZRELADDR = 0xc0008000
# No defconfig file to move this into...
#ifeq ($(CONFIG_SA1100_YOPY),y)
# ZTEXTADDR = 0x00080000
# ZBSSADDR = 0xc0200000
#endif
ifeq ($(CONFIG_SA1111),y)
ZRELADDR = 0xc0208000
endif
endif
ifeq ($(CONFIG_ARCH_PXA),y)
ZRELADDR = 0xa0008000
endif
ifeq ($(CONFIG_ARCH_ANAKIN),y)
ZRELADDR = 0x20008000
endif
ifeq ($(CONFIG_ARCH_IQ80310),y)
ZRELADDR = 0xa0008000
endif
ifeq ($(CONFIG_ARCH_ADIFCC),y)
ZRELADDR = 0xc0008000
zreladdr-$(CONFIG_SA1111) := 0xc0208000
endif
zreladdr-$(CONFIG_ARCH_PXA) := 0xa0008000
zreladdr-$(CONFIG_ARCH_ANAKIN) := 0x20008000
zreladdr-$(CONFIG_ARCH_IQ80310) := 0xa0008000
zreladdr-$(CONFIG_ARCH_ADIFCC) := 0xc0008000
ZRELADDR := $(zreladdr-y)
ZTEXTADDR := $(ztextaddr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)
#
# We now have a PIC decompressor implementation. Decompressors running
# from RAM should not define ZTEXTADDR. Decompressors running directly
# from ROM or Flash must define ZTEXTADDR (preferably via the config)
#
# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
ifeq ($(CONFIG_ZBOOT_ROM),y)
ZTEXTADDR =$(CONFIG_ZBOOT_ROM_TEXT)
ZBSSADDR =$(CONFIG_ZBOOT_ROM_BSS)
ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
else
ZTEXTADDR =0
ZBSSADDR =ALIGN(4)
ZTEXTADDR := 0
ZBSSADDR := ALIGN(4)
endif
export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
include $(TOPDIR)/Rules.make
EXTRA_TARGETS := Image zImage bootpImage
$(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy)
bzImage: $(obj)/zImage
@echo ' Kernel: $@ is ready'
$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
$(obj)/compressed/vmlinux: vmlinux FORCE
+@$(call descend,arch/arm/boot/compressed, $(obj)/compressed/vmlinux)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed $@
$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
+@$(call descend,arch/arm/boot/bootp, $(obj)/bootp/bootp)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed $@
.PHONY: initrd
initrd:
......@@ -157,19 +106,16 @@ zinstall: $(obj)/zImage
$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \
$(obj)/zImage System.map "$(INSTALL_PATH)"
clean:
$(RM) $(addprefix $(obj)/,Image zImage bootpImage)
+@$(call descend,arch/arm/boot/bootp, clean)
+@$(call descend,arch/arm/boot/compressed, clean)
clean-files := $(addprefix $(obj)/,Image zImage bootpImage)
subdir- := bootp compressed
archhelp:
@echo '* bzImage/zImage- Compressed kernel image (arch/$(ARCH)/boot/zImage)'
@echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
@echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
@echo ' bootpImage - Combined zImage and initial RAM disk'
@echo ' initrd - Create an initial image'
@echo ' install - Install uncompressed kernel'
@echo ' zinstall - Install compressed kernel'
@echo ' Install using (your) ~/bin/installkernel or'
@echo ' (distribution) /sbin/installkernel or'
@echo ' install to $$(INSTALL_PATH) and run lilo'
......@@ -9,8 +9,6 @@ ZLDFLAGS =-p -X -T $(obj)/bootp.lds \
EXTRA_TARGETS := bootp
include $(TOPDIR)/Rules.make
# Note that bootp.lds picks up kernel.o and initrd.o
$(obj)/bootp: $(addprefix $(obj)/,init.o kernel.o initrd.o bootp.lds)
$(LD) $(ZLDFLAGS) -o $@ $(obj)/init.o
......@@ -22,5 +20,3 @@ $(obj)/initrd.o: $(INITRD)
$(LD) -r -s -o $@ -b binary $(INITRD)
.PHONY: $(INITRD) $(ZSYSTEM)
clean:; $(RM) $(obj)/bootp
......@@ -63,28 +63,30 @@ ifeq ($(CONFIG_CPU_XSCALE),y)
OBJS += head-xscale.o
endif
SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;\
s/BSS_START/$(ZBSSADDR)/;s#OBJ#$(obj)#
SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
EXTRA_TARGETS := vmlinux piggy.o font.o head.o $(OBJS)
EXTRA_TARGETS := vmlinux vmlinux.lds piggy piggy.gz\
piggy.o font.o head.o $(OBJS)
EXTRA_CFLAGS := $(CFLAGS_BOOT) -fpic
EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
LDFLAGS_vmlinux := -p -X \
$(shell $(CC) $(CFLAGS) --print-libgcc-file-name) -T
$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
$(addprefix $(obj)/, $(OBJS))
$(addprefix $(obj)/, $(OBJS)) FORCE
$(call if_changed,ld)
@:
$(obj)/piggy: vmlinux FORCE
$(call if_changed,objcopy)
$(obj)/piggy: vmlinux; $(call if_changed,objcopy)
$(obj)/piggy.gz: $(obj)/piggy; $(call if_changed,gzip)
$(obj)/piggy.gz: $(obj)/piggy FORCE
$(call if_changed,gzip)
LDFLAGS_piggy.o := -r -b binary
$(obj)/piggy.o: $(obj)/piggy.gz
$(obj)/piggy.o: $(obj)/piggy.gz FORCE
$(call if_changed,ld)
CFLAGS_font.o := -Dstatic=
......@@ -93,9 +95,7 @@ $(obj)/font.o: $(FONTC)
$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config
@sed "$(SEDFLAGS)" < $< > $@
.PHONY: clean
clean:
rm -f $(addprefix $(obj)/,vmlinux core piggy* vmlinux.lds)
clean-files := $(addprefix $(obj)/,vmlinux piggy* vmlinux.lds)
$(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
......@@ -4,9 +4,6 @@
# Copyright (C) 2001 Russell King
#
include $(TOPDIR)/Rules.make
include/asm-arm/mach-types.h: $(obj)/mach-types $(obj)/gen-mach-types
@echo ' Generating $@'
@awk -f $(obj)/gen-mach-types $(obj)/mach-types > $@
@$(AWK) -f $(obj)/gen-mach-types $(obj)/mach-types > $@
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