pmaports/device/main/u-boot-librem5/APKBUILD
Clayton Craft 160e6085be
device/main/u-boot-librem5: upgrade to 2022.04_git20220420 (MR 3085)
This also re-enables the auto flashing for u-boot on the L5, but keeps
it disabled on the devkit for now until this u-boot supports the devkit
again.

[ci:skip-build] already built successfully in CI
2022-06-11 15:33:00 -07:00

114 lines
4.1 KiB
Text

# Mainline u-boot with Librem 5 support and config
# Maintainer: Clayton Craft <clayton@craftyguy.net>
# Co-Maintainer: Bhushan Shah <bshah@kde.org>
pkgname=u-boot-librem5
pkgver=2022.04_git20220420
pkgrel=0
# 'upstream/librem5-v3' branch in uboot repo
_commit="3fdb96e723a3fb0f2a271c5ff24bba7a39478c86"
# 'librem5' branch in atf repo
_atf_commit="92c2de12d36b31938ce940d5cac3c30a98665237"
_firmwareversion="8.12"
pkgdesc="u-boot bootloader for the Purism Librem5 phone"
url="http://www.denx.de/wiki/U-Boot/"
arch="aarch64"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs"
makedepends="
bc
binutils
bison
coreutils
dtc
flex
openssl-dev
py3-setuptools
python3-dev
swig
zlib-dev
"
options="!check !tracedeps pmb:cross-native"
source="
https://source.puri.sm/angus.ainslie/uboot-imx/-/archive/$_commit/uboot-imx-$_commit.tar.gz
https://source.puri.sm/Librem5/arm-trusted-firmware/-/archive/$_atf_commit/arm-trusted-firmware-$_atf_commit.tar.gz
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-$_firmwareversion.bin
update-u-boot
0001-librem5-enable-console-on-UART4.patch
"
install="$pkgname.post-upgrade"
install="$pkgname.post-upgrade $pkgname-devkit.post-upgrade"
subpackages="$pkgname-devkit"
_atf_builddir="$srcdir/arm-trusted-firmware-$_atf_commit"
_firmware_builddir="$srcdir/firmware-imx-$_firmwareversion"
builddir="$srcdir/uboot-imx-$_commit"
prepare() {
default_prepare
msg "Extracting DDR & HDMI firmware"
cd "$srcdir"
chmod +x firmware-imx-$_firmwareversion.bin
./firmware-imx-$_firmwareversion.bin --auto-accept
cp -v "$_firmware_builddir"/firmware/ddr/synopsys/lpddr4*.bin $builddir/
cp -v "$_firmware_builddir"/firmware/hdmi/cadence/signed_*imx8m.bin $builddir/
}
build() {
msg "Building ARM trusted firmware"
cd "$_atf_builddir"
LDFLAGS="" make PLAT=imx8mq bl31
# Overwrite default bl31 binary with one made here
export BL31="$_atf_builddir/build/imx8mq/release/bl31.bin"
cp -v "$_atf_builddir"/build/imx8mq/release/bl31.bin "$builddir"/
msg "Building u-boot"
cd $builddir
# Devkit uboot firmware
# NOTE: disabled, not supported yet in the new mainline branch
# make distclean
# make librem5_devkit_defconfig
# make ARCH=arm
# mv "$builddir"/flash.bin "$builddir"/devkit-boot.img
# sha512sum -b "$builddir"/devkit-boot.img > "$builddir"/devkit-boot.img.sha512
# Phone uboot firmware
make distclean
make librem5_defconfig
make ARCH=arm
mv flash.bin phone-boot.img
sha512sum -b phone-boot.img > phone-boot.img.sha512
}
package() {
install -D -m644 "$builddir"/phone-boot.img \
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img"
install -D -m644 "$builddir"/phone-boot.img.sha512 \
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img.sha512"
install -D -m 755 "$srcdir"/update-u-boot \
"$pkgdir"/usr/sbin/update-u-boot
}
devkit() {
pkgdesc="u-boot bootloader for the Purism Librem5 devkit"
# NOTE: package is empty since this u-boot doesn't support the devkit yet,
# but should in the future.
mkdir "$subpkgdir"
# install -D -m644 "$builddir"/devkit-boot.img \
# "$pkgdir/usr/share/u-boot/librem5/devkit-boot.img"
# install -D -m644 "$builddir"/devkit-boot.img.sha512 \
# "$pkgdir/usr/share/u-boot/librem5/devkit-boot.img.sha512"
# install -D -m 755 "$srcdir"/update-u-boot \
# "$pkgdir"/usr/sbin/update-u-boot
}
sha512sums="
5ff4d643fda9da61454badd6743914979d44f8d80bebc675e70fe6c1155ec927f8ff0f30389aeac600b8e4dc19ded1a76219dc10c467ce5cbd244275c81e3c92 uboot-imx-3fdb96e723a3fb0f2a271c5ff24bba7a39478c86.tar.gz
cd8c9411ae0e57d2c8c700bf3e8c8d03e7dab955ace249a00911dd8c42b42929e0de3a5885eb9b1d945174abc8cfb177595d83c235e757c70640f451b62547ba arm-trusted-firmware-92c2de12d36b31938ce940d5cac3c30a98665237.tar.gz
1f968558bf158401ee5afe1c67e67bdd8ca2cb5d07029e78c745e751c665b68fa74128fca8b7161501a6445bbb18e8d463b42d787a61132db5c8778703462668 firmware-imx-8.12.bin
e46a863001872943301f9712e45797553ce52d8b0c3e63dba7beb1a54b857e8f3a715863b84cd7ab784f039f82d29a2b19b581891d11a84c342b1570e5ccfed3 update-u-boot
f5c8a49bda189639386f2367418ab492f10e0e3c0c3f4ca078c461c0cf4427e113a90f49c37f01ef4db0a6e0f55d4f0a6346777e291918866821e659077e374a 0001-librem5-enable-console-on-UART4.patch
"