From 70592248e361d32b581d77b642b6e180f1b51693 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 10 Jan 2021 16:35:43 -0500 Subject: [PATCH 1/4] Add ootb RPi SD "support" --- hosts/{niximg.nix => nixISO.nix} | 0 hosts/nixSD.nix | 17 +++++++++++ overlays/ubootRaspberryPi3_64bit.nix | 3 ++ ...configs-rpi-allow-for-bigger-kernels.patch | 30 +++++++++++++++++++ shell.nix | 6 ++-- 5 files changed, 54 insertions(+), 2 deletions(-) rename hosts/{niximg.nix => nixISO.nix} (100%) create mode 100644 hosts/nixSD.nix create mode 100644 overlays/ubootRaspberryPi3_64bit.nix create mode 100644 pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch diff --git a/hosts/niximg.nix b/hosts/nixISO.nix similarity index 100% rename from hosts/niximg.nix rename to hosts/nixISO.nix diff --git a/hosts/nixSD.nix b/hosts/nixSD.nix new file mode 100644 index 000000000..83a01905e --- /dev/null +++ b/hosts/nixSD.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, config, unstableModulesPath, ... }: +{ + imports = [ + # passwd is nixos by default + ../users/nixos + # passwd is empty by default + ../users/root + (unstableModulesPath + "/installer/cd-dvd/sd-image-aarch64.nix") + ]; + + hardware.enableRedistributableFirmware.enable = lib.mkDefault true; + hardware.pulseaudio.enable = lib.mkDefault true; + sound.enable = lib.mkDefault true; + + documentation.enable = false; + networking.wireless.enable = true; +} diff --git a/overlays/ubootRaspberryPi3_64bit.nix b/overlays/ubootRaspberryPi3_64bit.nix new file mode 100644 index 000000000..c3ea03d79 --- /dev/null +++ b/overlays/ubootRaspberryPi3_64bit.nix @@ -0,0 +1,3 @@ +final: prev: { + ubootRaspberryPi3_64bit = prev.ubootRaspberryPi3_64bit.overrideAttrs (o: { patches = [ ../pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch ]; }); +} diff --git a/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch b/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch new file mode 100644 index 000000000..ca82e8212 --- /dev/null +++ b/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch @@ -0,0 +1,30 @@ +From 3c6b7c0922370e9d0c1705706e7c47dcd234e6c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Milan=20P=C3=A4ssler?= +Date: Wed, 30 Dec 2020 11:49:16 +0100 +Subject: [PATCH] configs/rpi: allow for bigger kernels + +--- + include/configs/rpi.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index 834f1cd2..b63ee96f 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -163,10 +163,10 @@ + "fdt_high=" FDT_HIGH "\0" \ + "initrd_high=" INITRD_HIGH "\0" \ + "kernel_addr_r=0x00080000\0" \ +- "scriptaddr=0x02400000\0" \ +- "pxefile_addr_r=0x02500000\0" \ +- "fdt_addr_r=0x02600000\0" \ +- "ramdisk_addr_r=0x02700000\0" ++ "scriptaddr=0x02c00000\0" \ ++ "pxefile_addr_r=0x02d00000\0" \ ++ "fdt_addr_r=0x02e00000\0" \ ++ "ramdisk_addr_r=0x02f00000\0" + + #if CONFIG_IS_ENABLED(CMD_MMC) + #define BOOT_TARGET_MMC(func) \ +-- +2.29.2 diff --git a/shell.nix b/shell.nix index dd7e309a2..e160e8cc9 100644 --- a/shell.nix +++ b/shell.nix @@ -17,9 +17,11 @@ let flk = pkgs.writeShellScriptBin "flk" '' if [[ -z "$1" ]]; then - echo "Usage: $(basename "$0") [ iso | install {host} | {host} [switch|boot|test] ]" + echo "Usage: $(basename "$0") [ iso | sd | install {host} | {host} [switch|boot|test] ]" elif [[ "$1" == "iso" ]]; then - nix build ${configs}.niximg.${build}.isoImage + nix build ${configs}.nixISO.${build}.isoImage + elif [[ "$1" == "sd" ]]; then + nix build ${configs}.nixSD.${build}.sdImage elif [[ "$1" == "install" ]]; then sudo nixos-install --flake ".#$2" "${"\${@:3}"}" else From 0652d917dcf2cd9f1989c4f52a21be97125e4272 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 11 Jan 2021 18:44:55 -0500 Subject: [PATCH 2/4] Use upstream patch with latest nixpkgs Don't use sdcard module from master due to modules and pkg incopmatibilities --- flake.lock | 13 ++++---- hosts/nixSD.nix | 4 +-- overlays/ubootRaspberryPi3_64bit.nix | 3 -- ...configs-rpi-allow-for-bigger-kernels.patch | 30 ------------------- pkgs/override.nix | 1 + 5 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 overlays/ubootRaspberryPi3_64bit.nix delete mode 100644 pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch diff --git a/flake.lock b/flake.lock index 609c2d338..df3483f97 100644 --- a/flake.lock +++ b/flake.lock @@ -17,15 +17,16 @@ }, "flake-utils": { "locked": { - "lastModified": 1605370193, - "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "lastModified": 1608663846, + "narHash": "sha256-YOAXeoNLW0IubQ6AZLGuSj5kAD5n4DYXLYReLtyds1A=", "owner": "numtide", "repo": "flake-utils", - "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "rev": "a68df93a37cd5137ac22ffeb2d8a03acf253cc24", "type": "github" }, "original": { "owner": "numtide", + "ref": "flatten-tree-system", "repo": "flake-utils", "type": "github" } @@ -51,11 +52,11 @@ }, "master": { "locked": { - "lastModified": 1607981906, - "narHash": "sha256-tFuNBkK0F5km1Lq5ulLgLVm3BvOvI7t4k4Y7xTIo3QE=", + "lastModified": 1610405177, + "narHash": "sha256-Y4GRoQpN5N2YM3qtbzrcJee/dBhJqPSSK+2290H4604=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dd95aa337e23a8a48fe82f0f7b1cced8bc03e379", + "rev": "f0a7fce6ee72e574c2406bf1cfd1741c8d2cd07e", "type": "github" }, "original": { diff --git a/hosts/nixSD.nix b/hosts/nixSD.nix index 83a01905e..706c7f509 100644 --- a/hosts/nixSD.nix +++ b/hosts/nixSD.nix @@ -1,11 +1,11 @@ -{ lib, pkgs, config, unstableModulesPath, ... }: +{ lib, pkgs, config, modulesPath, ... }: { imports = [ # passwd is nixos by default ../users/nixos # passwd is empty by default ../users/root - (unstableModulesPath + "/installer/cd-dvd/sd-image-aarch64.nix") + (modulesPath + "/installer/cd-dvd/sd-image-aarch64-new-kernel.nix") ]; hardware.enableRedistributableFirmware.enable = lib.mkDefault true; diff --git a/overlays/ubootRaspberryPi3_64bit.nix b/overlays/ubootRaspberryPi3_64bit.nix deleted file mode 100644 index c3ea03d79..000000000 --- a/overlays/ubootRaspberryPi3_64bit.nix +++ /dev/null @@ -1,3 +0,0 @@ -final: prev: { - ubootRaspberryPi3_64bit = prev.ubootRaspberryPi3_64bit.overrideAttrs (o: { patches = [ ../pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch ]; }); -} diff --git a/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch b/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch deleted file mode 100644 index ca82e8212..000000000 --- a/pkgs/misc/uboot/0001-configs-rpi-allow-for-bigger-kernels.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3c6b7c0922370e9d0c1705706e7c47dcd234e6c8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Milan=20P=C3=A4ssler?= -Date: Wed, 30 Dec 2020 11:49:16 +0100 -Subject: [PATCH] configs/rpi: allow for bigger kernels - ---- - include/configs/rpi.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include/configs/rpi.h b/include/configs/rpi.h -index 834f1cd2..b63ee96f 100644 ---- a/include/configs/rpi.h -+++ b/include/configs/rpi.h -@@ -163,10 +163,10 @@ - "fdt_high=" FDT_HIGH "\0" \ - "initrd_high=" INITRD_HIGH "\0" \ - "kernel_addr_r=0x00080000\0" \ -- "scriptaddr=0x02400000\0" \ -- "pxefile_addr_r=0x02500000\0" \ -- "fdt_addr_r=0x02600000\0" \ -- "ramdisk_addr_r=0x02700000\0" -+ "scriptaddr=0x02c00000\0" \ -+ "pxefile_addr_r=0x02d00000\0" \ -+ "fdt_addr_r=0x02e00000\0" \ -+ "ramdisk_addr_r=0x02f00000\0" - - #if CONFIG_IS_ENABLED(CMD_MMC) - #define BOOT_TARGET_MMC(func) \ --- -2.29.2 diff --git a/pkgs/override.nix b/pkgs/override.nix index 154d6a427..60c35c50d 100644 --- a/pkgs/override.nix +++ b/pkgs/override.nix @@ -13,4 +13,5 @@ with pkgs; nixpkgs-fmt manix qutebrowser + ubootRaspberryPi3_64bit ] From c5ecb4543ad37294f507f00cbdc453990d5f8171 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 11 Jan 2021 18:50:53 -0500 Subject: [PATCH 3/4] Fixup --- hosts/nixSD.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/nixSD.nix b/hosts/nixSD.nix index 706c7f509..d2da5e26f 100644 --- a/hosts/nixSD.nix +++ b/hosts/nixSD.nix @@ -8,7 +8,7 @@ (modulesPath + "/installer/cd-dvd/sd-image-aarch64-new-kernel.nix") ]; - hardware.enableRedistributableFirmware.enable = lib.mkDefault true; + hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.pulseaudio.enable = lib.mkDefault true; sound.enable = lib.mkDefault true; From 23c0756f7a616a929e1498d2087a42a3e8256013 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 11 Jan 2021 20:07:15 -0500 Subject: [PATCH 4/4] fixup --- shell.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 04efe0624..82d6efcaf 100644 --- a/shell.nix +++ b/shell.nix @@ -16,7 +16,7 @@ let flk = pkgs.writeShellScriptBin "flk" '' if [[ -z "$1" ]]; then - echo "Usage: $(basename "$0") [ iso | up | install {host} | {host} [switch|boot|test] ]" + echo "Usage: $(basename "$0") [ iso | sd | up | install {host} | {host} [switch|boot|test] ]" elif [[ "$1" == "up" ]]; then mkdir -p up hostname=$(hostname)