Customizing ubldr build...

看板FB_current作者時間13年前 (2012/06/03 18:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/13 (看更多)
In order to fully automate building SD images for Beaglebone, I'm trying to come up with a clean way to tailor the ubldr build. I think I've come up with a good way to do this and would appreciate any = feedback. First, here's the (somewhat simplified) script that builds and installs = ubldr (this is going into the beaglebsd.sh script I've been working on): cd /usr/src buildenv=3D`make TARGET_ARCH=3Darm TARGET_CPUTYPE=3Darm buildenvvars` cd sys/boot eval $buildenv make obj eval $buildenv make UBLDR_LOADADDR=3D0x80100000 all cd arm/uboot eval $buildenv make DESTDIR=3D${DESTDIR} BINDIR=3D NO_MAN=3Dtrue = install The key issue is the physical load address, which differs among boards. My idea is to allow specifying this at build time through a make variable UBLDR_LOADADDR. The Makefile for sys/boot/arm/uboot passes this down into a dynamically-built loader script. Here's a summary of the changes I'm proposing to sys/boot/arm/uboot/Makefile: +UBLDR_LOADADDR?=3D 0x1000000 =20 LDFLAGS=3D -nostdlib -static +LDFLAGS+=3D -T ldscript.generated LDFLAGS+=3D -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} =20 +${PROG}: ldscript.generated + +ldscript.generated:: + echo "UBLDR_LOADADDR =3D ${UBLDR_LOADADDR};" > = ldscript.generated And now the standard loader script can simply use the symbol instead of a hard-coded value: Index: ldscript.arm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ldscript.arm (revision 235597) +++ ldscript.arm (working copy) @@ -5,7 +5,7 @@ SECTIONS { /* Read-only sections, merged into text segment: */ - . =3D 0x1000000 + SIZEOF_HEADERS; + . =3D UBLDR_LOADADDR + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } This seems to work pretty well for me, except for one odd point: the make dependencies cause ubldr to get relinked on every build. (This can be fixed in the usual way.) If anyone sees a better way to handle this, I'd much appreciate the = input. Cheers, Tim _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1Fopqjqg (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1Fopqjqg (FB_current)