2020-01-14 03:54:08 +00:00
|
|
|
# Forked from Alpine, so we can build it with Librem 5 phone support
|
|
|
|
pkgname=u-boot-librem5
|
2022-01-13 07:45:40 +00:00
|
|
|
pkgver=0.12
|
2021-11-09 00:40:28 +00:00
|
|
|
pkgrel=0
|
2020-05-13 02:52:26 +00:00
|
|
|
# 'librem5' branch in atf repo
|
|
|
|
_atfversion="92c2de12d36b31938ce940d5cac3c30a98665237"
|
|
|
|
# 'librem5' branch in uboot repo
|
2021-12-31 02:39:52 +00:00
|
|
|
_ubootversion="0c1162a11d5f9736edde7a30cf0085f3e0277b47"
|
2019-09-01 04:06:30 +00:00
|
|
|
_m4version="a017421c340a69f2392086da93841244f78a03c5"
|
2021-11-09 00:40:28 +00:00
|
|
|
_firmwareversion="8.12"
|
2020-01-14 03:54:08 +00:00
|
|
|
pkgdesc="u-boot bootloader for the Purism Librem5 phone"
|
2019-01-10 03:48:05 +00:00
|
|
|
url="http://www.denx.de/wiki/U-Boot/"
|
|
|
|
arch="aarch64"
|
2019-08-21 09:45:13 +00:00
|
|
|
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs"
|
2020-01-12 02:49:07 +00:00
|
|
|
makedepends="$depends_dev bc dtc python3-dev swig binutils coreutils zlib-dev newlib-arm-none-eabi bison flex"
|
2021-02-20 14:06:51 +00:00
|
|
|
options="!check !tracedeps pmb:cross-native"
|
2019-01-10 03:48:05 +00:00
|
|
|
source="
|
2019-09-01 04:06:30 +00:00
|
|
|
uboot-imx-${_ubootversion}.tar.gz::https://source.puri.sm/Librem5/uboot-imx/-/archive/${_ubootversion}/uboot-imx-${_ubootversion}.tar.gz
|
|
|
|
m4-${_m4version}.tar.gz::https://source.puri.sm/Librem5/Cortex_M4/-/archive/${_m4version}/Cortex_M4-${_m4version}.tar.gz
|
2020-01-12 02:49:07 +00:00
|
|
|
arm-trusted-firmware-${_atfversion}.tar.gz::https://source.puri.sm/Librem5/arm-trusted-firmware/-/archive/${_atfversion}/arm-trusted-firmware-${_atfversion}.tar.gz
|
2020-09-07 23:09:25 +00:00
|
|
|
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${_firmwareversion}.bin
|
2021-03-09 08:26:16 +00:00
|
|
|
update-u-boot
|
2022-01-13 07:45:40 +00:00
|
|
|
0001-Enable-efidebug-command.patch
|
2019-01-10 03:48:05 +00:00
|
|
|
"
|
2022-01-13 07:45:40 +00:00
|
|
|
install="$pkgname.post-upgrade $pkgname-devkit.post-upgrade"
|
2021-03-09 08:26:16 +00:00
|
|
|
subpackages="$pkgname-devkit"
|
|
|
|
|
2019-01-10 03:48:05 +00:00
|
|
|
_ubootbuilddir="$srcdir"/uboot-imx-${_ubootversion}
|
2020-01-12 02:49:07 +00:00
|
|
|
_atfbuilddir="$srcdir"/arm-trusted-firmware-${_atfversion}
|
2019-09-01 04:06:30 +00:00
|
|
|
_m4builddir="$srcdir"/Cortex_M4-${_m4version}
|
2020-01-12 02:49:07 +00:00
|
|
|
_firmwarebuilddir="$srcdir"/firmware-imx-${_firmwareversion}
|
|
|
|
builddir="$_ubootbuilddir"
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2021-03-09 08:26:16 +00:00
|
|
|
prepare() {
|
|
|
|
default_prepare
|
|
|
|
|
|
|
|
msg "Extracting DDR & HDMI firmware"
|
|
|
|
cd "$srcdir"
|
|
|
|
chmod +x firmware-imx-${_firmwareversion}.bin
|
|
|
|
./firmware-imx-${_firmwareversion}.bin --auto-accept
|
|
|
|
cp -v "$_firmwarebuilddir"/firmware/ddr/synopsys/lpddr4*.bin "$_ubootbuilddir"/
|
|
|
|
cp -v "$_firmwarebuilddir"/firmware/hdmi/cadence/signed*.bin "$_ubootbuilddir"/
|
|
|
|
}
|
|
|
|
|
2019-01-10 03:48:05 +00:00
|
|
|
build() {
|
2019-09-01 04:06:30 +00:00
|
|
|
msg "Building M4"
|
|
|
|
cd "$_m4builddir"
|
|
|
|
make
|
|
|
|
|
2019-01-10 03:48:05 +00:00
|
|
|
msg "Building ARM trusted firmware"
|
|
|
|
cd "$_atfbuilddir"
|
2019-09-01 04:06:30 +00:00
|
|
|
LDFLAGS="" make PLAT=imx8mq bl31
|
2020-01-12 02:49:07 +00:00
|
|
|
# Overwrite default bl31 binary with one made here
|
|
|
|
cp -v "$_atfbuilddir"/build/imx8mq/release/bl31.bin "$_ubootbuilddir"/
|
|
|
|
|
2019-01-10 03:48:05 +00:00
|
|
|
msg "Building u-boot"
|
|
|
|
cd "$_ubootbuilddir"
|
2019-09-01 04:06:30 +00:00
|
|
|
# Note: HOSTCC is set explicitly here else it tries to use cc, which
|
|
|
|
# doesn't exist on Alpine
|
2020-09-07 23:09:25 +00:00
|
|
|
#
|
|
|
|
# Devkit uboot firmware
|
|
|
|
make distclean
|
2020-01-12 02:49:07 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc librem5_devkit_defconfig
|
2020-09-07 23:09:25 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc flash.bin
|
|
|
|
mv flash.bin devkit-flash.bin
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2020-09-07 23:09:25 +00:00
|
|
|
# Phone uboot firmware
|
|
|
|
make distclean
|
2020-01-14 03:54:08 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc librem5_defconfig
|
2020-09-07 23:09:25 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc flash.bin
|
|
|
|
mv flash.bin phone-flash.bin
|
2020-01-14 03:54:08 +00:00
|
|
|
|
|
|
|
msg "Building u-boot flashing images"
|
2020-09-07 23:09:25 +00:00
|
|
|
# devkit
|
|
|
|
dd if=/dev/zero of=devkit-boot.img bs=1024 count=1055
|
|
|
|
dd if="$_m4builddir"/m4.bin conv=notrunc of="$_ubootbuilddir"/devkit-boot.img bs=1024
|
|
|
|
dd if="$_ubootbuilddir"/devkit-flash.bin conv=notrunc of="$_ubootbuilddir"/devkit-boot.img bs=1024 seek=31
|
2022-01-13 07:45:40 +00:00
|
|
|
sha512sum -b "$_ubootbuilddir"/devkit-boot.img > "$_ubootbuilddir"/devkit-boot.img.sha512
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2020-09-07 23:09:25 +00:00
|
|
|
# phone
|
|
|
|
dd if=/dev/zero of=phone-boot.img bs=1024 count=1055
|
|
|
|
dd if="$_m4builddir"/m4.bin conv=notrunc of="$_ubootbuilddir"/phone-boot.img bs=1024
|
|
|
|
dd if="$_ubootbuilddir"/phone-flash.bin conv=notrunc of="$_ubootbuilddir"/phone-boot.img bs=1024 seek=31
|
2022-01-13 07:45:40 +00:00
|
|
|
sha512sum -b "$_ubootbuilddir"/phone-boot.img > "$_ubootbuilddir"/phone-boot.img.sha512
|
2019-01-10 03:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2020-01-14 03:54:08 +00:00
|
|
|
install -D -m644 "$_ubootbuilddir"/phone-boot.img \
|
2021-03-09 08:26:16 +00:00
|
|
|
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img"
|
2022-01-13 07:45:40 +00:00
|
|
|
install -D -m644 "$_ubootbuilddir"/phone-boot.img.sha512 \
|
|
|
|
"$pkgdir/usr/share/u-boot/librem5/phone-boot.img.sha512"
|
2021-03-09 08:26:16 +00: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"
|
|
|
|
install -D -m644 "$_ubootbuilddir"/devkit-boot.img \
|
|
|
|
"$subpkgdir/usr/share/u-boot/librem5/devkit-boot.img"
|
2022-01-13 07:45:40 +00:00
|
|
|
install -D -m644 "$_ubootbuilddir"/devkit-boot.img.sha512 \
|
|
|
|
"$subpkgdir/usr/share/u-boot/librem5/devkit-boot.img.sha512"
|
2021-03-09 08:26:16 +00:00
|
|
|
install -D -m 755 "$srcdir"/update-u-boot \
|
|
|
|
"$subpkgdir"/usr/sbin/update-u-boot
|
2019-01-10 03:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-26 06:30:32 +00:00
|
|
|
sha512sums="
|
2021-12-31 02:39:52 +00:00
|
|
|
ee540631b4bc0a33dfb29d9ba6e1dcd6a5cb1d43a4bc1ab2c7a29637d9c141d1c6559c933a48b8ce67d5bc140e7875a92cfc1846eb3ff7ce2826b8d12ff56b4e uboot-imx-0c1162a11d5f9736edde7a30cf0085f3e0277b47.tar.gz
|
2019-09-01 04:06:30 +00:00
|
|
|
035a4358ddf586c829da7fa2fb0d9d1df913c0c454f2d0e57ff0c6794552e49950fb6373f9aaf72e0e4c78ab411496aabbc60bf66cd76e35053f7a2d77911735 m4-a017421c340a69f2392086da93841244f78a03c5.tar.gz
|
2020-05-13 02:52:26 +00:00
|
|
|
cd8c9411ae0e57d2c8c700bf3e8c8d03e7dab955ace249a00911dd8c42b42929e0de3a5885eb9b1d945174abc8cfb177595d83c235e757c70640f451b62547ba arm-trusted-firmware-92c2de12d36b31938ce940d5cac3c30a98665237.tar.gz
|
2021-11-09 00:40:28 +00:00
|
|
|
1f968558bf158401ee5afe1c67e67bdd8ca2cb5d07029e78c745e751c665b68fa74128fca8b7161501a6445bbb18e8d463b42d787a61132db5c8778703462668 firmware-imx-8.12.bin
|
2022-01-13 07:45:40 +00:00
|
|
|
8eb2793814e53752ba8635694094ea43234ed6411ff4fd3e39c970fd4c4fa1b515b292a6d34b6e9a4ffbb573b1cf18a043f6be4e5cf95fa0ff4b9df9afe05c63 update-u-boot
|
|
|
|
24883f7293ebe7995aca8caae872a9c192b56651bfce9f408e5c9d001eda4df59fe755c006e737ff3ca42041577f711e4e600bd71629c2abad4b4a593062906c 0001-Enable-efidebug-command.patch
|
2021-08-26 06:30:32 +00:00
|
|
|
"
|