Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubootRockPi4: init #103735

Merged
merged 1 commit into from Nov 14, 2020
Merged

ubootRockPi4: init #103735

merged 1 commit into from Nov 14, 2020

Conversation

andir
Copy link
Member

@andir andir commented Nov 13, 2020

Motivation for this change

This adds support for the Radxa Rock Pi 4 board which is based on
RK3399. The u-boot outputs from the introduced build are suitable to
build a generic image for the Rock Pi 4 by setting the following in a
custom build of $nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix:

  sdImage.postBuildCommands = ''
    dd if=${pkgs.ubootRockPi4}/idbloader.img of=$img seek=64 conv=notrunc
    dd if=${pkgs.ubootROckPi4}/u-boot.itb of=$img seek=16384 conv=notrunc
  '';

cc @samueldr

Things done
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)

BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [ "u-boot.itb" "idbloader.img"];
postBuild = ''
./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something smells fishy here. The idbloader.img isn't produced by that defconfig like every other rk3399 defconfig?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this comment can be resolved as the code I had here was just duplicating efforts?

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot verify on hardware, but how does this work for you?

diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 0bb030a86a0..0a178b39800 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -400,9 +400,5 @@ in {
     extraMeta.platforms = ["aarch64-linux"];
     BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
     filesToInstall = [ "u-boot.itb" "idbloader.img"];
-    postBuild = ''
-      ./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
-      cat spl/u-boot-spl.bin >> idbloader.img
-    '';
   };
 }

Using nix-build -A pkgsCross.aarch64-multiplatform.ubootRockPi4

With this applied:

@DUFFMAN ~/tmp/nixpkgs/nixpkgs-103735 $ file result/*
result/idbloader.img: data
result/u-boot.itb:    Device Tree Blob version 17, size=1396, boot CPU=0, string block size=131, DT structure block size=1208

@DUFFMAN ~/tmp/nixpkgs/nixpkgs-103735 $ sha256sum result/*
5603261c91833d53495da0c1267846405d4a30def5c4a8b414ba05db3ff014bf  result/idbloader.img
4c29ebe130b4628e766ab3b93a1abb670e4886d19000f0c719d93e30e8606a74  result/u-boot.itb

And your commit untouched:

@DUFFMAN ~/tmp/nixpkgs/nixpkgs-103735 $ file result/*
result/idbloader.img: data
result/u-boot.itb:    Device Tree Blob version 17, size=1396, boot CPU=0, string block size=131, DT structure block size=1208

@DUFFMAN ~/tmp/nixpkgs/nixpkgs-103735 $ sha256sum result/*
5603261c91833d53495da0c1267846405d4a30def5c4a8b414ba05db3ff014bf  result/idbloader.img
4c29ebe130b4628e766ab3b93a1abb670e4886d19000f0c719d93e30e8606a74  result/u-boot.itb

It looks like you've been re-implemented a small bit of the existing build!

This adds support for the Radxa Rock Pi 4 board which is based on
RK3399. The u-boot outputs from the introduced build are suitable to
build a generic image for the Rock Pi 4 by setting the following in a
custom build of $nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix:

```
  sdImage.postBuildCommands = ''
    dd if=${pkgs.ubootRockPi4}/idbloader.img of=$img seek=64 conv=notrunc
    dd if=${pkgs.ubootROckPi4}/u-boot.itb of=$img seek=16384 conv=notrunc
  '';
```
@andir
Copy link
Member Author

andir commented Nov 14, 2020

Ha, thanks! I've removed that custom part.

@ofborg ofborg bot requested a review from samueldr November 14, 2020 01:55
@samueldr samueldr merged commit b8c1348 into NixOS:master Nov 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants