]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/u-boot
u-boot: update to 2022.10 and arm-trusted-firmware-2.7
[people/pmueller/ipfire-2.x.git] / lfs / u-boot
CommitLineData
17d9546f
AF
1###############################################################################
2# #
3# IPFire.org - A linux based firewall #
75c9d8c2 4# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
17d9546f
AF
5# #
6# This program is free software: you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation, either version 3 of the License, or #
9# (at your option) any later version. #
10# #
11# This program is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
18# #
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
6163e1b7 27VER = 2022.10
17d9546f 28
ddc492dd
MT
29THISAPP = u-boot-$(VER)
30DL_FILE = $(THISAPP).tar.bz2
17d9546f
AF
31DL_FROM = $(URL_IPFIRE)
32DIR_APP = $(DIR_SRC)/$(THISAPP)
2a0947f2 33TARGET = $(DIR_INFO)/$(THISAPP)-$(MKIMAGE)
aafdd71b 34SUP_ARCH = armv6l aarch64
17d9546f 35
1f38bac0 36CFLAGS := $(patsubst -fstack-protector-strong,,$(CFLAGS))
c0637090 37LDFLAGS += --no-warn-rwx-segments
1f38bac0 38
6163e1b7 39ATF_VER = 2.7
75c9d8c2 40
17d9546f
AF
41###############################################################################
42# Top-level Rules
43###############################################################################
44
706d8255 45objects = $(DL_FILE) arm-trusted-firmware-$(ATF_VER).tar.gz arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz
17d9546f
AF
46
47$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
75c9d8c2 48arm-trusted-firmware-$(ATF_VER).tar.gz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER).tar.gz
498ea595 49arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz
17d9546f 50
6163e1b7
AF
51$(DL_FILE)_BLAKE2 = 42aa7a6f131735888939982e579de4342e3909e064ab896b0df6f1ff56c20ed6cb11d25286da7c052a5f67dcef6fa7a746944d8df6dd504586f5a71502d157e1
52arm-trusted-firmware-$(ATF_VER).tar.gz_BLAKE2 = 4fc4d5646e272200d40081902e17f0be32956f451622f011a0d568c8cf26e15ab165fe16a69cf222241f7ba1d443add562d6d382277eb4fb2b49c3918cabdbad
53arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz_BLAKE2 = 04424a7dcda0771f469c8e918a24aed75017c1a28c1b8c2c794e3ce31afbc01e7906ccab6faf1459d69a5ec1ef4fdde2bab1011b883980efeae7372013f2570e
17d9546f
AF
54
55install : $(TARGET)
56
57check : $(patsubst %,$(DIR_CHK)/%,$(objects))
58
59download :$(patsubst %,$(DIR_DL)/%,$(objects))
60
9a7e4d85 61b2 : $(subst %,%_BLAKE2,$(objects))
17d9546f
AF
62
63###############################################################################
9a7e4d85 64# Downloading, checking, b2sum
17d9546f
AF
65###############################################################################
66
67$(patsubst %,$(DIR_CHK)/%,$(objects)) :
68 @$(CHECK)
69
70$(patsubst %,$(DIR_DL)/%,$(objects)) :
71 @$(LOAD)
72
9a7e4d85
PM
73$(subst %,%_BLAKE2,$(objects)) :
74 @$(B2SUM)
17d9546f 75
66c36198 76dist:
17d9546f
AF
77 @$(PAK)
78
79###############################################################################
80# Installation Details
81###############################################################################
82
83$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
84 @$(PREBUILD)
ddc492dd
MT
85 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
86
2a0947f2 87ifneq "$(MKIMAGE)" "1"
aafdd71b 88ifeq "${BUILD_ARCH}" "armv6l"
ddc492dd
MT
89 # Pandaboard
90 -mkdir -pv /usr/share/u-boot/pandaboard
91 cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config
e10049b3 92 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Pandaboard - IPFire.org"!' .config
ddc492dd 93 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
7284262a 94 cd $(DIR_APP) && install -v -m 644 MLO u-boot.img \
ddc492dd 95 /usr/share/u-boot/pandaboard
7284262a
AF
96 # Install pandaboard uboot as default
97 cd $(DIR_APP) && install MLO /boot/
98 cd $(DIR_APP) && install u-boot.img /boot/
ddc492dd
MT
99 cd $(DIR_APP) && make distclean
100
2a0947f2 101 # Wandboard
e10049b3
AF
102 -mkdir -pv /usr/share/u-boot/wandboard
103 cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_config
104 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Wandboard - IPFire.org"!' .config
105 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
106 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" u-boot.imx
107 cd $(DIR_APP) && install -v -m 644 u-boot.imx \
108 /usr/share/u-boot/wandboard
109 cd $(DIR_APP) && make distclean
2a0947f2
AF
110
111 # Raspberry Pi
112 -mkdir -pv /usr/share/u-boot/rpi
113 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_config
e10049b3 114 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi1 - IPFire.org"!' .config
ddc492dd 115 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2 116 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
117 /usr/share/u-boot/rpi/u-boot-rpi1.bin
118 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi1.bin
e10049b3 119 cd $(DIR_APP) && make distclean
2a0947f2
AF
120
121 # Raspberry Pi 2
184cbf9b 122 -mkdir -pv /usr/share/u-boot/rpi
2a0947f2 123 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_2_config
e10049b3 124 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi2 - IPFire.org"!' .config
ddc492dd 125 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2 126 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
127 /usr/share/u-boot/rpi/u-boot-rpi2.bin
128 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi2.bin
e10049b3 129 cd $(DIR_APP) && make distclean
2a0947f2 130
963f6e97 131 # Raspberry Pi 3 32bit
184cbf9b 132 -mkdir -pv /usr/share/u-boot/rpi
2a0947f2 133 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_32b_config
184cbf9b 134 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 32bit - IPFire.org"!' .config
2a0947f2
AF
135 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
136 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
137 /usr/share/u-boot/rpi/u-boot-rpi3.bin
138 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin
e10049b3 139 cd $(DIR_APP) && make distclean
2a0947f2
AF
140
141 # Orange Pi Zero
142 -mkdir -pv /usr/share/u-boot/orangepi_zero
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/orangepi-zero-add-macs.diff
144 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_config
184cbf9b 145 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero - IPFire.org"!' .config
2a0947f2
AF
146 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
147 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
148 /usr/share/u-boot/orangepi_zero
e10049b3 149 cd $(DIR_APP) && make distclean
ddc492dd 150
2a0947f2
AF
151 # Orange Pi PC
152 -mkdir -pv /usr/share/u-boot/orangepi_pc
153 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_pc_config
e10049b3 154 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi PC - IPFire.org"!' .config
ddc492dd 155 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2
AF
156 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
157 /usr/share/u-boot/orangepi_pc
e10049b3 158 cd $(DIR_APP) && make distclean
ddc492dd 159
56e211f6
AF
160 # LeMaker Banana Pi
161 -mkdir -pv /usr/share/u-boot/banana_pi
56e211f6 162 cd $(DIR_APP) && make CROSS_COMPILE="" Bananapi_config
e10049b3 163 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" BananaPi - IPFire.org"!' .config
56e211f6
AF
164 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
165 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
166 /usr/share/u-boot/banana_pi
e10049b3 167 cd $(DIR_APP) && make distclean
56e211f6 168
963f6e97
AF
169else
170 # Raspberry Pi 3
184cbf9b 171 -mkdir -pv /usr/share/u-boot/rpi
963f6e97
AF
172 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_config
173 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 - IPFire.org"!' .config
174 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
175 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
176 /usr/share/u-boot/rpi/u-boot-rpi3.bin
177 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin
178 cd $(DIR_APP) && make distclean
179
180 # Raspberry Pi 4
181 -mkdir -pv /usr/share/u-boot/rpi
182 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_4_config
183 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi4 - IPFire.org"!' .config
184 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
185 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
186 /usr/share/u-boot/rpi/u-boot-rpi4.bin
187 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi4.bin
963f6e97
AF
188 cd $(DIR_APP) && make distclean
189
d814021a
AF
190 # OrangePi Zero Plus
191 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
192 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz
c0637090 193 cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=sun50i_a64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)"
d814021a
AF
194 cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/sun50i_a64/release/bl31.bin bl31.bin
195 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
196 -mkdir -pv /usr/share/u-boot/orangepi_zero_plus
197 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_plus_config
198 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero+ - IPFire.org"!' .config
199 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
200 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
201 /usr/share/u-boot/orangepi_zero_plus
202 cd $(DIR_APP) && make distclean
203 cd $(DIR_APP) && rm -f bl31.bin
204
1f38bac0 205 # Nanopi R2S
75c9d8c2
AF
206 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
207 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz
c0637090 208 cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)"
75c9d8c2
AF
209 cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf
210 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
dac49f1b 211 -mkdir -pv /usr/share/u-boot/nanopi_r2s
1f38bac0
AF
212 cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2s-rk3328_config
213 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2S - IPFire.org"!' .config
fe582c9d 214 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
75c9d8c2 215 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
6163e1b7 216 cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
1f38bac0
AF
217 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
218 cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \
dac49f1b 219 /usr/share/u-boot/nanopi_r2s/u-boot-rockchip.bin
1f38bac0
AF
220 cd $(DIR_APP) && make distclean
221
75c9d8c2
AF
222 # Nanopi R4S
223 # arm trusted firmware for rk3399 cannot build without cortex m0 gcc crosscompiler
6163e1b7 224 # it is build on ubuntu with make PLAT=rk3399 ARCH=aarch64 DEBUG=0 bl31
7d5a7fea 225 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz
75c9d8c2
AF
226 -mkdir -pv /usr/share/u-boot/nanopi_r4s
227 cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r4s-rk3399_config
228 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R4S - IPFire.org"!' .config
229 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
230 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
6163e1b7 231 cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config
75c9d8c2
AF
232 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
233 cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \
234 /usr/share/u-boot/nanopi_r4s/u-boot-rockchip.bin
235 cd $(DIR_APP) && make distclean
236
963f6e97 237endif
2a0947f2
AF
238 # create an empty 128 KB File for the u-boot env
239 dd if=/dev/zero of=/boot/uboot.env bs=1K count=128
66c36198 240
2a0947f2 241 # config (uEnv.txt and boot.*)
56e211f6 242 cp -vf $(DIR_SRC)/config/u-boot/* /boot/
6cda03e8
AF
243 # patch real Kernel version to uEnv.txt
244 sed -e "s/xxxKVERxxx/$(KVER)/g" -i /boot/uEnv.txt
56e211f6 245
2a0947f2
AF
246else
247 # mkimage
aafdd71b 248ifeq "${BUILD_ARCH}" "armv6l"
2a0947f2 249 cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config
963f6e97
AF
250else
251 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_config
252endif
2a0947f2
AF
253 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" tools
254 cd $(DIR_APP) && install -v -m 755 tools/mkimage /usr/bin
255endif
256
17d9546f
AF
257 @rm -rf $(DIR_APP)
258 @$(POSTBUILD)