Skip to contentSkip to conversation

Handle most LDSCRIPT setting centrally

PATCH New Scott Wood 4 participants 8 messages Apr 6, 2011 – Apr 29, 2011

Subsystems (6)
lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

If board code specifies LDSCRIPT, that will be used. Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds $(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that were dead code, because they were overridden by a CPUDIR u-boot.lds under the old powerpc rules. These boards' own u-boot.lds have bitrotted and no longer work -- these lds files have been removed.

---
"./MAKEALL ppc" had identical output with and without this patch.

I tried building some arm boards, but couldn't find any that built for me even without this patch. They didn't appear to fail differently with it, though.

 arch/arm/config.mk                     |    1 -
 arch/i386/config.mk                    |    1 -
 arch/nios2/config.mk                   |    2 -
 arch/powerpc/config.mk                 |   11 ---
 arch/sh/config.mk                      |    6 --
 board/actux1/config.mk                 |    2 -
 board/actux2/config.mk                 |    2 -
 board/actux3/config.mk                 |    2 -
 board/altera/nios2-generic/config.mk   |    2 -
 board/amcc/acadia/config.mk            |    7 --
 board/amcc/bamboo/config.mk            |    7 --
 board/amcc/canyonlands/config.mk       |    7 --
 board/amcc/kilauea/config.mk           |    7 --
 board/amcc/sequoia/config.mk           |    7 --
 board/atmel/atstk1000/config.mk        |    1 -
 board/avnet/fx12mm/config.mk           |   29 ------
 board/avnet/v5fx30teval/config.mk      |   29 ------
 board/cm5200/u-boot.lds                |  120 --------------------------
 board/cogent/config.mk                 |    2 -
 board/earthlcd/favr-32-ezkit/config.mk |    1 -
 board/freescale/mx31ads/config.mk      |    2 -
 board/hymod/config.mk                  |    2 -
 board/munices/u-boot.lds               |  120 --------------------------
 board/samsung/smdk6400/config.mk       |    2 -
 board/sc3/u-boot.lds                   |  147 --------------------------------
 board/trab/config.mk                   |    2 -
 board/xilinx/ml507/config.mk           |    4 -
 board/xilinx/ppc405-generic/config.mk  |    4 -
 board/xilinx/ppc440-generic/config.mk  |    4 -
 config.mk                              |   33 ++++++-
 30 files changed, 28 insertions(+), 538 deletions(-)
 delete mode 100644 board/avnet/fx12mm/config.mk
 delete mode 100644 board/avnet/v5fx30teval/config.mk
 delete mode 100644 board/cm5200/u-boot.lds
 delete mode 100644 board/munices/u-boot.lds
 delete mode 100644 board/sc3/u-boot.lds
 delete mode 100644 board/xilinx/ml507/config.mk
 delete mode 100644 board/xilinx/ppc405-generic/config.mk
 delete mode 100644 board/xilinx/ppc440-generic/config.mk
arch/arm/config.mk +0 -1
index a6a4742..709eba9 100644
@@ -63,7 +63,6 @@ ifeq (,$(findstring arch/arm/lib/eabi_compat.o,$(PLATFORM_LIBS)))
 PLATFORM_LIBS += $(OBJTREE)/arch/arm/lib/eabi_compat.o
 endif
 endif
-LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
 
 # needed for relocation
 ifndef CONFIG_NAND_SPL
arch/i386/config.mk +0 -1
index 47e0fb4..d6e43d1 100644
@@ -39,4 +39,3 @@ PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions
 
 LDFLAGS_FINAL += --gc-sections -pie
-LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
arch/nios2/config.mk +0 -2
index d241a96..e58ea24 100644
@@ -29,7 +29,5 @@ STANDALONE_LOAD_ADDR ?= 0x02000000
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -G0
 
-LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
-
 LDFLAGS_FINAL += --gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
arch/powerpc/config.mk +0 -11
index 31e4416..bb613a7 100644
@@ -29,17 +29,6 @@ PLATFORM_RELFLAGS += -mrelocatable -ffunction-sections -fdata-sections
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_SPL
-LDSCRIPT := $(SRCTREE)/$(CONFIG_BOARDDIR)/u-boot-nand.lds
-else
-ifneq ($(wildcard $(SRCTREE)/arch/powerpc/cpu/$(CPU)/u-boot.lds),)
-LDSCRIPT := $(SRCTREE)/arch/powerpc/cpu/$(CPU)/u-boot.lds
-endif
-endif
-
 #
 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
 # will pick up a va_list declaration that is incompatible with the
arch/sh/config.mk +0 -6
index cd851f5..b5be5f2 100644
@@ -31,9 +31,3 @@ endif
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
 PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE)
 LDFLAGS_FINAL = --gc-sections
