2019-11-14 23:40:51 +01:00
|
|
|
{ buildUBoot
|
2020-01-18 00:27:57 +01:00
|
|
|
, lib
|
2019-11-14 23:40:51 +01:00
|
|
|
, python
|
|
|
|
, armTrustedFirmwareRK3399
|
|
|
|
, fetchpatch
|
|
|
|
, fetchFromGitLab
|
|
|
|
, fetchFromGitHub
|
2020-01-18 00:27:57 +01:00
|
|
|
, externalFirst ? false
|
2020-07-15 02:27:26 +02:00
|
|
|
, runCommandNoCC
|
2019-11-14 23:40:51 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pw = id: sha256: fetchpatch {
|
|
|
|
inherit sha256;
|
|
|
|
name = "${id}.patch";
|
|
|
|
url = "https://patchwork.ozlabs.org/patch/${id}/raw/";
|
|
|
|
};
|
|
|
|
|
2020-07-15 02:27:26 +02:00
|
|
|
# The version number for our opinionated firmware.
|
|
|
|
firmwareVersion = "002";
|
|
|
|
|
|
|
|
logo = runCommandNoCC "pbp-logo" {} ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp ${../artwork/nixos+pine-rle.bmp} $out/logo.bmp
|
|
|
|
(cd $out; gzip -k logo.bmp)
|
|
|
|
'';
|
|
|
|
|
2019-11-14 23:40:51 +01:00
|
|
|
atf = armTrustedFirmwareRK3399.overrideAttrs(oldAttrs: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ARM-software";
|
|
|
|
repo = "arm-trusted-firmware";
|
2020-06-20 22:41:33 +02:00
|
|
|
rev = "9935047b2086faa3bf3ccf0b95a76510eb5a160b";
|
|
|
|
sha256 = "1a6pm0nbgm5r3a41nwlkrli90l2blcijb02li7h75xcri6rb7frk";
|
2019-11-14 23:40:51 +01:00
|
|
|
};
|
2020-06-20 22:41:33 +02:00
|
|
|
version = "2020-06-17";
|
2019-11-14 23:40:51 +01:00
|
|
|
});
|
|
|
|
in
|
|
|
|
(buildUBoot {
|
2020-06-22 02:13:39 +02:00
|
|
|
defconfig = "pinebook-pro-rk3399_defconfig";
|
2019-11-14 23:40:51 +01:00
|
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
|
|
BL31 = "${atf}/bl31.elf";
|
|
|
|
filesToInstall = [
|
|
|
|
"idbloader.img"
|
|
|
|
"u-boot.itb"
|
|
|
|
".config"
|
|
|
|
];
|
|
|
|
|
|
|
|
extraPatches = [
|
2020-07-15 01:44:00 +02:00
|
|
|
# Upstream upcoming patches
|
|
|
|
# -------------------------
|
|
|
|
#
|
|
|
|
# https://patchwork.ozlabs.org/project/uboot/list/?series=182073
|
|
|
|
#
|
|
|
|
# RNG
|
|
|
|
# https://patchwork.ozlabs.org/patch/1305440/
|
|
|
|
(pw "1305440" "1w4vvj3la34rsdf5snlvjl9yxnxrybczjz8m73891x1r6lvr1agk")
|
|
|
|
# USB
|
|
|
|
# https://patchwork.ozlabs.org/patch/1305441/
|
|
|
|
(pw "1305441" "1my6vz2j7dp6k9qdyf4kzyfy2fgvj4bhxq0xnjkdvsasiz7rq2x9")
|
|
|
|
# SPI has been skipped as it seemed to cause issues.
|
|
|
|
|
2020-07-15 01:44:13 +02:00
|
|
|
# Upcoming patches
|
|
|
|
# ----------------
|
|
|
|
#
|
|
|
|
# These are not yet available on Patchwork. They are of *beta* quality.
|
|
|
|
# http://people.hupstream.com/~rtp/pbp/20200706/patches/series
|
|
|
|
#
|
|
|
|
# I have been authorised to distribute.
|
|
|
|
#
|
|
|
|
./0001-display-support.patch
|
|
|
|
|
2020-06-22 02:13:39 +02:00
|
|
|
# Dhivael patchset
|
|
|
|
# ----------------
|
|
|
|
#
|
|
|
|
# Origin: https://git.eno.space/pbp-uboot.git/
|
|
|
|
# Forward ported to 2020.07
|
2020-01-18 00:25:34 +01:00
|
|
|
|
2020-06-22 02:13:39 +02:00
|
|
|
./0001-rk3399-light-pinebook-power-and-standby-leds-during-.patch
|
|
|
|
./0002-reduce-pinebook_pro-bootdelay-to-1.patch
|
2020-07-15 01:51:23 +02:00
|
|
|
./0005-support-SPI-flash-boot.patch
|
2020-01-18 00:25:34 +01:00
|
|
|
|
2020-06-22 02:13:39 +02:00
|
|
|
# samueldr's patchset
|
|
|
|
# -------------------
|
2020-07-15 02:27:26 +02:00
|
|
|
./0001-opinionated-boot.patch
|
2020-01-18 00:27:57 +01:00
|
|
|
] ++ lib.optionals (externalFirst) [
|
2020-06-22 02:13:39 +02:00
|
|
|
# Origin: https://git.eno.space/pbp-uboot.git/
|
|
|
|
# Forward ported to 2020.07
|
|
|
|
./0003-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch
|
|
|
|
./0004-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch
|
2019-11-14 23:40:51 +01:00
|
|
|
];
|
2020-07-15 02:27:26 +02:00
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
CONFIG_IDENT_STRING=" (samueldr-pbp) v${firmwareVersion}"
|
|
|
|
'';
|
2019-11-14 23:40:51 +01:00
|
|
|
})
|
|
|
|
.overrideAttrs(oldAttrs: {
|
|
|
|
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
|
|
|
|
python
|
|
|
|
];
|
2020-06-22 02:13:39 +02:00
|
|
|
|
2019-11-14 23:40:51 +01:00
|
|
|
postPatch = oldAttrs.postPatch + ''
|
|
|
|
patchShebangs arch/arm/mach-rockchip/
|
|
|
|
'';
|
|
|
|
|
2020-07-15 01:51:23 +02:00
|
|
|
postInstall = ''
|
|
|
|
tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl-dtb.bin:spl/u-boot-spl-dtb.bin spl.bin
|
|
|
|
cat <(dd if=spl.bin bs=512K conv=sync) u-boot.itb > $out/u-boot.spiflash.bin
|
|
|
|
'';
|
|
|
|
|
2020-07-15 02:27:26 +02:00
|
|
|
makeFlags = oldAttrs.makeFlags ++ [
|
|
|
|
"LOGO_BMP=${logo}/logo.bmp"
|
|
|
|
];
|
|
|
|
|
2019-11-14 23:40:51 +01:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "gitlab.denx.de";
|
|
|
|
owner = "u-boot";
|
|
|
|
repo = "u-boot";
|
2020-06-22 02:13:39 +02:00
|
|
|
sha256 = "11154cxycw81dnmxfl10n2mgyass18jhjpwygqp7w1vjk9hgi4lw";
|
|
|
|
rev = "v2020.07";
|
2019-11-14 23:40:51 +01:00
|
|
|
};
|
|
|
|
})
|