pmaports/device/main/u-boot-librem5/APKBUILD

109 lines
4 KiB
Text
Raw Normal View History

# 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_rc1_git20220214
pkgrel=0
# 'upstream/librem5' branch in uboot repo
_commit="cf03130d32f69fb78f404d64f1262b7f5c9ce4b5"
# '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/Librem5/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"
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="
c4650c686e0ed6cf07d3b41c3e5e99d2cecad6f3bbaffafef5c2e99f1463b58b2e771b2844c76b26f714988e016398d08bd66ece3eef25f2f0a986dd29eabf37 uboot-imx-cf03130d32f69fb78f404d64f1262b7f5c9ce4b5.tar.gz
cd8c9411ae0e57d2c8c700bf3e8c8d03e7dab955ace249a00911dd8c42b42929e0de3a5885eb9b1d945174abc8cfb177595d83c235e757c70640f451b62547ba arm-trusted-firmware-92c2de12d36b31938ce940d5cac3c30a98665237.tar.gz
1f968558bf158401ee5afe1c67e67bdd8ca2cb5d07029e78c745e751c665b68fa74128fca8b7161501a6445bbb18e8d463b42d787a61132db5c8778703462668 firmware-imx-8.12.bin
e46a863001872943301f9712e45797553ce52d8b0c3e63dba7beb1a54b857e8f3a715863b84cd7ab784f039f82d29a2b19b581891d11a84c342b1570e5ccfed3 update-u-boot
acccd93ca755c619f8ac63987c4d0d149afb808d3c4f4ac923e4793855deae12e68b3e042f48fe1bed59aac47f5080e26ea2737cb9466404fa3e4771b5da2af8 0001-librem5-enable-console-on-UART4.patch
"