ports/main/u-boot/APKBUILD

195 lines
6.1 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
2022-04-17 17:49:25 +00:00
pkgver=2022.01
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"
makedepends="$depends_dev bc dtc python3-dev swig bison flex
openssl1.1-compat-dev py3-setuptools linux-headers"
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
hifive-unmatched-ramdisk.patch
2022-04-17 17:49:25 +00:00
0001-rockpro64-fix-boot-hang.patch
0002-rockpro64-baudrate.patch
fix-tools-build.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
odroid:odroid-xu3
";;
aarch64) board_configs="
thunderx:thunderx_88xx
raspberrypi:rpi_3
odroid:odroid-c2,odroid-n2
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="
qemu:qemu-riscv64
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() {
cd "$builddir"
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";;
"rockpro64-rk3399")
export BL31="/usr/share/arm-trusted-firmware/rk3399/bl31.elf";;
esac
export BUILD_DIR="$builddir"/build/$board
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" ${board}_config || return 1
make O="$BUILD_DIR" all || return 1
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
install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt || return 1
install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin || return 1
}
tools() {
pkgdesc="u-boot bootloader utility tools"
provides="uboot-tools"
replaces="uboot-tools"
mkdir -p $pkgdir
mkdir $subpkgdir
cd "$builddir"
for tool in bmp_logo dumpimage env/fw_printenv \
fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr img2srec \
mkenvimage mkimage ncb proftool ubsha1 xway-swap-bytes; do
install -D tools/$tool \
$subpkgdir/usr/bin/$(basename $tool)
done
install -Dm644 tools/env/fw_env.config \
"${subpkgdir}/usr/share/doc/${pkgname}/examples/fw_env.config"
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
local board_images=""
case "$board" in
"sifive_unleashed"|"sifive_unmatched")
board_images="u-boot.itb spl/u-boot-spl.bin --" ;;
"pine64-lts"|"pinebook"|"teres_i"|"a64-olinuxino"|"a64-olinuxino-emmc"|"orangepi_3")
board_images="u-boot-sunxi-with-spl.bin --" ;;
"rockpro64-rk3399")
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
cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \
|| return 1
ok=yes
fi
done
[ "$ok" = yes ] || return 1
done
}
for board_config in $board_configs; do
_board="${board_config%%:*}"
_configs="${board_config#*:}"
eval "${_board}() { _split_boards $_board ${_configs//,/ }; }"
done
sha512sums="
2022-04-17 17:49:25 +00:00
d83c62bd8f0f51664d2aca329a3ce1379cfd1dfff439dccd6cfc2cb33cfef89a2b01855c97716f591b5550bfdf99e2f3aef7efa33f2e7834c820648f9eef3825 u-boot-2022.01.tar.bz2
2022-03-21 12:25:55 +00:00
f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt
b5b5960a70c0edab38c208e5a41f2130c673334e05ef77dd4c839d59365d4243590a79bf3865914397b600550f4d0f69f8145e51a7ef05aa0190420fcc7ff02d update-u-boot
1e8c95a37e7efb74f6519f66da44a0050417066aa2bd6d38e8a7e7135f501a9578dcc3701f66a170bf4cbd5c17b87d69ff80760979b1aa31d26e75be7cf7b97f hifive-unmatched-ramdisk.patch
2022-04-17 17:49:25 +00:00
27253e065a46a4563522fcb9551d51d68e0114ba8964c0be5067dbe2e94b0cf1b197490c17ad394d29603a21ab8c5d17daf0b3bc9bcfff704d8070e26b0b4761 0001-rockpro64-fix-boot-hang.patch
e506f06071966922db393620212cf38b0d456bf517e9a719a5f2191fa815f37c17f7a1650e78742ea29bcb05f5cd63d5e8a88fb48dbd224539ae7188efdcf823 0002-rockpro64-baudrate.patch
3b900d833ee7d82ee3bca6e8f8cb8e297359bb65c3f095a0d22377779eb8a233c5e566e5db6ce79f3076fbe6413d002941eb9cc450e3462337f46c1805472ce0 fix-tools-build.patch
2022-03-21 12:25:55 +00:00
"