diff --git a/U-Boot.md b/U-Boot.md index cbdb42e..1b3722d 100644 --- a/U-Boot.md +++ b/U-Boot.md @@ -49,7 +49,7 @@ zstdcat result/sd-image/orangepi5plus-sd-image-*.img.zst | sudo dd status=progre # ================================== nix build github:ryan4yin/nixos-rk3588/2024032400#sdImage-opi5 # nix build .#sdImage-opi5-cross # fully cross-compiled -stdcat result/sd-image/orangepi5-sd-image-*.img.zst | sudo dd status=progress bs=8M of=/dev/sdX +zstdcat rock5a-*.img.zst | sudo dd status=progress bs=8M of=/dev/sdX ``` For Rock 5A, it requires a little more work to flash the image to the sd card: @@ -58,7 +58,7 @@ For Rock 5A, it requires a little more work to flash the image to the sd card: ```shell nix build .#sdImage-rock5a -zstd -d result/sd-image/rock5a-sd-image-*.img.zst -o rock5a.img +zstd -d rock5a-sd-image-*.img.zst -o rock5a.img # increase img's file size dd if=/dev/zero bs=1M count=16 >> rock5a.img diff --git a/modules/sd-image/rock5a.nix b/modules/sd-image/rock5a.nix index 4ca6b3c..66e7efc 100644 --- a/modules/sd-image/rock5a.nix +++ b/modules/sd-image/rock5a.nix @@ -8,8 +8,10 @@ inherit (rk3588) nixpkgs; rootPartitionUUID = "14e19a7b-0ae0-484d-9d54-43bd6fdc20c7"; - # rkbin-rk3588 = pkgs.callPackage ../../pkgs/rkbin-rk3588 {}; - uboot = pkgs.callPackage ../../pkgs/u-boot-radxa/prebuilt.nix {}; + uboot = pkgs.callPackage ../../pkgs/u-boot-radxa/default.nix { + # https://github.com/u-boot/u-boot/blob/v2024.01/configs/rock5a-rk3588s_defconfig + defconfig = "rock5a-rk3588s_defconfig"; + }; in { imports = [ ./sd-image-rock5a.nix diff --git a/pkgs/rkbin-rk3588/default.nix b/pkgs/rkbin-rk3588/default.nix deleted file mode 100644 index 7abe2b1..0000000 --- a/pkgs/rkbin-rk3588/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - stdenvNoCC, - fetchFromGitHub, -}: -stdenvNoCC.mkDerivation { - pname = "rkbin-rk3588"; - version = "0.0.1"; - - # https://github.com/armbian/rkbin/tree/master - src = fetchFromGitHub { - owner = "armbian"; - repo = "rkbin"; - rev = "ff684f607af661ac0ef5ce59f0533adb2beb6e12"; - sha256 = "sha256-sOhdlvdQrH7eykPV2y2r7/NqNcxdgtnBshQAka6ZXD0="; - }; - - installPhase = '' - mkdir $out && cp rk35/rk3588* $out/ - ''; -} diff --git a/pkgs/u-boot-radxa/build-from-source.nix b/pkgs/u-boot-radxa/build-from-source.nix deleted file mode 100644 index 03db4b2..0000000 --- a/pkgs/u-boot-radxa/build-from-source.nix +++ /dev/null @@ -1,44 +0,0 @@ -# TODO not working yet! -{ - lib, - buildUBoot, - fetchFromGitHub, - rkbin-rk3588, -}: -(buildUBoot rec { - version = "2023.08.27"; - - # https://github.com/radxa/u-boot/tree/stable-5.10-rock5 - src = fetchFromGitHub { - owner = "radxa"; - repo = "u-boot"; - rev = "8b4ecf0859a188a9de2017db7d5fccc90928318e"; # branch - stable-5.10-rock5 - sha256 = "sha256-29aulIto9YQmfnMwTqP8d70y2r/b4JgblKoByV4397o="; - }; - - # https://github.com/radxa/u-boot/blob/stable-5.10-rock5/configs/rock-5a-rk3588s_defconfig - defconfig = "rock-5a-rk3588s_defconfig"; - - extraMeta.platforms = ["aarch64-linux"]; - BL31 = "${rkbin-rk3588}/rk3588_bl31_v1.38.elf"; - - buildPhase = '' - make -j20 CROSS_COMPILE=aarch64-unknown-linux-gnu- \ - BL31=${rkbin-rk3588}/rk3588_bl31_v1.38.elf \ - spl/u-boot-spl.bin u-boot.dtb u-boot.itb - - tools/mkimage -n rk3588 -T rksd -d \ - ${rkbin-rk3588}/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin:spl/u-boot-spl.bin \ - idbloader.img - ''; - - filesToInstall = [ - "spl/u-boot-spl.bin" - - "u-boot.itb" - "idbloader.img" - ]; -}) -.overrideAttrs (oldAttrs: { - patches = []; # remove all patches, which is not compatible with thead-u-boot -}) diff --git a/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/idbloader.img b/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/idbloader.img deleted file mode 100644 index a292233..0000000 Binary files a/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/idbloader.img and /dev/null differ diff --git a/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/u-boot.itb b/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/u-boot.itb deleted file mode 100644 index 04b1fad..0000000 Binary files a/pkgs/u-boot-radxa/linux-u-boot-legacy-rock-5a/u-boot.itb and /dev/null differ diff --git a/pkgs/u-boot-radxa/prebuilt.nix b/pkgs/u-boot-radxa/prebuilt.nix deleted file mode 100644 index 4801d81..0000000 --- a/pkgs/u-boot-radxa/prebuilt.nix +++ /dev/null @@ -1,16 +0,0 @@ -{stdenv}: let - # Prebuilt u-boot for rock-5a, built from armbian/build with command: - # ./compile.sh build BOARD=rock-5a BRANCH=legacy BUILD_DESKTOP=no BUILD_MINIMAL=yes BUILD_ONLY=u-boot KERNEL_CONFIGURE=no RELEASE=bookworm - # And the unpack `output/debs/linux-u-boot-rock-5a-legacy_xxx.deb` to get the files below. - idbloader_img = ./linux-u-boot-legacy-rock-5a/idbloader.img; - u_boot_itb = ./linux-u-boot-legacy-rock-5a/u-boot.itb; -in - stdenv.mkDerivation { - pname = "u-boot-prebuilt"; - version = "unstable-2023-08-27"; - - buildCommand = '' - install -Dm444 ${idbloader_img} $out/idbloader.img - install -Dm444 ${u_boot_itb} $out/u-boot.itb - ''; - } diff --git a/pkgs/u-boot/default.nix b/pkgs/u-boot/default.nix new file mode 100644 index 0000000..e4bb263 --- /dev/null +++ b/pkgs/u-boot/default.nix @@ -0,0 +1,30 @@ +{ + fetchFromGitHub, + buildUBoot, + defconfig, + ... +}: let + rkbin = fetchFromGitHub { + owner = "rockchip-linux"; + repo = "rkbin"; + rev = "a2a0b89b6c8c612dca5ed9ed8a68db8a07f68bc0"; + hash = "sha256-U/jeUsV7bhqMw3BljmO6SI07NCDAd/+sEp3dZnyXeeA="; + }; +in + buildUBoot rec { + version = "2024.01"; + src = fetchFromGitHub { + owner = "u-boot"; + repo = "u-boot"; + rev = "v${version}"; + hash = "sha256-0Da7Czy9cpQ+D5EICc3/QSZhAdCBsmeMvBgykYhAQFw="; + }; + inherit defconfig; + patches = []; + extraMakeFlags = [ + "BL31=${rkbin}/bin/rk35/rk3588_bl31_v1.45.elf" + "ROCKCHIP_TPL=${rkbin}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin" + ]; + extraMeta.platforms = ["aarch64-linux"]; + filesToInstall = ["u-boot-rockchip.bin"]; + }