From 03d9b3e5bfb1ad4766e71c1c9040c39fd8f2c1b5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 15 Jan 2024 20:49:51 +0100 Subject: [PATCH] platforms: Add more QEMU-based environment descriptions. --- platforms/environments/qemu/arm64-netbsd.txt | 171 +++++++++++++++ platforms/environments/qemu/arm64-openbsd.txt | 189 +++++++++++++++++ .../environments/qemu/sparc64-openbsd.txt | 197 ++++++++++++++++++ 3 files changed, 557 insertions(+) create mode 100644 platforms/environments/qemu/arm64-netbsd.txt create mode 100644 platforms/environments/qemu/arm64-openbsd.txt create mode 100644 platforms/environments/qemu/sparc64-openbsd.txt diff --git a/platforms/environments/qemu/arm64-netbsd.txt b/platforms/environments/qemu/arm64-netbsd.txt new file mode 100644 index 00000000..c84b8c8e --- /dev/null +++ b/platforms/environments/qemu/arm64-netbsd.txt @@ -0,0 +1,171 @@ +(DR) Collect pointers to documentation and references +----------------------------------------------------- + +https://www.qemu.org/docs/master/system/target-arm.html +https://wiki.qemu.org/Documentation/Platforms/ARM +https://wiki.netbsd.org/ports/evbarm/qemu_arm/ +https://chrispinnock.com/stuff/emulation/ + +(QV) Choose a QEMU version +-------------------------- + +Use qemu-8.2.0 +% PATH=$HOME/inst-qemu/8.2.0/bin:$PATH + +(DL) Download an installation CD-ROM or DVD image +------------------------------------------------- + +Download: https://cdn.netbsd.org/pub/NetBSD/iso/9.3/NetBSD-9.3-evbarm-aarch64.iso + +(XI) Extract a disk image from the CD-ROM or DVD image +------------------------------------------------------ + +We cannot use the CD for installing into an empty disk image, because the CD +- unlike the FreeBSD one - does not have the El Torito extensions that mark +it as "bootable", and the two first UEFI firmwares only boot from CDs with +these extensions. But fortunately, the CD contains a bootable disk image. + +Extract arm64.img: +% sudo mount -r -t iso9660 NetBSD-9.3-evbarm-aarch64.iso /mnt +% cp -p /mnt/evbarm/binary/gzimg/arm64.img.gz arm64.img.gz +% sudo umount /mnt +% gunzip arm64.img + +This is a disk image with two partitions: +% fdisk arm64.img +Device Boot Start End Sectors Size Id Type +arm64.img1 * 32768 196607 163840 80M c W95 FAT32 (LBA) +arm64.img2 196608 2355071 2158464 1G a9 NetBSD +The first partition is for booting. +The second partition contains a preinstalled NetBSD. + +Resize the image to the desired size. On first boot, NetBSD will grow the +root file-system to match the size of the disk. +% qemu-img resize -f raw arm64.img 10G + +Convert it to qcow2: +% qemu-img convert -f raw -O qcow2 arm64.img netbsd93.qcow2 +% rm -f arm64.img + +(CD) Create an empty disk image to be used by the virtual machine +----------------------------------------------------------------- + +This is not needed in this case; we have a disk image already. + +(MA) Choose the machine arguments +--------------------------------- + +% machine_args="-M virt -cpu cortex-a53 -m 512" + +Since QEMU cannot directly boot a NetBSD kernel, we'll need some +boot firmware: + + - Either the UEFI firmware that comes bundled with QEMU: + % machine_args="$machine_args -bios edk2-aarch64-code.fd" + + - Or some UEFI firmware named 'QEMU_EFI.fd' that is part of some Linux + distros, such as in the Ubuntu package 'qemu-efi'. + % machine_args="$machine_args -bios QEMU_EFI.fd" + + - Or U-Boot. + +(DI) Choose the disk arguments +------------------------------ + +% disk_args="-drive file=netbsd93.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0" + +(NW) Choose the network arguments +--------------------------------- + +There are several possibilities. + +% net_args="" + +This provides an ethernet interface by default: +(qemu) info network +hub 0 + \ hub0port1: #net176: index=0,type=user,net=10.0.2.0,restrict=off + \ hub0port0: virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 +NetBSD will recognize it as 'vioif0'. + +% net_args="-netdev type=user,id=net0 -device virtio-net-device,netdev=net0,mac=52:54:00:12:34:56" + +This provides an ethernet interface too: +(qemu) info network +virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56 + \ net0: index=0,type=user,net=10.0.2.0,restrict=off +NetBSD will recognize it as 'vioif0'. + +% net_args="-netdev type=user,id=net0 -device e1000,netdev=net0,mac=52:54:00:12:34:56" + +This provides an ethernet interface too: +(qemu) info network +e1000.0: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:56 + \ net0: index=0,type=user,net=10.0.2.0,restrict=off +NetBSD will recognize it as 'wm0'. + +(DV) Choose the display/video arguments +--------------------------------------- + +% display_args="-nographic" + +(B1) Boot from the disk +----------------------- + +% common_args="$machine_args $disk_args $net_args $display_args" + +Resize the terminal to 80x24. + +% qemu-system-aarch64 $common_args + +This boots fine. Now is the time to switch to a graphic display, if desired: + +% display_args="-display gtk -monitor stdio" +% common_args="$machine_args $disk_args $net_args $display_args" +% qemu-system-aarch64 $common_args + +Login as root. + +Set root password: +# passwd +New Password: ******** + +Edit /etc/rc.conf, changing the value of hostname: +hostname=arm64-netbsd9.MYDOMAINNAME + +Edit /etc/hosts, adding a line: +10.0.2.15 arm64-netbsd9 + +Define the time zone: +# ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime + +Add account: +# useradd -d /home/MY_USER_NAME -m -u 1000 -G wheel MY_USER_NAME +# passwd MY_USER_NAME +New Password: ******** + +Edit /etc/profile to set TERM=vt220: +# env TERM=vt220 vi /etc/profile .cshrc +In /etc/profile, add + TERM=vt220 + export TERM +In .cshrc, add + setenv TERM vt220 + +# halt + +(PK) Install packages +--------------------- + +The list of packages is at http://www.pkgsrc.se/ +and http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/aarch64/9.3/All/. +See https://www.netbsd.org/docs/guide/en/netbsd.html#chap-boot-pkgsrc +# chmod 644 .cshrc .profile +Edit ~/.profile to define PKG_PATH: + export PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/aarch64/9.3/All +Logout. + +# pkg_add bash +# pkg_add gmake +# pkg_add vim +# pkg_add emacs-nox11 diff --git a/platforms/environments/qemu/arm64-openbsd.txt b/platforms/environments/qemu/arm64-openbsd.txt new file mode 100644 index 00000000..5cd8baa1 --- /dev/null +++ b/platforms/environments/qemu/arm64-openbsd.txt @@ -0,0 +1,189 @@ +(DR) Collect pointers to documentation and references +----------------------------------------------------- + +https://www.qemu.org/docs/master/system/target-arm.html +https://wiki.qemu.org/Documentation/Platforms/ARM +https://www.openbsd.org/arm64.html +https://ftp.openbsd.org/pub/OpenBSD/7.4/arm64/INSTALL.arm64 + +(QV) Choose a QEMU version +-------------------------- + +Use qemu-8.2.0 +% PATH=$HOME/inst-qemu/8.2.0/bin:$PATH + +(DL) Download an installation CD-ROM or DVD image +------------------------------------------------- + +Download: https://cdn.openbsd.org/pub/OpenBSD/7.4/arm64/install74.img +-> OpenBSD-7.4-arm64-install.img + +(XK) Extract the kernel from the CD-ROM or DVD image +---------------------------------------------------- + +This is not needed in this case. + +(CD) Create an empty disk image to be used by the virtual machine +----------------------------------------------------------------- + +% qemu-img create -f qcow2 openbsd74.qcow2 8G + +This is not needed in this case; we have a disk image already. + +(MA) Choose the machine arguments +--------------------------------- + +% machine_args="-M virt -cpu cortex-a53 -m 1024" + +Since QEMU cannot directly boot an OpenBSD kernel, we'll need some +boot firmware: + + - Either the UEFI firmware that comes bundled with QEMU: + % machine_args="$machine_args -bios edk2-aarch64-code.fd" + + - Or some UEFI firmware named 'QEMU_EFI.fd' that is part of some Linux + distros, such as in the Ubuntu package 'qemu-efi'. + % machine_args="$machine_args -bios QEMU_EFI.fd" + + - Or U-Boot. + +(DI) Choose the disk arguments +------------------------------ + +We cannot use the "virtual" disk driver here: +% disk_args="-drive file=openbsd74.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0" +because the OpenBSD installer would not recognize the disk at the +"Available disks" step. + +Therefore: +% disk_args="-drive file=openbsd74.qcow2,format=qcow2,index=0" + +(NW) Choose the network arguments +--------------------------------- + +There are several possibilities. + +% net_args="" + +This provides an ethernet interface by default: +(qemu) info network +hub 0 + \ hub0port1: #net176: index=0,type=user,net=10.0.2.0,restrict=off + \ hub0port0: virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 +OpenBSD will recognize it as 'vio0'. + +% net_args="-netdev type=user,id=net0 -device e1000,netdev=net0,mac=52:54:00:12:34:56" + +This provides an ethernet interface too: +(qemu) info network +e1000.0: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:56 + \ net0: index=0,type=user,net=10.0.2.0,restrict=off +OpenBSD will recognize it as 'em0'. + +(DV) Choose the display/video arguments +--------------------------------------- + +% display_args="-nographic" + +(B1) Boot from the disk +----------------------- + +% common_args="$machine_args $disk_args $net_args $display_args" + +Resize the terminal to 80x24. + +% fdisk OpenBSD-7.4-arm64-install.img +Device Boot Start End Sectors Size Id Type +OpenBSD-7.4-arm64-install.img1 * 32768 49151 16384 8M c W95 FAT32 (LB +OpenBSD-7.4-arm64-install.img4 49152 1032191 983040 480M a6 OpenBSD + +Either of these commands works: + +% qemu-system-aarch64 $common_args -cdrom OpenBSD-7.4-arm64-install.img + +% qemu-system-aarch64 $common_args -drive file=OpenBSD-7.4-arm64-install.img,format=raw,if=none,id=hd1 -device virtio-blk-device,drive=hd1 + +% qemu-system-aarch64 $common_args -drive file=OpenBSD-7.4-arm64-install.img,format=raw,index=1 + +Let's use the first one. + +(IN) Perform the steps of the installer +--------------------------------------- + +(I)nstall. +Terminal type: vt220 +Host name: arm64-openbsd74 +Root password: ******** +Setup a user? + login: MY_USER_NAME + full name: MY_FULL_NAME + password: ******** +Allow root ssh login: yes +Which disk is the root disk? sd0 +Partitioning: (E)dit auto layout + d e + d d + d b + c a + 14680064 [= 7 GB] + a b + enter enter swap + p + q +Location of sets? disk +Already mounted? no +Disk with install media? sd1 +Partition with the install sets? a +Pathname to the sets? 7.4/arm64 +Sets: + -game74.tgz + -x* +Continue without verification: yes + +Halt. + +(B2) Boot from the installed disk +--------------------------------- + +This does not need a -kernel option, since an OpenBSD/arm64 BOOTAA64 +bootloader is installed. + +% qemu-system-aarch64 $common_args + +This boots fine. Now is the time to switch to a graphic display, if desired: + +% display_args="-display gtk -monitor stdio" +% common_args="$machine_args $disk_args $net_args $display_args" +% qemu-system-aarch64 $common_args + +# mail +# syspatch + +If you are not using the graphic display, edit ~/.profile to set TERM=vt220: +# env TERM=vt220 vi .profile .cshrc +In .profile, add + TERM=vt220 + export TERM +In .cshrc, add + setenv TERM vt220 + +Edit /etc/myname, to change the domain to MYDOMAINNAME. + +# halt + +(PK) Install packages +--------------------- + +The list of packages is at https://ftp.hostserver.de/pub/OpenBSD/7.4/packages/aarch64/ +See https://www.openbsd.org/faq/faq15.html#PkgMgmt +Edit ~/.profile to define PKG_PATH: + PKG_PATH=https://ftp.hostserver.de/pub/OpenBSD/7.4/packages/aarch64/ + export PKG_PATH +Logout. + +# pkg_add bzip2 +# pkg_add gtar +# pkg_add bash +# pkg_add gmake +# pkg_add vim, pick no_x11 variant +# pkg_add emacs, pick no_x11 variant diff --git a/platforms/environments/qemu/sparc64-openbsd.txt b/platforms/environments/qemu/sparc64-openbsd.txt new file mode 100644 index 00000000..9585bfb8 --- /dev/null +++ b/platforms/environments/qemu/sparc64-openbsd.txt @@ -0,0 +1,197 @@ +(DR) Collect pointers to documentation and references +----------------------------------------------------- + +https://www.qemu.org/docs/master/system/target-sparc64.html +https://wiki.qemu.org/Documentation/Platforms/SPARC +https://www.openbsd.org/sparc64.html +https://ftp.openbsd.org/pub/OpenBSD/7.4/sparc64/INSTALL.sparc64 +https://chrispinnock.com/stuff/emulation/ + +(QV) Choose a QEMU version +-------------------------- + +Use qemu-8.2.0 +% PATH=$HOME/inst-qemu/8.2.0/bin:$PATH + +(DL) Download an installation CD-ROM or DVD image +------------------------------------------------- + +Choose OpenBSD 7.2, because with OpenBSD 7.3 and 7.4 booting +from the installed disk does not work: it would produce this output: +-------------------------------------------------------------------------------- +OpenBIOS for Sparc64 +Configuration device id QEMU version 1 machine id 0 +kernel cmdline +CPUs: 1 x SUNW,UltraSPARC-IIi +UUID: 00000000-0000-0000-0000-000000000000 +Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:22 + Type 'help' for detailed information +Trying disk:a... +Not a bootable ELF image +Not a bootable a.out image + +Loading FCode image... +Loaded 6888 bytes +entry point is 0x4000 +Evaluating FCode... +OpenBSD IEEE 1275 Bootblock 2.1 +..>> OpenBSD BOOT 1.25 +Trying bsd... +Booting /pci@1fe,0/pci@1,1/ide@3/ide@0/disk@0:a/bsd +10068240@0x1000000+7920@0x199a110+150292@0x1c00000+4044012@0x1c24b14 +symbols @ 0xfedca400 488378+165+666912+462908 start=0x1000000 +[ using 1619400 bytes of bsd ELF symbol table ] +Unimplemented service set-symbol-lookup ([2] -- [0]) +Unhandled Exception 0x0000000000000030 +PC = 0x0000000001139d7c NPC = 0x0000000001139d80 +Stopping execution +-------------------------------------------------------------------------------- +Reported at . + +Download: https://cdn.openbsd.org/pub/OpenBSD/7.2/sparc64/install72.iso +-> OpenBSD-7.2-sparc64-install.iso + +(XK) Extract the kernel from the CD-ROM or DVD image +---------------------------------------------------- + +This is not needed in this case. + +(CD) Create an empty disk image to be used by the virtual machine +----------------------------------------------------------------- + +% qemu-img create -f qcow2 openbsd72.qcow2 8G + +(MA) Choose the machine arguments +--------------------------------- + +% machine_args="-m 512" + +(DI) Choose the disk arguments +------------------------------ + +% disk_args="-drive file=openbsd72.qcow2,format=qcow2,index=0" + +(NW) Choose the network arguments +--------------------------------- + +% net_args="" +This provides an ethernet interface by default: +(qemu) info network +hub 0 + \ hub0port1: user.0: index=0,type=user,net=10.0.2.0,restrict=off + \ hub0port0: sunhme.0: index=0,type=nic,model=sunhme,macaddr=52:54:00:12:34:56 +But it leads to "data_access_error: no fault" errors later. + +If we were to use a network device on the ISA bus: +% net_args="-netdev type=user,id=net0 -device ne2k_isa,netdev=net0,mac=52:54:00:12:34:56" +OpenBSD would not recognize it. + +So, we need a network device on the PCI bus. In order to avoid an error +"PCI: no slot/function available for ne2k_pci, all in use or reserved" +from QEMU, we need to specify that it sits on the second PCI bus. Cf. + + +List of available network devices: +% qemu-system-sparc64 -device '?' # OpenBSD will recognize it as +e1000 em0 +i82550 fxp0 +ne2k_pci ne0 +pcnet pcn0 +rtl8139 re0 +sunhme hme0 +tulip dc0, does not autoconfigure +virtio-net-device -- +virtio-net-pci -- +... + +So, choose one of these, for example: +% net_args="-netdev type=user,id=net0 -device e1000,bus=pciB,netdev=net0,mac=52:54:00:12:34:56" + +(DV) Choose the display/video arguments +--------------------------------------- + +% display_args="-nographic" + +(B1) Boot from the CD/DVD +------------------------- + +% common_args="$machine_args $disk_args $net_args $display_args" + +Resize the terminal to 80x24. + +% qemu-system-sparc64 $common_args -cdrom OpenBSD-7.2-sparc64-install.iso -boot d + +(IN) Perform the steps of the installer +--------------------------------------- + +(I)nstall. +Terminal type: xterm +Host name: sparc64-openbsd72 +Root password: ******** +Setup a user? + login: MY_USER_NAME + full name: MY_FULL_NAME + password: ******** +Allow root ssh login: yes +Partitioning: (E)dit auto layout + d e + d d + d b + c a + 14680064 [= 7 GB] + a b + enter enter swap + p + q +Sets: + -game72.tgz + -x* +Continue without verification: yes + +Halt. + +(B2) Boot from the installed disk +--------------------------------- + +This does not need a -kernel option, since an OpenBIOS bootloader is installed. + +% qemu-system-sparc64 $common_args +root device: wd0a +swap device:enter + +This boots fine. Now is the time to switch to a graphic display, if desired: + +% display_args="-display gtk -monitor stdio" +% common_args="$machine_args $disk_args $net_args $display_args" +% qemu-system-sparc64 $common_args +root device: wd0a +swap device:enter + +# mail + +If you are not using the graphic display, edit ~/.profile to set TERM=vt220: +# env TERM=vt220 vi .profile .cshrc +In .profile, add + TERM=vt220 + export TERM +In .cshrc, add + setenv TERM vt220 + +Edit /etc/myname, to change the domain to MYDOMAINNAME. + +(PK) Install packages +--------------------- + +The list of packages is at https://ftp.hostserver.de/pub/OpenBSD/7.2/packages/sparc64/ +See https://www.openbsd.org/faq/faq15.html#PkgMgmt +Edit ~/.profile to define PKG_PATH: + PKG_PATH=https://ftp.hostserver.de/pub/OpenBSD/7.2/packages/`uname -m`/ + export PKG_PATH +Logout. + +# pkg_add bzip2 +# pkg_add gtar +# pkg_add bash +# pkg_add gmake +# pkg_add vim, pick no_x11 variant +# pkg_add emacs, pick no_x11 variant -- 2.39.5