]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - sys/boot/arm/uboot/Makefile
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / sys / boot / arm / uboot / Makefile
1 # $FreeBSD$
2
3 .include <bsd.own.mk>
4
5 FILES=          ubldr ubldr.bin
6
7 NEWVERSWHAT=    "U-Boot loader" ${MACHINE_ARCH}
8 BINDIR?=        /boot
9 INSTALLFLAGS=   -b
10 WARNS?=         1
11 # Address at which ubldr will be loaded.
12 # This varies for different boards and SOCs.
13 UBLDR_LOADADDR?=        0x1000000
14
15 # Architecture-specific loader code
16 SRCS=           start.S conf.c self_reloc.c vers.c
17
18 .if !defined(LOADER_NO_DISK_SUPPORT)
19 LOADER_DISK_SUPPORT?=   yes
20 .else
21 LOADER_DISK_SUPPORT=    no
22 .endif
23 LOADER_UFS_SUPPORT?=    yes
24 LOADER_CD9660_SUPPORT?= no
25 LOADER_EXT2FS_SUPPORT?= no
26 .if ${MK_NAND} != "no"
27 LOADER_NANDFS_SUPPORT?= yes
28 .else
29 LOADER_NANDFS_SUPPORT?= no
30 .endif
31 LOADER_NET_SUPPORT?=    yes
32 LOADER_NFS_SUPPORT?=    yes
33 LOADER_TFTP_SUPPORT?=   no
34 LOADER_GZIP_SUPPORT?=   no
35 LOADER_BZIP2_SUPPORT?=  no
36 .if ${MK_FDT} != "no"
37 LOADER_FDT_SUPPORT=     yes
38 .else
39 LOADER_FDT_SUPPORT=     no
40 .endif
41
42 .if ${LOADER_DISK_SUPPORT} == "yes"
43 CFLAGS+=        -DLOADER_DISK_SUPPORT
44 .endif
45 .if ${LOADER_UFS_SUPPORT} == "yes"
46 CFLAGS+=        -DLOADER_UFS_SUPPORT
47 .endif
48 .if ${LOADER_CD9660_SUPPORT} == "yes"
49 CFLAGS+=        -DLOADER_CD9660_SUPPORT
50 .endif
51 .if ${LOADER_EXT2FS_SUPPORT} == "yes"
52 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
53 .endif
54 .if ${LOADER_NANDFS_SUPPORT} == "yes"
55 CFLAGS+=        -DLOADER_NANDFS_SUPPORT
56 .endif
57 .if ${LOADER_GZIP_SUPPORT} == "yes"
58 CFLAGS+=        -DLOADER_GZIP_SUPPORT
59 .endif
60 .if ${LOADER_BZIP2_SUPPORT} == "yes"
61 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
62 .endif
63 .if ${LOADER_NET_SUPPORT} == "yes"
64 CFLAGS+=        -DLOADER_NET_SUPPORT
65 .endif
66 .if ${LOADER_NFS_SUPPORT} == "yes"
67 CFLAGS+=        -DLOADER_NFS_SUPPORT
68 .endif
69 .if ${LOADER_TFTP_SUPPORT} == "yes"
70 CFLAGS+=        -DLOADER_TFTP_SUPPORT
71 .endif
72 .if ${LOADER_FDT_SUPPORT} == "yes"
73 CFLAGS+=        -I${.CURDIR}/../../fdt
74 CFLAGS+=        -I${.OBJDIR}/../../fdt
75 CFLAGS+=        -DLOADER_FDT_SUPPORT
76 LIBUBOOT_FDT=   ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
77 LIBFDT=         ${.OBJDIR}/../../fdt/libfdt.a
78 .endif
79
80 CFLAGS+=        -DNETIF_OPEN_CLOSE_ONCE
81
82 .if ${MK_FORTH} != "no"
83 # Enable BootForth
84 BOOT_FORTH=     yes
85 CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
86 LIBFICL=        ${.OBJDIR}/../../ficl/libficl.a
87 .endif
88
89 # Always add MI sources
90 .PATH:          ${.CURDIR}/../../common
91 .include        "${.CURDIR}/../../common/Makefile.inc"
92 CFLAGS+=        -I${.CURDIR}/../../common
93 CFLAGS+=        -I.
94
95 CLEANFILES+=    vers.c loader.help
96
97 CFLAGS+=        -ffreestanding -msoft-float
98
99 LDFLAGS=        -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
100
101 # Pull in common loader code
102 .PATH:          ${.CURDIR}/../../uboot/common
103 .include        "${.CURDIR}/../../uboot/common/Makefile.inc"
104 CFLAGS+=        -I${.CURDIR}/../../uboot/common
105
106 # U-Boot standalone support library
107 LIBUBOOT=       ${.OBJDIR}/../../uboot/lib/libuboot.a
108 CFLAGS+=        -I${.CURDIR}/../../uboot/lib
109 CFLAGS+=        -I${.OBJDIR}/../../uboot/lib
110
111 # where to get libstand from
112 CFLAGS+=        -I${.CURDIR}/../../../../lib/libstand/
113
114 # clang doesn't understand %D as a specifier to printf
115 NO_WERROR.clang=
116
117 DPADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
118 LDADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
119
120 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
121
122 vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
123         sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
124
125 loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
126         cat ${.ALLSRC} | \
127             awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
128
129 ldscript.abs:
130         echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
131
132 ldscript.pie:
133         echo "UBLDR_LOADADDR = 0;" >${.TARGET}
134
135 ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
136         ${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
137             -o ${.TARGET} ${OBJS} ${LDADD}
138
139 ubldr.pie: ${OBJS} ldscript.pie ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
140         ${CC} ${CFLAGS} -T ldscript.pie ${LDFLAGS} -pie -Wl,-Bsymbolic \
141             -o ${.TARGET} ${OBJS} ${LDADD}
142
143 ubldr.bin: ubldr.pie
144         ${OBJCOPY} -S -O binary ubldr.pie ${.TARGET}
145
146 CLEANFILES+=    ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
147
148 .if !defined(LOADER_ONLY)
149 .PATH: ${.CURDIR}/../../forth
150 .include        "${.CURDIR}/../../forth/Makefile.inc"
151
152 # Install loader.rc.
153 FILES+= loader.rc
154 # Put sample menu.rc on disk but don't enable it by default.
155 FILES+= menu.rc
156 FILESNAME_menu.rc=      menu.rc.sample
157 .endif
158
159 .include <bsd.prog.mk>