Split kernel configuration in files

This commit is contained in:
Rodrigo Arias 2024-03-04 14:44:49 +01:00
parent 0003f07ed4
commit 023ad3de22
5 changed files with 70 additions and 3 deletions

View File

@ -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";

View File

@ -35,6 +35,7 @@
modules = [
./configuration.nix
./lagarto-hun.nix
./no-compressed.nix
];
};
};

View File

@ -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
'';
}
];
}

View File

@ -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
'';
} ];
}

31
vm.nix
View File

@ -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;