Qemu

From Linux PARISC Wiki
(Difference between revisions)
Jump to: navigation, search
m
m (Possible emulation guest targets)
 
(30 intermediate revisions by one user not shown)
Line 1: Line 1:
Richard Hendersons qemu git tree:
+
== QEMU support status regarding hppa/parisc ==
* https://github.com/rth7680/qemu/commits/tgt-hppa-softmmu
+
Helge Deller SeaBIOS git tree:
+
* https://github.com/hdeller/seabios-hppa/commits/parisc_firmware
+
  
Howto:
+
Starting with QEMU version 2.12 (April 2018), qemu fully supports 32-bit hppa user emulation (hppa-linux-user) and 32-bit hppa system emulation (qemu-system-hppa).
# checkout out trees above, configure and build
+
All necessary changes have been merged into the [https://git.qemu.org/?p=qemu.git;a=summary upstream qemu git tree].
# copy (or symlink) the parisc firmware file "out/hppa-firmware.img" from seabios into the qemu "pc-bios/" directory
+
# qemu-img create -f qcow2 hdd.img 30G
+
# download install image: https://cdimage.debian.org/cdimage/ports/, e.g. https://cdimage.debian.org/cdimage/ports/9.0/hppa/iso-cd/debian-9.0-hppa-NETINST-1.iso
+
# ./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -drive file=debian-9.0-hppa-NETINST-1.iso,type=cdrom -boot order=d -nographic -serial mon:stdio
+
  
 +
PA-RISC machines need a firmware ("PDC" = Processor Dependend Code).
 +
Qemu includes a precompiled PDC firmware for hppa ([https://git.qemu.org/?p=qemu.git;a=blob;f=pc-bios/hppa-firmware.img;h=86930974b9e12bec214fb464eee443a0d844e6ff;hb=HEAD pc-bios/hppa-firmware.img]), which is based on a [https://github.com/hdeller/seabios-hppa/commits/parisc_firmware fork of SeaBIOS ].
  
qemu options:
+
The emulated machine is a [https://www.openpa.net/systems/hp-visualize_b132l_b160l_b180l.html HP B160L desktop machine], with one or more 32-bit PA7100LC CPUs.
 +
 
 +
The QEMU emulation is able to run Linux and HP-UX. HP-UX support still needs improvement which is being worked on.
 +
 
 +
QEMU on parisc has been made available by:
 +
* [mailto:rth@twiddle.net Richard Henderson]: QEMU CPU emulation (32-bit only), QEMU hardware divers
 +
* [mailto:deller@gmx.de Helge Deller]: QEMU hardware drivers, SeaBIOS PDC firmware
 +
* [mailto:svens@stackframe.org Sven Schnelle]: Lots of fixes all over QEMU and SeaBIOS (SCSI, CPU emulation fixes, SeaBIOS PDC firmware)
 +
 
 +
== Ready-to-run QEMU image for parisc ==
 +
 
 +
Download Debian hard disc image:
 +
wget http://backup.parisc-linux.org/qemu/debian-10-hdd-img.tar.bz2
 +
Unzip image:
 +
tar xvfj debian-10-hdd-img.tar.bz2
 +
Run qemu:
 +
./hppa-softmmu/qemu-system-hppa -drive file=debian-10-hdd.img -nographic -serial mon:stdio -accel tcg,thread=multi -smp cpus=4
 +
Log in as '''root''', root password is "'''rootme'''"
 +
 
 +
== How to build QEMU from source ==
 +
 
 +
Check out the [https://git.qemu.org/?p=qemu.git;a=summary qemu git tree]
 +
 
 +
Run configure, e.g.
 +
* (for system emulation) '''./configure --target-list=hppa-softmmu --enable-numa'''
 +
* (for user emulation) '''./configure --target-list=hppa-linux-user --disable-stack-protector --prefix=/home/qemu-hppa/chroot-unstable --interp-prefix=/home/qemu-hppa/chroot-unstable --static'''
 +
 
 +
Run "make"
 +
 
 +
== How to run QEMU with Debian-10 installer image ==
 +
 
 +
* Create a virtual hard disc once:
 +
qemu-img create -f qcow2 hdd.img 50G
 +
* download a Linux install image, e.g.
 +
** for debian: https://cdimage.debian.org/cdimage/ports/10.0/hppa/iso-cd/debian-10.0-hppa-NETINST-1.iso
 +
** for gentoo: http://distfiles.gentoo.org/releases/hppa/autobuilds/
 +
* Start emulator with the installer image once:
 +
./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -drive file=debian-10.0-hppa-NETINST-1.iso,media=cdrom -boot order=d -nographic -serial mon:stdio
 +
* Choose typical installation options, the defaults are OK.
 +
* Either skip the step "Configure the Package manager", or configure the mirror as with hostname "ftp.ports.debian.org", and directory "/debian-ports"
 +
* Shut down virtual machine after installation
 +
 
 +
* Start emulator with installed operating system any time:
 +
./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -nographic -serial mon:stdio -accel tcg,thread=multi -smp cpus=2
 +
 
 +
* Edit the sources.list (/etc/apt/sources.list) file:
 +
deb http://ftp.ports.debian.org/debian-ports unstable main
 +
deb [arch=all] http://ftp.debian.org/debian unstable main
 +
deb-src http://ftp.debian.org/debian unstable main
 +
 
 +
== Some QEMU notes ==
 +
 
 +
Prefer the e1000 driver over the rtl8129 card. The latter gives irq issues with Dino emulation.
 +
 
 +
Possible qemu options:
 
* -accel tcg,thread=multi  - always use this to enable parallel tcg (otherwise all guest CPUs run on one host CPU)
 
* -accel tcg,thread=multi  - always use this to enable parallel tcg (otherwise all guest CPUs run on one host CPU)
 
* -smp cpus=4      - define number of CPUs in the guest (maximum CPUs: 32)  
 
* -smp cpus=4      - define number of CPUs in the guest (maximum CPUs: 32)  
Line 22: Line 71:
 
* -device VGA      - provide PCI VGA graphic card
 
* -device VGA      - provide PCI VGA graphic card
  
Examples:
+
== Tips and Tricks when running an emulation ==
* ./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -drive file=debian-8.0-hppa-NETINST-1.iso,media=cdrom -nographic -serial mon:stdio
+
 
* ./hppa-softmmu/qemu-system-hppa  -cdrom debian-8.0-hppa-NETINST-1.iso -nographic  -serial mon:stdio
+
* Linux kernel >= 4.14 runs best. Initial Linux kernel optimizations were added to kernel >= 4.9.
* ./hppa-softmmu/qemu-system-hppa -device virtio-scsi-pci,id=scsi -drive file=debian-8.0-hppa-NETINST-1.iso,if=scsi,media=cdrom,bus=-nographic -serial mon:stdio
+
* The "INTERRUPT KEY" mentioned sometimes by HP-UX can be emulated with the "Ctrl-\" key combination
* ./hppa-softmmu/qemu-system-hppa  -device lsi53c895a,id=scsi      -drive file=debian-8.0-hppa-NETINST-1.iso,if=scsi,media=cdrom,bus=-nographic  -serial mon:stdio
+
* In case you lost the HP-UX root password, boot at ISL 'hpux -is' and then give a new password with running "passwd".
 +
 
 +
== Possible emulation guest targets ==
 +
 
 +
* [https://en.wikipedia.org/wiki/HP-UX HP-UX], versions 9.x up to 11.11
 +
* Linux (Debian, Gentoo), Kernel >= v4.14
 +
* [https://wiki.netbsd.org/ports/hppa/ NetBSD]
 +
* [https://winworldpc.com/product/nextstep/3x NextSTEP]
 +
* [ftp://ftp.cirr.com/pub/hppa/mklinux/ OSF/MkLinux]
 +
 
 +
== HP-UX ==
 +
 
 +
Still LASI NIC emulation and NCR 710 Emulation needed in order to be able to boot older HP-UX releases.
 +
 
 +
[https://astr0baby.wordpress.com/2019/04/28/running-hp-ux-11-11-on-qemu-system-hp Astrobaby wrote about his test results.]
 +
 
 +
== NetBSD ==
 +
 
 +
Images at http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/images/
 +
 
 +
Info at https://www.netbsd.org/releases/current.html
 +
 
 +
  KERNEL=netbsd
 +
qemu-system-hppa \
 +
        -kernel ${KERNEL} \
 +
        -drive file=hdd.img \
 +
        -drive file=NetBSD-8.99.37-hppa.iso,media=cdrom \
 +
        -nographic \
 +
        -serial telnet::55555,server
 +
 
 +
(info by Nick Hudson <nick.hudson@gmx.co.uk>)
 +
 
 +
== OSF/MkLinux ==
 +
 
 +
Download at ftp://ftp.cirr.com/pub/hppa/mklinux/
 +
The file root_ext2_g.dd.bin.gz doesn't cleanly decompress.. so I did a gzip -dc into root_ext2_g.dd.bin.
 +
 
 +
MkLinux sources: https://github.com/slp/osfmk-mklinux
 +
 
 +
qemu-system-hppa -boot c -drive if=scsi,bus=0,index=3,file=root_ext2_g.dd.bin,format=raw \
 +
        -serial mon:stdio -nographic -m 128
 +
 
 +
It boots, but fails during device detection because Qemu currently emulates a B160, while MkLinux expects a HP700. So it fails to see the LASI chip below the GSC bridge.
 +
NVM bootdata Bad Checksum (0)
 +
OSF Mach boot
 +
: /mach
 +
text (0x95618) at 0x11000
 +
data (0x48594) at 0xa8000
 +
Mach 3.0 VERSION(PMK1.1): cb <pmk1_1>; Wed Nov 26 17:20:37 MET 1997; mach_kernel/PRODUCTION (cameleon)
 +
HP9000/
 +
unknown machine type 0x502
 +
good luck :-)
 +
, 0K Icache, 0K Dcache, 256 entry shared TLB)
 +
Warning: unsupported module at ffc00000 (type:7 svers:0 hvers:50)
 +
  Stack Trace (depth=1):
 +
      0x00084d68
 +
  End of Stack
 +
 
 +
(info by Jason Stevens <neozeed@gmail.com>)
 +
 
 +
== Future QEMU work ==
 +
 
 +
Upstream merging currently beeing worked on (September 2019):
 +
* Emulate Lasi
 +
* Emulate Lasi NIC (Intel Apricot i82596)
 +
* Artist graphics emulation
 +
* STI text console emulation for Linux and HP-UX
 +
* Add PS/2 mouse and keyboard ports
 +
 
 +
Still need to do:
 +
* Add Dino/Lasi serial port
 +
* Harmony sound card in Lasi
 +
* Does HP-UX has some kind of "sleep" assembler instruction in it's idle loop which can be used to lower qemu power consumption?
 +
* Fix virtio-drivers in SeaBIOS (endianess-bugs, because SeaBIOS is originally only Little-endian from x86)
 +
* Emulate Tulip (DEC 21x40) network cards in Qemu
 +
* More correct emulation of B160L in Qemu
 +
* Emulate a 712 and/or j5000/c3000 machine
 +
* Emulate built-in LASI SCI controller instead of PCI SCSI add-on card
 +
* Elroy PCI emulation, then emulate e.g. a C3000?
 +
* PA2.0/64bit (low prio)
 +
* ...
 +
* '''Push SeaBIOS changes upstream!!'''
 +
 
 +
== Screenshots ==
 +
 
 +
=== HP-UX booting up ===
 +
[[File:Qemu_sti_hpux_boot.png|640px]]
 +
 
 +
=== HP-UX CDE Login screen ===
 +
[[File:Qemu_cde1.png|640px]]
 +
 
 +
=== HP-UX CDE initial screen ===
 +
[[File:Qemu_cde3.png|640px]]
  
How to run:
+
=== Some applications started in CDE ===
* ./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -drive file=debian-8.0-hppa-NETINST-1.iso,media=cdrom -boot menu=on  -serial mon:stdio
+
[[File:Qemu_cde_desktop.png|640px]]

Latest revision as of 13:19, 9 October 2019

Contents

[edit] QEMU support status regarding hppa/parisc

Starting with QEMU version 2.12 (April 2018), qemu fully supports 32-bit hppa user emulation (hppa-linux-user) and 32-bit hppa system emulation (qemu-system-hppa). All necessary changes have been merged into the upstream qemu git tree.

PA-RISC machines need a firmware ("PDC" = Processor Dependend Code). Qemu includes a precompiled PDC firmware for hppa (pc-bios/hppa-firmware.img), which is based on a fork of SeaBIOS .

The emulated machine is a HP B160L desktop machine, with one or more 32-bit PA7100LC CPUs.

The QEMU emulation is able to run Linux and HP-UX. HP-UX support still needs improvement which is being worked on.

QEMU on parisc has been made available by:

  • Richard Henderson: QEMU CPU emulation (32-bit only), QEMU hardware divers
  • Helge Deller: QEMU hardware drivers, SeaBIOS PDC firmware
  • Sven Schnelle: Lots of fixes all over QEMU and SeaBIOS (SCSI, CPU emulation fixes, SeaBIOS PDC firmware)

[edit] Ready-to-run QEMU image for parisc

Download Debian hard disc image:

wget http://backup.parisc-linux.org/qemu/debian-10-hdd-img.tar.bz2

Unzip image:

tar xvfj debian-10-hdd-img.tar.bz2

Run qemu:

./hppa-softmmu/qemu-system-hppa -drive file=debian-10-hdd.img -nographic -serial mon:stdio -accel tcg,thread=multi -smp cpus=4 

Log in as root, root password is "rootme"

[edit] How to build QEMU from source

Check out the qemu git tree

Run configure, e.g.

  • (for system emulation) ./configure --target-list=hppa-softmmu --enable-numa
  • (for user emulation) ./configure --target-list=hppa-linux-user --disable-stack-protector --prefix=/home/qemu-hppa/chroot-unstable --interp-prefix=/home/qemu-hppa/chroot-unstable --static

Run "make"

[edit] How to run QEMU with Debian-10 installer image

  • Create a virtual hard disc once:
qemu-img create -f qcow2 hdd.img 50G
./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -drive file=debian-10.0-hppa-NETINST-1.iso,media=cdrom -boot order=d -nographic -serial mon:stdio 
  • Choose typical installation options, the defaults are OK.
  • Either skip the step "Configure the Package manager", or configure the mirror as with hostname "ftp.ports.debian.org", and directory "/debian-ports"
  • Shut down virtual machine after installation
  • Start emulator with installed operating system any time:
./hppa-softmmu/qemu-system-hppa -drive file=hdd.img -nographic -serial mon:stdio -accel tcg,thread=multi -smp cpus=2 
  • Edit the sources.list (/etc/apt/sources.list) file:
deb http://ftp.ports.debian.org/debian-ports unstable main
deb [arch=all] http://ftp.debian.org/debian unstable main 
deb-src http://ftp.debian.org/debian unstable main

[edit] Some QEMU notes

Prefer the e1000 driver over the rtl8129 card. The latter gives irq issues with Dino emulation.

Possible qemu options:

  • -accel tcg,thread=multi - always use this to enable parallel tcg (otherwise all guest CPUs run on one host CPU)
  • -smp cpus=4 - define number of CPUs in the guest (maximum CPUs: 32)
  • -boot menu=on - Firmware: enable interactive mode (boot prompt)
  • -boot order=c - Firmware: Boot from hard disc
  • -boot order=d - Firmware: Boot from CD/DVD
  • -serial mon:stdio use serial console
  • -nographic - no graphics device
  • -device VGA - provide PCI VGA graphic card

[edit] Tips and Tricks when running an emulation

  • Linux kernel >= 4.14 runs best. Initial Linux kernel optimizations were added to kernel >= 4.9.
  • The "INTERRUPT KEY" mentioned sometimes by HP-UX can be emulated with the "Ctrl-\" key combination
  • In case you lost the HP-UX root password, boot at ISL 'hpux -is' and then give a new password with running "passwd".

[edit] Possible emulation guest targets

[edit] HP-UX

Still LASI NIC emulation and NCR 710 Emulation needed in order to be able to boot older HP-UX releases.

Astrobaby wrote about his test results.

[edit] NetBSD

Images at http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/images/

Info at https://www.netbsd.org/releases/current.html

KERNEL=netbsd
qemu-system-hppa \
       -kernel ${KERNEL} \
       -drive file=hdd.img \
       -drive file=NetBSD-8.99.37-hppa.iso,media=cdrom \
       -nographic \
       -serial telnet::55555,server

(info by Nick Hudson <nick.hudson@gmx.co.uk>)

[edit] OSF/MkLinux

Download at ftp://ftp.cirr.com/pub/hppa/mklinux/ The file root_ext2_g.dd.bin.gz doesn't cleanly decompress.. so I did a gzip -dc into root_ext2_g.dd.bin.

MkLinux sources: https://github.com/slp/osfmk-mklinux

qemu-system-hppa -boot c -drive if=scsi,bus=0,index=3,file=root_ext2_g.dd.bin,format=raw \
       -serial mon:stdio -nographic -m 128 

It boots, but fails during device detection because Qemu currently emulates a B160, while MkLinux expects a HP700. So it fails to see the LASI chip below the GSC bridge.

NVM bootdata Bad Checksum (0)
OSF Mach boot
: /mach
text (0x95618) at 0x11000
data (0x48594) at 0xa8000
Mach 3.0 VERSION(PMK1.1): cb <pmk1_1>; Wed Nov 26 17:20:37 MET 1997; mach_kernel/PRODUCTION (cameleon)
HP9000/
unknown machine type 0x502
good luck :-)
, 0K Icache, 0K Dcache, 256 entry shared TLB)
Warning: unsupported module at ffc00000 (type:7 svers:0 hvers:50)
Stack Trace (depth=1):
     0x00084d68
End of Stack 

(info by Jason Stevens <neozeed@gmail.com>)

[edit] Future QEMU work

Upstream merging currently beeing worked on (September 2019):

  • Emulate Lasi
  • Emulate Lasi NIC (Intel Apricot i82596)
  • Artist graphics emulation
  • STI text console emulation for Linux and HP-UX
  • Add PS/2 mouse and keyboard ports

Still need to do:

  • Add Dino/Lasi serial port
  • Harmony sound card in Lasi
  • Does HP-UX has some kind of "sleep" assembler instruction in it's idle loop which can be used to lower qemu power consumption?
  • Fix virtio-drivers in SeaBIOS (endianess-bugs, because SeaBIOS is originally only Little-endian from x86)
  • Emulate Tulip (DEC 21x40) network cards in Qemu
  • More correct emulation of B160L in Qemu
  • Emulate a 712 and/or j5000/c3000 machine
  • Emulate built-in LASI SCI controller instead of PCI SCSI add-on card
  • Elroy PCI emulation, then emulate e.g. a C3000?
  • PA2.0/64bit (low prio)
  • ...
  • Push SeaBIOS changes upstream!!

[edit] Screenshots

[edit] HP-UX booting up

Qemu sti hpux boot.png

[edit] HP-UX CDE Login screen

Qemu cde1.png

[edit] HP-UX CDE initial screen

Qemu cde3.png

[edit] Some applications started in CDE

Qemu cde desktop.png

Personal tools