]>
Commit | Line | Data |
---|---|---|
1 | ############################################################################### | |
2 | # # | |
3 | # IPFire.org - A linux based firewall # | |
4 | # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # | |
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 | ||
25 | include Config | |
26 | ||
27 | VER = 2022.10 | |
28 | ||
29 | THISAPP = u-boot-$(VER) | |
30 | DL_FILE = $(THISAPP).tar.bz2 | |
31 | DL_FROM = $(URL_IPFIRE) | |
32 | DIR_APP = $(DIR_SRC)/$(THISAPP) | |
33 | TARGET = $(DIR_INFO)/$(THISAPP)-$(MKIMAGE) | |
34 | SUP_ARCH = armv6l aarch64 | |
35 | ||
36 | CFLAGS := $(patsubst -fstack-protector-strong,,$(CFLAGS)) | |
37 | LDFLAGS += --no-warn-rwx-segments | |
38 | ||
39 | ATF_VER = 2.7 | |
40 | ||
41 | ############################################################################### | |
42 | # Top-level Rules | |
43 | ############################################################################### | |
44 | ||
45 | objects = $(DL_FILE) arm-trusted-firmware-$(ATF_VER).tar.gz arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz | |
46 | ||
47 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
48 | arm-trusted-firmware-$(ATF_VER).tar.gz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER).tar.gz | |
49 | arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz = $(DL_FROM)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz | |
50 | ||
51 | $(DL_FILE)_BLAKE2 = 42aa7a6f131735888939982e579de4342e3909e064ab896b0df6f1ff56c20ed6cb11d25286da7c052a5f67dcef6fa7a746944d8df6dd504586f5a71502d157e1 | |
52 | arm-trusted-firmware-$(ATF_VER).tar.gz_BLAKE2 = 4fc4d5646e272200d40081902e17f0be32956f451622f011a0d568c8cf26e15ab165fe16a69cf222241f7ba1d443add562d6d382277eb4fb2b49c3918cabdbad | |
53 | arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz_BLAKE2 = 04424a7dcda0771f469c8e918a24aed75017c1a28c1b8c2c794e3ce31afbc01e7906ccab6faf1459d69a5ec1ef4fdde2bab1011b883980efeae7372013f2570e | |
54 | ||
55 | install : $(TARGET) | |
56 | ||
57 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
58 | ||
59 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
60 | ||
61 | b2 : $(subst %,%_BLAKE2,$(objects)) | |
62 | ||
63 | ############################################################################### | |
64 | # Downloading, checking, b2sum | |
65 | ############################################################################### | |
66 | ||
67 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
68 | @$(CHECK) | |
69 | ||
70 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
71 | @$(LOAD) | |
72 | ||
73 | $(subst %,%_BLAKE2,$(objects)) : | |
74 | @$(B2SUM) | |
75 | ||
76 | dist: | |
77 | @$(PAK) | |
78 | ||
79 | ############################################################################### | |
80 | # Installation Details | |
81 | ############################################################################### | |
82 | ||
83 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
84 | @$(PREBUILD) | |
85 | @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) | |
86 | ||
87 | ifneq "$(MKIMAGE)" "1" | |
88 | ifeq "${BUILD_ARCH}" "armv6l" | |
89 | # Pandaboard | |
90 | -mkdir -pv /usr/share/u-boot/pandaboard | |
91 | cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config | |
92 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Pandaboard - IPFire.org"!' .config | |
93 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
94 | cd $(DIR_APP) && install -v -m 644 MLO u-boot.img \ | |
95 | /usr/share/u-boot/pandaboard | |
96 | # Install pandaboard uboot as default | |
97 | cd $(DIR_APP) && install MLO /boot/ | |
98 | cd $(DIR_APP) && install u-boot.img /boot/ | |
99 | cd $(DIR_APP) && make distclean | |
100 | ||
101 | # Wandboard | |
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 | |
110 | ||
111 | # Raspberry Pi | |
112 | -mkdir -pv /usr/share/u-boot/rpi | |
113 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_config | |
114 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi1 - IPFire.org"!' .config | |
115 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
116 | cd $(DIR_APP) && install -v -m 644 u-boot.bin \ | |
117 | /usr/share/u-boot/rpi/u-boot-rpi1.bin | |
118 | cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi1.bin | |
119 | cd $(DIR_APP) && make distclean | |
120 | ||
121 | # Raspberry Pi 2 | |
122 | -mkdir -pv /usr/share/u-boot/rpi | |
123 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_2_config | |
124 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi2 - IPFire.org"!' .config | |
125 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
126 | cd $(DIR_APP) && install -v -m 644 u-boot.bin \ | |
127 | /usr/share/u-boot/rpi/u-boot-rpi2.bin | |
128 | cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi2.bin | |
129 | cd $(DIR_APP) && make distclean | |
130 | ||
131 | # Raspberry Pi 3 32bit | |
132 | -mkdir -pv /usr/share/u-boot/rpi | |
133 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_32b_config | |
134 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 32bit - IPFire.org"!' .config | |
135 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
136 | cd $(DIR_APP) && install -v -m 644 u-boot.bin \ | |
137 | /usr/share/u-boot/rpi/u-boot-rpi3.bin | |
138 | cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin | |
139 | cd $(DIR_APP) && make distclean | |
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 | |
145 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero - IPFire.org"!' .config | |
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 | |
149 | cd $(DIR_APP) && make distclean | |
150 | ||
151 | # Orange Pi PC | |
152 | -mkdir -pv /usr/share/u-boot/orangepi_pc | |
153 | cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_pc_config | |
154 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi PC - IPFire.org"!' .config | |
155 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
156 | cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \ | |
157 | /usr/share/u-boot/orangepi_pc | |
158 | cd $(DIR_APP) && make distclean | |
159 | ||
160 | # LeMaker Banana Pi | |
161 | -mkdir -pv /usr/share/u-boot/banana_pi | |
162 | cd $(DIR_APP) && make CROSS_COMPILE="" Bananapi_config | |
163 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" BananaPi - IPFire.org"!' .config | |
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 | |
167 | cd $(DIR_APP) && make distclean | |
168 | ||
169 | else | |
170 | # Raspberry Pi 3 | |
171 | -mkdir -pv /usr/share/u-boot/rpi | |
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 \ | |
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 | |
188 | cd $(DIR_APP) && make distclean | |
189 | ||
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 | |
193 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=sun50i_a64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
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 | ||
205 | # Nanopi R2S | |
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 | |
208 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
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) | |
211 | -mkdir -pv /usr/share/u-boot/nanopi_r2s | |
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 | |
214 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config | |
215 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config | |
216 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
217 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
218 | cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \ | |
219 | /usr/share/u-boot/nanopi_r2s/u-boot-rockchip.bin | |
220 | cd $(DIR_APP) && make distclean | |
221 | ||
222 | # Nanopi R4S | |
223 | # arm trusted firmware for rk3399 cannot build without cortex m0 gcc crosscompiler | |
224 | # it is build on ubuntu with make PLAT=rk3399 ARCH=aarch64 DEBUG=0 bl31 | |
225 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz | |
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 | |
231 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
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 | ||
237 | endif | |
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 | |
240 | ||
241 | # config (uEnv.txt and boot.*) | |
242 | cp -vf $(DIR_SRC)/config/u-boot/* /boot/ | |
243 | # patch real Kernel version to uEnv.txt | |
244 | sed -e "s/xxxKVERxxx/$(KVER)/g" -i /boot/uEnv.txt | |
245 | ||
246 | else | |
247 | # mkimage | |
248 | ifeq "${BUILD_ARCH}" "armv6l" | |
249 | cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config | |
250 | else | |
251 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_config | |
252 | endif | |
253 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" tools | |
254 | cd $(DIR_APP) && install -v -m 755 tools/mkimage /usr/bin | |
255 | endif | |
256 | ||
257 | @rm -rf $(DIR_APP) | |
258 | @$(POSTBUILD) |