Skip to contentSkip to conversation

arch/alpha: Makefiles update

CFT Sam Ravnborg 2 participants 2 messages Dec 30, 2002 – Dec 31, 2002 Alpha port

lore
Share & tools
lore
#0 lore raw

I have given the Alpha Makefile a rehaul, but lacks the binaries to actually test if it is OK.
Primary purpose is to make the architecture makefiles more look alike.

Anyone with alpha tools that want to give this a try?

When testing try out the following:

make
make msb
make srmboot
make boot
make bootimage

and try also
make KBUILD_VERBOSE=0 bootimage

Execute "find arch/alpha -name '*.o' | xargs rm"
to force the architecture specific files to be recompiled between each run.

I appreciate any feedback on the patch, as well as go/no-go reports. With this amount of changes I expect a few bugs, although I have been carefull reviewing my changes.

The target "rawboot" has been removed. Anyone using this? Same question goes for msb (my-special-boot) and srmboot.

Sam

Following files were changed:

 Makefile          |  147 ++++++++++++++++++++----------------------------------
 boot/Makefile     |  137 +++++++++++++++++++++++---------------------------
 kernel/Makefile   |    9 +--
 lib/Makefile      |   69 ++++++++++++-------------
 math-emu/Makefile |    3 -
 5 files changed, 158 insertions(+), 207 deletions(-)

===== arch/alpha/Makefile 1.18 vs edited =====

arch/alpha/Makefile +56 -91
@@ -10,13 +10,17 @@
 
 NM := $(NM) -B
 
-LDFLAGS_vmlinux = -static -N #-relax
-CFLAGS := $(CFLAGS) -pipe -mno-fp-regs -ffixed-8
-LDFLAGS_BLOB := --format binary --oformat elf64-alpha
+LDFLAGS_vmlinux	:= -static -N #-relax
+LDFLAGS_BLOB	:= --format binary --oformat elf64-alpha
+cflags-y	:= -pipe -mno-fp-regs -ffixed-8
 
 # Determine if we can use the BWX instructions with GAS.
 old_gas := $(shell if $(AS) --version 2>&1 | grep 'version 2.7' > /dev/null; then echo y; else echo n; fi)
 
+ifeq ($(old_gas),y)
+$(error The assembler '$(AS)' does not support the BWX instruction)
+endif
+
 # Determine if GCC understands the -mcpu= option.
 have_mcpu := $(shell if $(CC) -mcpu=ev5 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
 
@@ -27,68 +31,36 @@
 have_mcpu_ev67 := $(shell if $(CC) -mcpu=ev67 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
 
 have_msmall_data := $(shell if $(CC) -msmall-data -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi)
-ifeq ($(have_msmall_data),y)
-  CFLAGS := $(CFLAGS) -msmall-data
-endif
 
-# Turn on the proper cpu optimizations.
-ifeq ($(have_mcpu),y)
-  # If GENERIC, make sure to turn off any instruction set extensions that
-  # the host compiler might have on by default.  Given that EV4 and EV5
-  # have the same instruction set, prefer EV5 because an EV5 schedule is
-  # more likely to keep an EV4 processor busy than vice-versa.
-  mcpu_done := n
-  ifeq ($(CONFIG_ALPHA_GENERIC),y)
-    CFLAGS := $(CFLAGS) -mcpu=ev5
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56),nyy)
-    CFLAGS := $(CFLAGS) -mcpu=pca56
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56),nyy)
-    CFLAGS := $(CFLAGS) -mcpu=pca56
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV4),ny)
-    CFLAGS := $(CFLAGS) -mcpu=ev4
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV56),ny)
-    CFLAGS := $(CFLAGS) -mcpu=ev56
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV5),ny)
-    CFLAGS := $(CFLAGS) -mcpu=ev5
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67),nyy)
-    CFLAGS := $(CFLAGS) -mcpu=ev67
-    mcpu_done := y
-  endif
-  ifeq ($(mcpu_done)$(CONFIG_ALPHA_EV6),ny)
-    ifeq ($(have_mcpu_ev6),y)
-      CFLAGS := $(CFLAGS) -mcpu=ev6
-    else
-      ifeq ($(have_mcpu_pca56),y)
-        CFLAGS := $(CFLAGS) -mcpu=pca56
-      else
-        CFLAGS := $(CFLAGS) -mcpu=ev56
-      endif
-    endif
-    mcpu_done := y
-  endif
-endif
+cflags-$(have_msmall_data) += -msmall-data
+
+# If ALPHA_GENERIC, make sure to turn off any instruction set extensions
+# that the host compiler might have on by default. Given that EV4 and EV5
+# have the same instruction set, prefer EV5 because an EV5 schedule is
+# more likely to keep an EV4 processor busy than vice-versa.
+ 
+# Default value
+mach-yy := ev56
+mach-$(have_mcpu_pca56)$(have_mcpu_pca56)	:= pca56
+
+#Machine depedent values, influenced by gcc capabilitites
+mach-$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56)	:= pca56
+mach-$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56)	:= pca56
+mach-$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67)	:= ev67
+
+mach-y				:= $(mach-yy)
+mach-$(CONFIG_ALPHA_GENERIC)	:= ev5
+mach-$(CONFIG_ALPHA_EV4)	:= ev4
+mach-$(CONFIG_ALPHA_EV56)	:= ev56
+mach-$(CONFIG_ALPHA_EV5)	:= ev5
+mach-$(CONFIG_ALPHA_EV6)	:= ev6
+
+cflags-$(have_mcpu) += -mcpu=$(mach-y)
 
 # For TSUNAMI, we must have the assembler not emulate our instructions.
 # The same is true for IRONGATE, POLARIS, PYXIS.
 # BWX is most important, but we don't really want any emulation ever.
