]>
Commit | Line | Data |
---|---|---|
1 | ############################################################################### | |
2 | # # | |
3 | # IPFire.org - A linux based firewall # | |
4 | # Copyright (C) 2007-2023 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 = 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 | # Raspberry Pi 3 | |
88 | -mkdir -pv /usr/share/u-boot/rpi | |
89 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_config | |
90 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi3 - IPFire.org"!' .config | |
91 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
92 | cd $(DIR_APP) && install -v -m 644 u-boot.bin \ | |
93 | /usr/share/u-boot/rpi/u-boot-rpi3.bin | |
94 | cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi3.bin | |
95 | cd $(DIR_APP) && install -v -m 755 tools/mkimage /usr/bin | |
96 | cd $(DIR_APP) && make distclean | |
97 | ||
98 | # Raspberry Pi 4 | |
99 | -mkdir -pv /usr/share/u-boot/rpi | |
100 | cd $(DIR_APP) && make CROSS_COMPILE="" rpi_4_config | |
101 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" RPi4 - IPFire.org"!' .config | |
102 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
103 | cd $(DIR_APP) && install -v -m 644 u-boot.bin \ | |
104 | /usr/share/u-boot/rpi/u-boot-rpi4.bin | |
105 | cd $(DIR_APP) && install u-boot.bin /boot/u-boot-rpi4.bin | |
106 | cd $(DIR_APP) && make distclean | |
107 | ||
108 | # OrangePi Zero Plus | |
109 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
110 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz | |
111 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=sun50i_a64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
112 | cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/sun50i_a64/release/bl31.bin bl31.bin | |
113 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
114 | -mkdir -pv /usr/share/u-boot/orangepi_zero_plus | |
115 | cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_plus_config | |
116 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi Zero+ - IPFire.org"!' .config | |
117 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
118 | cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \ | |
119 | /usr/share/u-boot/orangepi_zero_plus | |
120 | cd $(DIR_APP) && make distclean | |
121 | cd $(DIR_APP) && rm -f bl31.bin | |
122 | ||
123 | # Nanopi R2S | |
124 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
125 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz | |
126 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
127 | cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf | |
128 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
129 | -mkdir -pv /usr/share/u-boot/nanopi_r2s | |
130 | cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2s-rk3328_config | |
131 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2S - IPFire.org"!' .config | |
132 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config | |
133 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config | |
134 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
135 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
136 | cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \ | |
137 | /usr/share/u-boot/nanopi_r2s/u-boot-rockchip.bin | |
138 | cd $(DIR_APP) && make distclean | |
139 | ||
140 | # Nanopi R2C | |
141 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/rockchip/add-nanopi-r2c-and-orangepi-r1-plus-lts.patch | |
142 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
143 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz | |
144 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
145 | cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf | |
146 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
147 | -mkdir -pv /usr/share/u-boot/nanopi_r2c | |
148 | ||
149 | cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r2c-rk3328_config | |
150 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R2C - IPFire.org"!' .config | |
151 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config | |
152 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config | |
153 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
154 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
155 | cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \ | |
156 | /usr/share/u-boot/nanopi_r2c/u-boot-rockchip.bin | |
157 | cd $(DIR_APP) && make distclean | |
158 | ||
159 | # Orangepi R1 plus lts | |
160 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
161 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER).tar.gz | |
162 | cd $(DIR_APP)/arm-trusted-firmware-$(ATF_VER) && make PLAT=rk3328 ARCH=aarch64 DEBUG=0 bl31 LDFLAGS="$(LDFLAGS)" | |
163 | cd $(DIR_APP) && cp arm-trusted-firmware-$(ATF_VER)/build/rk3328/release/bl31/bl31.elf bl31.elf | |
164 | cd $(DIR_APP) && rm -rf arm-trusted-firmware-$(ATF_VER) | |
165 | -mkdir -pv /usr/share/u-boot/orangepi_r1_plus_lts | |
166 | ||
167 | cd $(DIR_APP) && make CROSS_COMPILE="" orangepi-r1-plus-lts-rk3328_config | |
168 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" OrangePi R1 plus lts - IPFire.org"!' .config | |
169 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config | |
170 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config | |
171 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
172 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
173 | cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \ | |
174 | /usr/share/u-boot/orangepi_r1_plus_lts/u-boot-rockchip.bin | |
175 | cd $(DIR_APP) && make distclean | |
176 | ||
177 | # Nanopi R4S | |
178 | # arm trusted firmware for rk3399 cannot build without cortex m0 gcc crosscompiler | |
179 | # it is build on ubuntu with make PLAT=rk3399 ARCH=aarch64 DEBUG=0 bl31 | |
180 | cd $(DIR_APP) && tar axf $(DIR_DL)/arm-trusted-firmware-$(ATF_VER)-rk3399-binary.tar.xz | |
181 | -mkdir -pv /usr/share/u-boot/nanopi_r4s | |
182 | cd $(DIR_APP) && make CROSS_COMPILE="" nanopi-r4s-rk3399_config | |
183 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" Nanopi R4S - IPFire.org"!' .config | |
184 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BOOTCOMMAND=.*!CONFIG_BOOTCOMMAND="console=ttyS2,115200n8;run distro_bootcmd"!' .config | |
185 | cd $(DIR_APP) && sed -i -e 's!^CONFIG_BAUDRATE=.*!CONFIG_BAUDRATE=115200!' .config | |
186 | cd $(DIR_APP) && sed -i -e 's!.*CONFIG_ENV_OVERWRITE.*!CONFIG_ENV_OVERWRITE=y!' .config | |
187 | cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" | |
188 | cd $(DIR_APP) && install -v -m 644 u-boot-rockchip.bin \ | |
189 | /usr/share/u-boot/nanopi_r4s/u-boot-rockchip.bin | |
190 | cd $(DIR_APP) && make distclean | |
191 | ||
192 | # create an empty 128 KB File for the u-boot env | |
193 | dd if=/dev/zero of=/boot/uboot.env bs=1K count=128 | |
194 | ||
195 | # config (uEnv.txt and boot.*) | |
196 | cp -vf $(DIR_SRC)/config/u-boot/* /boot/ | |
197 | # create signed binary boot script (boot.scr) | |
198 | mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr | |
199 | ||
200 | # patch real Kernel version to uEnv.txt | |
201 | sed -e "s/xxxKVERxxx/$(KVER)/g" -i /boot/uEnv.txt | |
202 | ||
203 | @rm -rf $(DIR_APP) | |
204 | @$(POSTBUILD) |