Skip to content

Instantly share code, notes, and snippets.

@AleXoundOS
Created February 8, 2020 20:44
Show Gist options
  • Save AleXoundOS/f98f19809cef10aed52eeed5a7838d3a to your computer and use it in GitHub Desktop.
Save AleXoundOS/f98f19809cef10aed52eeed5a7838d3a to your computer and use it in GitHub Desktop.
uboot nix derivation for Rock64 with CONFIG_BAUDRATE=115200
{ lib, buildUBoot, fetchFromGitHub, armTrustedFirmwareRK3328 }:
let
rkbin = fetchFromGitHub {
owner = "ayufan-rock64";
repo = "rkbin";
rev = "f79a708978232a2b6b06c2e4173c5314559e0d3a";
sha256 = "0h7xm4ck3p3380c6bqm5ixrkxwcx6z5vysqdwvfa7gcqx5d6x5zz";
};
in buildUBoot {
extraMakeFlags = [ "all" "u-boot.itb" ];
defconfig = "rock64-rk3328_defconfig";
extraMeta = {
platforms = [ "aarch64-linux" ];
license = lib.licenses.unfreeRedistributableFirmware;
};
BL31="${armTrustedFirmwareRK3328}/bl31.elf";
filesToInstall = [ "u-boot.itb" "idbloader.img"];
# Derive MAC address from cpuid
# Submitted upstream: https://patchwork.ozlabs.org/patch/1203686/
extraConfig = ''
CONFIG_MISC_INIT_R=y
CONFIG_BAUDRATE=115200
'';
# Close to being blob free, but the U-Boot TPL causes random memory
# corruption
postBuild = ''
./tools/mkimage -n rk3328 -T rksd -d ${rkbin}/rk33/rk3328_ddr_786MHz_v1.13.bin idbloader.img
cat spl/u-boot-spl.bin >> idbloader.img
'';
}
@AleXoundOS
Copy link
Author

AleXoundOS commented Feb 8, 2020

Successfully cross-builds at 437e1f69be786bfbd06a611530bbd2fac6af1d35 nixpkgs commit:

$ nix-build -I nixpkgs=https://github.com/NixOS/nixpkgs/tarball/437e1f69be786bfbd06a611530bbd2fac6af1d35 -E 'with import <nixpkgs> {}; pkgsCross.aarch64
-multiplatform.callPackage ./ubootRock64.nix {}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment