2022-03-06 16:08:29 +01:00
|
|
|
# Mainline u-boot with Librem 5 support and config
|
|
|
|
# Maintainer: Clayton Craft <clayton@craftyguy.net>
|
2022-12-09 22:13:27 +10:00
|
|
|
# Co-Maintainer: Alistair Francis <alistair@alistair23.me>
|
2020-01-13 19:54:08 -08:00
|
|
|
pkgname=u-boot-librem5
|
2022-12-09 20:56:23 +10:00
|
|
|
pkgver=2022.10
|
|
|
|
pkgrel=0
|
|
|
|
# 'upstream/librem5' branch in uboot repo
|
|
|
|
_commit="c4960dade272da9d6a7f53f6956d4d6747d573e9"
|
2020-05-12 19:52:26 -07:00
|
|
|
# 'librem5' branch in atf repo
|
2022-12-09 20:56:23 +10:00
|
|
|
_atf_commit="1fd3ff86cd4a05cd3e5637bf5a6902ac58fcafb9"
|
2021-11-08 16:40:28 -08:00
|
|
|
_firmwareversion="8.12"
|
2020-01-13 19:54:08 -08:00
|
|
|
pkgdesc="u-boot bootloader for the Purism Librem5 phone"
|
2019-01-09 19:48:05 -08:00
|
|
|
url="http://www.denx.de/wiki/U-Boot/"
|
|
|
|
arch="aarch64"
|
2019-08-21 11:45:13 +02:00
|
|
|
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs"
|
2022-03-07 17:06:25 -08:00
|
|
|
makedepends="
|
|
|
|
bc
|
|
|
|
binutils
|
|
|
|
bison
|
|
|
|
coreutils
|
|
|
|
dtc
|
|
|
|
flex
|
|
|
|
openssl-dev
|
|
|
|
py3-setuptools
|
|
|
|
python3-dev
|
|
|
|
swig
|
|
|
|
zlib-dev
|
|
|
|
"
|
2021-02-20 15:06:51 +01:00
|
|
|
options="!check !tracedeps pmb:cross-native"
|
2019-01-09 19:48:05 -08:00
|
|
|
source="
|
2022-04-20 23:25:56 -07:00
|
|
|
https://source.puri.sm/angus.ainslie/uboot-imx/-/archive/$_commit/uboot-imx-$_commit.tar.gz
|
2022-03-07 17:06:25 -08:00
|
|
|
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
|
2021-03-09 00:26:16 -08:00
|
|
|
update-u-boot
|
2022-03-07 17:06:25 -08:00
|
|
|
0001-librem5-enable-console-on-UART4.patch
|
2019-01-09 19:48:05 -08:00
|
|
|
"
|
2022-03-07 17:06:25 -08:00
|
|
|
install="$pkgname.post-upgrade"
|
2022-04-05 10:56:56 -07:00
|
|
|
install="$pkgname.post-upgrade $pkgname-devkit.post-upgrade"
|
|
|
|
subpackages="$pkgname-devkit"
|
2021-03-09 00:26:16 -08:00
|
|
|
|
2022-03-07 17:06:25 -08:00
|
|
|
_atf_builddir="$srcdir/arm-trusted-firmware-$_atf_commit"
|
|
|
|
_firmware_builddir="$srcdir/firmware-imx-$_firmwareversion"
|
|
|
|
builddir="$srcdir/uboot-imx-$_commit"
|
2019-01-09 19:48:05 -08:00
|
|
|
|
2021-03-09 00:26:16 -08:00
|
|
|
prepare() {
|
|
|
|
default_prepare
|
|
|
|
|
|
|
|
msg "Extracting DDR & HDMI firmware"
|
|
|
|
cd "$srcdir"
|
2022-03-07 17:06:25 -08:00
|
|
|
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/
|
2022-12-01 09:37:17 +01:00
|
|
|
|
|
|
|
# Disable -Werror in arm-trusted-firmware so it builds with GCC 12. The
|
|
|
|
# version we use here is missing E=0 introduced here:
|
|
|
|
# https://github.com/ARM-software/arm-trusted-firmware/commit/6336b07ad25cb05ca75f5a465d816af7956e0a59
|
|
|
|
sed -i "s/-Werror//g" "$_atf_builddir"/Makefile
|
2021-03-09 00:26:16 -08:00
|
|
|
}
|
|
|
|
|
2019-01-09 19:48:05 -08:00
|
|
|
build() {
|
|
|
|
msg "Building ARM trusted firmware"
|
2022-03-07 17:06:25 -08:00
|
|
|
cd "$_atf_builddir"
|
2022-12-01 09:37:17 +01:00
|
|
|
LDFLAGS="-no-warn-rwx-segment" make PLAT=imx8mq bl31
|
2020-01-11 18:49:07 -08:00
|
|
|
# Overwrite default bl31 binary with one made here
|
2022-03-07 17:06:25 -08:00
|
|
|
export BL31="$_atf_builddir/build/imx8mq/release/bl31.bin"
|
|
|
|
cp -v "$_atf_builddir"/build/imx8mq/release/bl31.bin "$builddir"/
|
2020-01-11 18:49:07 -08:00
|
|
|
|
2019-01-09 19:48:05 -08:00
|
|
|
msg "Building u-boot"
|
2022-03-07 17:06:25 -08:00
|
|
|
cd $builddir
|
|
|
|
|
2020-09-07 16:09:25 -07:00
|
|
|
# Devkit uboot firmware
|
2022-03-07 17:06:25 -08:00
|
|
|
# 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
|
2019-01-09 19:48:05 -08:00
|
|
|
|
2020-09-07 16:09:25 -07:00
|
|
|
# Phone uboot firmware
|
|
|
|
make distclean
|
2022-03-07 17:06:25 -08:00
|
|
|
make librem5_defconfig
|
|
|
|
make ARCH=arm
|
|
|
|
mv flash.bin phone-boot.img
|
|
|
|
sha512sum -b phone-boot.img > phone-boot.img.sha512
|
2019-01-09 19:48:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2022-03-07 17:06:25 -08:00
|
|
|
install -D -m644 "$builddir"/phone-boot.img \
|
2021-03-09 00:26:16 -08:00
|
|
|
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img"
|
2022-03-07 17:06:25 -08:00
|
|
|
install -D -m644 "$builddir"/phone-boot.img.sha512 \
|
2022-01-12 23:45:40 -08:00
|
|
|
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img.sha512"
|
2021-03-09 00:26:16 -08:00
|
|
|
install -D -m 755 "$srcdir"/update-u-boot \
|
|
|
|
"$pkgdir"/usr/sbin/update-u-boot
|
|
|
|
}
|
|
|
|
|
|
|
|
devkit() {
|
|
|
|
pkgdesc="u-boot bootloader for the Purism Librem5 devkit"
|
2022-04-05 10:56:56 -07:00
|
|
|
|
|
|
|
# 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
|
2019-01-09 19:48:05 -08:00
|
|
|
}
|
|
|
|
|
2021-08-25 23:30:32 -07:00
|
|
|
sha512sums="
|
2022-12-09 20:56:23 +10:00
|
|
|
d35e46b94ebf50a7ffcedf824f19bca5195cbf0bbcee1dd6cea115f090a3a963975e6eaaa33eac623bbbf9ade62ab983a434adaf9435c993eacba9f7b4bb48a8 uboot-imx-c4960dade272da9d6a7f53f6956d4d6747d573e9.tar.gz
|
|
|
|
088b1b159e54d97cf3e47cb2de8327719779e558d1fe2453a46eb12081de4f1641e84dea37bb01518a6760a49e83b6d96ad185cdb5d9ec2b64f5ac934c368adf arm-trusted-firmware-1fd3ff86cd4a05cd3e5637bf5a6902ac58fcafb9.tar.gz
|
2021-11-08 16:40:28 -08:00
|
|
|
1f968558bf158401ee5afe1c67e67bdd8ca2cb5d07029e78c745e751c665b68fa74128fca8b7161501a6445bbb18e8d463b42d787a61132db5c8778703462668 firmware-imx-8.12.bin
|
2022-03-07 17:06:25 -08:00
|
|
|
e46a863001872943301f9712e45797553ce52d8b0c3e63dba7beb1a54b857e8f3a715863b84cd7ab784f039f82d29a2b19b581891d11a84c342b1570e5ccfed3 update-u-boot
|
2022-04-20 23:25:56 -07:00
|
|
|
f5c8a49bda189639386f2367418ab492f10e0e3c0c3f4ca078c461c0cf4427e113a90f49c37f01ef4db0a6e0f55d4f0a6346777e291918866821e659077e374a 0001-librem5-enable-console-on-UART4.patch
|
2021-08-25 23:30:32 -07:00
|
|
|
"
|