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
|
2020-01-12 02:49:07 +00:00
|
|
|
pkgver=0.4
|
2019-02-28 04:55:10 +00:00
|
|
|
pkgrel=0
|
2020-01-14 03:54:08 +00:00
|
|
|
# 'librem5' branch for devkit
|
|
|
|
_atfversion="783fc2b2c4266bfdb5218e4d9b6b2bc90849e0e9"
|
|
|
|
# 'busfreq' branch
|
2020-01-12 02:49:07 +00:00
|
|
|
_ubootversion="54f300a32d00f3acebf7e6fcff210ad34e157eb9"
|
2019-09-01 04:06:30 +00:00
|
|
|
_m4version="a017421c340a69f2392086da93841244f78a03c5"
|
2020-01-12 02:49:07 +00:00
|
|
|
_firmwareversion="7.9"
|
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"
|
2019-02-28 08:11:08 +00:00
|
|
|
options="!check !tracedeps"
|
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
|
|
|
|
https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${_firmwareversion}.bin
|
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}
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2020-01-12 02:49:07 +00:00
|
|
|
builddir="$_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"/
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
msg "Building u-boot"
|
|
|
|
cd "$_ubootbuilddir"
|
|
|
|
make distclean
|
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-01-14 03:54:08 +00:00
|
|
|
#
|
|
|
|
# Devkit uboot firmware
|
2020-01-12 02:49:07 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc librem5_devkit_defconfig
|
2019-09-01 04:06:30 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc
|
2020-01-12 02:49:07 +00:00
|
|
|
make ARCH=arm HOSTCC=gcc flash.bin
|
|
|
|
make ARCH=arm HOSTCC=gcc u-boot.imx
|
2020-01-14 03:54:08 +00:00
|
|
|
mv flash.bin devkit-flash.bin
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2020-01-14 03:54:08 +00:00
|
|
|
# Phone uboot firmware
|
|
|
|
make distclean
|
|
|
|
make ARCH=arm HOSTCC=gcc librem5_defconfig
|
|
|
|
make ARCH=arm HOSTCC=gcc
|
|
|
|
make ARCH=arm HOSTCC=gcc flash.bin
|
|
|
|
make ARCH=arm HOSTCC=gcc u-boot.imx
|
|
|
|
mv flash.bin phone-flash.bin
|
|
|
|
|
|
|
|
msg "Building u-boot flashing images"
|
2020-01-12 02:49:07 +00:00
|
|
|
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
|
2020-01-14 03:54:08 +00:00
|
|
|
dd if="$_ubootbuilddir"/devkit-flash.bin conv=notrunc of="$_ubootbuilddir"/devkit-boot.img bs=1024 seek=31
|
2019-01-10 03:48:05 +00:00
|
|
|
|
2020-01-14 03:54:08 +00:00
|
|
|
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
|
2019-01-10 03:48:05 +00:00
|
|
|
msg "done!"
|
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2020-01-14 03:54:08 +00:00
|
|
|
install -D -m644 "$_ubootbuilddir"/devkit-boot.img \
|
|
|
|
"$pkgdir/usr/share/firmware/librem5/devkit-boot.img"
|
|
|
|
install -D -m644 "$_ubootbuilddir"/phone-boot.img \
|
|
|
|
"$pkgdir/usr/share/firmware/librem5/phone-boot.img"
|
2019-01-10 03:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-12 02:49:07 +00:00
|
|
|
sha512sums="6bcce8d553059dcde094b8a0bb352f1c8c8f33f5e59c3e1cde87d614bd785c929abe883b4ea6a72958c2849a6578dc06fe558e8d82180334ff0c1eb190a6a0ed uboot-imx-54f300a32d00f3acebf7e6fcff210ad34e157eb9.tar.gz
|
2019-09-01 04:06:30 +00:00
|
|
|
035a4358ddf586c829da7fa2fb0d9d1df913c0c454f2d0e57ff0c6794552e49950fb6373f9aaf72e0e4c78ab411496aabbc60bf66cd76e35053f7a2d77911735 m4-a017421c340a69f2392086da93841244f78a03c5.tar.gz
|
2020-01-14 03:54:08 +00:00
|
|
|
d4366a775a6dbeab491087991238c55812371aa2d57279d01c49f0da2f0cfa60f6531609e53b79fb44c39b0e94fd5a2ddd2b13d77469d5588452f11de05ba40b arm-trusted-firmware-783fc2b2c4266bfdb5218e4d9b6b2bc90849e0e9.tar.gz
|
2020-01-12 02:49:07 +00:00
|
|
|
d7c221e0c1cc5a22c9b98ba369f481d690a2227b0897836fb0b18975f0d2f0a085f7a120d24bdd161850d32f878e7f1aa47015dee76f7b40e84f45adf379e22c firmware-imx-7.9.bin"
|