-
-ifdef CONFIG_SYS_LDSCRIPT
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else
-LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
-endif
board/actux1/config.mk +0 -2
index 88634f7..9cb838b 100644
@@ -2,5 +2,3 @@ CONFIG_SYS_TEXT_BASE = 0x00e00000
 
 # include NPE ethernet driver
 BOARDLIBS = arch/arm/cpu/ixp/npe/libnpe.o
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot.lds
board/actux2/config.mk +0 -2
index 88634f7..9cb838b 100644
@@ -2,5 +2,3 @@ CONFIG_SYS_TEXT_BASE = 0x00e00000
 
 # include NPE ethernet driver
 BOARDLIBS = arch/arm/cpu/ixp/npe/libnpe.o
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot.lds
board/actux3/config.mk +0 -2
index 88634f7..9cb838b 100644
@@ -2,5 +2,3 @@ CONFIG_SYS_TEXT_BASE = 0x00e00000
 
 # include NPE ethernet driver
 BOARDLIBS = arch/arm/cpu/ixp/npe/libnpe.o
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot.lds
board/altera/nios2-generic/config.mk +0 -2
index 95e75af..00c16fc 100644
@@ -30,5 +30,3 @@ PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(VENDOR)/include
 ifeq ($(debug),1)
 PLATFORM_CPPFLAGS += -DDEBUG
 endif
-
-LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/u-boot.lds
board/amcc/acadia/config.mk +0 -7
index 2f2787f..bfc0945 100644
@@ -28,10 +28,3 @@
 ifeq ($(debug),1)
 PLATFORM_CPPFLAGS += -DDEBUG
 endif
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_U_BOOT
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-endif
board/amcc/bamboo/config.mk +0 -7
index 7ca16a0..24f74e1 100644
@@ -30,10 +30,3 @@ endif
 ifeq ($(dbcr),1)
 PLATFORM_CPPFLAGS += -DCONFIG_SYS_INIT_DBCR=0x8cff0000
 endif
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_U_BOOT
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-endif
board/amcc/canyonlands/config.mk +0 -7
index abf2a26..d693a26 100644
@@ -33,10 +33,3 @@ endif
 ifeq ($(dbcr),1)
 PLATFORM_CPPFLAGS += -DCONFIG_SYS_INIT_DBCR=0x8cff0000
 endif
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_U_BOOT
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-endif
board/amcc/kilauea/config.mk +0 -7
index 4ae3ea9..003b8c3 100644
@@ -24,10 +24,3 @@
 ifeq ($(debug),1)
 PLATFORM_CPPFLAGS += -DDEBUG
 endif
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_U_BOOT
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-endif
board/amcc/sequoia/config.mk +0 -7
index 73efe72..e0bf071 100644
@@ -33,10 +33,3 @@ endif
 ifeq ($(dbcr),1)
 PLATFORM_CPPFLAGS += -DCONFIG_SYS_INIT_DBCR=0x8cff0000
 endif
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-else ifdef CONFIG_NAND_U_BOOT
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-endif
board/atmel/atstk1000/config.mk +0 -1
index 8c03b77..284f7ff 100644
@@ -1,4 +1,3 @@
 PLATFORM_RELFLAGS	+= -ffunction-sections -fdata-sections
 PLATFORM_LDFLAGS	+= --gc-sections
 CONFIG_SYS_TEXT_BASE		= 0x00000000
