]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/u-boot
Revert "u-boot: Sigh, fix another .xz != .gz"
[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
c16b1b1a 27VER = 2022.04
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
AF
36CFLAGS := $(patsubst -fstack-protector-strong,,$(CFLAGS))
37
c16b1b1a 38ATF_VER = 2.7
75c9d8c2 39
17d9546f
AF
40###############################################################################
41# Top-level Rules
42###############################################################################
43
01b3a62a 44objects = $(DL_FILE) arm-trusted-firmware-$(ATF_VER).tar.gz arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.gz
17d9546f
AF
45
46$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
75c9d8c2 47arm-trusted-firmware-$(ATF_VER).tar.gz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER).tar.gz
be5703ef 48arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.gz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.gz
17d9546f 49
be5703ef 50# Downloaded from https://ftp.denx.de/pub/u-boot/
c16b1b1a 51$(DL_FILE)_BLAKE2 = 5d2035130c0631f8f1b7f7963bedf71578a66994e3950eb103a404a08e85686cd971ba51e8172093ccb75d975101024bf2a94d4064763ad57ad8950c11092319
be5703ef 52# Downloaded from https://github.com/ARM-software/arm-trusted-firmware/tags
c16b1b1a 53arm-trusted-firmware-$(ATF_VER).tar.gz_BLAKE2 = 4fc4d5646e272200d40081902e17f0be32956f451622f011a0d568c8cf26e15ab165fe16a69cf222241f7ba1d443add562d6d382277eb4fb2b49c3918cabdbad
be5703ef
PM
54# Downloaded from https://github.com/skiffos/rk3399-firmware-blobs/tags
55arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.gz_BLAKE2 = d6441f38f5795b1c7d4e15fe9b2fec3632490283d1e8f0a0ce53b7456413e9f455c78f4071f73f664c16813dba97897941d40ef3037a9f60302de158b7f3cd41
17d9546f
AF
56
57install : $(TARGET)
58
59check : $(patsubst %,$(DIR_CHK)/%,$(objects))
60
61download :$(patsubst %,$(DIR_DL)/%,$(objects))
62
9a7e4d85 63b2 : $(subst %,%_BLAKE2,$(objects))
17d9546f
AF
64
65###############################################################################
9a7e4d85 66# Downloading, checking, b2sum
17d9546f
AF
67###############################################################################
68
69$(patsubst %,$(DIR_CHK)/%,$(objects)) :
70 @$(CHECK)
71
72$(patsubst %,$(DIR_DL)/%,$(objects)) :
73 @$(LOAD)
74
9a7e4d85
PM
75$(subst %,%_BLAKE2,$(objects)) :
76 @$(B2SUM)
17d9546f 77
66c36198 78dist:
17d9546f
AF
79 @$(PAK)
80
81###############################################################################
82# Installation Details
83###############################################################################
84
85$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
86 @$(PREBUILD)
ddc492dd
MT
87 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
88
2a0947f2 89ifneq "$(MKIMAGE)" "1"
aafdd71b 90ifeq "${BUILD_ARCH}" "armv6l"
ddc492dd
MT
91 # Pandaboard
92 -mkdir -pv /usr/share/u-boot/pandaboard
93 cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config
e10049b3 94 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Pandaboard - IPFire.org"!' .config
ddc492dd 95 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
7284262a 96 cd $(DIR_APP) && install -v -m 644 MLO u-boot.img \
ddc492dd 97 /usr/share/u-boot/pandaboard
7284262a
AF
98 # Install pandaboard uboot as default
99 cd $(DIR_APP) && install MLO /boot/
100 cd $(DIR_APP) && install u-boot.img /boot/
ddc492dd
MT
101 cd $(DIR_APP) && make distclean
102
2a0947f2 103 # Wandboard
e10049b3
AF
104 -mkdir -pv /usr/share/u-boot/wandboard
105 cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_config
106 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Wandboard - IPFire.org"!' .config
107 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
108 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" u-boot.imx
109 cd $(DIR_APP) && install -v -m 644 u-boot.imx \
110 /usr/share/u-boot/wandboard
111 cd $(DIR_APP) && make distclean
2a0947f2
AF
112
113 # Raspberry Pi
114 -mkdir -pv /usr/share/u-boot/rpi
115 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_config
e10049b3 116 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi1 - IPFire.org"!' .config
ddc492dd 117 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2 118 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
119 /usr/share/u-boot/rpi/u-boot-rpi1.bin
120 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi1.bin
e10049b3 121 cd $(DIR_APP) && make distclean
2a0947f2
AF
122
123 # Raspberry Pi 2
184cbf9b 124 -mkdir -pv /usr/share/u-boot/rpi
2a0947f2 125 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_2_config
e10049b3 126 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi2 - IPFire.org"!' .config
ddc492dd 127 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2 128 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
129 /usr/share/u-boot/rpi/u-boot-rpi2.bin
130 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi2.bin
e10049b3 131 cd $(DIR_APP) && make distclean
2a0947f2 132
963f6e97 133 # Raspberry Pi 3 32bit
184cbf9b 134 -mkdir -pv /usr/share/u-boot/rpi
2a0947f2 135 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_32b_config
184cbf9b 136 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 32bit - IPFire.org"!' .config
2a0947f2
AF
137 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
138 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
139 /usr/share/u-boot/rpi/u-boot-rpi3.bin
140 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin
e10049b3 141 cd $(DIR_APP) && make distclean
2a0947f2
AF
142
143 # Orange Pi Zero
144 -mkdir -pv /usr/share/u-boot/orangepi_zero
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/orangepi-zero-add-macs.diff
146 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_config
184cbf9b 147 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero - IPFire.org"!' .config
2a0947f2
AF
148 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
149 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
150 /usr/share/u-boot/orangepi_zero
e10049b3 151 cd $(DIR_APP) && make distclean
ddc492dd 152
2a0947f2
AF
153 # Orange Pi PC
154 -mkdir -pv /usr/share/u-boot/orangepi_pc
155 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_pc_config
e10049b3 156 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi PC - IPFire.org"!' .config
ddc492dd 157 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
2a0947f2
AF
158 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
159 /usr/share/u-boot/orangepi_pc
e10049b3 160 cd $(DIR_APP) && make distclean
ddc492dd 161
56e211f6
AF
162 # LeMaker Banana Pi
163 -mkdir -pv /usr/share/u-boot/banana_pi
56e211f6 164 cd $(DIR_APP) && make CROSS_COMPILE="" Bananapi_config
e10049b3 165 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" BananaPi - IPFire.org"!' .config
56e211f6
AF
166 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
167 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
168 /usr/share/u-boot/banana_pi
e10049b3 169 cd $(DIR_APP) && make distclean
56e211f6 170
963f6e97
AF
171else
172 # Raspberry Pi 3
184cbf9b 173 -mkdir -pv /usr/share/u-boot/rpi
963f6e97
AF
174 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_config
175 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 - IPFire.org"!' .config
176 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
177 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
184cbf9b
AF
178 /usr/share/u-boot/rpi/u-boot-rpi3.bin
179 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin
180 cd $(DIR_APP) && make distclean
181
182 # Raspberry Pi 4
183 -mkdir -pv /usr/share/u-boot/rpi
184 cd $(DIR_APP) && make CROSS_COMPILE="" rpi_4_config
185 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi4 - IPFire.org"!' .config
186 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
187 cd $(DIR_APP) && install -v -m 644 u-boot.bin \
188 /usr/share/u-boot/rpi/u-boot-rpi4.bin
189 cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi4.bin
963f6e97
AF
190 cd $(DIR_APP) && make distclean
191
d814021a
AF
192 # OrangePi Zero Plus
193 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
194 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz
195 cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=sun50i_a64 DEBUG=0 bl31
196 cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/sun50i_a64/release/bl31.bin bl31.bin
197 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
198 -mkdir -pv /usr/share/u-boot/orangepi_zero_plus
199 cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_plus_config
200 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero+ - IPFire.org"!' .config
201 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
202 cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
203 /usr/share/u-boot/orangepi_zero_plus
204 cd $(DIR_APP) && make distclean
205 cd $(DIR_APP) && rm -f bl31.bin
206
1f38bac0 207 # Nanopi R2S
75c9d8c2
AF
208 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
209 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz
210 cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31
211 cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf
212 cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER)
dac49f1b 213 -mkdir -pv /usr/share/u-boot/nanopi_r2s
1f38bac0
AF
214 cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2s-rk3328_config
215 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2S - IPFire.org"!' .config
fe582c9d 216 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
75c9d8c2
AF
217 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config
218 cd $(DIR_APP) && sed -i -e 's!.*CONFIG_MISC_INIT_R.*!# CONFIG_MISC_INIT_R is not set!' .config
1f38bac0
AF
219 cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
220 cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \
dac49f1b 221 /usr/share/u-boot/nanopi_r2s/u-boot-rockchip.bin
1f38bac0
AF
222 cd $(DIR_APP) && make distclean
223
75c9d8c2
AF
224 # Nanopi R4S
225 # arm trusted firmware for rk3399 cannot build without cortex m0 gcc crosscompiler
7d5a7fea 226 cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz
75c9d8c2
AF
227 -mkdir -pv /usr/share/u-boot/nanopi_r4s
228 cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r4s-rk3399_config
229 cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R4S - IPFire.org"!' .config
230 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config
231 cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .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)