Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2012 16:27:05 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236159 - head/sys/boot/arm/uboot
Message-ID:  <201205271627.q4RGR5Ya059967@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Sun May 27 16:27:04 2012
New Revision: 236159
URL: http://svn.freebsd.org/changeset/base/236159

Log:
  Allow the load address used by ARM ubldr to be set via Make argument.
  
  In particular, this simplifies scripts that build system
  images.

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/arm/uboot/ldscript.arm

Modified: head/sys/boot/arm/uboot/Makefile
==============================================================================
--- head/sys/boot/arm/uboot/Makefile	Sun May 27 16:24:00 2012	(r236158)
+++ head/sys/boot/arm/uboot/Makefile	Sun May 27 16:27:04 2012	(r236159)
@@ -7,6 +7,9 @@ NEWVERSWHAT=	"U-Boot loader" ${MACHINE_A
 BINDIR?=	/boot
 INSTALLFLAGS=	-b
 WARNS?=		1
+# Address at which ubldr will be loaded.
+# This varies for different boards and SOCs.
+UBLDR_LOADADDR?=	0x1000000
 
 # Architecture-specific loader code
 SRCS=		start.S conf.c vers.c
@@ -85,7 +88,9 @@ CLEANFILES+=	vers.c loader.help
 
 CFLAGS+=	-ffreestanding
 
-LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+LDFLAGS=	-nostdlib -static
+LDFLAGS+=	-T ldscript.generated
+LDFLAGS+=	-T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
 
 # Pull in common loader code
 .PATH:		${.CURDIR}/../../uboot/common
@@ -110,6 +115,18 @@ loader.help: help.common help.uboot
 	cat ${.ALLSRC} | \
 	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
 
+${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+
+ldscript.generated::
+	rm -f ldscript.generated.tmp
+	echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp
+	if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \
+		true; \
+	else \
+		rm -f ldscript.generated; \
+		mv ldscript.generated.tmp ldscript.generated; \
+	fi
+
 .PATH: ${.CURDIR}/../../forth
 FILES=	loader.help
 

Modified: head/sys/boot/arm/uboot/ldscript.arm
==============================================================================
--- head/sys/boot/arm/uboot/ldscript.arm	Sun May 27 16:24:00 2012	(r236158)
+++ head/sys/boot/arm/uboot/ldscript.arm	Sun May 27 16:27:04 2012	(r236159)
@@ -5,7 +5,7 @@ ENTRY(_start)
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-  . = 0x1000000 + SIZEOF_HEADERS;
+  . = UBLDR_LOADADDR + SIZEOF_HEADERS;
   .interp     : { *(.interp) 	}
   .hash          : { *(.hash)		}
   .dynsym        : { *(.dynsym)		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205271627.q4RGR5Ya059967>