ports/main/u-boot/APKBUILD

214 lines
6.8 KiB
Plaintext
Raw Normal View History

2022-03-21 12:25:55 +00:00
# Contributor: He Yangxuan <yangxuan8282@gmail.com>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=u-boot
2023-05-13 16:17:21 +00:00
pkgver=2023.04
2022-04-17 17:49:25 +00:00
pkgrel=0
2022-03-21 12:25:55 +00:00
pkgdesc="u-boot bootloader common files"
url="https://www.denx.de/wiki/U-Boot/"
arch="all !s390x !ppc64le"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11"
2023-05-13 16:17:21 +00:00
options="!check"
makedepends="
$depends_dev
bc
bison
dtc
flex
gnutls-dev
linux-headers
openssl-dev>3
py3-elftools
py3-setuptools
python3-dev
swig
util-linux-dev
"
2022-03-21 12:25:55 +00:00
if [ "$CARCH" = "aarch64" ]; then
makedepends="$makedepends arm-trusted-firmware"
fi
source="https://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
README.txt
update-u-boot
2023-05-13 16:17:21 +00:00
fix-tools-build.patch
2022-04-17 17:49:25 +00:00
0001-rockpro64-fix-boot-hang.patch
0002-rockpro64-baudrate.patch
2023-05-13 16:17:21 +00:00
0001-Revert-mmc-s5p_sdhci-unset-the-SDHCI_QUIRK_BROKEN_R1.patch
0002-samsung-common-only-load-CROS_EC-if-enabled-in-confi.patch
2022-03-21 12:25:55 +00:00
"
builddir="$srcdir"/u-boot-${pkgver//_/-}
if [ "$CARCH" = "riscv64" ]; then
makedepends="$makedepends opensbi"
export OPENSBI=/usr/share/opensbi/generic/firmware/fw_dynamic.bin
fi
# secfixes:
# 2021.04-r0:
# - CVE-2021-27097
# - CVE-2021-27138
case "$CARCH" in
arm*) board_configs="
beagleboard:am335x_boneblack_vboot
cubieboard:Cubieboard,Cubieboard2
leemaker:Bananapi,Lamobo_R1
linksprite:Linksprite_pcDuino3_Nano
cuboxi:mx6cuboxi
raspberrypi:rpi_0_w,rpi,rpi_2,rpi_3_32b
wandboard:wandboard
qemu:qemu_arm
2023-05-13 16:17:21 +00:00
odroid:odroid,odroid-xu3
sunxi:LicheePi_Zero,Bananapi,Lamobo_R1,Cubieboard,Cubieboard2,orangepi_pc,bananapi_m2_berry,bananapi_m2_zero
2022-03-21 12:25:55 +00:00
";;
aarch64) board_configs="
thunderx:thunderx_88xx
2023-05-13 16:17:21 +00:00
raspberrypi:rpi_3,rpi_arm64
2022-03-21 12:25:55 +00:00
odroid:odroid-c2,odroid-n2
2023-05-13 16:17:21 +00:00
snapdragon:starqltechn
exynos:a3y17lte,a5y17lte,a7y17lte
2022-03-21 12:25:55 +00:00
libretech:libretech-cc
rockchip:rockpro64-rk3399
qemu:qemu_arm64
sunxi:pine64-lts,pinebook,orangepi_3,teres_i,a64-olinuxino,a64-olinuxino-emmc,nanopi_neo2
";;
riscv64) board_configs="
2023-05-13 16:17:21 +00:00
qemu:qemu-riscv64,qemu-riscv64_smode
2022-03-21 12:25:55 +00:00
unleashed:sifive_unleashed
unmatched:sifive_unmatched
";;
esac
_allboards=""
for board_config in $board_configs; do
_allboards="$_allboards $pkgname-${board_config%%:*}"
done
subpackages="$_allboards $pkgname-tools"
case "$CARCH" in
arm*|aarch64|riscv64) subpackages="$pkgname-all:_all $_allboards $pkgname-tools";;
esac
build() {
touch include/config.h
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
local board_config board
for board_config in $board_configs; do
local configs="${board_config#*:}"
for board in ${configs//,/ }; do
msg "Building u-boot for $board"
case "$board" in
"pine64-lts"|"pinebook"|"teres_i"|"a64-olinuxino"|"a64-olinuxino-emmc")
export BL31="/usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin";;
"orangepi_3")
export BL31="/usr/share/arm-trusted-firmware/sun50i_h6/bl31.bin";;
2023-05-13 16:17:21 +00:00
"rockpro64-rk3399"|"roc-pc-rk3399")
2022-03-21 12:25:55 +00:00
export BL31="/usr/share/arm-trusted-firmware/rk3399/bl31.elf";;
2023-05-13 16:17:21 +00:00
"roc-cc-rk3328")
export BL31="/usr/share/arm-trusted-firmware/rk3328/bl31.elf";;
2022-03-21 12:25:55 +00:00
esac
export BUILD_DIR="$builddir"/build/$board
mkdir -p "$BUILD_DIR"
2023-05-13 16:17:21 +00:00
make O="$BUILD_DIR" ${board}_config
make O="$BUILD_DIR" all
2022-03-21 12:25:55 +00:00
done
done
msg "Building u-boot-tools"
make tools-only_defconfig
make tools-all
}
package() {
case "$CARCH" in
mips64|x86*) return;;
esac
cd "$builddir"/build
mkdir -p "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/sbin
2023-05-13 16:17:21 +00:00
install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt
install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin
2022-03-21 12:25:55 +00:00
}
tools() {
pkgdesc="u-boot bootloader utility tools"
provides="uboot-tools"
replaces="uboot-tools"
mkdir -p $pkgdir
mkdir $subpkgdir
cd "$builddir"
2023-05-13 16:17:21 +00:00
for tool in dumpimage env/fw_printenv \
2022-03-21 12:25:55 +00:00
fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr img2srec \
2023-05-13 16:17:21 +00:00
mkenvimage mkimage ncb proftool; do
2022-03-21 12:25:55 +00:00
install -D tools/$tool \
2023-05-13 16:17:21 +00:00
$subpkgdir/usr/bin/"$(basename $tool)"
2022-03-21 12:25:55 +00:00
done
install -Dm644 tools/env/fw_env.config \
2023-05-13 16:17:21 +00:00
"$subpkgdir/usr/share/doc/$pkgname/examples/fw_env.config"
2022-03-21 12:25:55 +00:00
cd "$subpkgdir"/usr/bin
ln -sf fw_printenv fw_setenv
}
_all() {
pkgdesc="u-boot for all boards (meta package)"
depends="$_allboards"
mkdir -p "$subpkgdir"/
}
_split_boards() {
cd "$builddir"/build
pkgdesc="u-boot for $1"
depends="u-boot"
shift
local board
for board; do
msg "Including board $board"
mkdir -p "$subpkgdir"/usr/share/$pkgname/$board
export BUILD_DIR="$builddir"/build/$board
2023-05-13 16:17:21 +00:00
board_images=""
2022-03-21 12:25:55 +00:00
case "$board" in
"sifive_unleashed"|"sifive_unmatched")
board_images="u-boot.itb spl/u-boot-spl.bin --" ;;
2023-05-13 16:17:21 +00:00
"pine64-lts"|"pinebook"|"teres_i"|"a64-olinuxino"|"a64-olinuxino-emmc"|"orangepi_3"|"bananapi_m2_zero"|"bananapi_m2_berry")
2022-03-21 12:25:55 +00:00
board_images="u-boot-sunxi-with-spl.bin --" ;;
2023-05-13 16:17:21 +00:00
"rockpro64-rk3399"|"roc-pc-rk3399"|"roc-cc-rk3328")
2022-03-21 12:25:55 +00:00
board_images="tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb --" ;;
esac
local ok=no
for image in $board_images -- MLO SPL u-boot.img -- u-boot.bin; do
if [ "$image" = "--" ]; then
[ "$ok" = yes ] && break
continue
fi
if [ -e "$BUILD_DIR"/$image ]; then
2023-05-13 16:17:21 +00:00
cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board
2022-03-21 12:25:55 +00:00
ok=yes
fi
done
2023-05-13 16:17:21 +00:00
[ "$ok" = yes ] || return
2022-03-21 12:25:55 +00:00
done
}
for board_config in $board_configs; do
_board="${board_config%%:*}"
_configs="${board_config#*:}"
eval "${_board}() { _split_boards $_board ${_configs//,/ }; }"
done
sha512sums="
2023-05-13 16:17:21 +00:00
31a44083af8084cd657c08233f485ff9503002bbaf95114c6135d483881fa14dc5a1b7ab42fd91f1fdd6b330556e76958d475280115018cb59c62b6ab4b508e6 u-boot-2023.04.tar.bz2
2022-03-21 12:25:55 +00:00
f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt
b5b5960a70c0edab38c208e5a41f2130c673334e05ef77dd4c839d59365d4243590a79bf3865914397b600550f4d0f69f8145e51a7ef05aa0190420fcc7ff02d update-u-boot
2023-05-13 16:17:21 +00:00
83fc42c698f8236ba1f7d71383863e0bda255ada85bb885856a24b2036944d230d918a9d965d5ff90720726c9ee85ffda5e88eefc27b94ef9e7b4f456dcfb195 fix-tools-build.patch
29238add149e49acdfd891bc82295fb2bf25f467f8930d770c806e35564f373da4ed36e8e44941b479713db715401b99e00e99b3d741bd37d85ac2aeee0f335d 0001-rockpro64-fix-boot-hang.patch
56999b24f998162d58059984861077e22f47d5990d545e96b2d7d0eadac02495f9d6ca3b70029ec257bdd3613d721cc1a25facc406050979aa8be80886f6967f 0002-rockpro64-baudrate.patch
72efbc68fa98448b7cfe509c45fd934baf27810bcbde758f64bc1faa141287a0a18c54f5c60335e68438a57e3826e91c30b740c12eedd7d360ff28eb1d41c235 0001-Revert-mmc-s5p_sdhci-unset-the-SDHCI_QUIRK_BROKEN_R1.patch
fcf0b66fb7ec8868a971551bb2ae7bfe8f3cb1ba28513f7a34d13e937543fb993a78419a9f1faf890c8dadb7c5ee088e95b40f1f6522f4efa9e87a2014dfacf2 0002-samsung-common-only-load-CROS_EC-if-enabled-in-confi.patch
2022-03-21 12:25:55 +00:00
"