-LDSCRIPT		= $(src)board/atmel/atstk1000/u-boot.lds
board/avnet/fx12mm/config.mk deleted +0 -29
deleted file mode 100644
index 78dde62..0000000
@@ -1,29 +0,0 @@
-#
-# (C) Copyright 2008
-# Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
-# Work supported by Qtechnology http://www.qtec.com
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-#
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-endif
board/avnet/v5fx30teval/config.mk deleted +0 -29
deleted file mode 100644
index 78dde62..0000000
@@ -1,29 +0,0 @@
-#
-# (C) Copyright 2008
-# Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
-# Work supported by Qtechnology http://www.qtec.com
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-#
-
-ifdef CONFIG_SYS_LDSCRIPT
-# need to strip off double quotes
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-endif
board/cm5200/u-boot.lds deleted +0 -120

120 lines not on this page · raw message

board/cogent/config.mk +0 -2
index 78730db..12e2e7c 100644
@@ -26,5 +26,3 @@
 #
 
 PLATFORM_CPPFLAGS += -I$(TOPDIR)
-
-LDSCRIPT := $(SRCTREE)/board/cogent/u-boot.lds
board/earthlcd/favr-32-ezkit/config.mk +0 -1
index f8bc88d..284f7ff 100644
@@ -1,4 +1,3 @@
 PLATFORM_RELFLAGS	+= -ffunction-sections -fdata-sections
 PLATFORM_LDFLAGS	+= --gc-sections
 CONFIG_SYS_TEXT_BASE		= 0x00000000
-LDSCRIPT		= $(src)board/earthlcd/favr-32-ezkit/u-boot.lds
board/freescale/mx31ads/config.mk +0 -2
index 2303f30..0131edf 100644
@@ -1,3 +1 @@
 CONFIG_SYS_TEXT_BASE = 0x87f00000
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot.lds
board/hymod/config.mk +0 -2
index ae766bc..ea64004 100644
@@ -28,5 +28,3 @@
 PLATFORM_CPPFLAGS += -I$(TOPDIR)
 
 OBJCFLAGS = --remove-section=.ppcenv
-
-LDSCRIPT := $(SRCTREE)/board/hymod/u-boot.lds
board/munices/u-boot.lds deleted +0 -120

120 lines not on this page · raw message

board/samsung/smdk6400/config.mk +0 -2
index 90cbcf2..6f04c2f 100644
@@ -28,5 +28,3 @@ CONFIG_SYS_TEXT_BASE = $(RAM_TEXT)
 else
 CONFIG_SYS_TEXT_BASE = 0
 endif
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot-nand.lds
board/sc3/u-boot.lds deleted +0 -147

147 lines not on this page · raw message

board/trab/config.mk +0 -2
index a349b8c..367f0b7 100644
@@ -24,5 +24,3 @@ sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
 ifndef CONFIG_SYS_TEXT_BASE
 CONFIG_SYS_TEXT_BASE = 0x0DF40000
 endif
-
-LDSCRIPT := $(SRCTREE)/board/$(BOARDDIR)/u-boot.lds
board/xilinx/ml507/config.mk deleted +0 -4
deleted file mode 100644
index 4df1d9c..0000000
@@ -1,4 +0,0 @@
-# need to strip off double quotes
-ifneq ($(CONFIG_SYS_LDSCRIPT),)
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-endif
board/xilinx/ppc405-generic/config.mk deleted +0 -4
deleted file mode 100644
index 4df1d9c..0000000
@@ -1,4 +0,0 @@
-# need to strip off double quotes
-ifneq ($(CONFIG_SYS_LDSCRIPT),)
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-endif
board/xilinx/ppc440-generic/config.mk deleted +0 -4
deleted file mode 100644
index 4df1d9c..0000000
@@ -1,4 +0,0 @@
-# need to strip off double quotes
-ifneq ($(CONFIG_SYS_LDSCRIPT),)
-LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
-endif
config.mk +28 -5
index fa46ff1..7ce554e 100644
@@ -153,14 +153,37 @@ endif
 RELFLAGS= $(PLATFORM_RELFLAGS)
 DBGFLAGS= -g # -DDEBUG
 OPTFLAGS= -Os #-fomit-frame-pointer
