--- /dev/null
+Installation media for emulated virtual machines
+================================================
+
+With Glibc (or uClibc)
+======================
+
+alpha
+-----
+
+* Debian
+ https://cdimage.debian.org/cdimage/ports/12.0/alpha/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/alpha/debian-12.0.0-alpha-NETINST-1.iso
+* T2 SDE
+ http://dl.t2sde.org/binary/2023/t2-23.6-alpha-minimal-desktop-gcc-glibc.iso
+
+arm v5 (soft-float)
+------
+
+* Debian
+ https://cdimage.debian.org/debian-cd/12.2.0/armel/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/armel/iso-dvd/debian-12.2.0-armel-DVD-1.iso
+
+arm v7 (hard-float)
+------
+
+* Debian
+ https://cdimage.debian.org/debian-cd/12.2.0/armhf/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/armhf/iso-dvd/debian-12.2.0-armhf-DVD-1.iso
+* Raspbian
+ https://www.raspberrypi.com/software/operating-systems/
+
+arm64
+-----
+
+* Debian
+ https://cdimage.debian.org/debian-cd/12.2.0/arm64/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/arm64/iso-dvd/debian-12.2.0-arm64-DVD-1.iso
+* Raspbian
+ https://www.raspberrypi.com/software/operating-systems/
+* openSUSE
+ https://get.opensuse.org/leap/15.5/#download
+ -> https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-aarch64-Media.iso
+* Fedora
+ https://fedoraproject.org/server/download
+ -> https://download.fedoraproject.org/pub/fedora/linux/releases/39/Server/aarch64/iso/Fedora-Server-dvd-aarch64-39-1.5.iso
+* Gentoo
+ https://www.gentoo.org/downloads/#arm64-advanced
+
+hppa
+----
+
+* Debian
+ https://cdimage.debian.org/cdimage/ports/12.0/hppa/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/hppa/debian-12.0.0-hppa-NETINST-1.iso
+* T2 SDE
+ http://dl.t2sde.org/binary/2023/t2-23.6-hppa-minimal-desktop-gcc-glibc.iso
+* Gentoo
+ https://www.gentoo.org/downloads/#hppa
+
+loongarch64
+-----------
+
+?
+
+m68k
+----
+
+* Debian
+ https://cdimage.debian.org/cdimage/ports/12.0/m68k/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/m68k/debian-12.0.0-m68k-NETINST-1.iso
+* T2 SDE
+ http://dl.t2sde.org/binary/2023/t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso
+
+mips, mips64
+------------
+
+* Debian
+ https://cdimage.debian.org/debian-cd/12.2.0/mipsel/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/mipsel/iso-dvd/debian-12.2.0-mipsel-DVD-1.iso
+ https://cdimage.debian.org/debian-cd/12.2.0/mips64el/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/mips64el/iso-dvd/debian-12.2.0-mips64el-DVD-1.iso
+
+powerpc, powerpc64, powerpc64le
+-------------------------------
+
+* Debian
+ https://cdimage.debian.org/cdimage/ports/12.0/powerpc/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/powerpc/debian-12.0.0-powerpc-NETINST-1.iso
+ https://cdimage.debian.org/cdimage/ports/12.0/ppc64/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/ppc64/debian-12.0.0-ppc64-NETINST-1.iso
+ https://cdimage.debian.org/debian-cd/12.2.0/ppc64el/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/ppc64el/iso-dvd/debian-12.2.0-ppc64el-DVD-1.iso
+* openSUSE
+ https://get.opensuse.org/leap/15.5/#download
+ -> https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-ppc64le-Media.iso
+* Fedora
+ https://fedoraproject.org/server/download
+ -> https://download.fedoraproject.org/pub/fedora-secondary/releases/39/Server/ppc64le/iso/Fedora-Server-dvd-ppc64le-39-1.5.iso
+* Gentoo
+ https://www.gentoo.org/downloads/#ppc
+* T2 SDE
+ http://dl.t2sde.org/binary/2023/t2-23.6-ppc-minimal-firefox-gcc-glibc-603.iso
+
+riscv64
+-------
+
+* openSUSE
+ https://download.opensuse.org/ports/riscv/tumbleweed/images/
+* Fedora
+ http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id
+ -> http://fedora.riscv.rocks/kojifiles/work/tasks/6900/1466900/Fedora-Developer-39-20230927.n.0-sda.raw.xz
+
+s390x
+-----
+
+* Debian
+ https://cdimage.debian.org/debian-cd/12.2.0/s390x/iso-dvd/
+ -> https://cdimage.debian.org/debian-cd/12.2.0/s390x/iso-dvd/debian-12.2.0-s390x-DVD-1.iso
+* openSUSE
+ https://get.opensuse.org/leap/15.5/#download
+ -> https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-s390x-Media.iso
+* Fedora
+ https://fedoraproject.org/server/download
+ -> https://download.fedoraproject.org/pub/fedora-secondary/releases/39/Server/s390x/iso/Fedora-Server-dvd-s390x-39-1.5.iso
+* Gentoo
+ https://www.gentoo.org/downloads/#s390
+
+sh4
+---
+
+?
+
+sparc, sparc64
+--------------
+
+* Debian
+ https://cdimage.debian.org/cdimage/ports/12.0/sparc64/
+ -> https://cdimage.debian.org/cdimage/ports/12.0/sparc64/debian-12.0.0-sparc64-NETINST-1.iso
+* Gentoo
+ https://www.gentoo.org/downloads/#sparc
+* T2 SDE
+ http://dl.t2sde.org/binary/2023/t2-23.10-sparc6432-minimal-desktop-gcc-glibc.iso
+
+With musl libc
+==============
+
+arm v7
+------
+
+* Alpine
+ https://alpinelinux.org/downloads/
+ -> http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/armv7/
+ http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/armhf/
+
+arm64
+-----
+
+* Alpine
+ https://alpinelinux.org/downloads/
+ -> http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/aarch64/
+
+m68k
+----
+
+?
+
+mips, mips64
+------------
+
+?
+
+powerpc, powerpc64, powerpc64le
+-------------------------------
+
+* Alpine
+ https://alpinelinux.org/downloads/
+ -> http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/ppc64le/
+
+riscv64
+-------
+
+?
+
+s390x
+-----
+
+* Alpine
+ https://alpinelinux.org/downloads/
+ -> http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/
+
+sh4
+---
+
+?
+
--- /dev/null
+QEMU environments
+=================
+
+This page explains how set up a QEMU environment for a platform.
+
+
+Introduction
+============
+
+Setting up a QEMU environment for a platform can be a matter of
+trial-and-error, and sometimes may not succeed at all.
+
+The reasons are:
+
+ * QEMU does not only emulate a CPU, but also some hardware
+ (IDE disk adapter or SCSI disk adapter, ethernet card,
+ graphics card, and so on). The OS that you want to install
+ in the guest VM supports some set of hardware, too.
+ And the two need to have some intersection! If, for example,
+ the machine emulated by QEMU has IDE disks but no SCSI disks
+ and the OS has SCSI drivers but no IDE drivers, you will never
+ succeed in making the two work together.
+
+ * The boot loading mechanism in the original hardware often starts
+ with a piece of proprietary software (BIOS, EFI, etc.). For
+ some of them, QEMU contains a Free Software replacement (U-Boot,
+ OpenBIOS, SeaBIOS, OpenSBI, skiboot, etc.). For others, there is
+ a Free Software replacement packaged separately: edk2 a.k.a.
+ 'qemu-efi'.
+ For this reasons, QEMU allows to bypass this platform dependent
+ boot loading mechanism, but only for Linux kernels. It offers
+ three options
+ - -kernel, indicating the kernel image to start,
+ - -initrd, indicating a (most often compressed) file system
+ to load into a RAM disk,
+ - -append, containing command line options for the kernel.
+
+ * The RAM size of the virtual machine. For many distros, 512 MiB
+ are enough. However, some need 1 GiB, some even 2 GiB.
+
+The writeup here describes how to reduce the trial-and-error.
+
+
+Steps
+=====
+
+(DR) Collect pointers to documentation and references.
+(QV) Choose a QEMU version.
+(DL) Download an installation CD-ROM or DVD image.
+(XK) Extract the kernel from the CD-ROM or DVD image.
+(CD) Create an empty disk image to be used by the virtual machine.
+(MA) Choose the machine arguments.
+(DI) Choose the disk arguments.
+(NW) Choose the network arguments.
+(DV) Choose the display/video arguments.
+(B1) Boot from the CD/DVD.
+(IN) Perform the steps of the installer.
+(B2) Boot from the installed disk.
+(PK) Install packages.
+
+Here are considerations and tips for each of the steps.
+
+As a convention, let me define these prompts:
+% command executed on the host
+# command executed as root on the guest
+$ command executed as normal user on the guest
+
+
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+It's useful to have relevant documentation at hand, as well as references
+to configurations some other people have successfully used.
+
+
+(QV) Choose a QEMU version
+--------------------------
+
+Generally, the best QEMU version to use is the newest release.
+
+It's pretty easy to build, per <https://www.qemu.org/download/>.
+It's the usual "./configure; make; make install" trio. The configure
+options that I choose are the following:
+
+./configure --prefix=... \
+--target-list=\
+aarch64-softmmu,\
+alpha-softmmu,\
+arm-softmmu,\
+hppa-softmmu,\
+i386-softmmu,\
+loongarch64-softmmu,\
+m68k-softmmu,\
+mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,\
+ppc-softmmu,ppc64-softmmu,\
+riscv32-softmmu,riscv64-softmmu,\
+s390x-softmmu,\
+sh4-softmmu,\
+sparc-softmmu,sparc64-softmmu,\
+x86_64-softmmu,\
+aarch64-linux-user,\
+alpha-linux-user,\
+arm-linux-user,\
+hppa-linux-user,\
+i386-linux-user,\
+loongarch64-linux-user,\
+m68k-linux-user,\
+mips-linux-user,mipsel-linux-user,mipsn32-linux-user,mipsn32el-linux-user,mips64-linux-user,mips64el-linux-user,\
+ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,\
+riscv32-linux-user,riscv64-linux-user,\
+s390x-linux-user,\
+sh4-linux-user,\
+sparc-linux-user,sparc32plus-linux-user,sparc64-linux-user,\
+x86_64-linux-user \
+--disable-strip \
+--disable-werror \
+--enable-slirp \
+--enable-curses --enable-gtk --enable-vnc
+
+Notes:
+* --disable-werror is to avoid gratuitous compilation errors.
+* --enable-slirp is to enable an easy networking setup.
+ https://wiki.qemu.org/Documentation/Networking#User_Networking_(SLIRP)
+* --enable-curses --enable-gtk --enable-vnc is for supporting
+ the text-mode UI, the Gtk UI, and a VNC UI.
+
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Most distributions provide ISO CD or DVD images.
+For Linux distros, see the file linux-install-media.txt.
+
+Generally, try to get a CD/DVD with packages included.
+This gives you the advantage that you can install additional packages
+after the installation, even years after the installation. These CDs/DVDs
+are typically 0.5 GB or larger.
+The CDs/DVDs that are 100 MB or 200 MB large are typically
+"network installation" CDs/DVDs. They download packages to install through
+the network. They drawback is that they stop working when the package
+repositories disappear from the distro's site or their mirrors.
+For instance, Debian's ports
+ https://cdimage.debian.org/cdimage/ports/12.0/
+have only "network installation" CDs. Which is OK for now, but will be a
+problem when 15.0 is released, because as you can see in
+<http://ftp.debian.org/debian/dists/>, only the three latest major Debian
+releases still have downloadable package repositories.
+
+Use 'wget', not a browser, to download the image.
+In case there you encounter a network disconnect during the download,
+a 'wget' download can be continued, while a browser download cannot.
+(Debian mentions this too, in
+<https://www.debian.org/CD/http-ftp/index.en.html>.)
+
+You can inspect their contents by mounting them:
+% sudo mount -r -t iso9660 DISTRO.iso /mnt
+Afterwards, don't forget
+% sudo umount /mnt
+
+Some distributions also provide ready-to-use disk images.
+But they have the drawbacks that
+ - The disk size is not your choice; you may need to add additional
+ virtual disks.
+ - The credentials are not your choice either.
+
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+As mentioned above, QEMU offers a way to bypass bootloader problems,
+by starting a Linux (or *BSD) kernel directly. To use it, you need three
+files, that you will find on the CD/DVD:
+ - The Linux kernel, typically called 'vmlinux' or 'vmlinuz',
+ - The initial RAM disk, typically called 'initrd' or 'initrd.gz',
+ - The bootloader's configuration, typically called 'grub.cfg'. Here
+ you will find appropriate Linux kernel command line options.
+ (Who would guess options such as "console=ttyS0", "root=/dev/sda3", or
+ "dwc_otg.lpm_enable=0" without some help?)
+
+To extract these files from a CD/DVD image:
+ % sudo mount -r -t iso9660 DISTRO.iso /mnt
+ % ls -l /mnt
+ Once you found them, copy them out. For example:
+ % mkdir boot
+ % cp -a /mnt/boot/* boot/
+ % cp -p /mnt/EFI/BOOT/grub.cfg boot/
+ % sudo umount /mnt
+
+To extract these files from a pre-made disk image:
+1. Convert the disk image to raw format (standard suffix: .img).
+ For example:
+ % qemu-img convert -f qcow2 -O raw distroimage.qcow2 distroimage.img
+2. You need the 'kpartx' package installed. (You can also get away without
+ kpartx, but then you need to guess numerical offsets...) 'kpartx' makes
+ the partitions of a disk image accessible as individual device files
+ (under /dev/mapper/), so that you can mount them through 'mount'.
+ % sudo kpartx -av distroimage.img
+ Here you may need to try various loopXpY devices.
+ % sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+ % mkdir boot
+ % (cd /mnt/boot && tar chf - --exclude=lost+found *) | (cd boot && tar xvf -)
+ % sudo umount /mnt
+ % sudo kpartx -dv distroimage.img
+
+Often, the kernel file is compressed; However, QEMU needs an uncompressed file
+instead. So, in order to make the file usable, you have to uncompress it first.
+Like this:
+
+ % file boot/vmlinuz
+ boot/vmlinuz: gzip compressed data, max compression, from Unix, original size modulo 2^32 22547496
+ % mv boot/vmlinuz boot/vmlinux.gz
+ % gunzip boot/vmlinux.gz
+ % file boot/vmlinux
+ boot/vmlinux: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), statically linked, BuildID[sha1]=a734ed8b161f494c6d5eaac927f06fadd80d01c9, stripped
+
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+In the simplest case, it is a command such as
+
+ % qemu-img create -f qcow2 DISKNAME.qcow2 10G
+
+or
+
+ % qemu-img create -f raw DISKNAME.img 10G
+
+QEMU supports several disk formats. While "raw" (suffix .img) is the
+simplest one — every block of the virtual disk is stored explicitly
+and takes up a block of space on your host's disk —, "qcow2" is the
+common one. It supports snapshots and consumes less space in the
+beginning. For details, see
+https://www.qemu.org/docs/master/system/images.html .
+
+Regarding the disk size: It's common to work with a single virtual disk.
+So, it will need to contain both the OS and your data. The size of the OS
+can vary from 1 GB for a headless server to 8 GB for a distro with, say,
+a KDE GUI environment. About the data: I like to have 5 GB of disk space
+for development purposes. So 10 GB are a good first-time guess for me.
+
+On most QEMU machines, you can add another virtual disk afterwards, that
+is, pass another '-drive' option the the qemu-system-CPU command and then
+mount it from from inside the VM. But as this is a bit of a hassle, I
+suggest to reserve enough room on the first disk from the beginning.
+
+
+(MA) Choose the machine arguments
+---------------------------------
+
+qemu-system-CPU always emulates a complete machine, that includes
+PCI, SCSI, USB etc. buses and some hard disks, keyboard, mouse, display
+and serial console devices. The machine may also impose limitations,
+for example on the available RAM size. So, choose the machine wisely,
+as it has implications on all the other parameters.
+
+You get a list of possible machines through
+
+ % qemu-system-CPU -M ?
+or
+ % qemu-system-CPU -M help
+
+If a machine named 'virt' is supported, and the OS that you want to
+run in the VM is a sufficiently recent Linux (with virt I/O drivers
+supported in the kernel), it is a good choice, because it will allow
+much greater I/O throughput than with the other machines that emulate
+a PCI or SCSI access to the disk.
+
+After choosing the machine, choose also the CPU and the memory size.
+For a list of possible CPUs, do
+
+ % qemu-system-CPU -cpu ?
+or
+ % qemu-system-CPU -cpu help
+
+For the memory size, typically pick something between 256 MB (sufficient
+for a distro without GUI, unless the installer needs more than that) and
+2048 MB (this is what you need for a GNOME GUI, for example).
+
+In some cases, you will also need a '-bios ...' option. This denotes the
+software that is activated at boot time, before the kernel takes over.
+QEMU comes with a working BIOS/EFI/... for most machines and uses that by
+default; therefore you will need a '-bios ...' option only in the most
+exotic cases.
+
+Assign these arguments to a variable, by convention named machine_args.
+
+
+(DI) Choose the disk arguments
+------------------------------
+
+The QEMU arguments that tell it about the disk file and format are easy
+to find. If the machine is a 'virt' machine, use
+
+ % disk_args="-drive file=DISKNAME.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+or (for a raw-format disk)
+ % disk_args="-drive file=DISKNAME.img,format=raw,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+
+Otherwise, use
+
+ % disk_args="-drive file=DISKNAME.qcow2,format=qcow2,[if=...,]index=0"
+or
+ % disk_args="-drive file=DISKNAME.img,format=raw,[if=...,]index=0"
+
+The 'if=...' sub-option defines the disk interface, typically 'if=ide'
+or 'if=scsi'.
+
+If you want to understand what such an option is doing, run
+
+ % qemu-system-CPU -S -nographic $disk_args
+
+switch to QEMU input mode (C-a c), then enter the command
+
+ (qemu) info block
+
+For more info, see https://www.qemu.org/docs/master/system/invocation.html .
+
+
+(NW) Choose the network arguments
+---------------------------------
+
+There are many available QEMU options regarding networking, that support
+advanced features like allowing different VMs to communicate with each other.
+
+For our purposes, the "user" mode is sufficient. In this mode, QEMU
+implements a virtual ethernet card and a DHCP server that sits between
+the host and the guest VM. As a result:
+ - The guest has a direct connection only to the host.
+ - The guest's IP address is 10.0.2.15.
+ - The host's IP address on this connection is 10.0.2.2.
+ - The public internet can be reached through the host, once the
+ virtual ethernet interface is brought "up" in the guest VM.
+
+To get this "user" networking enabled, on many QEMU machines, no particular
+options are needed:
+
+ % net_args=""
+
+On a 'virt' machine, instead, you may need
+
+ % net_args="-device virtio-net-device,netdev=usernet -netdev user,id=usernet"
+
+Special case: On m68k, machine '-M q800', use
+
+ % net_args="-net nic,model=dp83932 -net user"
+
+You don't need to provide a particular MAC address for the guest, since only
+the connection to the host gets to see this MAC address.
+
+To test these arguments, run
+
+ % qemu-system-CPU -S -nographic $machine_args $net_args
+
+switch to QEMU input mode (C-a c), then enter the command
+
+ (qemu) info network
+
+It should produce output similar to:
+
+ hub 0
+ \ hub0port1: user.0: 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
+
+or
+
+ hub 0
+ \ hub0port1: user.0: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: smc91c111.0: index=0,type=nic,model=smc91c111,macaddr=52:54:00:12:34:56
+
+The name and model of the ethernet card can vary, of course.
+
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+You need to pass arguments to QEMU to tell it how to configure the display
+and video (graphics card). The two most useful configurations are:
+
+* Do input and output to the current terminal emulator.
+
+ This has the advantages:
+ - During boot, when things may go wrong, you have the terminal emulator's
+ scrollback buffer available, for investigation.
+ - You can easily copy text from/into the VM.
+
+ To achieve this mode, usually it is enough to specify
+
+ % display_args="-nographic"
+
+ For optimal results, it may be useful to later set TERM=xterm in the VM.
+
+* Do input and output in a separate window.
+
+ This has the advantages:
+ - You can run a graphical environment.
+ - It behaves more like real hardware.
+
+ To achieve this mode, you specify
+
+ % display_args="-display gtk -monitor stdio"
+
+ It would also be possible to specify '-display vnc' instead of '-display gtk',
+ if you need remote access to the VM.
+
+ Note that '-display gtk' sometimes does not work satisfactorily:
+ - In some configurations, keystrokes are ignored.
+ - In some configurations, decent keyboard input does not work, due to a
+ problem with repeat.
+ - In some environments, use of the arrow keys in a bash prompt tends to
+ hang for a while. (Maybe it can be fixed by setting TERM?)
+ - In some configurations, non-ASCII characters are not well rendered.
+
+How to enter QEMU commands while the VM is running?
+
+* In the "-nographic" mode, the terminal is multiplexing the input for the VM
+ and the input for QEMU.
+ Some "magic" commands in this mode are:
+ C-a h print this help
+ C-a x exit emulator
+ C-a s save disk data back to file (if -snapshot)
+ C-a t toggle console timestamps
+ C-a b send break (magic sysrq)
+ C-a c switch between console and monitor
+ C-a C-a sends C-a
+ For the full reference, see
+ https://www.qemu.org/docs/master/system/mux-chardev.html .
+
+* In the separate-window mode, due to the '-monitor stdio' option, you use
+ the terminal emulator exclusively for QEMU commands.
+
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+This step may require some trial-and-error.
+
+Start by combining the previously selected QEMU command-line options:
+
+ % common_args="$machine_args $disk_args $net_args $display_args"
+
+In case you downloaded a CD/DVD image (as opposed to a pre-made disk image),
+find the command-line option that simulates the presence of this CD/DVD in a
+CD/DVD drive.
+
+ -cdrom CDIMAGE.iso
+
+If that does not work, use a '-drive' option, similar to the $disk_args.
+If the machine is a 'virt' machine, use
+
+ -drive file=CDIMAGE.iso,if=virtio,media=cdrom
+
+Otherwise, use
+
+ -drive file=CDIMAGE.iso,if=...,media=cdrom
+
+The 'if=...' sub-option defines the disk interface, typically 'if=ide'
+or 'if=scsi'.
+
+Don't forget the 'media=cdrom' sub-option; this is what tells QEMU to access
+the image in read-only mode (as opposed to read-write mode, which is the
+default for '-drive').
+
+Note a subtle difference between the two syntaxes: '-cdrom' "inserts" the
+CD/DVD image into an existing CD/DVD drive, whereas '-drive' creates a new
+CD/DVD drive and "inserts" the CD/DVD image into it.
+
+If you want to understand what such an option is doing, run
+
+ % qemu-system-CPU -S -nographic ...
+
+switch to QEMU input mode (C-a c), then enter the command
+
+ (qemu) info block
+
+For more info, see https://www.qemu.org/docs/master/system/invocation.html .
+
+Now, you are ready to boot the VM. Try first without any -kernel option:
+
+ % qemu-system-CPU $common_args -cdrom ...
+
+This may work if the BIOS and the contents of the CD together provide a
+working bootloader chain.
+
+In some configurations, adding a '-boot d' option may be helpful.
+
+If this did not work and the OS to boot is Linux, use the options -kernel,
+-initrd, -append, as described in the Introduction above, to bypass the
+platform dependent boot loading mechanism:
+
+ % qemu-system-CPU $common_args -cdrom ... \
+ -kernel boot/vmlinux -initrd boot/initrd.gz
+
+There are good chances that this works fine.
+
+If this produces some output but the essential error messages get cleared
+from the screen before you can read them, log the output to a file:
+
+ % qemu-system-CPU $common_args ... 2>&1 | tee out
+
+If it fails to produce any output, it may be because the kernel is booting
+but its output is not directed to the terminal emulator. In this situation
+it may help to add kernel parameters such as
+
+ -append "loglevel=9"
+
+or
+
+ -append "console=ttyS0,115200"
+
+or
+
+ -append "vga=off"
+
+If it still fails to produce any output, try replacing the display_args with
+
+ % display_args="-display gtk -monitor stdio"
+
+If the kernel is now booting fine and you used display_args="-nographic",
+you may now terminate the qemu-system-CPU process and instead replace the
+display_args with
+
+ % display_args="-display gtk -monitor stdio"
+
+if you find that desirable.
+
+Another troubleshooting trick: If you want to know what things look like
+from the booted Linux OS, use a Debian installer CD and either
+ - at the first installer screen press ESC, and then choose "Execute a shell",
+or
+ - boot with a '-append "rescue/enable=true"' option.
+
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Assume that the previous step succeeded, that is, that the kernel booted and
+started an installer. For curses-based installers it is generally useful to
+resize the terminal emulator window to 80x24 characters.
+
+Take note of the partitioning result, in particular which disk partition
+contains the / file system.
+
+To terminate the installation: If available, use a 'halt' (or 'reboot')
+command from within the VM. Otherwise, if you have a (qemu) prompt,
+give the command
+
+ (qemu) quit
+
+Or, if the input is multiplexed, use the
+
+ C-a x
+
+magic command.
+
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This step may require some trial-and-error as well.
+
+Start with the successful QEMU arguments from the step "Boot from the CD/DVD",
+except that you remove the option that activate the CD.
+
+If the installer installed a working boot loader chain, you don't need any
+further arguments; this will be enough:
+
+ % qemu-system-CPU $common_args
+
+If this does not work and the OS to boot is Linux, then you will need
+-kernel, -initrd, -append options, as described in the Introduction.
+
+For the T2-SDE Linux distribution, the same kernel and the same initrd can
+be used as when installing. Thus the command line is
+
+ % qemu-system-CPU $common_args \
+ -kernel boot/vmlinux-X.Y.Z-t2 -initrd boot/initrd-X.Y.Z-t2 \
+ -append "root=/dev/sdaN"
+
+where /dev/sdaN is the partition on which the / file system was installed.
+
+For other Linux distributions (in particular, Debian, openSUSE), you need
+to extract
+ - the kernel,
+ - the initial RAM disk (initrd),
+ - and the boot loader configuration file
+from the virtual disk, so that you can use them as arguments to QEMU.
+It goes like this:
+1. Convert the disk image to raw format (standard suffix: .img).
+ For example:
+ % qemu-img convert -f qcow2 -O raw DISKNAME.qcow2 DISKNAME.img
+2. You need the 'kpartx' package installed. (Alternatively, you could use
+ the 'guestmount' program that is part of the 'libguestfs' package. You
+ can also get away without kpartx or guestmount, but then you need to
+ guess numerical offsets...)
+ 'kpartx' makes the partitions of a disk image accessible as individual
+ device files (under /dev/mapper/), so that you can mount them through
+ 'mount'.
+ % sudo kpartx -av DISKNAME.img
+ Here you may need to try various loopXpY devices.
+ % sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+ % cp /mnt/boot/vmlinux /mnt/boot/vmlinuz .
+ % cp /mnt/boot/initrd.gz .
+ % cp /mnt/boot/grub/grub.cfg .
+ % sudo umount /mnt
+ % sudo kpartx -dv DISKNAME.img
+3. Often, the kernel file is compressed; However, QEMU needs an uncompressed
+ file instead. So, in order to make the file usable, you have to uncompress
+ it first. Like this:
+ % file vmlinuz
+ vmlinuz: gzip compressed data, max compression, from Unix, original size modulo 2^32 22547496
+ % mv vmlinuz vmlinux.gz
+ % gunzip vmlinux.gz
+ % file vmlinux
+ vmlinux: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), statically linked, BuildID[sha1]=a734ed8b161f494c6d5eaac927f06fadd80d01c9, stripped
+4. Inspect the boot loader configuration file (grub.cfg in this case)
+ and note relevant kernel command line options, to pass through '-append'.
+Now the command line is
+
+ % qemu-system-CPU $common_args \
+ -kernel vmlinux -initrd initrd.gz \
+ -append "root=/dev/sdaN ..."
+
+
+(PK) Install packages
+---------------------
+
+Install packages you will need. For development, I typically make sure
+'make', 'gcc', 'g++', 'vim', and 'emacs' are available.
+
+Details depend on the distribution and its package manager.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/alpha/port-status.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.0.2
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/ports/12.0/alpha/debian-12.0.0-alpha-NETINST-1.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.0.0-alpha-NETINST-1.iso /mnt
+% mkdir boot-for-install
+% cp -p /mnt/boot/* boot-for-install/
+% sudo umount /mnt
+% mv boot-for-install/vmlinuz boot-for-install/vmlinux.gz
+% gunzip boot-for-install/vmlinux.gz
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+With only 256 MB, later an "Out of memory" error may occur.
+% machine_args="-M clipper -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net124: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: e1000.0: index=0,type=nic,model=e1000,macaddr=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-alpha $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "console=ttyS0,115200" \
+ -drive file=debian-12.0.0-alpha-NETINST-1.iso,if=ide,media=cdrom
+
+Here, the '-append "console=..."' option is needed so that output gets directed
+to the terminal emulator.
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: alpha-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection: Keep enabled: SSH server.
+
+After "Install aboot on a hard disk" failed:
+Since kpartx won't work here:
+At the "Finishing the installation" screen, save the contents of the boot partition:
+ - Execute a shell
+ - # mount -t proc proc /target/proc
+ # mount --rbind /sys /target/sys
+ # mount --rbind /dev /target/dev
+ # chroot /target bash
+ # tar cvf /dev/boot.tar --exclude=lost+found boot
+ # scp /dev/boot.tar USER@10.0.2.2:
+ Ctrl-D
+ Ctrl-D
+Then "Finishing the installation" -> "Continue without boot loader".
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+Extract this boot partition here:
+% tar xvf $HOME/boot.tar
+% cp boot/vmlinuz-6.5.0-5-alpha-generic boot/vmlinux.gz
+% ln -s initrd.img-6.5.0-5-alpha-generic boot/initrd.img
+% gunzip boot/vmlinux.gz
+
+% qemu-system-alpha $common_args \
+ -kernel boot/vmlinux -initrd boot/initrd.img -append "root=/dev/sda3 console=ttyS0,115200"
+
+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-alpha $common_args \
+ -kernel boot/vmlinux -initrd boot/initrd.img -append "root=/dev/sda3"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+
+(PK) Install packages
+---------------------
+
+# apt update
+
+Edit /etc/apt/sources.list, commenting out the "unreleased" line.
+
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el # does not work
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/alpha/port-status.en.html
+https://virtuallyfun.com/2021/08/10/installing-debian-linux-5-0-on-the-qemu-dec-alpha/
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.9.0
+% PATH=$HOME/inst-qemu/2.9.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+I downloaded
+https://cdimage.debian.org/cdimage/archive/5.0.10/alpha/iso-cd/debian-5010-alpha-netinst.iso
+but you are better off starting with
+https://cdimage.debian.org/cdimage/archive/5.0.10/alpha/iso-dvd/debian-5010-alpha-DVD-1.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-5010-alpha-netinst.iso /mnt
+% mkdir boot-for-install
+% cp -p /mnt/boot/* boot-for-install/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian5010.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M clipper -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian5010.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-display gtk -monitor stdio"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-alpha $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz \
+ -drive file=debian-5010-alpha-netinst.iso,if=ide,media=cdrom
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Host name: alpha-debian5
+Domain name: MYDOMAINNAME
+
+login: root
+password: ********
+
+login: MY_USER_NAME
+password: ********
+
+Mirror: enter manually
+ ftp.de.debian.org
+ /debian-archive/debian/ (instead of /debian/)
+
+Since kpartx won't work here:
+At the "Finishing the installation" screen, save the contents of the boot partition:
+ - Go back
+ - Execute a shell
+ - # mount -t proc proc /target/proc
+ # mount --rbind /sys /target/sys
+ # mount --rbind /dev /target/dev
+ # chroot /target bash
+ # tar cvf /dev/boot.tar --exclude=lost+found boot
+ # scp /dev/boot.tar ...
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+Extract this boot partition here:
+% tar xvf boot.tar
+% gunzip -c < boot/vmlinuz > boot/vmlinux
+
+% qemu-system-alpha $common_args \
+ -kernel boot/vmlinux -initrd boot/initrd.img -append "root=/dev/hda3"
+
+(PK) Install packages
+---------------------
+
+login as root
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs22-nox emacs22-el
+# apt-get install bzip2
+# apt-get install g++
+# apt-get install expect dejagnu
+
+
+Notes
+-----
+
+To shutdown: Use 'reboot' - because 'shutdown' only navigates among the runlevels.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/alpha/port-status.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://dl.t2sde.org/binary/2023/t2-23.6-alpha-minimal-desktop-gcc-glibc.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop t2-23.6-alpha-minimal-desktop-gcc-glibc.iso /mnt
+% mkdir boot
+% cp -a /mnt/boot/* boot/
+% sudo umount /mnt
+% gunzip boot/vmlinux-6.3.7-t2.gz
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 t2sde.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M clipper -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=t2sde.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net182: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: e1000.0: index=0,type=nic,model=e1000,macaddr=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-alpha $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "console=ttyS0,115200" \
+ -cdrom t2-23.6-alpha-minimal-desktop-gcc-glibc.iso
+does not work; the CD-ROM device is:
+(qemu) info block
+...
+ide1-cd0 (#block321): t2-23.6-alpha-minimal-desktop-gcc-glibc.iso (raw, read-only)
+ Attached to: /machine/unattached/device[17]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+but Linux does not recognize it. Instead, use:
+
+% qemu-system-alpha $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "console=ttyS0,115200" \
+ -drive file=t2-23.6-alpha-minimal-desktop-gcc-glibc.iso,if=ide,media=cdrom
+
+This creates a different CD-ROM device:
+(qemu) info block
+...
+ide0-cd1 (#block321): t2-23.6-alpha-minimal-desktop-gcc-glibc.iso (raw, read-only)
+ Attached to: /machine/unattached/device[17]
+ Removable device: locked, tray closed
+ Cache mode: writeback
+
+that Linux recognizes.
+
+Here, the '-append "console=..."' option is needed so that output gets directed
+to the terminal emulator.
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Serial terminal: <Enter> or console
+# install
+Keyboard: us
+Partition: Automatic, classic partitions.
+File system on /dev/sda2: ext4
+Install the system
+Start gasgui Package Manager
+Full install (all packages).
+Keyboard: us
+Root password: ********
+Time zone: Europe/Berlin
+Set date: 2023, not 2003.
+Locale: en_US.UTF-8
+=> While installing aboot:
+ "Existing disk label is corrupt"
+Therefore: <Back>
+Network configuration: Configure eth0 through DHCP. <Back>.
+System init configuration: Default runlevel 3. <Back>.
+Then: <Exit>
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+% qemu-system-alpha $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda2 console=ttyS0,115200"
+
+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-alpha $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda2 console=ttyS0,115200"
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+New password: ********
+
+(PK) Install packages
+---------------------
+
+Nothing to do. If some packages are needed that are not on the CD-ROM,
+they can be compiled locally through
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f PACKAGE
+But that takes a long time.
+
+
+Notes
+-----
+
+After every reboot, you need to set the date (year 2023, not 2003).
--- /dev/null
+(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.freebsd.org/QemuRecipes
+https://wiki.qemu.org/Hosts/BSD
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-5.0.0
+% PATH=$HOME/inst-qemu/5.0.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download image from
+https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-arm-armv7-RPI2.img.xz
+Uncompress it:
+% xz -d FreeBSD-12.2-RELEASE-arm-armv7-RPI2.img.xz
+
+Convert to qcow2 format:
+% qemu-img convert -f raw -O qcow2 FreeBSD-12.2-RELEASE-arm-armv7-RPI2.img freebsd12.qcow2
+
+(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
+-----------------------------------------------------------------
+
+This is not needed in this case; we have a disk image already.
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -m 512"
+
+Since QEMU cannot directly boot a FreeBSD kernel, we'll need some
+boot firmware:
+
+ - Either the UEFI firmware that comes bundled with QEMU:
+ % machine_args="$machine_args -bios edk2-arm-code.fd"
+
+ - Or U-Boot. References:
+ https://www.denx.de/wiki/U-Boot
+ https://github.com/ARM-software/u-boot
+ FreeBSD provided binaries of it in its package repository:
+ https://freebsd.pkgs.org/12/freebsd-armv7/26/ ->
+ https://freebsd.pkgs.org/12/freebsd-armv7/u-boot-qemu-arm-2020.07.txz.html ->
+ https://freebsd.pkgs.org/12/freebsd-amd64/u-boot-qemu-arm-2020.07.txz.html ->
+ https://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/u-boot-qemu-arm-2020.07.txz
+ Unpack it.
+ But these binaries are no longer available. Newer binaries are, though:
+ https://freebsd.pkgs.org/12/freebsd-amd64/u-boot-qemu-arm-2023.07.02.pkg.html ->
+ https://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/u-boot-qemu-arm-2023.07.02.pkg
+ % mv u-boot-qemu-arm-2023.07.02.pkg u-boot-qemu-arm-2023.07.02.tar.xz
+ % xz -d u-boot-qemu-arm-2023.07.02.tar.xz
+ % tar -xOf u-boot-qemu-arm-2023.07.02.tar /usr/local/share/u-boot/u-boot-qemu-arm/u-boot.bin > u-boot.bin
+ % machine_args="$machine_args -bios u-boot.bin"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-hda freebsd12.qcow2"
+
+(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: virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
+
+This common alternative does not work in this case:
+% 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
+But FreeBSD would not recognize it later.
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-nographic"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+This is not needed in this case; we have a disk image already.
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+This is not needed in this case; we have a disk image already.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-arm $common_args
+
+With machine_args containing '-bios edk2-arm-code.fd', it fails
+with an error such as
+--------------------------------------------------------------
+Starting dhclient.
+DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 3
+Fatal kernel mode data abort: 'Alignment Fault' on read
+trapframe: 0xd0d2ba98
+FSR=00000001, FAR=d461901a, spsr=40000013
+r0 =00000000, r1 =00000000, r2 =00000000, r3 =d0d2bbac
+r4 =00000014, r5 =d461901a, r6 =0000011a, r7 =d461902e
+r8 =c091aec0, r9 =00000000, r10=0000011a, r11=d0d2bbc8
+r12=4300ffff, ssp=d0d2bb28, slr=c04dfcb8, pc =c04dfe18
+
+panic: Fatal abort
+cpuid = 0
+time = 1603427332
+KDB: stack backtrace:
+#0 0xc0324600 at kdb_backtrace+0x48
+#1 0xc02ce07c at vpanic+0x164
+#2 0xc02cdf18 at vpanic+0
+#3 0xc06606ac at abort_align+0
+#4 0xc0660724 at abort_align+0x78
+#5 0xc0660414 at abort_handler+0x4a0
+#6 0xc0640370 at exception_exit+0
+#7 0xc04dfe18 at udp_input+0x3b8
+#8 0xc0422588 at ip_input+0x204
+#9 0xc03f92f8 at netisr_dispatch_src+0x138
+#10 0xc03ef5b0 at ether_demux+0x1c4
+#11 0xc03f0b2c at ether_nh_input+0x46c
+#12 0xc03f92f8 at netisr_dispatch_src+0x138
+#13 0xc03efa50 at ether_input+0x3c
+#14 0xc01af650 at vtnet_rx_vq_process+0x974
+#15 0xc01aa6b4 at vtpci_legacy_intr+0x78
+#16 0xc028fd6c at ithread_loop+0x298
+#17 0xc028bf28 at fork_exit+0xc0
+--------------------------------------------------------------
+
+With machine_args containing '-bios u-boot.bin':
+- The original u-boot-qemu-arm-2020.07 worked fine.
+- With the newer one u-boot-qemu-arm-2023.07.02, it hangs after
+--------------------------------------------------------------
+Booting [/boot/kernel/kernel]...
+Using DTB provided by EFI at 0x5dcd3000.
+Kernel entry at 0x57e00180...
+Kernel args: (null)
+--------------------------------------------------------------
+
+Login in as root. Password: root
+
+As in https://www.freebsd.org/doc/en/articles/linux-users/network.html
+# env TERM=xterm vi /etc/rc.conf
+hostname="arm-freebsd12.MYDOMAINNAME"
+
+Reboot.
+
+Set root password:
+# passwd
+login: root
+password: ********
+
+Add account:
+# adduser
+Username: MY_USER_NAME
+Full name: MY_FULL_NAME
+Invite MY_USER_NAME into other groups? wheel
+=>
+login: MY_USER_NAME
+password: ********
+
+Edit ~/.profile to set TERM=xterm (since qemu's 'gtk' display is based on vte):
+# env TERM=xterm vi /etc/profile .cshrc
+In /etc/profile, add
+ TERM=xterm
+ export TERM
+In .cshrc, add
+ setenv TERM xterm
+
+Edit /etc/passwd: Change root's shell to /bin/sh.
+
+Mount /proc:
+Edit /etc/fstab as indicated in
+https://www.freebsd.org/cgi/man.cgi?query=procfs&sektion=&n=1
+
+(PK) Install packages
+---------------------
+
+# pkg search bash
+# pkg install bash
+# pkg install gmake
+Do not install these, because they take up too much disk space:
+# pkg install gcc9 binutils gdb vim-console emacs-nox
+
+
+Notes
+-----
+
+After every reboot, you need to set the clock:
+# env TZ=Europe/Berlin date yymmddHHMM
+
+The primary compiler is CC="cc" (clang 10.0.1).
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://blog.agchapman.com/using-qemu-to-emulate-a-raspberry-pi/
+or (older):
+https://azeria-labs.com/emulate-raspberry-pi-with-qemu/
+https://www.raspberrypi.org/forums/viewtopic.php?t=175454
+https://blogs.msdn.microsoft.com/iliast/2016/11/10/how-to-emulate-raspberry-pi/
+http://www.raspberry-pi-geek.de/Magazin/2014/04/Raspberry-Pi-emulieren
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Use Raspbian from https://www.raspberrypi.org/downloads/raspbian/
+I downloaded 2017-11-29-raspbian-stretch.zip .
+
+% unzip -x 2017-11-29-raspbian-stretch.zip
+
+Add 5 GiB to the 2nd partition, as described in
+https://askubuntu.com/questions/107228/how-to-resize-virtual-machine-disk
+% mv 2017-11-29-raspbian-stretch.img raspbian-orig.img
+% (cat raspbian-orig.img; dd if=/dev/zero bs=1048576 count=5120) > raspbian.img
+% fdisk raspbian.img
+d 2
+n p 2 94208 20094975
+w
+% sudo kpartx -av raspbian.img
+% sudo e2fsck -f /dev/mapper/loop0p2
+% sudo resize2fs /dev/mapper/loop0p2
+% sudo kpartx -dv raspbian.img
+% rm raspbian-orig.img
+
+Convert to qcow2 format:
+% qemu-img convert -f raw -O qcow2 raspbian.img raspbian.qcow2
+
+(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
+-----------------------------------------------------------------
+
+This is not needed in this case; we have a disk image already.
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-machine versatilepb -cpu arm1176 -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-hda raspbian.qcow2"
+
+(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: smc91c111.0: index=0,type=nic,model=smc91c111,macaddr=52:54:00:12:34:56
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+Either choose text mode
+ % display_args="-nographic"
+or the graphics mode (Raspbian has a nice UI)
+ % display_args="-display gtk -monitor stdio"
+
+(B2) Boot from the disk
+-----------------------
+
+This needs a -kernel option, since no bootloader is installed.
+And the kernel must be one has been specially built for being a QEMU guest.
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+
+% wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.34-jessie
+
+For text mode:
+ % qemu-system-arm $common_args \
+ -kernel kernel-qemu-4.4.34-jessie -append "root=/dev/sda2 panic=1 console=ttyAMA0"
+
+ login: pi
+ Password: raspberry
+
+For graphics mode:
+ % qemu-system-arm $common_args \
+ -kernel kernel-qemu-4.4.34-jessie -append "root=/dev/sda2 panic=1"
+
+ Applications Menu > Preferences > Raspberry Pi Configuration > Localisation
+ Locale: en / US / UTF-8
+ Timezone: Europe / Berlin
+ Keyboard: United States / English (US)
+ WiFi Country: DE
+
+Reboot.
+
+(PK) Install packages
+---------------------
+
+
+Notes
+-----
+
+At boot, an error "failed to start load kernel modules" can occur if not enough CPU power.
+Workaround: stop other CPU intensive processes while booting Raspbian.
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-standard-3.13.0-aarch64.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 alpine.qcow2 9G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -cpu cortex-a53 -m 1024"
+
+With versions < 3.15, if we try to let QEMU boot the Linux kernel
+directly, the Alpine Linux installer fails with an error message
+"Bootloader "" not supported!". So, use a 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=alpine.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
+
+% 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
+
+% 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
+
+In all three cases, Linux will recognize it as 'eth0'.
+
+(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-aarch64 $common_args \
+ -cdrom alpine-standard-3.13.0-aarch64.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+login: root
+
+# date MMDDhhmmYYYY (in UTC)
+
+# ifconfig -a
+shows network devices lo, eth0.
+
+# setup-alpine
+keyboard layout: us
+variant: us
+hostname: arm64-alpine
+interface [eth0]: dhcp
+root password: ********
+time zone: Europe/Berlin
+mirror: either http://ftp.halifax.rwth-aachen.de/alpine/ or f
+disk: vda
+partitioning scheme: sys
+
+# halt
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a GRUB bootloader is installed.
+% qemu-system-aarch64 $common_args
+
+login: root
+password: ********
+
+# date MMDDhhmmYYYY (in local time)
+
+# apk update
+# apk add bash
+
+# adduser -s /bin/bash MY_USER_NAME
+Password: ********
+
+(PK) Install packages
+---------------------
+
+The list of packages is at https://pkgs.alpinelinux.org/packages
+
+# date MMDDhhmmYYYY (in local time)
+
+# apk add make
+# apk add gcc g++
+# apk add gdb
+# apk add vim
+
+Edit /etc/apk/repositories, to enable 'community' repository (next to 'main').
+# apk add emacs
+
+# apk add expect dejagnu dejagnu-dev
+
+
+Notes
+-----
+
+After every boot:
+# date MMDDhhmmYYYY (in local time)
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/aarch64/alpine-standard-3.19.0-aarch64.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop alpine-standard-3.19.0-aarch64.iso /mnt
+% mkdir boot-for-install
+% cp -a /mnt/boot/* boot-for-install/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 alpine.qcow2 9G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -cpu cortex-a53 -m 1024"
+
+We could use a boot firmware (like in arm64-alpine-3.13.txt).
+But with versions ≥ 3.15, we can just as well let QEMU boot the Linux kernel
+directly.
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=alpine.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
+
+% 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
+
+% 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
+
+In all three cases, Linux will recognize it as 'eth0'.
+
+(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.
+
+Either
+ % qemu-system-aarch64 $common_args \
+ -kernel boot-for-install/vmlinuz-lts -initrd boot-for-install/initramfs-lts \
+ -cdrom alpine-standard-3.19.0-aarch64.iso
+or alternatively
+ % qemu-system-aarch64 $common_args -bios edk2-aarch64-code.fd \
+ -cdrom alpine-standard-3.19.0-aarch64.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+login: root
+
+# date MMDDhhmmYYYY (in UTC)
+
+# ifconfig -a
+shows network devices lo, eth0.
+
+# setup-alpine
+hostname: arm64-alpine
+interface [eth0]: dhcp
+root password: ********
+time zone: Europe/Berlin
+mirror: either http://ftp.halifax.rwth-aachen.de/alpine/ or f
+disk: vda
+partitioning scheme: sys
+
+Ignore the error:
+--------------------------------------------------------------------------------
+Installing system on /dev/vda3:
+usage: /usr/sbin/update-u-boot [-b|--board <board-type>] [-d|--device <device>]
+
+options:
+
+ -b,--board <board> Specify the board type: wand, cubie, cubie2, cuboxi, pine64-lts, etc.
+ (current default: none)
+
+ -d,--device <device> Specify the device where to install u-boot
+ (current default: none)
+
+ -i,--imagedir <imagedir> Specify u-boot image directory
+ (current default: /usr/share/u-boot)
+
+ -n,--dry-run Print commands but don't execute them
+--------------------------------------------------------------------------------
+
+# halt
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+(The installer attempted to install an U-Boot bootloader, but failed to do so.)
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw alpine.qcow2 alpine.img
+% sudo kpartx -av alpine.img
+% sudo mount -r -t ext4 /dev/mapper/loop6p1 /mnt
+% mkdir boot
+% (cd /mnt && sudo tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv alpine.img
+% rm alpine.img
+
+% qemu-system-aarch64 $common_args \
+ -kernel boot/vmlinuz-lts -initrd boot/initramfs-lts -append "root=/dev/vda3 modules=ext4"
+
+(The 'modules=ext4' option is taken from boot/extlinux/extlinux.conf.)
+
+login: root
+password: ********
+
+# apk update
+# apk add bash
+
+# adduser -s /bin/bash MY_USER_NAME
+Password: ********
+
+(PK) Install packages
+---------------------
+
+The list of packages is at https://pkgs.alpinelinux.org/packages
+
+# apk add make
+# apk add gcc g++
+# apk add gdb
+# apk add vim
+
+Edit /etc/apk/repositories, to enable 'community' repository (next to 'main').
+# apk add emacs
+
+# apk add expect dejagnu dejagnu-dev
--- /dev/null
+(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.freebsd.org/arm64/QEMU
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-5.0.0
+% PATH=$HOME/inst-qemu/5.0.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-arm64-aarch64-disc1.iso.xz
+Uncompress it:
+% xz -d FreeBSD-13.2-RELEASE-arm64-aarch64-disc1.iso.xz
+-> FreeBSD-13.2-RELEASE-arm64-aarch64-disc1.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 freebsd132.qcow2 9.5G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -cpu cortex-a53 -m 1024"
+
+Since QEMU cannot directly boot a FreeBSD 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=freebsd132.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
+FreeBSD will recognize it as 'vtnet0'.
+
+% 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
+FreeBSD will recognize it as 'vtnet0'.
+
+% 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
+FreeBSD will recognize it as 'em0'.
+
+(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-aarch64 $common_args -cdrom FreeBSD-13.2-RELEASE-arm64-aarch64-disc1.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Console type: xterm
+Install.
+Host name: arm64-freebsd132.MYDOMAINNAME
+ZFS configuration: on the first device, not on the second.
+
+login: root
+password: ********
+
+System configuration: Enable ntpdate and ntpd.
+
+System hardening: Select proc_debug.
+
+Username: MY_USER_NAME
+Full name: MY_FULL_NAME
+Invite MY_USER_NAME into other groups? wheel
+password: ********
+
+Exit installer.
+Reboot.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a FreeBSD/arm64 EFI 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
+
+Login in as root.
+
+Edit ~/.profile to set TERM=xterm (since qemu's 'gtk' display is based on vte):
+# env TERM=xterm vi /etc/profile .cshrc
+In /etc/profile, add
+ TERM=xterm
+ export TERM
+In .cshrc, add
+ setenv TERM xterm
+
+Add these lines to /etc/sysctl.conf:
+Cf. https://www.freebsd.org/releases/13.0R/relnotes/
+ kern.elf32.allow_wx=0
+ kern.elf64.allow_wx=0
+
+(PK) Install packages
+---------------------
+
+# pkg search bash
+# pkg install bash
+# pkg install gmake gcc12 binutils gdb vim emacs-nox
+
+Make room:
+# rm /var/cache/pkg/*.pkg
+
+
+Notes
+-----
+
+The primary compiler is CC="cc" (clang 14.0.5).
+Alternatively, you may use CC="gcc12 -Wl,-rpath=/usr/local/lib/gcc12" (gcc 12.2.0).
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.debian.org/Arm64Port
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.0.2
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/release/12.0.0/arm64/iso-cd/debian-12.0.0-arm64-netinst.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.0.0-arm64-netinst.iso /mnt
+% mkdir boot-for-install
+% cp -a /mnt/install.a64/* boot-for-install/
+% sudo umount /mnt
+% mv boot-for-install/vmlinuz boot-for-install/vmlinux
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+Which CPU? Cf.
+ https://www.debian.org/releases/stable/arm64/ch02s01.html.en#arm64-supported-platforms
+ https://en.wikipedia.org/wiki/Comparison_of_ARMv8-A_cores
+
+% machine_args="-M virt -cpu cortex-a53 -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(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
+
+(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-aarch64 $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz \
+ -cdrom debian-12.0.0-arm64-netinst.iso
+works; the CD-ROM device is:
+(qemu) info block
+...
+virtio2 (#block348): debian-12.0.0-arm64-netinst.iso (raw, read-only)
+ Attached to: /machine/peripheral-anon/device[1]/virtio-backend
+ Cache mode: writeback
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: arm64-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection: Keep enabled: SSH server.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+For booting from the installed disk, we need another kernel and initrd,
+because
+ % qemu-system-aarch64 $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "root=/dev/vda2"
+merely launches the installer again, which is not what we want.
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian12.qcow2 debian12.img
+% sudo kpartx -av debian12.img
+% sudo mount -r -t ext2 /dev/mapper/loop6p1 /mnt
+% mkdir boot
+% (cd /mnt && sudo tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian12.img
+% rm debian12.img
+
+% qemu-system-aarch64 $common_args \
+ -kernel boot/vmlinuz -initrd boot/initrd.img -append "root=/dev/vda2"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# halt
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+openSUSE Leap 15.2
+Download: https://get.opensuse.org/leap aarch64 Offline image.
+->
+https://ftp.gwdg.de/pub/opensuse/ports/aarch64/distribution/leap/15.2/iso/openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.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 opensuse.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -cpu cortex-a53 -m 1024"
+
+We'll use 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=opensuse.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-netdev type=user,id=net0 -device virtio-net-device,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-aarch64 $common_args -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Choose: Installation.
+
+It takes 1 minute to boot and a couple of minutes to start the YaST2 installer.
+
+List of online repositories: none anyway
+System role: Server
+Partitioning:
+ Guided
+ Choose ext4 instead of btrfs.
+ /dev/vdb1 (256 MiB) vfat, /boot/efi
+ /dev/vdb2 (9.75 GiB) ext4, /
+Time zone: Europe / Germany
+Local User:
+ Full name: MY_FULL_NAME
+ Username: MY_USER_NAME
+ Password: ********
+Settings:
+ Secure boot: disable
+Wait for the packages installation to complete.
+Wait for the bootloader installation to complete.
+It reboots.
+
+$ sudo bash
+# zypper repos
+4 | repo-oss | Main Repository | Yes | (r ) Yes | Yes
+6 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes
+OK
+
+$ sudo halt
+Power Off.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a grub bootloader is installed.
+
+Keep the CD-ROM, for being able to install packages.
+
+% qemu-system-aarch64 $common_args -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+It is not worth trying
+ % display_args="-display gtk -monitor stdio"
+since that display does not understand UTF-8 drawing characters, nor colours.
+
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+# cnf make
+# cnf gcc
+# cnf gdb
+# cnf emacs
+# zypper install make
+# zypper install gcc10-c++
+# zypper install gdb
+# zypper install emacs
+
+# halt
+Power Off.
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+openSUSE Leap 15.2
+Download: https://get.opensuse.org/leap aarch64 Offline image.
+->
+https://ftp.gwdg.de/pub/opensuse/ports/aarch64/distribution/leap/15.2/iso/openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso /mnt
+% mkdir boot-for-install
+% cp -a /mnt/boot/aarch64/* boot-for-install/
+% cp -p /mnt/EFI/BOOT/grub.cfg boot-for-install/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 opensuse.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M virt -cpu cortex-a53 -m 1024"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=opensuse.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-netdev type=user,id=net0 -device virtio-net-device,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-aarch64 $common_args \
+ -kernel boot-for-install/linux -initrd boot-for-install/initrd \
+ -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+It takes 1 minute to boot and a couple of minutes to start the YaST2 installer.
+
+List of online repositories: none anyway
+System role: Server
+Partitioning:
+ Guided
+ Choose ext4 instead of btrfs.
+ /dev/vdb1 (8 MiB) BIOS boot
+ /dev/vdb2 (9.99 GiB) ext4, /
+Time zone: Europe / Germany
+Local User:
+ Full name: MY_FULL_NAME
+ Username: MY_USER_NAME
+ Password: ********
+Settings:
+ Secure boot: disable
+Wait for the packages installation to complete.
+--------------------------------------------------------------------------------
+│Error │
+│Execution of command "[["/usr/sbin/grub2-install", "--target=arm64-efi", "--fo│
+│Exit code: 1 │
+│Error output: Installing for arm64-efi platform. │
+│/usr/sbin/grub2-install: error: cannot find EFI directory. │
+--------------------------------------------------------------------------------
+[Abort].
+[Continue installation].
+It reboots.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+(The installer attempted to install grub as bootloader, but failed to do so.)
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw opensuse.qcow2 opensuse.img
+% sudo kpartx -av opensuse.img
+% sudo mount -r -t ext4 /dev/mapper/loop6p2 /mnt
+% mkdir boot
+% (cd /mnt/boot && sudo tar cf - .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv opensuse.img
+% rm opensuse.img
+
+Keep the CD-ROM, for being able to install packages.
+
+% qemu-system-aarch64 $common_args \
+ -kernel boot/Image -initrd boot/initrd \
+ -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+$ sudo bash
+# zypper repos
+4 | repo-oss | Main Repository | Yes | (r ) Yes | Yes
+6 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes
+OK
+
+$ sudo halt
+Power Off.
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+# cnf make
+# cnf gcc
+# cnf gdb
+# cnf emacs
+# zypper install make
+# zypper install gcc10-c++
+# zypper install gdb
+# zypper install emacs
+
+# halt
+Power Off.
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: originally debian-8.6.0-armel-CD-1.iso
+(no longer available)
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-8.6.0-armel-CD-1.iso /mnt
+% mkdir boot-for-install
+% cp -p /mnt/install/versatile/netboot/* boot-for-install/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian86.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M versatilepb -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian86.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-display gtk -monitor stdio"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-arm $common_args \
+ -kernel boot-for-install/vmlinuz-3.16.0-4-versatile -initrd boot-for-install/initrd.gz
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Host name: armel-debian8
+Domain name: MYDOMAINNAME
+
+No root account.
+login: MY_USER_NAME
+password: ********
+
+"No boot loader installed
+You will need to boot manually with the /boot/vmlinuz kernel on partition /dev/sda1
+and root=/dev/sda1 passed as kernel argument."
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian86.qcow2 debian86.img
+a)
+% sudo kpartx -av debian86.img
+% sudo mount -r -t ext4 /dev/mapper/loop0p1 /mnt
+% (cd /mnt && tar cf - boot) | tar xvf -
+% sudo umount /mnt
+% sudo kpartx -dv debian86.img
+b)
+(fdisk shows the offset as 2048*512. hd shows the offset is 0x100000 bytes. But mount option 'offset' requires it in bytes, not sectors.)
+% sudo mount -r -o loop,offset=1048576 -t ext4 debian86.img /mnt
+% (cd /mnt && tar cf - boot) | tar xvf -
+% sudo umount /mnt
+
+% qemu-system-arm $common_args \
+ -kernel boot/vmlinuz -initrd boot/initrd.img -append "root=/dev/sda1"
+
+Networking not working!
+It's a DNS problem. /etc/resolv.conf contains: "nameserver fec0::3"
+Replace it with: "nameserver 8.8.8.8"
+This works temporarily.
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844592
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844566
+Workaround: Disable IPv6 through
+# echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/01-disable-ipv6.conf
+See https://www.thomas-krenn.com/de/wiki/IPv6_deaktivieren
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+
+Restore ability to install precompiled packages:
+Edit /etc/apt/sources.list, replacing http://ftp.de.debian.org/debian/
+with http://ftp.de.debian.org/debian-archive/debian/
+
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs-nox emacs24-el
+# apt-get install g++
+# apt-get install expect dejagnu
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.debian.org/ArmHardFloatPort
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.0.2
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/release/12.0.0/armhf/iso-cd/debian-12.0.0-armhf-netinst.iso
+This CD image does not work any more already six months after it
+was released. You need the *newest* Debian version's netinst CD.
+As of 2023-12-12 it is
+https://cdimage.debian.org/cdimage/release/12.4.0/armhf/iso-cd/debian-12.4.0-armhf-netinst.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.4.0-armhf-netinst.iso /mnt
+% mkdir boot-for-install
+
+Here, we have the choice among /cdrom/ and /netboot/ installers.
+However, the /cdrom/ installers don't actually recognize the CD-ROM
+later, regardless which of the two options we pass:
+ -cdrom debian-12.4.0-armhf-netinst.iso
+or
+ -drive file=debian-12.4.0-armhf-netinst.iso,if=virtio,media=cdrom
+So, use the /netboot/ installer:
+
+% cp -a /mnt/install.ahf/netboot/* boot-for-install/
+% sudo umount /mnt
+% mv boot-for-install/vmlinuz boot-for-install/vmlinux
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+Which CPU? Cf.
+ https://www.debian.org/releases/stable/armhf/ch02s01.html.en#idp42797344
+ https://en.wikipedia.org/wiki/Comparison_of_ARMv7-A_cores
+
+% machine_args="-M virt -cpu cortex-a15 -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-device,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+Use this:
+
+% net_args="-netdev user,id=net0 -device virtio-net-device,netdev=net0,mac=52:54:00:12:34:56"
+or (equivalent)
+% 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:
+(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
+
+The other candidate
+ % net_args=""
+provides an ethernet interface too:
+(qemu) info network
+hub 0
+ \ hub0port1: #net191: 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
+But the installer would not recognize it later.
+
+(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.
+
+No option for the CD-ROM since it would not be recognized.
+% qemu-system-arm $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: armhf-debian12
+Domain name: MYDOMAINNAME
+
+Since the CDROM is ignored, it asks for the Debian archive mirror.
+Debian archive mirror: Germany, deb.debian.org
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Software selection: Keep enabled: SSH server.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+For booting from the installed disk, we need another kernel and initrd,
+because
+ % qemu-system-arm $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "root=/dev/vda2"
+merely launches the installer again, which is not what we want.
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian12.qcow2 debian12.img
+% sudo kpartx -av debian12.img
+% sudo mount -r -t ext4 /dev/mapper/loop6p1 /mnt
+% mkdir boot
+% (cd /mnt && tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian12.img
+% rm debian12.img
+
+% qemu-system-arm $common_args \
+ -kernel boot/vmlinuz -initrd boot/initrd.img -append "root=/dev/vda2"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://parisc.wiki.kernel.org/index.php/Qemu
+https://www.debian.org/ports/hppa/index.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.0.2
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/ports/12.0/hppa/debian-12.0.0-hppa-NETINST-1.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.0.0-hppa-NETINST-1.iso /mnt
+% mkdir boot-for-install
+% cp -a /mnt/install/* boot-for-install/
+% sudo umount /mnt
+% ln -s vmlinuz-6.1.0-9-parisc boot-for-install/vmlinux
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M hppa -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net160: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: tulip.0: index=0,type=nic,model=tulip,macaddr=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.
+
+Either
+ % qemu-system-hppa $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz \
+ -cdrom debian-12.0.0-hppa-NETINST-1.iso
+or (equivalently)
+ % qemu-system-hppa $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz \
+ -drive file=debian-12.0.0-hppa-NETINST-1.iso,if=scsi,bus=0,unit=2,media=cdrom
+works; the CD-ROM device is:
+(qemu) info block
+...
+scsi0-cd2 (#block320): debian-12.0.0-hppa-NETINST-1.iso (raw, read-only)
+ Attached to: /machine/unattached/device[9]/scsi.0/legacy[2]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: hppa-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection: Keep enabled: SSH server.
+
+Fix the configuration on the installed disk
+-------------------------------------------
+
+Increase a couple of systemd timeouts.
+https://unix.stackexchange.com/questions/227017/how-to-change-systemd-service-timeout-value
+https://wiki.archlinux.org/title/Kernel_parameters
+https://wiki.archlinux.org/title/Systemd#Targets
+https://wiki.debian.org/DebianInstaller/FAQ#Q:_Can_I_use_d-i_as_a_rescue_system.3F_What_pitfalls_are_there.3F
+https://www.debian.org/releases/stable/amd64/ch08s06.en.html
+% qemu-system-hppa $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "rescue/enable=true" \
+ -cdrom debian-12.0.0-hppa-NETINST-1.iso
+Language: English
+Location: United States
+Keyboard: American English
+Host name: hppa-debian12
+Domain name: MYDOMAINNAME
+Accept a dummy time zone.
+Device to use as root file system: /dev/sda5
+Execute a shell in /dev/sda5
+# vi /etc/systemd/system.conf /etc/systemd/user.conf
+Edit /etc/systemd/system.conf,
+replacing 3 Timeout values: 90s -> 900s, and uncommenting these lines.
+Edit /etc/systemd/user.conf,
+replacing 3 Timeout values: 90s -> 900s, and uncommenting these lines.
+# sync
+# Ctrl-D
+Reboot.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a SeaBIOS bootloader is installed.
+% qemu-system-hppa $common_args
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://parisc.wiki.kernel.org/index.php/Qemu
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.2.0-rc3 (because it supports 64-bit CPUs and has
+<https://gitlab.com/qemu-project/qemu/-/issues/1991> fixed).
+% PATH=$HOME/inst-qemu/8.2.0-rc3/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://dl.t2sde.org/binary/2023/t2-23.6-hppa-minimal-desktop-gcc-glibc.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop t2-23.6-hppa-minimal-desktop-gcc-glibc.iso /mnt
+% mkdir boot
+% cp -a /mnt/boot/* boot/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 t2sde.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+The documentation says: Start 64-bit machine with "-machine C3700" and 32-bit CPU with "-machine B160L".
+Since the kernel provided by T2-SDE is a 64-bit kernel, we need a 64-bit machine.
+If we try it without '-M C3700', we later get an error message:
+-------------------------------------------------------------------
+Autobooting Linux kernel which was loaded by qemu...
+
+Can't boot kernel which was built for PA8x00 CPUs on this machine.
+-------------------------------------------------------------------
+So:
+
+% machine_args="-M C3700 -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=t2sde.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(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.
+
+Either
+ % qemu-system-hppa $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 \
+ -cdrom t2-23.6-hppa-minimal-desktop-gcc-glibc.iso
+or
+ % qemu-system-hppa $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 \
+ -drive file=t2-23.6-hppa-minimal-desktop-gcc-glibc.iso,if=scsi,bus=0,unit=2,media=cdrom
+works; the CD-ROM device is:
+(qemu) info block
+...
+scsi0-cd2 (#block311): t2-23.6-hppa-minimal-desktop-gcc-glibc.iso (raw, read-only)
+ Attached to: /machine/unattached/device[6]/scsi.0/legacy[2]
+ Removable device: locked, tray closed
+ Cache mode: writeback
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Serial terminal: <Enter> or console
+# install
+Partition:
+ fdisk
+ n p 1 <Enter> <Enter>
+ w
+On /dev/sda1: Create filesystem of type ext3 [why not ext4?] with mount point /
+Install the system
+Start gasgui Package Manager
+Full install (all packages).
+Keyboard: us
+Root password: ********
+Time zone: Europe/Berlin
+Locale: en_US.UTF-8
+Generated /etc/palo.conf:
+ --format-as=3 --commandline=1/vmlinuz-6.3.7-t2 initrd=1/initrd-6.3.7-t2 root=/dev/disk/by-uuid/2ee3cd4d-9f49-4fac-9300-fcd546150c34
+Finally: <Back>
+Network configuration: Configure eth0 through DHCP. <Back>.
+System init configuration: Default runlevel 3. <Back>.
+Then: <Exit>
+It reboots.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+% qemu-system-hppa $common_args
+does not boot:
+--------------------------------------------------------------------------------
+ Primary boot path: FWSCSI.0.0
+ Alternate boot path: FWSCSI.2.0
+ Console path: SERIAL_2.9600.8.none
+ Keyboard path: SERIAL_2.9600.8.none
+
+ Available boot devices:
+ FWSCSI.0.0 : lsi 00:00.0 0:0 Drive QEMU QEMU HARDDISK 2.5+
+ FWSCSI.2.0 : DVD/CD [lsi 00:00.0 2:0 Drive QEMU QEMU CD-ROM 2.5+]
+
+Booting from FWSCSI.0.0 ...
+Not a PA-RISC boot image. LIF magic is 0x0, should be 0x8000.
+SeaBIOS wants SYSTEM HALT.
+--------------------------------------------------------------------------------
+
+So, use:
+% qemu-system-hppa $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda1"
+
+This boots fine. Now would be the time to switch to a graphic display,
+but it does not work:
+ - The window's height is too large.
+ - T2-SDE creates two login sessions that read from the same input device
+ at the same time.
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+New password: ********
+
+(PK) Install packages
+---------------------
+
+Nothing to do. If some packages are needed that are not on the CD-ROM,
+they can be compiled locally through
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f PACKAGE
+But that takes a long time.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://wiki.qemu.org/Documentation/Platforms/m68k
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/m68k/index.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/ports/12.0/m68k/debian-12.0.0-m68k-NETINST-1.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.0.0-m68k-NETINST-1.iso /mnt
+% mkdir boot-for-install
+% cp -p /mnt/install/kernels/* boot-for-install/
+% cp -p /mnt/install/cdrom/* boot-for-install/
+% sudo umount /mnt
+% ln -s vmlinux-6.1.0-9-m68k boot-for-install/vmlinux
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M q800 -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+Either
+ % net_args=""
+or
+ % net_args="-net nic,model=dp83932 -net user"
+works. Each provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net110: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: dp8393x.0: index=0,type=nic,model=dp8393x,macaddr=08:00:07: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.
+
+Either
+% qemu-system-m68k $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "console=ttyS0,115200" \
+ -cdrom debian-12.0.0-m68k-NETINST-1.iso
+or
+ % qemu-system-m68k $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "console=ttyS0,115200" \
+ -drive file=debian-12.0.0-m68k-NETINST-1.iso,if=scsi,media=cdrom
+works; the CD-ROM device is:
+(qemu) info block
+...
+scsi0-cd2 (#block364): debian-12.0.0-m68k-NETINST-1.iso (raw, read-only)
+ Attached to: /machine/esp/scsi.0/legacy[2]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+Here, the '-append "console=..."' option is needed so that output gets directed
+to the terminal emulator.
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: m68k-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+When asked for a Debian archive mirror, do *not* enter a valid mirror,
+because it would lead to a crash:
+--------------------------------------------------------------------------------
+[ 2393.270000] *** TRAP #7 *** FORMAT=0
+[ 2393.270000] Current process id is 20895
+[ 2393.270000] BAD KERNEL TRAP: 00000000
+[ 2393.270000] Modules linked in: ipv6(+) dm_mod md_mod btrfs libcrc32c xor zlib
+--------------------------------------------------------------------------------
+Instead, as a workaround:
+Select <Go back>.
+Continue without a network mirror? Yes.
+
+Software selection: Keep enabled: SSH server.
+
+Take note of the message
+ │ No boot loader installed │
+ │ No boot loader has been installed, either because you chose not to or │
+ │ because your specific architecture doesn't support a boot loader yet. │
+ │ │
+ │ You will need to boot manually with the /vmlinuz kernel on partition │
+ │ /dev/sda2 and root=/dev/sda2 passed as a kernel argument. │
+
+(B2) Boot from the installed disk
+---------------------------------
+
+For booting from the installed disk, we need another kernel and initrd,
+because
+ % qemu-system-m68k $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "console=ttyS0,115200 root=/dev/sda2"
+merely launches the installer again, which is not what we want.
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian12.qcow2 debian12.img
+% sudo kpartx -av debian12.img
+% sudo mount -r -t ext4 /dev/mapper/loop18p2 /mnt
+% mkdir boot
+% cp -p /mnt/boot/* boot/
+% sudo umount /mnt
+% sudo kpartx -dv debian12.img
+% rm debian12.img
+
+% qemu-system-m68k $common_args \
+ -kernel boot/vmlinux-6.1.0-9-m68k -initrd boot/initrd.img-6.1.0-9-m68k -append "console=ttyS0,115200 root=/dev/sda2"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+
+(PK) Install packages
+---------------------
+
+Binary packages are at
+https://ftp.debian.org/debian-ports/pool-m68k/main/
+
+Edit /etc/apt/sources.list:
+- Comment out the cdrom line.
+- Add:
+ deb http://deb.debian.org/debian-ports sid main
+('sid' means 'unstable'.)
+
+# apt update
+
+Upgrade from 12.0 ('bookworm') to unstable ('sid'):
+# apt upgrade
+
+# reboot
+
+login as MY_USER_NAME
+$ sudo bash
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://wiki.qemu.org/Documentation/Platforms/m68k
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://dl.t2sde.org/binary/2023/t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso /mnt
+% mkdir boot
+% cp -a /mnt/boot/* boot/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 t2sde.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M q800 -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=t2sde.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+Either
+ % net_args=""
+or
+ % net_args="-net nic,model=dp83932 -net user"
+works. Each provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net110: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: dp8393x.0: index=0,type=nic,model=dp8393x,macaddr=08:00:07: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.
+
+Either
+ % qemu-system-m68k $common_args \
+ -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "console=ttyS0,115200" \
+ -cdrom t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso
+or
+ % qemu-system-m68k $common_args \
+ -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "console=ttyS0,115200" \
+ -drive file=t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso,if=scsi,bus=0,unit=2,media=cdrom
+works; the CD-ROM device is:
+(qemu) info block
+...
+scsi0-cd2 (#block364): t2-23.12-m68k-minimal-desktop-gcc-glibc-68020.iso (raw, read-only)
+ Attached to: /machine/esp/scsi.0/legacy[2]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+Here, the '-append "console=..."' option is needed so that output gets directed
+to the terminal emulator.
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Serial terminal: <Enter> or console
+# install
+Partition:
+ fdisk
+ n p 1 <Enter> <Enter>
+ w
+On /dev/sda1: Create filesystem of type ext3 [why not ext4?] with mount point /
+Install the system
+Start gasgui Package Manager
+Full install (all packages).
+Keyboard: us
+Root password: ********
+Time zone: Europe/Berlin
+Locale: en_US.UTF-8
+Network configuration: Configure eth0 through DHCP. <Back>.
+SSH daemon configuration: <Back>.
+System init configuration: Default runlevel 3. <Back>.
+Then: <Exit>
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+% qemu-system-m68k $common_args
+does not boot:
+--------------------------------------------------------------------------------
+qemu-system-m68k: could not load MacROM 'MacROM.bin'
+--------------------------------------------------------------------------------
+
+So, use:
+% qemu-system-m68k $common_args -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "root=/dev/sda1 console=ttyS0,115200"
+
+This boots fine. Now would be the time to switch to a graphic display,
+but it does not work:
+ - Typing into the window has no effect.
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+New password: ********
+
+(PK) Install packages
+---------------------
+
+Nothing to do. If some packages are needed that are not on the CD-ROM,
+they can be compiled locally through
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f PACKAGE
+But that takes a long time.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-mips.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(UP) Upgrade a 32-bit VM to a 64-bit VM
+---------------------------------------
+
+Start with a copy of the mipseb-linux-debian8 VM.
+
+Support for "gcc -mabi=n32" and "gcc -mabi=64":
+$ sudo bash
+# apt-get install libc6-dev-mipsn32 libc6-dev-mips64
+
+Install a 64-bit kernel:
+$ sudo bash
+# apt-cache pkgnames | sort | grep linux | grep image
+# apt-get install linux-image-5kc-malta
+
+Reboot:
+$ sudo shutdown now
+
+(B2) Boot from the installed disk, in 64-bit mode now
+-----------------------------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+% qemu-img convert -f qcow2 -O raw debian87.qcow2 debian87.img
+% sudo kpartx -av debian87.img
+% sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+% mkdir boot
+% (cd /mnt/boot && tar chf - --exclude=lost+found *-5kc-malta) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian87.img
+
+% common_args="$common_args -cpu 5KEc"
+
+% qemu-system-mips64 $common_args \
+ -kernel boot/vmlinux-3.16.0-4-5kc-malta -initrd boot/initrd.img-3.16.0-4-5kc-malta -append "root=/dev/sda1"
+
+(PK) Install packages
+---------------------
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-mips.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(UP) Upgrade a 32-bit VM to a 64-bit VM
+---------------------------------------
+
+Start with a copy of the mipsel-linux-debian8 VM.
+
+Support for "gcc -mabi=n32" and "gcc -mabi=64":
+$ sudo bash
+# apt-get install libc6-dev-mipsn32 libc6-dev-mips64
+
+Install a 64-bit kernel:
+$ sudo bash
+# apt-cache pkgnames | sort | grep linux | grep image
+# apt-get install linux-image-5kc-malta
+
+Reboot:
+$ sudo shutdown now
+
+(B2) Boot from the installed disk, in 64-bit mode now
+-----------------------------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+% qemu-img convert -f qcow2 -O raw debian87.qcow2 debian87.img
+% sudo kpartx -av debian87.img
+% sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+% mkdir boot
+% (cd /mnt/boot && tar chf - --exclude=lost+found *-5kc-malta) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian87.img
+
+% common_args="$common_args -cpu 5KEc"
+
+% qemu-system-mips64 $common_args \
+ -kernel boot/vmlinux-3.16.0-4-5kc-malta -initrd boot/initrd.img-3.16.0-4-5kc-malta -append "root=/dev/sda1"
+
+(PK) Install packages
+---------------------
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-mips.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+We don't use a CD-ROM image, only a kernel + initrd.
+
+% mkdir boot-for-install
+% (cd boot-for-install
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-mips/current/images/malta/netboot/vmlinux-3.16.0-4-4kc-malta
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-mips/current/images/malta/netboot/initrd.gz)
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian87.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M malta -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian87.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(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-mips $common_args \
+ -kernel boot-for-install/vmlinux-3.16.0-4-4kc-malta -initrd boot-for-install/initrd.gz
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Host name: mipseb-debian8
+Domain name: MYDOMAINNAME
+
+No root account.
+login: MY_USER_NAME
+password: ********
+
+"No boot loader installed
+You will need to boot manually with the /vmlinuz kernel on partition /dev/sda1
+and root=/dev/sda1 passed as kernel argument."
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian87.qcow2 debian87.img
+a)
+% sudo kpartx -av debian87.img
+% sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+% mkdir boot
+% (cd /mnt/boot && tar chf - --exclude=lost+found vmlinux-* initrd.img-*) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian87.img
+b)
+(fdisk shows the offset as 2048*512. hd shows the offset is 0x100000 bytes. But mount option 'offset' requires it in bytes, not sectors.)
+% sudo mount -r -o loop,offset=1048576 -t ext4 debian87.img /mnt
+% (cd /mnt && tar cf - boot) | tar xvf -
+% sudo umount /mnt
+
+% qemu-system-mips $common_args \
+ -kernel boot/vmlinux-3.16.0-4-4kc-malta -initrd boot/initrd.img-3.16.0-4-4kc-malta -append "root=/dev/sda1"
+
+Networking not working!
+It's a DNS problem. /etc/resolv.conf contains: "nameserver fec0::3"
+Replace it with: "nameserver 8.8.8.8"
+This works temporarily.
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844592
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844566
+Workaround: Disable IPv6 through
+# echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/01-disable-ipv6.conf
+See https://www.thomas-krenn.com/de/wiki/IPv6_deaktivieren
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+
+Restore ability to install precompiled packages:
+Edit /etc/apt/sources.list, replacing http://ftp.de.debian.org/debian/
+with http://ftp.de.debian.org/debian-archive/debian/
+
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs-nox emacs24-el
+# apt-get install g++
+# apt-get install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-mips.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.0.2
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/release/12.0.0/mipsel/iso-cd/debian-12.0.0-mipsel-netinst.iso
+This CD image does not work any more already six months after it
+was released. You need the *newest* Debian version's netinst CD.
+As of 2023-12-12 it is
+https://cdimage.debian.org/cdimage/release/12.4.0/mipsel/iso-cd/debian-12.4.0-mipsel-netinst.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.4.0-mipsel-netinst.iso /mnt
+% mkdir boot-for-install
+% cp -p /mnt/install/malta/netboot/* boot-for-install/
+% sudo umount /mnt
+% ln -s vmlinuz-6.1.0-15-4kc-malta boot-for-install/vmlinux
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M malta -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net120: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: pcnet.0: index=0,type=nic,model=pcnet,macaddr=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"
+
+This combination of QEMU machine and kernel appears to not recognize any CD-ROM.
+I tried
+ % qemu-system-mipsel $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz
+with each of the following options:
+ -cdrom debian-12.0.0-mipsel-netinst.iso
+ -drive file=debian-12.0.0-mipsel-netinst.iso,media=cdrom
+ -drive file=debian-12.0.0-mipsel-netinst.iso,index=1,media=cdrom
+ -drive file=debian-12.0.0-mipsel-netinst.iso,if=ide,media=cdrom
+and in all cases the installer asked for the Debian mirror already very early.
+
+So, let's actually use this feature of the Debian installer: it acts like a
+net-installation CD when only the kernel and initrd are present and the CD
+cannot be accessed.
+% qemu-system-mipsel $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: mipsel-debian12
+Domain name: MYDOMAINNAME
+
+Since the CDROM is ignored, it asks for the Debian archive mirror.
+Debian archive mirror: Germany, deb.debian.org
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Software selection: Keep enabled: SSH server.
+
+Take note of the message
+ │ No boot loader installed │
+ │ No boot loader has been installed, either because you chose not to or │
+ │ because your specific architecture doesn't support a boot loader yet. │
+ │ │
+ │ You will need to boot manually with the /vmlinux kernel on partition │
+ │ /dev/sda1 and root=/dev/sda1 passed as a kernel argument. │
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed:
+% qemu-system-mipsel $common_args -boot c
+just hangs.
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian12.qcow2 debian12.img
+% sudo kpartx -av debian12.img
+% sudo mount -r -t ext4 /dev/mapper/loop6p1 /mnt
+% mkdir boot
+% (cd /mnt/boot && sudo tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian12.img
+% rm debian12.img
+% ln -s vmlinuz-6.1.0-15-4kc-malta boot/vmlinuz
+% ln -s initrd.img-6.1.0-15-4kc-malta boot/initrd.img
+
+% qemu-system-mipsel $common_args -kernel boot/vmlinuz -initrd boot/initrd.img -append "root=/dev/sda1"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-mips.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+We don't use a CD-ROM image, only a kernel + initrd.
+
+% mkdir boot-for-install
+% (cd boot-for-install
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-mipsel/current/images/malta/netboot/vmlinux-3.16.0-4-4kc-malta
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-mipsel/current/images/malta/netboot/initrd.gz)
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian87.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M malta -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian87.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(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-mipsel $common_args \
+ -kernel boot-for-install/vmlinux-3.16.0-4-4kc-malta -initrd boot-for-install/initrd.gz
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Host name: mipsel-debian8
+Domain name: MYDOMAINNAME
+
+No root account.
+login: MY_USER_NAME
+password: ********
+
+"No boot loader installed
+You will need to boot manually with the /vmlinuz kernel on partition /dev/sda1
+and root=/dev/sda1 passed as kernel argument."
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian87.qcow2 debian87.img
+a)
+% sudo kpartx -av debian87.img
+% sudo mount -r -t ext4 /dev/mapper/loop1p1 /mnt
+% mkdir boot
+% (cd /mnt/boot && tar chf - --exclude=lost+found vmlinux-* initrd.img-*) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian87.img
+b)
+(fdisk shows the offset as 2048*512. hd shows the offset is 0x100000 bytes. But mount option 'offset' requires it in bytes, not sectors.)
+% sudo mount -r -o loop,offset=1048576 -t ext4 debian87.img /mnt
+% (cd /mnt && tar cf - boot) | tar xvf -
+% sudo umount /mnt
+
+% qemu-system-mipsel $common_args \
+ -kernel boot/vmlinux-3.16.0-4-4kc-malta -initrd boot/initrd.img-3.16.0-4-4kc-malta -append "root=/dev/sda1"
+
+Networking not working!
+It's a DNS problem. /etc/resolv.conf contains: "nameserver fec0::3"
+Replace it with: "nameserver 8.8.8.8"
+This works temporarily.
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844592
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844566
+Workaround: Disable IPv6 through
+# echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/01-disable-ipv6.conf
+See https://www.thomas-krenn.com/de/wiki/IPv6_deaktivieren
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+
+Restore ability to install precompiled packages:
+Edit /etc/apt/sources.list, replacing http://ftp.de.debian.org/debian/
+with http://ftp.de.debian.org/debian-archive/debian/
+
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs-nox emacs24-el
+# apt-get install g++
+# apt-get install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://wiki.qemu.org/Documentation/Platforms/PowerPC
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/powerpc/index.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2 (This version fixes a couple of 'Illegal instruction' in glibc math functions.)
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/ports/12.0/powerpc/debian-12.0.0-powerpc-NETINST-1.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop debian-12.0.0-powerpc-NETINST-1.iso /mnt
+% mkdir boot-for-install
+% cp -a /mnt/install/* boot-for-install/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+The only supported machines that can boot a Linux kernel are g3beige, mac99.
+% machine_args="-M g3beige -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,if=ide,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net107: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: ne2k_pci.0: index=0,type=nic,model=ne2k_pci,macaddr=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"
+
+Without a -kernel option, it doesn't boot:
+% qemu-system-ppc $common_args \
+ -cdrom debian-12.0.0-powerpc-NETINST-1.iso
+-----------------------------------------------------------------------
+>> =============================================================
+>> OpenBIOS 1.1 [Mar 7 2023 22:21]
+>> Configuration device id QEMU version 1 machine id 2
+>> CPUs: 1
+>> Memory: 256M
+>> UUID: 00000000-0000-0000-0000-000000000000
+>> CPU type PowerPC,750
+milliseconds isn't unique.
+Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
+Trying hd:,\\:tbxi...
+Trying hd:,\ppc\bootinfo.txt...
+Trying hd:,%BOOT...
+No valid state has been set by load or init-program
+
+0 >
+-----------------------------------------------------------------------
+
+So:
+% qemu-system-ppc $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz -append "console=ttyPZ0" \
+ -cdrom debian-12.0.0-powerpc-NETINST-1.iso
+
+Here, the '-append "console=..."' option is needed so that output gets
+directed to the terminal emulator throughout the boot process.
+'-append "console=ttyS0"' would not be the right option, because with it,
+the output stops after 5 seconds.
+
+Alternatively, you could activate the graphic display:
+
+% display_args="-display gtk -monitor stdio"
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-ppc $common_args \
+ -kernel boot-for-install/vmlinux -initrd boot-for-install/initrd.gz \
+ -cdrom debian-12.0.0-powerpc-NETINST-1.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: powerpc-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection:
+ (without graphic display) Keep enabled: SSH server.
+ (with graphic display) Disable desktop and Xfce. Enable SSH server.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option because, although an OpenBIOS bootloader is installed, no "-boot X" option works.
+% qemu-system-ppc $common_args -boot c
+-----------------------------------------------------------------------
+>> =============================================================
+>> OpenBIOS 1.1 [Mar 7 2023 22:21]
+>> Configuration device id QEMU version 1 machine id 2
+>> CPUs: 1
+>> Memory: 256M
+>> UUID: 00000000-0000-0000-0000-000000000000
+>> CPU type PowerPC,750
+milliseconds isn't unique.
+Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
+Trying hd:,\\:tbxi...
+Trying hd:,\ppc\bootinfo.txt...
+Trying hd:,%BOOT...
+No valid state has been set by load or init-program
+
+0 >
+-----------------------------------------------------------------------
+
+Extract the kernel for booting:
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian12.qcow2 debian12.img
+% sudo kpartx -av debian12.img
+% sudo mount -r -t ext4 /dev/mapper/loop6p2 /mnt
+% mkdir boot
+% (cd /mnt && sudo tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian12.img
+% rm debian12.img
+
+Boot without graphic display:
+% qemu-system-ppc $common_args -kernel boot/vmlinux -initrd boot/initrd.img -append "root=/dev/sda3 console=ttyPZ0"
+
+This boots fine. Now is the time to switch to a graphic display, if desired
+and if not already done before:
+
+% display_args="-display gtk -monitor stdio"
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-ppc $common_args -kernel boot/vmlinux -initrd boot/initrd.img -append "root=/dev/sda3"
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el # fails
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://wiki.qemu.org/Documentation/Platforms/PowerPC
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://dl.t2sde.org/binary/2023/t2-23.6-ppc-minimal-firefox-gcc-glibc-603.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop t2-23.6-ppc-minimal-firefox-gcc-glibc-603.iso /mnt
+% mkdir boot
+% cp -a /mnt/boot/* boot/
+% cp -a /mnt/etc/kboot.conf boot/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 t2sde.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M g3beige -m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=t2sde.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net144: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: ne2k_pci.0: index=0,type=nic,model=ne2k_pci,macaddr=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-ppc $common_args \
+ -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 \
+ -cdrom t2-23.6-ppc-minimal-firefox-gcc-glibc-603.iso
+works; the CD-ROM device is:
+(qemu) info block
+...
+ide1-cd0 (#block354): t2-23.6-ppc-minimal-firefox-gcc-glibc-603.iso (raw, read-only)
+ Attached to: /machine/unattached/device[7]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Serial terminal: <Enter> or console
+# install
+Partition:
+ fdisk
+ n p 1 <Enter> <Enter>
+ w
+On /dev/sda1: Create filesystem of type ext3 [why not ext4?] with mount point /
+Install the system
+Start gasgui Package Manager
+Full install (all packages).
+Keyboard: us
+Root password: ********
+Time zone: Europe/Berlin
+Locale: en_US.UTF-8
+Generated /boot/grub/grub.cfg:
+ menuentry "T2/Linux" {
+ linux /boot/vmlinux-6.3.7-t2
+ root=/dev/disk/by-uuid/3be5afe0-790f-4726-a1c4-71adeab1fbf4
+ ro console=ttyPZ0 initrd /boot/initrd-6.3.7-t2
+ }
+But: "No HFS bootstrap partition found!"
+Therefore: <Back>
+Generated /etc/kboot.conf:
+ t2sde='/boot/vmlinux-6.3.7-t2 initrd=/boot/initrd-6.3.7-t2 root=/dev/sda1' # video=ps3fb:mode:13
+Again: <Back>
+Network configuration: Configure eth0 through DHCP. <Back>.
+System init configuration: Default runlevel 3. <Back>.
+Then: <Exit>
+It reboots.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+% qemu-system-ppc $common_args
+does not boot:
+--------------------------------------------------------------------------------
+>> =============================================================
+>> OpenBIOS 1.1 [Mar 7 2023 22:21]
+>> Configuration device id QEMU version 1 machine id 2
+>> CPUs: 1
+>> Memory: 256M
+>> UUID: 00000000-0000-0000-0000-000000000000
+>> CPU type PowerPC,750
+milliseconds isn't unique.
+Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
+Trying hd:,\\:tbxi...
+Trying hd:,\ppc\bootinfo.txt...
+Trying hd:,%BOOT...
+No valid state has been set by load or init-program
+--------------------------------------------------------------------------------
+
+So, use:
+% qemu-system-ppc $common_args -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda1"
+
+It boots, but there is no login prompt. There are two possible fixes for this situation:
+
+* Tell the kernel about the console device, so that a 'getty' process gets spawned for it.
+ (See also the generated grub.cfg, above.)
+ % qemu-system-ppc $common_args -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda1 console=ttyPZ0,115200"
+
+* Use a graphic display:
+ % display_args="-display gtk -monitor stdio"
+ % common_args="$machine_args $disk_args $net_args $display_args"
+ % qemu-system-ppc $common_args -kernel boot/vmlinux-6.3.7-t2 -initrd boot/initrd-6.3.7-t2 -append "root=/dev/sda1"
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+New password: ********
+
+(PK) Install packages
+---------------------
+
+Nothing to do. If some packages are needed that are not on the CD-ROM,
+they can be compiled locally through
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f PACKAGE
+But that takes a long time.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.debian.org/PPC64
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2 (This version fixes a couple of 'Illegal instruction' in glibc math functions.)
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/ports/12.0/ppc64/debian-12.0.0-ppc64-NETINST-1.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 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+The best supported machine appears to be 'pseries'.
+% machine_args="-M pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off -cpu POWER8 -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net174: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: l-lan@71000002: index=0,type=nic,model=spapr-vlan,macaddr=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"
+% qemu-system-ppc64 $common_args -cdrom debian-12.0.0-ppc64-NETINST-1.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: powerpc64-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection: Keep enabled: SSH server.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an Open Firmware bootloader and a GRUB bootloader are installed.
+
+% qemu-system-ppc64 $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-ppc64 $common_args
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.alpinelinux.org/wiki/Ppc64le
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-5.0.0
+% PATH=$HOME/inst-qemu/5.0.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/ppc64le/alpine-standard-3.13.0-ppc64le.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 alpine.qcow2 9G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M pseries -cpu POWER8 -m 1024"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=alpine.qcow2,format=qcow2,if=scsi,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net174: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: l-lan@71000002: index=0,type=nic,model=spapr-vlan,macaddr=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-ppc64 $common_args -cdrom alpine-standard-3.13.0-ppc64le.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+It takes 1-5 minutes to boot.
+
+login: root
+
+Configure the networking in a preliminary way:
+# ifconfig -a
+shows network devices lo, eth0.
+Later I can customize /etc/network/interfaces. But now:
+# ifconfig lo up
+# ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
+# route add default gw 10.0.2.2
+# echo 'nameserver 10.0.2.3' > /etc/resolv.conf
+Test it:
+# wget http://www.gnu.org
+# rm index.html
+
+# setup-alpine
+keyboard layout: us
+variant: us
+hostname: powerpc64le-alpine
+interface [eth0]:
+ ip address: 10.0.2.15
+ netmask: 255.255.255.0
+ gateway: 10.0.2.2
+DNS domain name: MYDOMAINNAME
+DNS nameserver: 10.0.2.3
+root password: ********
+time zone: Europe/Berlin
+mirror: either http://ftp.halifax.rwth-aachen.de/alpine/ or f
+disk: sda
+partitioning scheme: sys
+
+# halt
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an Open Firmware bootloader is installed.
+
+% qemu-system-ppc64 $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-ppc64 $common_args
+
+login: root
+password: ********
+
+# apk update
+# apk add bash
+
+# adduser -s /bin/bash MY_USER_NAME
+Password: ********
+
+(PK) Install packages
+---------------------
+
+The list of packages is at https://pkgs.alpinelinux.org/packages
+
+# apk add make
+# apk add gcc g++
+# apk add gdb
+# apk add vim
+
+Edit /etc/apk/repositories, to enable the 'community' repository (next to 'main').
+# apk add emacs
+
+# apk add expect dejagnu dejagnu-dev
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://www.debian.org/ports/powerpc/index.en.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2 (This version fixes a couple of 'Illegal instruction' in glibc math functions.)
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdimage.debian.org/cdimage/release/12.0.0/ppc64el/iso-cd/debian-12.0.0-ppc64el-netinst.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 debian12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+The best supported machine appears to be 'pseries'.
+With only 512 MB, later an "Out of memory" error may occur.
+% machine_args="-M pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off -cpu POWER8 -m 1024"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian12.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net100: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: l-lan@71000002: index=0,type=nic,model=spapr-vlan,macaddr=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"
+% qemu-system-ppc64 $common_args -cdrom debian-12.0.0-ppc64el-netinst.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Language: English
+Location: United States
+Keyboard: American English
+Host name: powerpc64le-debian12
+Domain name: MYDOMAINNAME
+
+If you get asked for a Debian archive mirror at this point, it means that the
+CDROM was not recognized. Fix that problem first; this will avoid redownloading
+most of its contents.
+
+No root account.
+Full name: MY_FULL_NAME
+login: MY_USER_NAME
+password: ********
+
+Accept a dummy time zone.
+
+Partitioning: Entire disk. All files in one partition.
+
+Debian archive mirror: Germany, deb.debian.org
+Software selection: Keep enabled: SSH server.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an Open Firmware bootloader and a GRUB bootloader are installed.
+
+% qemu-system-ppc64 $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-ppc64 $common_args
+
+login as MY_USER_NAME
+$ sudo bash
+# timedatectl set-timezone Europe/Berlin
+# reboot
+
+(PK) Install packages
+---------------------
+
+login as MY_USER_NAME
+$ sudo bash
+# apt update
+# apt install make
+# apt install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt install vim-nox vim-doc
+# apt install emacs-nox emacs-el
+# apt install g++
+# apt install expect dejagnu
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+openSUSE Leap 15.2
+Download: https://get.opensuse.org/leap ppc64le Offline image.
+->
+https://ftp.gwdg.de/pub/opensuse/ports/ppc/distribution/leap/15.2/iso/openSUSE-Leap-15.2-DVD-ppc64le-Build314.3-Media.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 opensuse.qcow2 13G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off -cpu POWER8 -m 2048"
+
+The option '-m 2048' (for 2 GiB of RAM) is needed because the final phase
+of the YaST installer takes a lot of memory.
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=opensuse.qcow2,format=qcow2,if=scsi,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-display gtk -monitor stdio"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-ppc64 $common_args -cdrom openSUSE-Leap-15.2-DVD-ppc64le-Build314.3-Media.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Choose: Installation.
+
+It takes 1 minute to boot and a couple of minutes to start the YaST2 installer.
+
+List of online repositories: none anyway
+System role: KDE
+Partitioning:
+ Guided
+ Choose ext4 instead of btrfs.
+ /dev/vdb1 (8 MiB) PReP boot
+ /dev/vdb2 (9.99 GiB) ext4, /
+Time zone: Europe / Germany
+Local User:
+ Full name: MY_FULL_NAME
+ Username: MY_USER_NAME
+ Password: ********
+Settings: nothing to change
+Wait for the packages installation to complete.
+Wait 20 minutes while nothing visible happens.
+Wait for the bootloader installation to complete.
+It reboots.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a grub bootloader is installed.
+
+Keep the CD-ROM, for being able to install packages.
+
+% qemu-system-ppc64 $common_args -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+SUSE > System Settings > Workspace > Workspace Behavior > Screen Locking > Activation
+Lock screen: off
+Lock screen after waking: off
+
+SUSE > System Settings > Hardware > Power Management > Activity Settings
+Define a special behavior: Never turn off the screen
+
+SUSE > System Settings > Workspace > Window Management > Window Behavior > Focus
+Window activation policy: Focus follows mouse
+
+Power Off.
+
+(PK) Install packages
+---------------------
+
+SUSE > Applications > System > YaST Software
+Search: GNU Emacs, install emacs-x11
+Search: gcc, install gcc10-c++
+
+Or alternatively:
+$ sudo bash
+# cnf gcc
+# cnf gdb
+# cnf emacs
+# zypper install gcc10-c++
+# zypper install gdb
+# zypper install emacs
+
+Power Off.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-ppc.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+openSUSE Leap 15.2
+Download: https://get.opensuse.org/leap ppc64le Offline image.
+->
+https://ftp.gwdg.de/pub/opensuse/ports/ppc/distribution/leap/15.2/iso/openSUSE-Leap-15.2-DVD-ppc64le-Build314.3-Media.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 opensuse.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off -cpu POWER8 -m 2048"
+
+The option '-m 2048' (for 2 GiB of RAM) is needed because the final phase
+of the YaST installer takes a lot of memory.
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=opensuse.qcow2,format=qcow2,if=scsi,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+
+(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-ppc64 $common_args -cdrom openSUSE-Leap-15.2-DVD-ppc64le-Build314.3-Media.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Choose: Installation.
+
+It takes 1 minute to boot and a couple of minutes to start the YaST2 installer.
+
+List of online repositories: none anyway
+System role: Server
+Partitioning:
+ Guided
+ Choose ext4 instead of btrfs.
+ /dev/vdb1 (8 MiB) PReP boot
+ /dev/vdb2 (9.99 GiB) ext4, /
+Time zone: Europe / Germany
+Local User:
+ Full name: MY_FULL_NAME
+ Username: MY_USER_NAME
+ Password: ********
+Settings: nothing to change
+Wait for the packages installation to complete.
+Wait 8 minutes while nothing visible happens.
+Wait for the bootloader installation to complete.
+It reboots.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a grub bootloader is installed.
+
+Keep the CD-ROM, for being able to install packages.
+
+% qemu-system-ppc64 $common_args -cdrom openSUSE-Leap-15.2-DVD-aarch64-Build208.3-Media.iso
+
+$ sudo bash
+# zypper repos
+4 | repo-oss | Main Repository | Yes | (r ) Yes | Yes
+6 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes
+OK
+
+$ sudo halt
+Power Off.
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+# cnf gcc
+# cnf gdb
+# cnf emacs
+# zypper install gcc10-c++
+# zypper install gdb
+# zypper install emacs
+
+# halt
+Power Off.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-riscv.html
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+Development source code:
+https://github.com/riscv
+https://riscv.org/software-status/
+
+Distros:
+https://wiki.debian.org/RISC-V
+https://fedoraproject.org/wiki/Architectures/RISC-V
+https://github.com/rwmjones/fedora-riscv-bootstrap/blob/master/README
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+% wget -r -l 1 https://fedorapeople.org/groups/risc-v/disk-images/
+% xz -d < disk-images/stage4-disk.img.xz > stage4-disk.img
+% qemu-img convert -f raw -O qcow2 stage4-disk.img stage4-disk.qcow2
+
+(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
+-----------------------------------------------------------------
+
+This is not needed in this case; we have a disk image already.
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-machine virt -m 2G"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-device virtio-blk-device,drive=hd0 -drive file=stage4-disk.qcow2,format=qcow2,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-device virtio-net-device,netdev=usernet -netdev user,id=usernet"
+This provides an ethernet interface:
+(qemu) info network
+virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56
+ \ usernet: index=0,type=user,net=10.0.2.0,restrict=off
+
+(RN) Choose the random-number generator arguments
+-------------------------------------------------
+
+% rng_args="-device virtio-rng-device,rng=rng0 -object rng-random,filename=/dev/urandom,id=rng0"
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-nographic"
+
+(B2) Boot from the disk
+-----------------------
+
+This needs a -kernel option, since no bootloader is installed.
+
+% common_args="$machine_args $disk_args $net_args $rng_args $display_args"
+
+Resize the terminal to 80x24.
+
+% qemu-system-riscv64 $common_args -kernel disk-images/bbl -append "console=ttyS0 ro root=/dev/vda"
+
+login: root
+password: riscv
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+
+login: MY_USER_NAME
+password: ********
+
+Edit /etc/crypto-policies/back-ends/openssh.config
+to remove unsupported 'GSSAPIKexAlgorithms' option.
+Edit /etc/ssh/ssh_config.d/05-redhat.conf
+to remove unsupported 'GSSAPIAuthentication' option.
+
+(PK) Install packages
+---------------------
+
+
+Notes
+-----
+
+After every boot:
+# date MMDDhhmmYYYY (in UTC)
+
+Bugs:
+- Building mpfr-4.2.1-rc1 works only with --disable-shared.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-s390x.html
+https://wiki.qemu.org/Documentation/Platforms/S390X
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.alpinelinux.org/wiki/S390x/Installation
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2.
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/s390x/alpine-standard-3.13.0-s390x.iso
+ https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/s390x/netboot-3.13.0/vmlinuz-lts
+ https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/s390x/netboot-3.13.0/initramfs-lts
+ https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/s390x/alpine-netboot-3.13.0-s390x.tar.gz
+
+Now:
+Download: https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/alpine-standard-3.19.0-s390x.iso
+ https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/netboot-3.19.0/vmlinuz-lts
+ https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/netboot-3.19.0/initramfs-lts
+ https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/alpine-netboot-3.19.0-s390x.tar.gz
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+This is not needed in this case; we downloaded the kernel and initial RAM disk
+separately.
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 alpine.qcow2 9G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M s390-ccw-virtio -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-device virtio-blk-ccw,drive=hd0 -drive file=alpine.qcow2,format=qcow2,if=none,id=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-device virtio-net-ccw,netdev=net0,mac=52:54:00:71:f3:5c,devno=fe.0.0001 -netdev user,id=net0"
+
+(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-s390x $common_args -cdrom alpine-standard-3.19.0-s390x.iso -boot d
+This does not work: The CD-ROM is not bootable.
+Explanation: "The first problem is that QEMU’s firmware for the s390x guests can not directly boot the ISO images yet, since the images have been built without the so-called El-Torito boot information, which is required for bootable images here. ... you still have to fetch the kernel and initrd images from the ISO image and specify them with the --kernel and --initrd parameters when running QEMU."
+
+So, use netboot, as it does not rely on a bootable CDROM.
+% qemu-system-s390x $common_args \
+ -kernel vmlinuz-lts -initrd initramfs-lts \
+ -append "ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/v3.19/main modloop=http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/s390x/netboot/modloop-lts"
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+login: root
+
+# ifconfig -a
+shows network devices lo, eth0.
+
+# setup-alpine
+keyboard layout: us
+variant: us
+hostname: s390x-alpine
+interface [eth0]:
+ ip address: 10.0.2.15
+ netmask: 255.255.255.0
+ gateway: 10.0.2.2
+DNS domain name: MYDOMAINNAME
+DNS nameserver: 10.0.2.3
+root password: ********
+time zone: Europe/Berlin
+mirror: either http://ftp.halifax.rwth-aachen.de/alpine/ or f
+disk: vda
+partitioning scheme: sys
+
+# halt
+
+(B2) Boot from the installed disk
+---------------------------------
+
+% qemu-system-s390x $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-s390x $common_args
+
+login: root
+password: ********
+
+# apk update
+# apk add bash
+
+# adduser -s /bin/bash MY_USER_NAME
+Password: ********
+
+(PK) Install packages
+---------------------
+
+The list of packages is at https://pkgs.alpinelinux.org/packages
+
+# apk add make
+# apk add gcc g++
+# apk add gdb
+# apk add vim
+
+Edit /etc/apk/repositories, to enable the 'community' repository (next to 'main').
+# apk add emacs
+
+# apk add expect dejagnu dejagnu-dev
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-s390x.html
+https://wiki.qemu.org/Documentation/Platforms/S390X
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use at least qemu-4.1.0 (earlier versions such as 2.9.0 hang when building gmp).
+% PATH=$HOME/inst-qemu/6.1.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+We don't use a CD-ROM image, only a kernel + initrd.
+
+% mkdir boot-for-install
+% (cd boot-for-install
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-s390x/current/images/generic/kernel.debian
+ wget ftp://ftp.de.debian.org/pub/debian/dists/jessie/main/installer-s390x/current/images/generic/initrd.debian)
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian86.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M s390-ccw-virtio -m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian86.qcow2,if=none,format=raw,id=hd0 -device virtio-blk-ccw,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-netdev user,id=net0 -device virtio-net-ccw,netdev=net0,mac=52:54:00:71:f3:5c,devno=fe.0.0001"
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-display gtk -monitor stdio"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-s390x $common_args \
+ -kernel boot-for-install/kernel.debian -initrd boot-for-install/initrd.debian
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Network device: virtio
+IP address: 10.0.2.15
+Netmask: 255.255.255.0
+Gateway: 10.0.2.2
+Name server: 10.0.2.3
+
+Host name: s390x-debian8
+Domain name: MYDOMAINNAME
+Remote installation password: ******** (never used)
+
+No root account.
+login: MY_USER_NAME
+password: ********
+
+Disk: vda
+Partition: yes
+Free space to partition: pri/log
+Create a new partition.
+ 0.2 GB, Primary, /boot
+ 9.5 GB, Primary, /
+ 1 GB, Primary, swap area
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, in order to tell the kernel which is the root device.
+
+http://superuser.com/questions/344899/how-can-i-mount-a-disk-image
+% qemu-img convert -f qcow2 -O raw debian86.qcow2 debian86.img
+a)
+% sudo kpartx -av debian86.img
+% sudo mount -r -t ext4 /dev/mapper/loop0p1 /mnt
+% mkdir boot
+% (cd /mnt && sudo tar cf - --exclude=lost+found .) | (cd boot && tar xvf -)
+% sudo umount /mnt
+% sudo kpartx -dv debian86.img
+b)
+(fdisk shows the offset as 2048*512. hd shows the offset is 0x100000 bytes. But mount option 'offset' requires it in bytes, not sectors.)
+% sudo mount -r -o loop,offset=1048576 -t ext4 debian86.img /mnt
+% (cd /mnt && tar cf - boot) | tar xvf -
+% sudo umount /mnt
+
+% qemu-system-s390x $common_args \
+ -kernel boot/vmlinuz -initrd boot/initrd.img -append "root=/dev/vda2"
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+
+Restore ability to install precompiled packages:
+Edit /etc/apt/sources.list, replacing http://ftp.de.debian.org/debian/
+with http://ftp.de.debian.org/debian-archive/debian/
+
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs-nox emacs24-el
+# apt-get install libc6-dev-s390
+# apt-get install g++
+# apt-get install expect dejagnu
+
+
+Notes
+-----
+
+"make check" of gmp-6.2.0 in 64-bit mode hangs. (with qemu-2.9.0)
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-s390x.html
+https://wiki.qemu.org/Documentation/Platforms/S390X
+https://www.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.2.0-rc0 (to fix <https://gitlab.com/qemu-project/qemu/-/issues/1865>).
+% PATH=$HOME/inst-qemu/8.2.0-rc0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+openSUSE Leap 15.5
+Download: https://get.opensuse.org/leap/15.5/#download
+-> https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-s390x-Media.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 opensuse.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-M s390-ccw-virtio -m 2048"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=opensuse.qcow2,format=qcow2,if=none,id=hd0 -device virtio-blk-ccw,drive=hd0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args="-netdev user,id=net0 -device virtio-net-ccw,netdev=net0,mac=52:54:00:71:f3:5c,devno=fe.0.0001"
+
+(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-s390x $common_args -cdrom openSUSE-Leap-15.5-DVD-s390x-Media.iso
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+VLAN ID: <Enter> 1 <Enter>
+Display type: 2
+
+List of online repositories: Keep only Main Update and Main repositories.
+System role: Server
+Partitioning:
+ Accept the default, because the Guided Setup does not propose a /boot/zipl partition.
+ /dev/vda1 (300 MiB) ext2, /boot/zipl
+ /dev/vda2 (9.71 GiB) btrfs, /
+Time zone: Europe / Germany
+Local User:
+ Full name: MY_FULL_NAME
+ Username: MY_USER_NAME
+ Password: ********
+Settings: nothing to change
+Wait for the packages installation to complete.
+Wait 34 minutes while nothing visible happens.
+Wait for the bootloader installation to complete.
+It shuts down.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a grub bootloader is installed.
+
+Keep the CD-ROM, for being able to install packages.
+
+% qemu-system-s390x $common_args -cdrom openSUSE-Leap-15.5-DVD-s390x-Media.iso
+
+$ sudo bash
+# zypper repos
+The repositories that I turned off are enabled again!
+# zypper modifyrepo --disable repo-backports-update
+# zypper modifyrepo --disable repo-non-oss
+# zypper modifyrepo --disable repo-openh264
+# zypper modifyrepo --disable repo-sle-update
+# zypper modifyrepo --disable repo-update-non-oss
+# zypper repos
+10 | repo-oss | Main Reposi-> | Yes | (r ) Yes | Yes
+14 | repo-update | Main Update-> | Yes | (r ) Yes | Yes
+Now it's OK.
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+# cnf gcc
+# cnf gdb
+# cnf emacs
+# zypper install gcc10-c++
+# zypper install gdb
+# zypper install emacs
+# zypper install make
+
+# halt
+Power Off.
--- /dev/null
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+
+https://www.qemu.org/docs/master/system/target-sparc.html
+https://wiki.qemu.org/Documentation/Platforms/SPARC
+https://wiki.qemu.org/Hosts/BSD
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.12.0
+% PATH=$HOME/inst-qemu/2.12.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: originally https://cdn.netbsd.org/pub/NetBSD/iso/7.1/NetBSD-7.1-sparc.iso
+now: http://archive.netbsd.org/pub/NetBSD-archive/NetBSD-7.1/iso/NetBSD-7.1-sparc.iso
+ https://ftp.uni-hannover.de/netbsd/iso/7.1/NetBSD-7.1-sparc.iso
+ https://mirror.dimensiondata.com/mirrors/NetBSD/iso/7.1/NetBSD-7.1-sparc.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 netbsd71.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-m 256"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=netbsd71.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: user.0: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: lance.0: index=0,type=nic,model=lance,macaddr=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"
+% qemu-system-sparc $common_args -cdrom NetBSD-7.1-sparc.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Enter:
+- 1) cdrom
+- CD-ROM [/dev/cd0a]:
+- Path to instfs.tgz
+- [vt100] xterm
+- (I)install/Upgrade: I
+- a: in English
+- a: to hard disk
+- b: Yes
+- a: sd0
+- a: Set sizes
+- /: 9983 MB, swap: 256 MB, x
+- Partition sizes OK
+- disk name
+- b: Yes
+- b: Installation without X11
+- a: CD-ROM
+- enter
+- a: configure network
+ le0
+ Host name: sparc-netbsd7
+ DNS domain: MYDOMAINNAME
+ IPv4 address: 10.0.2.15
+ IPv4 netmask: 0xffffff00
+ IPv4 gateway: 10.0.2.2
+ Name server: 10.0.2.3
+ Install in /etc: Yes
+- b: timezone
+ Europe/Berlin
+- d: root password
+ Yes
+ New password: ********
+- g: sshd
+ YES
+- h: ntpd
+ YES
+- i: ntpdate at boot
+ YES
+- o: user
+ name: MY_USER_NAME
+ Yes
+ /bin/sh
+ New password: ********
+- x: Finished configuring
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an OpenBIOS bootloader is installed.
+% qemu-system-sparc $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-sparc $common_args
+
+(PK) Install packages
+---------------------
+
+The list of packages is at http://www.pkgsrc.se/
+and http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/sparc64/7.1/All/
+(no longer available).
+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/`uname -m`/7.1/All
+Logout.
+
+# pkg_add bash
+# pkg_add gmake
+# pkg_add vim
+# pkg_add emacs-nox11
--- /dev/null
+(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://wiki.freebsd.org/QemuRecipes
+https://wiki.qemu.org/Hosts/BSD
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-5.0.0
+% PATH=$HOME/inst-qemu/5.0.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-sparc64-dvd1.iso.xz
+Uncompress it:
+% xz -d FreeBSD-12.2-RELEASE-sparc64-dvd1.iso.xz
+-> FreeBSD-12.2-RELEASE-sparc64-dvd1.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 freebsd12.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=freebsd12.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
+
+(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"
+% qemu-system-sparc64 $common_args -cdrom FreeBSD-12.2-RELEASE-sparc64-dvd1.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Console type: xterm
+<Install>
+Continue with default keymap
+Hostname: sparc64-freebsd12.MYDOMAINNAME
+Optional system components: base-dbg ports
+Partition: Manual
+ Auto
+ Entire disk
+ Sun VTOC8
+ Finish
+Wait...
+Root password: ********
+Network interface:
+ IPv4: yes, DHCP
+ IPv6: no
+Clock UTC: yes
+Region: Europe, Germany, Germany
+Services: ntpd
+Hardening: none
+
+Reboot.
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an OpenBIOS bootloader is installed.
+
+% qemu-system-sparc64 $common_args
+
+Login in as root.
+
+Reboot, since the file system is not stable yet.
+
+(PK) Install packages
+---------------------
+
+# pkg search bash => Not found.
+Indeed, http://pkg.freebsd.org/ does not have anything for sparc64.
+So, following https://www.freebsd.org/doc/handbook/ports-using.html :
+# cd /usr/ports/shells/bash
+# make install
+=> Takes hours and does not complete because of a dependency chain
+ bash -> bison -> m4 -> texinfo -> help2man -> p5-Locale-gettext
+Retry:
+# cd /usr/ports/ports-mgmt/pkg
+# make install
+# cd /usr/ports/devel/m4
+# make install
+# cd /usr/ports/devel/bison
+# make install
+# cd /usr/ports/shells/bash
+# make install
+=> Takes hours again.
+
+Remove nonsensical symlink.
+# rm /home
+
+Add account:
+# adduser
+Username: MY_USER_NAME
+Full name: MY_FULL_NAME
+Invite MY_USER_NAME into other groups? wheel
+Shell: sh
+=>
+login: MY_USER_NAME
+password: ********
+
+Edit ~/.profile to set TERM=xterm (since qemu's 'gtk' display is based on vte):
+# env TERM=xterm vi /etc/profile .cshrc
+In /etc/profile, add
+ TERM=xterm
+ export TERM
+In .cshrc, add
+ setenv TERM xterm
+
+Edit /etc/passwd: Change root's shell to /bin/sh.
+
+At boot time, there are problems with the file system. Need to run
+# fsck -y
+
+Mount /proc:
+Edit /etc/fstab as indicated in
+https://www.freebsd.org/cgi/man.cgi?query=procfs&sektion=&n=1
+
+
+Notes
+-----
+
+GNU libsigsegv does not work:
+checking if the system supports catching SIGSEGV... no
+checking if the system supports catching stack overflow... no
+
+GNU mpfr does not work: 117 test failures.
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+https://wiki.debian.org/Sparc64
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-2.9.0
+% PATH=$HOME/inst-qemu/2.9.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://people.debian.org/~glaubitz/debian-cd/2016-12-13/debian-9.0-sparc64-NETINST-1.iso
+(no longer available)
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 debian90.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-m 512 -vga none"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=debian90.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+is not OK. It yields:
+(qemu) info network
+hub 0
+ \ hub0port1: user.0: index=0,type=user,net=10.0.2.0,restrict=off
+ \ hub0port0: ne2k_pci.0: index=0,type=nic,model=ne2k_pci,macaddr=52:54:00:12:34:56
+
+Instead use:
+% net_args="-netdev user,id=hostnet0 -device virtio-net-pci,disable-modern=off,disable-legacy=off,disable-modern=on,netdev=hostnet0"
+It yields:
+(qemu) info network
+virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
+ \ hostnet0: index=0,type=user,net=10.0.2.0,restrict=off
+
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-nographic"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% qemu-system-sparc64 $common_args -cdrom debian-9.0-sparc64-NETINST-1.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Host name: sparc64-debian9
+Domain name: MYDOMAINNAME
+
+No root account.
+login: MY_USER_NAME
+password: ********
+
+But I cannot boot. "Cannot find /etc/silo.conf" Solution:
+- Make a boot partition at the beginning of the disk, max. 1 GB large.
+ See http://www.justskins.com/forums/fun-installing-debian-in-219272.html
+
+Partitioning:
+ Manual.
+ - /dev/sda1: 250 MB, ext2, /boot, bootable: true
+ - /dev/sda2: 9.5 GB, ext4, /
+ - Rest: swap
+
+# fdisk -l
+Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
+Geometry: 255 heads, 63 sectors/track, 1305 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disklabel type: sun
+
+Device Start End Sectors Size Id Type Flags
+/dev/sda1 0 481949 481950 235.3M 1 Boot
+/dev/sda2 481950 19037024 18555075 8.9G 83 Linux native
+/dev/sda3 0 20964824 20964825 10G 5 Whole disk
+/dev/sda4 19037025 20964824 1927800 941.3M 82 Linux swap
+
+# ls -l `find /dev/ -type l` | grep sda1
+lrwxrwxrwx 1 root root 7 Jan 24 16:25 /dev/block/8:1 -> ../sda1
+lrwxrwxrwx 1 root root 10 Jan 24 16:25 /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part1 -> ../../sda1
+lrwxrwxrwx 1 root root 10 Jan 24 16:25 /dev/disk/by-path/platform-ffe2d650-pci-0000:00:05.0-ata-1-part1 -> ../../sda1
+
+# ls -l /target/boot
+-rw-r--r-- 1 root root 2245942 Apr 30 2016 System.map-4.5.0-2-sparc64
+lrwxrwxrwx 1 root root 1 Jan 24 17:06 boot -> .
+-rw-r--r-- 1 root root 126918 Apr 30 2016 config-4.5.0-2-sparc64
+lrwxrwxrwx 1 root root 1 Jan 24 17:06 etc -> .
+-rw-r--r-- 1 root root 1024 Jan 22 2016 fd.b
+-rw-r--r-- 1 root root 512 Jan 22 2016 first.b
+-rw-r--r-- 1 root root 1024 Jan 22 2016 generic.b
+-rw-r--r-- 1 root root 800 Jan 22 2016 ieee32.b
+lrwxrwxrwx 1 root root 26 Jan 24 16:46 initrd.img -> initrd.img-4.5.0-2-sparc64
+-rw-r--r-- 1 root root 16041790 Jan 24 16:48 initrd.img-4.5.0-2-sparc64
+-rw-r--r-- 1 root root 6752 Jan 22 2016 isofs.b
+drwx------ 2 root root 12288 Jan 24 16:25 lost+found
+-rw-r--r-- 1 root root 7680 Jan 24 17:06 old.b
+-rw-r--r-- 1 root root 53760 Jan 24 17:06 second.b
+-rw-r--r-- 1 root root 172 Jan 24 17:06 silo.conf
+-rw-r--r-- 1 root root 51437 Jan 22 2016 silotftp.b
+-rw-r--r-- 1 root root 512 Jan 22 2016 ultra.b
+lrwxrwxrwx 1 root root 23 Jan 24 16:46 vmlinuz -> vmlinuz-4.5.0-2-sparc64
+-rw-r--r-- 1 root root 3526042 Apr 30 2016 vmlinuz-4.5.0-2-sparc64
+
+# mount
+/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
+/dev/sda1 on /boot type ext2 (rw,relatime,block_validity,barrier,user_xattr,acl)
+...
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an OpenBIOS bootloader is installed.
+
+% qemu-system-sparc64 $common_args -boot c
+
+But now the network is still not available.
+
+# ifconfig -a
+enp0s4: flags=4098<BROADCAST,MULTICAST> mtu 1500
+ ether 52:54:00:12:34:56 txqueuelen 1000 (Ethernet)
+ RX packets 0 bytes 0 (0.0 B)
+ RX errors 0 dropped 0 overruns 0 frame 0
+ TX packets 0 bytes 0 (0.0 B)
+ TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
+
+lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
+ inet 127.0.0.1 netmask 255.0.0.0
+ inet6 ::1 prefixlen 128 scopeid 0x10<host>
+ loop txqueuelen 1 (Local Loopback)
+ RX packets 0 bytes 0 (0.0 B)
+ RX errors 0 dropped 0 overruns 0 frame 0
+ TX packets 0 bytes 0 (0.0 B)
+ TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
+
+# ip link show
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
+ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+2: enp0s4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
+ link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
+
+# ip a
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
+ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+ inet 127.0.0.1/8 scope host lo
+ valid_lft forever preferred_lft forever
+ inet6 ::1/128 scope host
+ valid_lft forever preferred_lft forever
+2: enp0s4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
+ link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
+
+# lspci
+00:01.0 PCI bridge: Oracle/SUN Simba Advanced PCI Bridge (rev 11)
+00:01.1 PCI bridge: Oracle/SUN Simba Advanced PCI Bridge (rev 11)
+00:02.0 Bridge: Oracle/SUN EBUS (rev 01)
+00:03.0 IDE interface: Silicon Image, Inc. PCI0646 (rev 07)
+00:04.0 Ethernet controller: Red Hat, Inc Virtio network device
+
+# ls -l /sys/class/net/
+total 0
+lrwxrwxrwx 1 root root 0 Jan 28 02:35 enp0s4 -> ../../devices/root/ffe2d650/pci0000:00/0000:00:04.0/virtio0/net/enp0s4
+lrwxrwxrwx 1 root root 0 Jan 28 02:35 lo -> ../../devices/virtual/net/lo
+
+# cat /proc/net/dev
+Inter-| Receive | Transmit
+ face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
+ lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+enp0s4: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+
+# lsmod | grep virt
+virtio_net 24168 0
+virtio_pci 14583 0
+virtio_ring 12099 2 virtio_net,virtio_pci
+virtio 6188 2 virtio_net,virtio_pci
+
+# cat -n /etc/network/interfaces
+ 1 # This file describes the network interfaces available on your system
+ 2 # and how to activate them. For more information, see interfaces(5).
+ 3
+ 4 source /etc/network/interfaces.d/*
+ 5
+ 6 # The loopback network interface
+ 7 auto lo
+ 8 iface lo inet loopback
+ 9
+ 10 # The primary network interface
+ 11 allow-hotplug enp0s5
+ 12 iface enp0s5 inet dhcp
+
+Fix: Edit /etc/network/interfaces, to mention enp0s4 instead of enp0s5.
+
+Networking not working!
+It's a DNS problem. /etc/resolv.conf contains: "nameserver fec0::3"
+Replace it with: "nameserver 8.8.8.8"
+This works temporarily.
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844592
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844566
+Workaround: Disable IPv6 through
+# echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/01-disable-ipv6.conf
+See https://www.thomas-krenn.com/de/wiki/IPv6_deaktivieren
+
+(PK) Install packages
+---------------------
+
+$ sudo bash
+Edit /etc/apt/sources.list, see https://wiki.debian.org/Sparc64
+# apt-get update
+# apt-get install make
+# apt-get install gcc binutils-doc glibc-doc libc-dbg gdb
+# apt-get install vim-nox vim-doc
+# apt-get install emacs-nox emacs24-el
+# apt-get install libc6-dev-sparc
+# apt-get install g++
+
+
+Notes
+-----
+
+Replaced "-m 512" with "-m 2048". The original 0.5 GB RAM + 1 GB swap
+were not enough to compile GNU poke 2.90.0 in 32-bit mode.
--- /dev/null
+(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.kernel.org/doc/html/v6.6/admin-guide/kernel-parameters.html
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-8.1.2
+% PATH=$HOME/inst-qemu/8.1.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://dl.t2sde.org/binary/2023/t2-23.10-sparc6432-minimal-desktop-gcc-glibc.iso
+
+(XK) Extract the kernel from the CD-ROM or DVD image
+----------------------------------------------------
+
+% sudo mount -r -t iso9660 -o loop t2-23.10-sparc6432-minimal-desktop-gcc-glibc.iso /mnt
+% mkdir boot
+% cp -a /mnt/boot/* boot/
+% sudo umount /mnt
+
+(CD) Create an empty disk image to be used by the virtual machine
+-----------------------------------------------------------------
+
+% qemu-img create -f qcow2 t2sde.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+On this platform, more system calls can get interrupted (EINTR)
+than on other Linux platforms. In particular, we get a "short write"
+while extracting second stage file system if we specify only "-m 1024".
+This is probably a bug in the initrd's 'cat', 'mv', and 'tar' programs.
+So, as a workaround:
+% machine_args="-m 2048"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=t2sde.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(qemu) info network
+hub 0
+ \ hub0port1: #net109: 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
+
+(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 \
+ -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 \
+ -cdrom t2-23.10-sparc6432-minimal-desktop-gcc-glibc.iso
+works; the CD-ROM device is:
+(qemu) info block
+...
+ide1-cd0 (#block387): t2-23.10-sparc6432-minimal-desktop-gcc-glibc.iso (raw, read-only)
+ Attached to: /machine/unattached/device[19]
+ Removable device: not locked, tray closed
+ Cache mode: writeback
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Serial terminal: <Enter> or console
+# install
+Keyboard: us
+Partition: Automatic, classic partitions.
+File system on /dev/sda1: ext4
+ Proceed anyway: y
+Install the system
+Start gasgui Package Manager
+Full install (all packages).
+Keyboard: us
+Root password: ********
+Time zone: Europe/Berlin
+Locale: en_US.UTF-8
+Generated /boot/grub/grub.cfg:
+ menuentry "T2/Linux" {
+ linux /boot/vmlinux-6.6.3-t2 root=/dev/disk/by-uuid/6191b4f7-31be-4b8a-8a8a-a545cb286a8b ro resume=/dev/disk/by-uuid/c5f7d2b5-ff7a-4c09-880e-864b85cc52b4 console=ttyS0 initrd /boot/initrd-6.6.3-t2
+ }
+Error: grub2-install: error: unknown filesystem.
+Therefore: <Back>
+Generated /boot/silo.conf:
+ root=/dev/sda1
+ image=/boot/vmlinuz-6.6.3-t2
+ label=linux root=/dev/sda1 initrd=/boot/initrd-6.6.3-t2 read-only
+Again: <Back>
+Network configuration: Configure eth0 through DHCP. <Back>.
+SSH daemon configuration: <Back>.
+System init configuration: Default runlevel 3. <Back>.
+Then: <Exit>
+# halt
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This needs a -kernel option, since no bootloader is installed.
+% qemu-system-sparc64 $common_args
+does not boot:
+--------------------------------------------------------------------------------
+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
+Loading a.out image...
+Loaded 7680 bytes
+entry point is 0x4000
+SILO Version 1.4.14
+
+Cannot find /boot/silo.conf (error: 4294967295)
+
+Couldn't load /boot/silo.conf
+No config file loaded, you can boot just from this command line
+Type [prompath;]part/path_to_image [parameters] on the prompt
+E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
+or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
+boot:
+--------------------------------------------------------------------------------
+
+So, use:
+% qemu-system-sparc64 $common_args -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "root=/dev/sda1"
+
+It boots, but there is no login prompt. There are two possible fixes for this situation:
+
+* Tell the kernel about the console device, so that a 'getty' process gets spawned for it.
+ (See also the generated grub.cfg, above.)
+ % qemu-system-sparc64 $common_args -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "root=/dev/sda1 console=ttyS0,115200"
+
+* Use a graphic display:
+ % display_args="-display gtk -monitor stdio"
+ % common_args="$machine_args $disk_args $net_args $display_args"
+ % qemu-system-sparc64 $common_args -kernel boot/vmlinux-6.6.3-t2 -initrd boot/initrd-6.6.3-t2 -append "root=/dev/sda1"
+ But this mode is rather useless, since typing into the VGA window has
+ no effect, and the serial0 window merely displays what the console would
+ show.
+
+# useradd -d /home/MY_USER_NAME -m -U -u 1000 -G wheel MY_USER_NAME
+# passwd MY_USER_NAME
+New password: ********
+
+(PK) Install packages
+---------------------
+
+Nothing to do. If some packages are needed that are not on the CD-ROM,
+they can be compiled locally through
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f PACKAGE
+But that takes a long time.
+
+
+Notes
+-----
+
+"gcc" produces 32-bit binaries. "gcc -m64" produces 64-bit binaries.
+
+But the machine is not usable for several reasons:
+
+1) After a couple of hours of run time, there is no available memory any more:
+
+$ free
+ total used free shared buff/cache available
+Mem: 2056072 1996384 30744 16 86008 59688
+Swap: 514072 6208 507864
+
+2) gdb is broken:
+
+$ gdb --help
+../../gdb/arch-utils.c:753: internal-error: initialize_current_architecture: Selection of initial architecture failed
+A problem internal to GDB has been detected,
+further debugging may prove unreliable.
+----- Backtrace -----
+0x7010f43b ???
+0x704eba53 ???
+0x704ebe9b ???
+0x705f884f ???
+0x700c8257 ???
+0x7049c6ab ???
+0x7032d6ff ???
+0x7032e893 ???
+0x7006436b ???
+0xf7247937 __libc_start_call_main
+0xf7247a3b __libc_start_main@@GLIBC_2.34
+0x700641bb ???
+---------------------
+
+This is a bug, please report it. For instructions, see:
+<https://www.gnu.org/software/gdb/bugs/>.
+
+Aborted (core dumped)
+
+Try: Install gdb from source:
+# cd /usr/src/t2-src
+# svn update
+# scripts/Emerge-Pkg -f gdb
+ (takes 05:09:15 to build perl,
+ 03:21:51 to build python,
+ 13:58:35 to build gdb)
+Did not help.
+
+3) A configure test hangs (not reproducible):
+checking whether chown always updates ctime...
+
+4) After a certain time, all new files have the same time stamp.
+-rw-r--r-- 1 bruno bruno 5088 2023-12-03 10:11:42.172000000 +0100 gettime-res.o
+-rw-r--r-- 1 bruno bruno 5460 2023-12-03 10:11:44.692000000 +0100 getugroups.o
+-rw-r--r-- 1 bruno bruno 9196 2023-12-03 10:11:48.088000000 +0100 getumask.o
+-rw-r--r-- 1 bruno bruno 5868 2023-12-03 10:11:55.536000000 +0100 yesno.o
+-rw-r--r-- 1 bruno bruno 6692 2023-12-03 10:11:55.536000000 +0100 xvasprintf.o
+-rw-r--r-- 1 bruno bruno 20028 2023-12-03 10:11:55.536000000 +0100 xstrtoumax.o
+-rw-r--r-- 1 bruno bruno 14048 2023-12-03 10:11:55.536000000 +0100 xstrtoul.o
+-rw-r--r-- 1 bruno bruno 19860 2023-12-03 10:11:55.536000000 +0100 xstrtoull.o
+-rw-r--r-- 1 bruno bruno 15612 2023-12-03 10:11:55.536000000 +0100 xstrtol.o
+...
+
+5) In 64-bit mode, the compilation of mktime.c crashes:
+depbase=`echo mktime.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
+gcc -m64 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC -DEXEEXT=\"\" -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1 -I/home/bruno/prefix64/include -Wall -fvisibility=hidden -g -O2 -MT mktime.o -MD -MP -MF $depbase.Tpo -c -o mktime.o ../../gllib/mktime.c &&\
+mv -f $depbase.Tpo $depbase.Po
+during GIMPLE pass: slp
+../../gllib/mktime.c: In function 'ranged_convert':
+../../gllib/mktime.c:271:1: internal compiler error: Bus error
+ 271 | ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *),
+ | ^~~~~~~~~~~~~~
+0x1303c37 internal_error(char const*, ...)
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+0xf732fc03 __rt_sigreturn_stub
+ ???:0
+Please submit a full bug report, with preprocessed source (by using -freport-bug).
+Please include the complete backtrace with any bug report.
+See <https://gcc.gnu.org/bugs/> for instructions.
+make[4]: *** [Makefile:11320: mktime.o] Error 1
--- /dev/null
+(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://wiki.qemu.org/Hosts/BSD
+https://gunkies.org/wiki/Installing_NetBSD_6.1.5_Sparc64_on_Qemu
+
+(QV) Choose a QEMU version
+--------------------------
+
+Use qemu-3.1.0
+% PATH=$HOME/inst-qemu/3.1.0/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: http://cdn.netbsd.org/pub/NetBSD/iso/8.0/NetBSD-8.0-sparc64.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 netbsd80.qcow2 10G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-m 512"
+
+(DI) Choose the disk arguments
+------------------------------
+
+% disk_args="-drive file=netbsd80.qcow2,format=qcow2,index=0"
+
+(NW) Choose the network arguments
+---------------------------------
+
+% net_args=""
+This provides an ethernet interface:
+(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
+
+(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"
+% qemu-system-sparc64 $common_args -cdrom NetBSD-8.0-sparc64.iso -boot d
+
+(IN) Perform the steps of the installer
+---------------------------------------
+
+Enter:
+- Terminal type: xterm
+- a: in English
+- a: to hard disk
+- b: Yes
+- a: wd0
+- a: Set sizes
+- /: 9727 MB, swap: 512 MB, x
+- Partition sizes OK
+- disk name
+- b: Yes
+- b: Installation without X11
+- a: CD-ROM
+- enter
+- a: configure network
+ hme0
+ Autoconfiguration: Yes
+ DNS domain: MYDOMAINNAME
+ Check values:
+ Nameserver: 10.0.2.3
+ Host IP: 10.0.2.15
+ Netmask: 255.255.255.0
+ IPv4 Gateway: 10.0.2.2
+ But the host name is not right. So:
+ Autoconfiguration: No
+ Host name: sparc64-netbsd8
+ DNS domain: MYDOMAINNAME
+ Your IPv4 address: 10.0.2.15
+ IPv4 netmask: 255.255.255.0
+ IPv4 gateway: 10.0.2.2
+ DNS server: 10.0.2.3
+ Install in /etc: Yes
+- b: timezone
+ Europe/Berlin
+- d: root password
+ Yes
+ New password: ********
+- g: sshd
+ YES
+- h: ntpd
+ YES
+- i: ntpdate at boot
+ YES
+- o: Add a user
+ user: MY_USER_NAME, group wheel, /bin/sh
+ password: ********
+- x: Finished configuring
+- d: Reboot
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since an OpenBIOS bootloader is installed.
+
+% qemu-system-sparc64 $common_args
+
+Edit ~/.profile: Set TERM to vt100.
+
+(PK) Install packages
+---------------------
+
+The list of packages is at http://www.pkgsrc.se/
+and http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/sparc64/8.0/All/
+(no longer available).
+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/`uname -m`/8.0/All
+Logout.
+
+# pkg_add bash
+# pkg_add gmake
+# pkg_add vim
+# pkg_add emacs-nox11
-Use https://cdn.openbsd.org/pub/OpenBSD/7.3/amd64/install73.iso -> OpenBSD-7.3-amd64-install.iso.
+(DR) Collect pointers to documentation and references
+-----------------------------------------------------
+https://www.qemu.org/docs/master/system/target-i386.html
+https://wiki.qemu.org/Hosts/BSD
+
+(QV) Choose a QEMU version
+--------------------------
Use qemu-8.0.2
-PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+% PATH=$HOME/inst-qemu/8.0.2/bin:$PATH
+
+(DL) Download an installation CD-ROM or DVD image
+-------------------------------------------------
+
+Download: https://cdn.openbsd.org/pub/OpenBSD/7.3/amd64/install73.iso
+-> OpenBSD-7.3-amd64-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 vmdk openbsd73.vmdk 8G
+
+(MA) Choose the machine arguments
+---------------------------------
+
+% machine_args="-enable-kvm -m 1024"
+
+(DI) Choose the disk arguments
+------------------------------
-Create empty disk:
-qemu-img create -f vmdk openbsd73.vmdk 8G
+% disk_args="-device virtio-blk,drive=hd0 -drive if=none,file=openbsd73.vmdk,id=hd0"
-Boot with CD:
+(NW) Choose the network arguments
+---------------------------------
-machine_args="-enable-kvm -m 1024"
-disk_args="-device virtio-blk,drive=hd0 -drive if=none,file=x86_64-openbsd73/openbsd73.vmdk,id=hd0"
-net_args="-net user -net nic,model=virtio"
-#display_args="-nographic"
-display_args="-display gtk -monitor stdio"
-common_args="$machine_args $disk_args $net_args $display_args"
-qemu-system-x86_64 $common_args -cdrom OpenBSD-7.3-amd64-install.iso
+Either
+ % net_args=""
+or
+ % net_args="-net user -net nic,model=virtio"
+works. In the first case, OpenBSD will recognize an ethernet interface named
+'em0'. In the second case, it will recognize a network interface named 'vio0'.
+(DV) Choose the display/video arguments
+---------------------------------------
+
+% display_args="-display gtk -monitor stdio"
+
+(B1) Boot from the CD/DVD
+-------------------------
+
+% common_args="$machine_args $disk_args $net_args $display_args"
+% qemu-system-x86_64 $common_args -cdrom OpenBSD-7.3-amd64-install.iso
+
+If you get an error
+-----------------------------------------------------------------------
+ ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
+ qemu-system-x86_64: failed to initialize kvm: Device or resource busy
+-----------------------------------------------------------------------
+it means that another hypervisor is in use. As a workaround, remove the
+option '-enable-kvm' from the machine_args. This will significantly slow
+down the execution speed of the VM, though.
+
+(IN) Perform the steps of the installer
+---------------------------------------
(I)nstall.
Host name: openbsd73
Root password: ********
X Window System: no
Setup a user?
- login: *****
+ login: MY_USER_NAME
password: ********
Allow root ssh login: yes
Partitioning: (W)hole disk MBR, then (E)dit auto layout
Continue without verification: yes
Reboot.
-Boot from the installed disk, without the CD
-(does not need a -kernel option, since a SeaBIOS bootloader is installed):
-qemu-system-x86_64 $common_args
+
+(B2) Boot from the installed disk
+---------------------------------
+
+This does not need a -kernel option, since a SeaBIOS bootloader is installed.
+
+% qemu-system-x86_64 $common_args
# mail
-# Install some packages.
-# List is at https://ftp.hostserver.de/pub/OpenBSD/7.3/packages/amd64/
-# See https://www.openbsd.org/faq/faq15.html#PkgMgmt
+(PK) Install packages
+---------------------
+
+The list of packages is at https://ftp.hostserver.de/pub/OpenBSD/7.3/packages/amd64/
+See https://www.openbsd.org/faq/faq15.html#PkgMgmt
Edit ~/.profile to define PKG_PATH:
-PKG_PATH=https://ftp.hostserver.de/pub/OpenBSD/7.3/packages/`uname -m`/
-export PKG_PATH
+# PKG_PATH=https://ftp.hostserver.de/pub/OpenBSD/7.3/packages/`uname -m`/
+# export PKG_PATH
Logout.
# pkg_add bzip2
Root password: ********
X Window System: no
Setup a user?
- login: *****
+ login: MY_USER_NAME
password: ********
Allow root ssh login: yes
Partitioning: (W)hole disk MBR, then (E)dit auto layout
For the following OSes, you can install a virtual machine:
- GNU/Hurd
+ - GNU/kFreeBSD
- musl libc (Alpine Linux)
- FreeBSD, DragonFly BSD
- NetBSD
4. Find the right parameters for the hypervisor, so that it boots from
the CD/DVD.
5. Perform the steps of the installer.
-6. Reboot the virtual machine without the CD/DVD.
+6. Reboot the virtual machine, this time booting from the virtual disk.
7. Install whatever packages you will need for development (gcc, g++,
make, vim, emacs).
+Specific, detailed instructions for QEMU are in
+environments/qemu-environments.txt.
+
As examples, find in the environments/ directory:
+ * qemu/alpha-linux-debian5.txt
+ * qemu/alpha-linux-debian12.txt
+ * qemu/alpha-linux-t2sde.txt
+ * qemu/arm-freebsd12.txt
+ * qemu/arm-raspbian.txt
+ * qemu/armel-linux-debian8.txt
+ * qemu/armelhf-linux-debian12.txt
+ * qemu/arm64-linux-debian12.txt
+ * qemu/arm64-linux-opensuse-a.txt
+ * qemu/arm64-linux-opensuse-b.txt
+ * qemu/arm64-alpine-3.13.txt
+ * qemu/arm64-alpine-3.19.txt
+ * qemu/arm64-freebsd132.txt
+ * qemu/hppa-linux-debian12.txt
+ * qemu/hppa-linux-t2sde.txt
+ * qemu/m68k-linux-debian12.txt
+ * qemu/m68k-linux-t2sde.txt
+ * qemu/mipseb-linux-debian8.txt
+ * qemu/mipsel-linux-debian12.txt
+ * qemu/mipsel-linux-debian8.txt
+ * qemu/mips64eb-linux-debian8.txt
+ * qemu/mips64el-linux-debian8.txt
+ * qemu/powerpc-linux-debian12.txt
+ * qemu/powerpc-linux-t2sde.txt
+ * qemu/powerpc64-linux-debian12.txt
+ * qemu/ppc64le-linux-debian12.txt
+ * qemu/ppc64le-linux-opensuse-kde.txt
+ * qemu/ppc64le-linux-opensuse.txt
+ * qemu/ppc64le-alpine.txt
+ * qemu/riscv64-linux-fedora28.txt
+ * qemu/s390x-linux-debian8.txt
+ * qemu/s390x-linux-opensuse.txt
+ * qemu/s390x-alpine.txt
+ * qemu/sparc-netbsd.txt
+ * qemu/sparc64-linux-debian9.txt
+ * qemu/sparc64-linux-t2sde.txt
+ * qemu/sparc64-freebsd12.txt
+ * qemu/sparc64-netbsd.txt
* qemu/x86_64-openbsd73.txt: How to install OpenBSD 7.3 with QEMU.
* virtualbox/openbsd73.txt: How to install OpenBSD 7.3 with VirtualBox.
+Download locations:
+ * GNU/Linux and Linux:
+ See linux-install-media.txt.
+ * GNU/Hurd:
+ https://cdimage.debian.org/cdimage/ports/12.0/hurd-i386/iso-cd/
+ * GNU/kFreeBSD:
+ https://cdimage.debian.org/cdimage/archive/7.11.0/kfreebsd-i386/iso-dvd/
+ https://cdimage.debian.org/cdimage/archive/7.11.0/kfreebsd-amd64/iso-dvd/
+
Bring your own hardware
-----------------------
- arm
- arm64
- hppa
+ - m68k
- mips, mips64
- powerpc, powerpc64, powerpc64le
- riscv64