diff --git a/ops/nixos/kerrigan/default.nix b/ops/nixos/kerrigan/default.nix index 811d069582..a2d8d9d94c 100644 --- a/ops/nixos/kerrigan/default.nix +++ b/ops/nixos/kerrigan/default.nix @@ -13,8 +13,19 @@ let }; }) nmFiles); - boot-builder = pkgs.callPackage ./boot-builder.nix { }; - populate-boot-builder = pkgs.buildPackages.callPackage ./boot-builder.nix { }; + uboot-envtools = pkgs.ubootTools.override { + extraMakeFlags = [ "HOST_TOOLS_ALL=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "envtools" ]; + + outputs = [ "out" "man" ]; + + postInstall = '' + ln -s $out/bin/fw_printenv $out/bin/fw_setenv + installManPage doc/*.1 + ''; + filesToInstall = [ + "tools/env/fw_printenv" + ]; + }; in { fileSystems = { @@ -97,6 +108,7 @@ in environment.systemPackages = with pkgs; [ libqmi screen minicom conntrack-tools modemmanager android-tools + uboot-envtools ]; services.udev.packages = with pkgs; [ modemmanager @@ -119,4 +131,51 @@ in systemd.services."systemd-networkd-wait-online".wantedBy = lib.mkForce []; system.stateVersion = "23.05"; + + hardware.deviceTree = { + enable = true; + name = "marvell/armada-7040-mochabin.dtb"; + filter = "armada-7040-mochabin.dtb"; + overlays = [{ + name = "spi"; + filter = "armada-7040-mochabin.dtb"; + dtsText = '' + /dts-v1/; + /plugin/; + + / { + compatible = "globalscale,mochabin marvell,armada7040 marvell,armada-ap806-quad marvell,armada-ap806"; + }; + + &cp0_spi1 { + flash@0 { + status = "disabled"; + }; + flash-real@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "firmware"; + reg = <0x0 0x3e0000>; + read-only; + }; + partition@3e0000 { + label = "u-boot-env"; + reg = <0x3e0000 0x20000>; + }; + }; + }; + }; + ''; + }]; + }; }