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
|
|
|
|
2012-09-09 11:40:37 +00:00
|
|
|
.if !defined(LOADER_NO_DISK_SUPPORT)
|
2008-11-19 17:34:28 +00:00
|
|
|
LOADER_DISK_SUPPORT?= yes
|
2012-09-09 11:40:37 +00:00
|
|
|
.else
|
|
|
|
LOADER_DISK_SUPPORT= no
|
|
|
|
.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
|
|
|
|
LOADER_EXT2FS_SUPPORT?= no
|
2012-05-17 10:11:18 +00:00
|
|
|
.if ${MK_NAND} != "no"
|
|
|
|
LOADER_NANDFS_SUPPORT?= yes
|
|
|
|
.else
|
|
|
|
LOADER_NANDFS_SUPPORT?= no
|
|
|
|
.endif
|
2008-10-14 10:11:14 +00:00
|
|
|
LOADER_NET_SUPPORT?= yes
|
|
|
|
LOADER_NFS_SUPPORT?= yes
|
|
|
|
LOADER_TFTP_SUPPORT?= no
|
|
|
|
LOADER_GZIP_SUPPORT?= no
|
|
|
|
LOADER_BZIP2_SUPPORT?= no
|
2010-06-13 12:46:32 +00:00
|
|
|
.if ${MK_FDT} != "no"
|
2010-05-25 15:21:39 +00:00
|
|
|
LOADER_FDT_SUPPORT= yes
|
|
|
|
.else
|
|
|
|
LOADER_FDT_SUPPORT= no
|
|
|
|
.endif
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
.if ${LOADER_DISK_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_DISK_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_UFS_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_UFS_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_CD9660_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_CD9660_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_EXT2FS_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_EXT2FS_SUPPORT
|
|
|
|
.endif
|
2012-05-17 10:11:18 +00:00
|
|
|
.if ${LOADER_NANDFS_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_NANDFS_SUPPORT
|
|
|
|
.endif
|
2008-10-14 10:11:14 +00:00
|
|
|
.if ${LOADER_GZIP_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_GZIP_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_BZIP2_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_BZIP2_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_NET_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_NET_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_NFS_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_NFS_SUPPORT
|
|
|
|
.endif
|
|
|
|
.if ${LOADER_TFTP_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -DLOADER_TFTP_SUPPORT
|
|
|
|
.endif
|
2010-05-25 15:21:39 +00:00
|
|
|
.if ${LOADER_FDT_SUPPORT} == "yes"
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../fdt
|
|
|
|
CFLAGS+= -I${.OBJDIR}/../../fdt
|
|
|
|
CFLAGS+= -DLOADER_FDT_SUPPORT
|
2014-11-01 17:12:44 +00:00
|
|
|
LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
|
2010-05-25 15:21:39 +00:00
|
|
|
LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
|
|
|
|
.endif
|
2008-10-14 10:11:14 +00:00
|
|
|
|
2014-12-23 15:42:34 +00:00
|
|
|
.if ${MK_FORTH} != "no"
|
2008-10-14 10:11:14 +00:00
|
|
|
# Enable BootForth
|
|
|
|
BOOT_FORTH= yes
|
|
|
|
CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
|
|
|
|
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Always add MI sources
|
|
|
|
.PATH: ${.CURDIR}/../../common
|
|
|
|
.include "${.CURDIR}/../../common/Makefile.inc"
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../common
|
|
|
|
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}
|
2008-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
# Pull in common loader code
|
|
|
|
.PATH: ${.CURDIR}/../../uboot/common
|
|
|
|
.include "${.CURDIR}/../../uboot/common/Makefile.inc"
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../uboot/common
|
|
|
|
|
|
|
|
# U-Boot standalone support library
|
|
|
|
LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../uboot/lib
|
|
|
|
CFLAGS+= -I${.OBJDIR}/../../uboot/lib
|
|
|
|
|
|
|
|
# where to get libstand from
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
|
|
|
|
|
2016-12-15 17:36:54 +00:00
|
|
|
CFLAGS+= -fPIC
|
|
|
|
|
2012-12-15 21:47:05 +00:00
|
|
|
# clang doesn't understand %D as a specifier to printf
|
|
|
|
NO_WERROR.clang=
|
|
|
|
|
2014-11-01 17:12:44 +00:00
|
|
|
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
|
|
|
|
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
|
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} | \
|
|
|
|
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
|
|
|
|
|
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>
|