+
+# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
+# that (or fail if absent).  Otherwise, search for a linker script in a
+# standard location.
+
 ifndef LDSCRIPT
-#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
-ifeq ($(CONFIG_NAND_U_BOOT),y)
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
-else
-LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
+	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
+	ifdef CONFIG_SYS_LDSCRIPT
+		# need to strip off double quotes
+		LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
+	endif
 endif
+
+ifndef LDSCRIPT
+	ifeq ($(CONFIG_NAND_U_BOOT),y)
+		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
+		ifeq ($(wildcard $(LDSCRIPT)),)
+			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+		endif
+	endif
+	ifeq ($(wildcard $(LDSCRIPT)),)
+		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
+	endif
+	ifeq ($(wildcard $(LDSCRIPT)),)
+		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
+	endif
+	ifeq ($(wildcard $(LDSCRIPT)),)
+$(error could not find linker script)
+	endif
 endif
+
 OBJCFLAGS += --gap-fill=0xff
 
 gccincdir := $(shell $(CC) -print-file-name=include)
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

Dear Scott Wood,

Quoted 5 lines · In message <[email protected]> you wrote:

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc.

Quoted 7 lines

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

Thanks for this nice cleanup.

Only one question: Which boards / architectures did you cover during your tests?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q:  How do you play religious roulette?
A:  You stand around in a circle  and  blaspheme  and  see  who  gets
    struck by lightning first.
author
#2 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

Quoted 12 lines · On Thu, 7 Apr 2011 09:11:03 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Scott Wood,

Quoted 9 lines · In message <[email protected]> you wrote:

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Quoted 8 lines
Quoted 3 lines

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

Thanks for this nice cleanup.

Only one question: Which boards / architectures did you cover during your tests?

As I noted, I did a MAKEALL ppc and all the output (sizes, errors, etc) was the same as before the patch.

I tried a few arm boards, and all the ones I tried failed the same way they did before the patch. I don't have toolchains for the other arches readily available. Any help in testing this change on non-ppc would be appreciated.

-Scott

#3 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

Quoted 24 lines · Scott Wood
Quoted 12 lines · On Thu, 7 Apr 2011 09:11:03 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Scott Wood,

Quoted 9 lines · In message <[email protected]> you wrote:

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Quoted 8 lines
Quoted 3 lines

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

Thanks for this nice cleanup.

Only one question: Which boards / architectures did you cover during your tests?

Quoted 8 lines

As I noted, I did a MAKEALL ppc and all the output (sizes, errors, etc) was the same as before the patch.

I tried a few arm boards, and all the ones I tried failed the same way they did before the patch. I don't have toolchains for the other arches readily available. Any help in testing this change on non-ppc would be appreciated.

I have tried this patch on all (two!) x86 configurations and looks good

You may have my:

Regards,

Graeme

#4 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

In reply to Scott Wood
Quoted 16 lines · Scott Wood

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. ?Some are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

If board code specifies LDSCRIPT, that will be used. Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

Quoted 7 lines

If neither of these are specified, then the central config.mk will check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds $(TOPDIR)/$(CPUDIR)/u-boot.lds

i guess if i simply renamed blackfin/u-boot.lds.S to blackfin/u-boot.lds, things would "just work" for me too. -mike

#5 lore raw

PATCH 1/1 Blackfin: use common LDSCRIPT logic

In reply to Scott Wood

Now that common code is a bit smarter when it comes to default LDSCRIPT values, rename the default Blackfin file and drop the Blackfin-specific config.mk logic.

---
 arch/blackfin/config.mk        |    4 -
 arch/blackfin/cpu/u-boot.lds   |  158 ++++++++++++++++++++++++++++++++++++++++
 arch/blackfin/lib/u-boot.lds.S |  158 ----------------------------------------
 3 files changed, 158 insertions(+), 162 deletions(-)
 create mode 100644 arch/blackfin/cpu/u-boot.lds
 delete mode 100644 arch/blackfin/lib/u-boot.lds.S
