NixOS on ARM/QEMU: Difference between revisions

imported>Flokli
add NixOS on ARM/QEMU
 
imported>Samueldr
m Add outdated notice
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
{{ARM/breadcrumb}}
{{outdated|Information on this page needs to be updated. Support for OVMF, kvm and other use cases needs to be checked. Additionally, U-Boot support may have improved.}}
== Status ==
== Status ==


NixOS on ARM through QEMU is possible, by using qemu-system-arm on QEMU's 'virt' machine, and the u-boot image for qemu.
NixOS on ARM through QEMU is possible, by using qemu-system-arm on QEMU's 'virt' machine, and the u-boot image for qemu.


{{note| [[https://lists.denx.de/pipermail/u-boot/2017-October/308693.html u-boot currently requires highmem=off for PCI to work]], so you won't be able to use more than 2GB of RAM .}}
{{note| [[https://lists.denx.de/pipermail/u-boot/2017-October/308693.html u-boot currently requires highmem=off for PCI to work]], so you won't be able to use more than 2GB of RAM.}}


== Board-specific installation notes ==
== Board-specific installation notes ==


=== Required images ===
=== Required images ===
First get some recent sd-image-armv7l-linux.img and uboot-qemu_arm_defconfig-*_u-boot.bin as described [[NixOS_on_ARM|here]].
First get some recent <tt>sd-image-armv7l-linux.img</tt> and <tt>uboot-qemu_arm_defconfig-*_u-boot.bin</tt> as described [[NixOS_on_ARM|the main NixOS on ARM page]].


=== Creating qcow image ===
=== Creating qcow image ===
Line 20: Line 23:


== Booting using qemu ==
== Booting using qemu ==
The following command will boot QEMU's 'virt' machine with u-boot and the converted sdcard image, exposing four cpu cores a:
The following command will boot QEMU's 'virt' machine with u-boot and the converted sdcard image, exposing four cpu cores and 2GB of RAM:


<syntaxhighlight>
<syntaxhighlight>
qemu-system-arm -machine virt,highmem=off -bios uboot-qemu_arm_defconfig-2018.03_u-boot.bin -drive if=none,file=sd-image-armv7l-linux.qcow2,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0 -netdev user,id=net0 -device virtio-net-pci,netdev=net0 -nographic -smp 2 -m 10G
qemu-system-arm -machine virt,highmem=off -bios uboot-qemu_arm_defconfig-2018.03_u-boot.bin -drive if=none,file=sd-image-armv7l-linux.qcow2,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0 -netdev user,id=net0 -device virtio-net-pci,netdev=net0 -nographic -smp 4 -m 2G


U-Boot 2018.03 (Mar 13 2018 - 12:02:19 +0000)
U-Boot 2018.03 (Mar 13 2018 - 12:02:19 +0000)
Line 89: Line 92:


{{note| first boot might take a bit longer, due to the root file system being resized to the disk size.}}
{{note| first boot might take a bit longer, due to the root file system being resized to the disk size.}}
== QEMU AArch64 ==
{{expansion}}
<syntaxhighlight>
$ nix-build -A pkgsCross.aarch64-multiplatform.ubootQemuAarch64
$ qemu-system-aarch64 -nographic \
    -machine virt -cpu cortex-a57 \
    -bios result/u-boot.bin \
    ./nixos-sd-image-21.03pre262561.581232454fd-aarch64-linux.img \
    -m 4G
</syntaxhighlight>
[[Category:Virtualization]]