Booting Linux and userspace OK
This commit is contained in:
parent
c6a304ca7d
commit
9a475bc1e3
8
boot.sh
8
boot.sh
@ -67,7 +67,7 @@ exec qemu-system-riscv64 \
|
||||
-device loader,addr=0x84000000,file=$system/kernel \
|
||||
-kernel $system/kernel \
|
||||
-initrd $system/initrd \
|
||||
-append "$(cat $system/kernel-params) init=$system/init regInfo=/nix/store/x3zpwfbk2wkiisxhgi7zwsfwbdfxk0w1-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS"
|
||||
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS"
|
||||
$QEMU_OPTS \
|
||||
"$@"
|
||||
|
||||
@ -78,9 +78,9 @@ exec qemu-system-riscv64 \
|
||||
|
||||
|
||||
|
||||
-kernel ${NIXPKGS_QEMU_KERNEL_visionfive_nix:-/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel} \
|
||||
-initrd /nix/store/96058frp51dn0xxfci4kyvzz0rvd5ngy-initrd-linux-riscv64-unknown-linux-gnu-6.1.72/initrd \
|
||||
-append "$(cat /nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel-params) init=/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/init regInfo=/nix/store/bgqa92gznhcr9aryx6ac4ycx4s2385cr-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 console=tty0 $QEMU_KERNEL_PARAMS" \
|
||||
# -kernel ${NIXPKGS_QEMU_KERNEL_visionfive_nix:-/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel} \
|
||||
# -initrd /nix/store/96058frp51dn0xxfci4kyvzz0rvd5ngy-initrd-linux-riscv64-unknown-linux-gnu-6.1.72/initrd \
|
||||
# -append "$(cat /nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel-params) init=/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/init regInfo=/nix/store/bgqa92gznhcr9aryx6ac4ycx4s2385cr-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 console=tty0 $QEMU_KERNEL_PARAMS" \
|
||||
|
||||
|
||||
# -drive "file=$NIX_DISK_IMAGE,if=virtio,id=hd0" \
|
||||
|
@ -3,27 +3,16 @@
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/profiles/base.nix"
|
||||
#"${modulesPath}/virtualisation/qemu-vm.nix"
|
||||
];
|
||||
|
||||
networking.hostName = "visionfive-nix";
|
||||
|
||||
boot = {
|
||||
kernelParams = [ "boot.shell_on_fail" ];
|
||||
consoleLogLevel = lib.mkDefault 7;
|
||||
initrd.kernelModules = [
|
||||
"virtio_pci"
|
||||
"virtio_blk"
|
||||
"virtio_input"
|
||||
"9pnet"
|
||||
"9pnet_virtio"
|
||||
];
|
||||
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
# boot = {
|
||||
# loader = {
|
||||
# grub.enable = false;
|
||||
# generic-extlinux-compatible.enable = true;
|
||||
# };
|
||||
# };
|
||||
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
|
||||
@ -31,4 +20,6 @@
|
||||
services.openssh.enable = true;
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxPackagesCustom;
|
||||
}
|
||||
|
@ -13,8 +13,11 @@
|
||||
overlay = import ./overlay.nix;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules = [
|
||||
# For now we only define a config for VM, later we will want to split
|
||||
# this into different configs.
|
||||
./vm.nix
|
||||
|
||||
./configuration.nix
|
||||
#"${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
|
||||
];
|
||||
in {
|
||||
overlay = import ./overlay.nix;
|
||||
@ -47,8 +50,8 @@
|
||||
let
|
||||
nixosconf = self.nixosConfigurations.cross;
|
||||
syspkgs = nixosconf.pkgs;
|
||||
#toplevel = nixosconf.config.system.build.toplevel;
|
||||
toplevel = "${nixosconf.config.system.build.vm}/system";
|
||||
toplevel = nixosconf.config.system.build.toplevel;
|
||||
#toplevel = "${nixosconf.config.system.build.vm}/system";
|
||||
in
|
||||
pkgs.mkShell {
|
||||
pname = "qemu-shell";
|
||||
|
33
overlay.nix
33
overlay.nix
@ -35,4 +35,37 @@ final: prev:
|
||||
"FW_PAYLOAD_PATH=${final.uboot-custom}/u-boot.bin"
|
||||
];
|
||||
});
|
||||
|
||||
linuxPackagesCustom = prev.linuxPackagesFor (prev.linux.override {
|
||||
structuredExtraConfig = with prev.lib.kernel; {
|
||||
KEXEC = yes;
|
||||
SERIAL_8250_DW = yes;
|
||||
PINCTRL_STARFIVE = yes;
|
||||
|
||||
# Doesn't build as a module
|
||||
DW_AXI_DMAC_STARFIVE = yes;
|
||||
|
||||
# stmmac hangs when built as a module
|
||||
#PTP_1588_CLOCK = yes;
|
||||
#STMMAC_ETH = yes;
|
||||
#STMMAC_PCI = yes;
|
||||
|
||||
# For qemu
|
||||
BLOCK = yes;
|
||||
BLK_DEV = yes;
|
||||
DEVTMPFS = yes;
|
||||
VIRTIO_MENU = yes;
|
||||
VIRTIO_BLK = yes;
|
||||
|
||||
# For 9P: https://wiki.qemu.org/Documentation/9psetup
|
||||
NET_9P = yes;
|
||||
NET_9P_VIRTIO = yes;
|
||||
NET_9P_DEBUG = yes;
|
||||
"9P_FS" = yes;
|
||||
"9P_FS_POSIX_ACL" = yes;
|
||||
PCI = yes;
|
||||
VIRTIO_PCI = yes;
|
||||
PCI_HOST_GENERIC = yes;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
29
vm.nix
Normal file
29
vm.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
# Contains the configuration to make a VM bootable with qemu.
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/virtualisation/qemu-vm.nix"
|
||||
];
|
||||
|
||||
boot = {
|
||||
kernelParams = [ "boot.shell_on_fail" ];
|
||||
consoleLogLevel = lib.mkDefault 7;
|
||||
initrd.kernelModules = [
|
||||
"virtio_pci"
|
||||
"virtio_blk"
|
||||
"virtio_input"
|
||||
"9pnet"
|
||||
"9pnet_virtio"
|
||||
];
|
||||
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.diskImage = null;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user