Format the qcow2 image with ext4
The image needs to be available to the guest with a partition table and a partition with a label named "nixos" so the stage1 can mount it. By enabling the virtualisation.diskImage option we now have a persistent root filesystem, including /home.
This commit is contained in:
parent
6a8eadb037
commit
483ad2944b
6
boot.sh
6
boot.sh
@ -8,7 +8,11 @@ CDIR=$(readlink -f "$PWD")
|
|||||||
NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./nixos-riscv.qcow2}")
|
NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./nixos-riscv.qcow2}")
|
||||||
|
|
||||||
if ! test -e "$NIX_DISK_IMAGE"; then
|
if ! test -e "$NIX_DISK_IMAGE"; then
|
||||||
qemu-img create -f qcow2 "$NIX_DISK_IMAGE" 1024M
|
size=1024M
|
||||||
|
qemu-img create -f raw "$NIX_DISK_IMAGE.raw" "$size"
|
||||||
|
mkfs.ext4 -L nixos "$NIX_DISK_IMAGE.raw"
|
||||||
|
qemu-img convert -f raw -O qcow2 "$NIX_DISK_IMAGE.raw" "$NIX_DISK_IMAGE"
|
||||||
|
rm "$NIX_DISK_IMAGE.raw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "NIX_DISK_IMAGE = $NIX_DISK_IMAGE"
|
echo "NIX_DISK_IMAGE = $NIX_DISK_IMAGE"
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
toplevel = nixosconf.config.system.build.toplevel;
|
toplevel = nixosconf.config.system.build.toplevel;
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
pname = "qemu-shell";
|
pname = "qemu-shell";
|
||||||
buildInputs = with pkgs; [ qemu ];
|
buildInputs = with pkgs; [ qemu e2fsprogs ];
|
||||||
# Here we tell the run script where to find the system
|
# Here we tell the run script where to find the system
|
||||||
NIXOS_SYSTEM_TOPLEVEL = toplevel;
|
NIXOS_SYSTEM_TOPLEVEL = toplevel;
|
||||||
OPENSBI = syspkgs.opensbi-uboot;
|
OPENSBI = syspkgs.opensbi-uboot;
|
||||||
|
Loading…
Reference in New Issue
Block a user