-
-ifeq ($(old_gas),y)
-  # How do we do #error in make?
-  CFLAGS := --error-please-upgrade-your-assembler
-endif
-CFLAGS := $(CFLAGS) -Wa,-mev6
+CFLAGS += $(cflags-y) -Wa,-mev6
 
 HEAD := arch/alpha/kernel/head.o
 
@@ -96,37 +68,21 @@
 core-$(CONFIG_MATHEMU)  += arch/alpha/math-emu/
 libs-y			+= arch/alpha/lib/
 
-export libs-y
+boot := arch/alpha/boot
 
-MAKEBOOT = $(MAKE) -C arch/alpha/boot
+#Default target when executing make with no arguments
+all boot: $(boot)/vmlinux.gz
 
-rawboot:	vmlinux
-	@$(MAKEBOOT) rawboot
+$(boot)/vmlinux.gz: vmlinux
+	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $@
 
-boot:	vmlinux
-	@$(MAKEBOOT)
+# My special boot (msb) writes directly to a specific disk partition,
+# I doubt most people will want to do that without changes..
+msb srmboot: vmlinux
+	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $@
 
-#
-# My boot writes directly to a specific disk partition, I doubt most
-# people will want to do that without changes..
-#
-msb my-special-boot:	vmlinux
-	@$(MAKEBOOT) msb
-
-bootimage:	vmlinux
-	@$(MAKEBOOT) bootimage
-
-srmboot:	vmlinux
-	@$(MAKEBOOT) srmboot
-
-archclean:
-	@$(MAKEBOOT) clean
-
-archmrproper:
-	rm -f include/asm-alpha/asm_offsets.h
-
-bootpfile:	vmlinux
-	@$(MAKEBOOT) bootpfile
+bootimage bootpfile: vmlinux
+	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $(boot)/$@
 
 
 prepare: include/asm-$(ARCH)/asm_offsets.h
@@ -134,12 +90,21 @@
 arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
 				   include/config/MARKER
 
-include/asm-$(ARCH)/asm_offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
-	@$(generate-asm-offsets.h) < $< > $@
-
-include/asm-$(ARCH)/asm_offsets.h: include/asm-$(ARCH)/asm_offsets.h.tmp
+include/asm-$(ARCH)/asm_offsets.h: include/asm-$(ARCH)/asm_offsets.h
 	@echo -n '  Generating $@'
+	@$(generate-asm-offsets.h) < $< > [email protected]
 	@$(update-if-changed)
 
+archclean:
+	$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
+
 CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
 	       include/asm-$(ARCH)/offset.h
