diff --git a/configuration.nix b/configuration.nix index 36d9c23..52b277b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -18,11 +18,19 @@ system.stateVersion = "24.05"; - boot.kernelPackages = lib.mkForce pkgs.linuxPackagesCustom; + #boot.kernelPackages = lib.mkForce pkgs.linuxPackagesCustom; + + boot.kernelPatches = [ { + name = "riscv-common"; + patch = null; + extraConfig = '' + KEXEC y + ''; + } ]; boot.kernelParams = [ - "console=ttyS0,115200" "console=tty1" + "console=ttyS0,115200" ]; services.getty.autologinUser = "test"; diff --git a/flake.nix b/flake.nix index 16fcd9e..9989226 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,7 @@ modules = [ ./configuration.nix ./lagarto-hun.nix + ./no-compressed.nix ]; }; }; diff --git a/lagarto-hun.nix b/lagarto-hun.nix index 3259beb..3a1679e 100644 --- a/lagarto-hun.nix +++ b/lagarto-hun.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, modulesPath, ... }: let - overlay = prev: final: { + overlay = final: prev: { uboot = prev.ubootQemuRiscv64Smode.override { filesToInstall = [ "u-boot.bin" "u-boot-nodtb.bin" ]; extraConfig = '' @@ -60,4 +60,21 @@ let }; in { nixpkgs.overlays = [ overlay ]; + + #boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPatches = [ + { + name = assert false; "sbi-early-console"; + patch = null; + extraConfig = '' + # Early console via SBI + RISCV_SBI y + RISCV_SBI_V01 y + SERIAL_EARLYCON y + SERIAL_EARLYCON_RISCV_SBI y + HVC_DRIVER y + HVC_RISCV_SBI y + ''; + } + ]; } diff --git a/no-compressed.nix b/no-compressed.nix index 5ae1968..f365e95 100644 --- a/no-compressed.nix +++ b/no-compressed.nix @@ -10,4 +10,14 @@ # FIXME: Broken as rustc injects compressed instructions. # For now we disable it. services.nscd.enableNsncd = false; + + boot.kernelPatches = [ { + name = "disable-compressed"; + patch = null; + extraConfig = '' + RISCV_ISA_C n + NONPORTABLE y + EFI n + ''; + } ]; } diff --git a/vm.nix b/vm.nix index 4e2a99f..31fefff 100644 --- a/vm.nix +++ b/vm.nix @@ -9,6 +9,7 @@ boot = { kernelParams = [ "boot.shell_on_fail" ]; + #kernelPackages = lib.mkForce pkgs.linuxPackagesCustom; consoleLogLevel = lib.mkDefault 7; initrd.kernelModules = [ "virtio_pci" @@ -18,6 +19,36 @@ "9pnet_virtio" ]; + kernelPatches = [ { + name = "qemu"; + patch = null; + extraConfig = '' + # For qemu + BLOCK y + BLK_DEV y + DEVTMPFS y + VIRTIO_MENU y + VIRTIO_BLK y + VIRTIO_NET y + EXT4_FS y + + # For 9P: https://wiki.qemu.org/Documentation/9psetup + NET_9P y + NET_9P_VIRTIO y + NET_9P_DEBUG y + NET_DEVICES y + NET_CORE y + INET y + NETWORK_FILESYSTEMS y + OVERLAY_FS y + "9P_FS" y + "9P_FS_POSIX_ACL" y + PCI y + VIRTIO_PCI y + PCI_HOST_GENERIC y + ''; + } ]; + loader = { grub.enable = false; generic-extlinux-compatible.enable = true;