Skip to content
Clemens Tiedt edited this page Dec 5, 2024 · 60 revisions

Installation of QEMU

Ubuntu

apt install qemu qemu-system

Arch Linux

pacman -S qemu-full

Setting up a virtual machine

  • Create the virtual disk image

    qemu-img create -f qcow2 void.img 10G
  • Download the image from https://voidlinux.org/download/ (base live glibc)

  • Run the VM

    qemu-system-x86_64 -m 1024 -hda void.img -cdrom void-live-x86_64-20210930.iso -boot d
    • Depending on output, you might need to use a VNC viewer
    • Hint: when the display works without VNC, you can release the mouse grab with CtrlAltG
  • Default credentials are username: root, password: voidlinux

  • Run the Void Linux installer (on the default US keymap, the - is the key to the right of the 0)

    void-installer
  • Configuration

    • Keyboard: de-latin1
    • RootPassword: root
    • Partition (using cfdisk): dos (MBR), 7.5G primary Linux, 2.5G Free space
    • BootLoader: /dev/sda
    • Filesystems: 7.5G ext4, /
  • Install (ignore sed error)

  • Reboot

  • Pick "Boot first HD found by BIOS"

Booting without live ISO

  • You can shutdown using

    poweroff
  • Run the VM without the live ISO

    qemu-system-x86_64 -m 1024 -hda void.img

Installing necessary components

  • Update the system
    xbps-install -Su

Compiling the kernel

  • Install the necessary dependencies

    • Arch Linux

      pacman -S lld
    • Ubuntu

      apt install flex bison lld libssl-dev libelf-dev
      • Download clang

      • Extract & switch to archive

        tar -xf clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz && cd clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04
      • Copy files

        sudo cp -r bin/* /usr/bin/
        sudo cp -r include/* /usr/include/
        sudo cp -r share/* /usr/bin/share/
        sudo apt install libncurses5
  • Follow the quickstart

  • Configure the kernel

    make LLVM=1 menuconfig
    • / for search; type RUST and ensure "Depends on:" is met
  • Build the kernel

    make LLVM=1

Running the VM with the new kernel

qemu-system-x86_64\
    -m 1024\
    -hda void.img\
    -append "root=/dev/sda1"\
    -kernel ../Rust-for-Linux/arch/x86/boot/bzImage\
    -nic user,hostfwd=tcp::2222-:22

Installing and mounting bs2ramfs

  • Create mount point and mount
    mkdir /mnt/bs2
    mount -t bs2ramfs_name -o size=10m bs2ramfs /mnt/bs2