+
+define archhelp
+  echo '* boot		- Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
+  echo '  bootimage	- Bootable image (arch/alpha/boot/bootimage)'
+  echo '  bootpfile	- INITRD image (arch/alpha(boot/bootpfile)'
+  echo '  srmboot	- Write bootimage to $$(BOOTDEV)'
+  echo '  msb		- My special boot???'
+endef

===== arch/alpha/boot/Makefile 1.10 vs edited =====

arch/alpha/boot/Makefile +65 -72

159 lines not on this page · raw message

===== arch/alpha/kernel/Makefile 1.15 vs edited =====

arch/alpha/kernel/Makefile +3 -6
@@ -19,12 +19,9 @@
 obj-y	 += irq_i8259.o irq_srm.o \
 	    es1888.o smc37c669.o smc37c93x.o ns87312.o
 
-ifdef CONFIG_VGA_HOSE
-obj-y	 += console.o
-endif
-
-obj-$(CONFIG_SMP)    += smp.o
-obj-$(CONFIG_PCI)    += pci.o pci_iommu.o
+obj-$(CONFIG_VGA_HOSE)	+= console.o
+obj-$(CONFIG_SMP)	+= smp.o
+obj-$(CONFIG_PCI)	+= pci.o pci_iommu.o
 obj-$(CONFIG_SRM_ENV)	+= srm_env.o
 
 ifdef CONFIG_ALPHA_GENERIC

===== arch/alpha/lib/Makefile 1.11 vs edited =====

arch/alpha/lib/Makefile +33 -36

91 lines not on this page · raw message

===== arch/alpha/math-emu/Makefile 1.6 vs edited =====

arch/alpha/math-emu/Makefile +1 -2
@@ -1,7 +1,6 @@
 #
 # Makefile for the FPU instruction emulation.
 #
-
-CFLAGS += -I. -I$(TOPDIR)/include/math-emu -w
+CFLAGS += -Iinclude/math-emu -w
 
 obj-$(CONFIG_MATHEMU) += math.o qrnnd.o
#1 lore raw
Quoted 10 lines · Sam Ravnborg
arch/alpha/Makefile +10 -0
+# If ALPHA_GENERIC, make sure to turn off any instruction set extensions
+# that the host compiler might have on by default. Given that EV4 and EV5
+# have the same instruction set, prefer EV5 because an EV5 schedule is
+# more likely to keep an EV4 processor busy than vice-versa.
+ 
+# Default value
+mach-yy := ev56
+mach-$(have_mcpu_pca56)$(have_mcpu_pca56)	:= pca56
+
+#Machine depedent values, influenced by gcc capabilitites

arch/alpha/Makefile line 56

Quoted 10 lines
arch/alpha/Makefile +10 -0
+mach-$(CONFIG_ALPHA_SX164)$(have_mcpu_pca56)	:= pca56
+mach-$(CONFIG_ALPHA_POLARIS)$(have_mcpu_pca56)	:= pca56
+mach-$(CONFIG_ALPHA_EV67)$(have_mcpu_ev67)	:= ev67
+
+mach-y				:= $(mach-yy)
+mach-$(CONFIG_ALPHA_GENERIC)	:= ev5
+mach-$(CONFIG_ALPHA_EV4)	:= ev4
+mach-$(CONFIG_ALPHA_EV56)	:= ev56
+mach-$(CONFIG_ALPHA_EV5)	:= ev5
+mach-$(CONFIG_ALPHA_EV6)	:= ev6

This doesn't work. For example CONFIG_ALPHA_EV67 depends on
CONFIG_ALPHA_EV6, so we'll never use the -mcpu=ev67 flag.

I'm reverting this part. I see nothing wrong with an if/else tree for this. It's straightforward. I think anything you come up with to replace it will be harder to understand at a glance, and therefore more fragile.

arch/alpha/Makefile line 82

Quoted 4 lines
arch/alpha/Makefile +4 -0
+# My special boot (msb) writes directly to a specific disk partition,
+# I doubt most people will want to do that without changes..
+msb srmboot: vmlinux
+	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $@

I've just removed these targets.

I'm testing the rest of the patch now. Will apply if successful.

r~