2008-10-14 10:11:14 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2014-05-06 04:22:01 +00:00
|
|
|
.include <src.opts.mk>
|
2010-06-13 12:46:32 +00:00
|
|
|
|
2015-05-10 19:14:28 +00:00
|
|
|
FILES= ubldr ubldr.bin
|
|
|
|
|
2008-10-14 10:11:14 +00:00
|
|
|
NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
|
|
|
|
BINDIR?= /boot
|
|
|
|
INSTALLFLAGS= -b
|
|
|
|
WARNS?= 1
|
2012-05-27 16:27:04 +00:00
|
|
|
# Address at which ubldr will be loaded.
|
|
|
|
# This varies for different boards and SOCs.
|
|
|
|
UBLDR_LOADADDR?= 0x1000000
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
# Architecture-specific loader code
|
2015-05-10 19:14:28 +00:00
|
|
|
SRCS= start.S conf.c self_reloc.c vers.c
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2017-03-28 23:56:02 +00:00
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
|
|
|
|
CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
|
|
|
|
.endif
|
|
|
|
|
2008-11-19 17:34:28 +00:00
|
|
|
LOADER_UFS_SUPPORT?= yes
|
2008-10-14 10:11:14 +00:00
|
|
|
LOADER_CD9660_SUPPORT?= no
|
2017-10-16 03:59:52 +00:00
|
|
|
LOADER_MSDOS_SUPPORT?= no
|
2008-10-14 10:11:14 +00:00
|
|
|
LOADER_EXT2FS_SUPPORT?= no
|
|
|
|
LOADER_NET_SUPPORT?= yes
|
|
|
|
LOADER_NFS_SUPPORT?= yes
|
|
|
|
LOADER_TFTP_SUPPORT?= no
|
|
|
|
LOADER_GZIP_SUPPORT?= no
|
|
|
|
LOADER_BZIP2_SUPPORT?= no
|
2017-10-16 03:59:52 +00:00
|
|
|
LOADER_FDT_SUPPORT= ${MK_FDT}
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
# Always add MI sources
|
2017-10-16 03:59:28 +00:00
|
|
|
.include "../../loader.mk"
|
2008-10-14 10:11:14 +00:00
|
|
|
CFLAGS+= -I.
|
|
|
|
|
2016-12-19 14:40:59 +00:00
|
|
|
CLEANFILES+= loader.help
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2013-10-27 14:27:11 +00:00
|
|
|
CFLAGS+= -ffreestanding -msoft-float
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2015-05-10 19:14:28 +00:00
|
|
|
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
|
2017-07-01 18:48:15 +00:00
|
|
|
LDFLAGS+= -Wl,-znotext
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
# Pull in common loader code
|
2017-10-22 22:49:51 +00:00
|
|
|
.include "../../uboot.mk"
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2016-12-15 17:36:54 +00:00
|
|
|
CFLAGS+= -fPIC
|
|
|
|
|
2017-10-09 22:12:46 +00:00
|
|
|
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
|
|
|
|
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2015-05-10 19:14:28 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
2013-02-11 02:15:26 +00:00
|
|
|
loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
|
2008-10-14 10:11:14 +00:00
|
|
|
cat ${.ALLSRC} | \
|
2017-10-22 22:50:08 +00:00
|
|
|
awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2015-05-10 19:14:28 +00:00
|
|
|
ldscript.abs:
|
|
|
|
echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
|
|
|
|
|
|
|
|
ldscript.pie:
|
|
|
|
echo "UBLDR_LOADADDR = 0;" >${.TARGET}
|
|
|
|
|
2015-05-16 21:08:33 +00:00
|
|
|
ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
|
2015-05-10 19:14:28 +00:00
|
|
|
${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
|
|
|
|
-o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
|
2015-05-16 21:08:33 +00:00
|
|
|
ubldr.pie: ${OBJS} ldscript.pie ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
|
2015-05-10 19:14:28 +00:00
|
|
|
${CC} ${CFLAGS} -T ldscript.pie ${LDFLAGS} -pie -Wl,-Bsymbolic \
|
|
|
|
-o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
|
|
|
|
ubldr.bin: ubldr.pie
|
|
|
|
${OBJCOPY} -S -O binary ubldr.pie ${.TARGET}
|
|
|
|
|
|
|
|
CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
|
2012-05-27 16:27:04 +00:00
|
|
|
|
2013-07-27 18:18:46 +00:00
|
|
|
.if !defined(LOADER_ONLY)
|
2015-04-03 02:27:40 +00:00
|
|
|
.PATH: ${.CURDIR}/../../forth
|
2015-04-02 20:07:05 +00:00
|
|
|
.include "${.CURDIR}/../../forth/Makefile.inc"
|
2013-07-27 18:18:46 +00:00
|
|
|
|
2015-07-04 16:19:38 +00:00
|
|
|
# Install loader.rc.
|
2013-07-27 18:18:46 +00:00
|
|
|
FILES+= loader.rc
|
2015-07-04 16:19:38 +00:00
|
|
|
# Put sample menu.rc on disk but don't enable it by default.
|
2013-07-27 18:18:46 +00:00
|
|
|
FILES+= menu.rc
|
|
|
|
FILESNAME_menu.rc= menu.rc.sample
|
|
|
|
.endif
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|