diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 82 |
1 files changed, 82 insertions, 0 deletions
@@ -21,3 +21,85 @@ submodules to that location, execute the `build` function from the `craft.sh` file inside the root of the repo and remove the temporary directory. Log output is redirected to the calling terminal. + +## Build Arch Linux guest virtual machine for builds + +Craft will use a QEMU virtual machine to execute build processes. The following +commands can be used to create an Arch Linux based virtual machine suitable for +this purpose. + +It is expected that the Arch Linux installation image file +(`archlinux-2024.02.01-x86_64.iso`) or a symbolic link to it is present in the +root of the craft repository. + +``` +# create virtual machine disk file and boot with installation media +qemu-img create -f qcow2 vms/archlinux.qcow2 30G +qemu-system-x86_64 \ + -enable-kvm \ + -m 4G \ + -nic user,model=virtio \ + -drive file=vms/archlinux.qcow2,media=disk,if=virtio \ + -smp cpus=4 \ + -nographic \ + -cdrom archlinux-2024.02.01-x86_64.iso + +# press TAB in bootloader menu and append ` console=ttyS0` to kernel args + +# check if time is synchronized +timedatectl + +# create partitions and file systems +parted /dev/vda --script mklabel msdos +parted /dev/vda --script mkpart primary 1MiB 2GiB +parted /dev/vda --script set 1 boot on +parted /dev/vda --script mkpart primary 2GiB 100% +mkfs.vfat -n BOOT /dev/vda1 +mkfs.btrfs -L ROOT /dev/vda2 + +# mount root and boot partition +mount /dev/vda2 /mnt +mount --mkdir /dev/vda1 /mnt/boot + +# install Arch Linux packages +pacstrap -K /mnt \ + base \ + linux \ + linux-firmware \ + syslinux \ + btrfs-progs \ + networkmanager \ + chrony \ + nano \ + neovim \ + htop \ + which \ + openssh \ + rsync \ + base-devel \ + go + +# system configuration +genfstab -L /mnt >> /mnt/etc/fstab +arch-chroot /mnt +ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime +hwclock --systohc +sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen +locale-gen +echo 'LANG=en_US.UTF-8' > /etc/locale.conf +echo 'craft-archlinux' > /etc/hostname +mkinitcpio -P +echo 'root' | passwd -s +systemctl enable NetworkManager +systemctl enable chronyd + +# bootloader installation +mkdir -p /boot/syslinux +cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/ +extlinux --install /boot/syslinux +dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of=/dev/vda +sed -i 's|root=/dev/sda3 rw|root=/dev/vda2 rw console=ttyS0|g' /boot/syslinux/syslinux.cfg + +exit +poweroff +``` |