arch/blackfin/config.mk +0 -4
index 95cf7db..f35b579 100644
@@ -76,10 +76,6 @@ LDR_FLAGS += $(LDR_FLAGS-y)
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
 
-ifeq ($(wildcard $(TOPDIR)/board/$(BOARD)/u-boot.lds*),)
-LDSCRIPT = $(obj)arch/$(ARCH)/lib/u-boot.lds.S
-endif
-
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 $(error do not set CONFIG_SYS_TEXT_BASE for Blackfin boards)
 endif
arch/blackfin/cpu/u-boot.lds new file +158 -0

158 lines not on this page · raw message

arch/blackfin/lib/u-boot.lds.S deleted +0 -158

158 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 1/1 Blackfin: use common LDSCRIPT logic

Quoted 2 lines · On Friday, April 08, 2011 00:56:34 Mike Frysinger wrote:
 create mode 100644 arch/blackfin/cpu/u-boot.lds
 delete mode 100644 arch/blackfin/lib/u-boot.lds.S

blah, prob should have used -M. this is a simple rename.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110408/565f0054/attachment.pgp

#7 lore raw

PATCH 1/1 Handle most LDSCRIPT setting centrally

In reply to Scott Wood

Dear Scott Wood,

Quoted 68 lines · In message <[email protected]> you wrote:

Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding.

If board code specifies LDSCRIPT, that will be used. Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds $(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that were dead code, because they were overridden by a CPUDIR u-boot.lds under the old powerpc rules. These boards' own u-boot.lds have bitrotted and no longer work -- these lds files have been removed.

---
"./MAKEALL ppc" had identical output with and without this patch.

I tried building some arm boards, but couldn't find any that built for me even without this patch. They didn't appear to fail differently with it, though.

 arch/arm/config.mk                     |    1 -
 arch/i386/config.mk                    |    1 -
 arch/nios2/config.mk                   |    2 -
 arch/powerpc/config.mk                 |   11 ---
 arch/sh/config.mk                      |    6 --
 board/actux1/config.mk                 |    2 -
 board/actux2/config.mk                 |    2 -
 board/actux3/config.mk                 |    2 -
 board/altera/nios2-generic/config.mk   |    2 -
 board/amcc/acadia/config.mk            |    7 --
 board/amcc/bamboo/config.mk            |    7 --
 board/amcc/canyonlands/config.mk       |    7 --
 board/amcc/kilauea/config.mk           |    7 --
 board/amcc/sequoia/config.mk           |    7 --
 board/atmel/atstk1000/config.mk        |    1 -
 board/avnet/fx12mm/config.mk           |   29 ------
 board/avnet/v5fx30teval/config.mk      |   29 ------
 board/cm5200/u-boot.lds                |  120 --------------------------
 board/cogent/config.mk                 |    2 -
 board/earthlcd/favr-32-ezkit/config.mk |    1 -
 board/freescale/mx31ads/config.mk      |    2 -
 board/hymod/config.mk                  |    2 -
 board/munices/u-boot.lds               |  120 --------------------------
 board/samsung/smdk6400/config.mk       |    2 -
 board/sc3/u-boot.lds                   |  147 --------------------------------
 board/trab/config.mk                   |    2 -
 board/xilinx/ml507/config.mk           |    4 -
 board/xilinx/ppc405-generic/config.mk  |    4 -
 board/xilinx/ppc440-generic/config.mk  |    4 -
 config.mk                              |   33 ++++++-
 30 files changed, 28 insertions(+), 538 deletions(-)
Quoted 8 lines
 delete mode 100644 board/avnet/fx12mm/config.mk
 delete mode 100644 board/avnet/v5fx30teval/config.mk
 delete mode 100644 board/cm5200/u-boot.lds
 delete mode 100644 board/munices/u-boot.lds
 delete mode 100644 board/sc3/u-boot.lds
 delete mode 100644 board/xilinx/ml507/config.mk
 delete mode 100644 board/xilinx/ppc405-generic/config.mk
 delete mode 100644 board/xilinx/ppc440-generic/config.mk

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Imagination is more important than knowledge.      -- Albert Einstein