]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/arm/uboot/Makefile
Allow the load address used by ARM ubldr to be set via Make argument.
[FreeBSD/FreeBSD.git] / sys / boot / arm / uboot / Makefile
1 # $FreeBSD$
2
3 .include <bsd.own.mk>
4
5 PROG=           ubldr
6 NEWVERSWHAT=    "U-Boot loader" ${MACHINE_ARCH}
7 BINDIR?=        /boot
8 INSTALLFLAGS=   -b
9 WARNS?=         1
10 # Address at which ubldr will be loaded.
11 # This varies for different boards and SOCs.
12 UBLDR_LOADADDR?=        0x1000000
13
14 # Architecture-specific loader code
15 SRCS=           start.S conf.c vers.c
16
17 LOADER_DISK_SUPPORT?=   yes
18 LOADER_UFS_SUPPORT?=    yes
19 LOADER_CD9660_SUPPORT?= no
20 LOADER_EXT2FS_SUPPORT?= no
21 .if ${MK_NAND} != "no"
22 LOADER_NANDFS_SUPPORT?= yes
23 .else
24 LOADER_NANDFS_SUPPORT?= no
25 .endif
26 LOADER_NET_SUPPORT?=    yes
27 LOADER_NFS_SUPPORT?=    yes
28 LOADER_TFTP_SUPPORT?=   no
29 LOADER_GZIP_SUPPORT?=   no
30 LOADER_BZIP2_SUPPORT?=  no
31 .if ${MK_FDT} != "no"
32 LOADER_FDT_SUPPORT=     yes
33 .else
34 LOADER_FDT_SUPPORT=     no
35 .endif
36
37 .if ${LOADER_DISK_SUPPORT} == "yes"
38 CFLAGS+=        -DLOADER_DISK_SUPPORT
39 .endif
40 .if ${LOADER_UFS_SUPPORT} == "yes"
41 CFLAGS+=        -DLOADER_UFS_SUPPORT
42 .endif
43 .if ${LOADER_CD9660_SUPPORT} == "yes"
44 CFLAGS+=        -DLOADER_CD9660_SUPPORT
45 .endif
46 .if ${LOADER_EXT2FS_SUPPORT} == "yes"
47 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
48 .endif
49 .if ${LOADER_NANDFS_SUPPORT} == "yes"
50 CFLAGS+=        -DLOADER_NANDFS_SUPPORT
51 .endif
52 .if ${LOADER_GZIP_SUPPORT} == "yes"
53 CFLAGS+=        -DLOADER_GZIP_SUPPORT
54 .endif
55 .if ${LOADER_BZIP2_SUPPORT} == "yes"
56 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
57 .endif
58 .if ${LOADER_NET_SUPPORT} == "yes"
59 CFLAGS+=        -DLOADER_NET_SUPPORT
60 .endif
61 .if ${LOADER_NFS_SUPPORT} == "yes"
62 CFLAGS+=        -DLOADER_NFS_SUPPORT
63 .endif
64 .if ${LOADER_TFTP_SUPPORT} == "yes"
65 CFLAGS+=        -DLOADER_TFTP_SUPPORT
66 .endif
67 .if ${LOADER_FDT_SUPPORT} == "yes"
68 CFLAGS+=        -I${.CURDIR}/../../fdt
69 CFLAGS+=        -I${.OBJDIR}/../../fdt
70 CFLAGS+=        -DLOADER_FDT_SUPPORT
71 LIBFDT=         ${.OBJDIR}/../../fdt/libfdt.a
72 .endif
73
74 .if !defined(NO_FORTH)
75 # Enable BootForth
76 BOOT_FORTH=     yes
77 CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
78 LIBFICL=        ${.OBJDIR}/../../ficl/libficl.a
79 .endif
80
81 # Always add MI sources
82 .PATH:          ${.CURDIR}/../../common
83 .include        "${.CURDIR}/../../common/Makefile.inc"
84 CFLAGS+=        -I${.CURDIR}/../../common
85 CFLAGS+=        -I.
86
87 CLEANFILES+=    vers.c loader.help
88
89 CFLAGS+=        -ffreestanding
90
91 LDFLAGS=        -nostdlib -static
92 LDFLAGS+=       -T ldscript.generated
93 LDFLAGS+=       -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
94
95 # Pull in common loader code
96 .PATH:          ${.CURDIR}/../../uboot/common
97 .include        "${.CURDIR}/../../uboot/common/Makefile.inc"
98 CFLAGS+=        -I${.CURDIR}/../../uboot/common
99
100 # U-Boot standalone support library
101 LIBUBOOT=       ${.OBJDIR}/../../uboot/lib/libuboot.a
102 CFLAGS+=        -I${.CURDIR}/../../uboot/lib
103 CFLAGS+=        -I${.OBJDIR}/../../uboot/lib
104
105 # where to get libstand from
106 CFLAGS+=        -I${.CURDIR}/../../../../lib/libstand/
107
108 DPADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND}
109 LDADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand
110
111 vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
112         sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
113
114 loader.help: help.common help.uboot
115         cat ${.ALLSRC} | \
116             awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
117
118 ${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
119
120 ldscript.generated::
121         rm -f ldscript.generated.tmp
122         echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp
123         if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \
124                 true; \
125         else \
126                 rm -f ldscript.generated; \
127                 mv ldscript.generated.tmp ldscript.generated; \
128         fi
129
130 .PATH: ${.CURDIR}/../../forth
131 FILES=  loader.help
132
133 .include <bsd.prog.mk>