MorphOS on Libvirt
  • Just looking around
    Posts: 10 from 2023/6/24
    I don't know where to post this, but I was playing with MorphOS in libvirt on Fedora and it actually works pretty well after a bunch of tinkering. I'll try to cover the reasons for things out of the ordinary.

    Machine Choice and Domain:
    - I used mac99, because with it and the firmware from http://zero.eik.bme.hu/ was the only way I could get everything to work, including networking, shutdown, etc.
    - Added "xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0" in order to add qemu overrides and commands.

    Video
    - Set the graphics to "bochs". Libvirt doesn't recognize "sm501" or "ati-vga".
    - Set an alias so we can override the driver type.
    - In the overrides change the card to "sm501" and remove the "vgamem", "bus", and "addr" settings for it, so it will function properly.
    - I started with "ati-vga", but trying to drag and drop anything resulted in a freeze, so I switched to "sm501"

    NIC:
    - Used "ne2k_pci" for the network because even though "sungem" and "rtl8139" would appear in the OS they would not pass traffic.
    - Added an alias so I can remove the bus and address. Setting these seems to prevent it from working.

    USB
    - Changed the USB controller to "pci-ohci"
    - Added the mouse and keyboard with qemu args, other stuff added by libvirt prevented proper function.

    Storage:
    - Added storage with qemu commandline args. Libvirt's settings prevented proper functioning.

    Audio:
    - No solution for audio.

    Installing:
    - Add the cdrom via qemu commandline args similar to how the hard drive is done.
    Code:

    <qemu:arg value='-cdrom'/>
    <qemu:arg value='morphos-3.18.iso'/>

    - In all cases (cdrom, firmware, and hda) you need to update values to use the full path.
    - Update to boot from the boot.img file on the cdrom by changing:
    Code:
    <qemu:arg value='boot-device=hd:,\boot.img'/>

    to
    Code:
    <qemu:arg value='boot-device=cd:,\mac_ppc32\boot.img'/>

    - If using Fedora with selinux enabled you'll need to set the selinux context of the bios file to make libvirt happy.
    Code:
    chcon -t virt_content_t openbios-qemu.elf

    - Create a disk file
    Code:
    qemu-img create -f qcow2 MorphOS.qcow2 8G

    - Boot and install.
    - Shutdown.
    Remove the cdrom values and restore the boot-device setting.

    Entire Example Domain XML:
    Code:

    <domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
    <name>MorphOS</name>
    <uuid>5509dd95-a210-4918-9f2a-a37dfe95e439</uuid>
    <memory unit='KiB'>2097152</memory>
    <currentMemory unit='KiB'>2097152</currentMemory>
    <vcpu placement='static'>1</vcpu>
    <os>
    <type arch='ppc' machine='mac99'>hvm</type>
    <boot dev='hd'/>
    </os>
    <clock offset='localtime'/>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>destroy</on_crash>
    <devices>
    <emulator>/usr/bin/qemu-system-ppc</emulator>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='usb' index='0' model='pci-ohci'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <interface type='user'>
    <mac address='52:54:00:46:f2:fb'/>
    <model type='ne2k_pci'/>
    <alias name='ua-net'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
    <target port='0'/>
    </serial>
    <console type='pty'>
    <target type='serial' port='0'/>
    </console>
    <graphics type='spice' autoport='yes'>
    <listen type='address'/>
    <gl enable='no'/>
    </graphics>
    <audio id='1' type='spice'/>
    <video>
    <model type='bochs' vram='16384' heads='1' primary='yes'/>
    <alias name='ua-video'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </video>
    <memballoon model='virtio'>
    <alias name='ua-virt'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </memballoon>
    </devices>
    <qemu:commandline>
    <qemu:arg value='-machine'/>
    <qemu:arg value='mac99,via=pmu,usb=on'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-prom-env'/>
    <qemu:arg value='boot-device=hd:,boot.img'/>
    <qemu:arg value='-boot'/>
    <qemu:arg value='d'/>
    <qemu:arg value='-vga'/>
    <qemu:arg value='none'/>
    <qemu:arg value='-bios'/>
    <qemu:arg value='openbios-qemu.elf'/>
    <qemu:arg value='-hda'/>
    <qemu:arg value='MorphOS.qcow2'/>
    </qemu:commandline>
    <qemu:override>
    <qemu:device alias='ua-net'>
    <qemu:frontend>
    <qemu:property name='addr' type='remove'/>
    <qemu:property name='bus' type='remove'/>
    </qemu:frontend>
    </qemu:device>
    <qemu:device alias='ua-video'>
    <qemu:frontend>
    <qemu:property name='driver' type='string' value='sm501'/>
    <qemu:property name='vgamem' type='remove'/>
    <qemu:property name='addr' type='remove'/>
    <qemu:property name='bus' type='remove'/>
    </qemu:frontend>
    </qemu:device>
    </qemu:override>
    </domain>


    sxtK3SYl.png

    [ Edited by AA5ikkR5SQC6pJSc 24.06.2023 - 21:13 ]
  • »24.06.23 - 21:21
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 3092 from 2003/3/5
    From: Canada
    Looks useful. Thanks for sharing!
  • »25.06.23 - 01:58
    Profile Visit Website
  • Just looking around
    Posts: 10 from 2023/6/24
    I've been able to get audio working with the VIA-AC97 audio from Pegasos 2 using QEMU 8, however I haven't been able to get any NIC to work. Instead if I try to run ifconfig or ping I get a popup window that says, "need version 0 of bsdsocket.library". I've tried sungem, rtl8139, and ne2k_pci.

    The same configurations I've tried work with Debian PPC and AmigaOS 4.1.

    [ Edited by AA5ikkR5SQC6pJSc 08.07.2023 - 17:48 ]
  • »08.07.23 - 22:45
    Profile
  • Butterfly
    Butterfly
    Mabo
    Posts: 67 from 2010/5/3
    Very interesting :)

    Can you share the qcow2 img? Via google drive or...

    Subscribed!
  • »24.07.23 - 16:47
    Profile Visit Website
  • Just looking around
    Posts: 10 from 2023/6/24
    I could make a qcow2 image, but it's pretty easy to install. I was eventually able to get network and audio to work by making audio load after network initialization. I put a domain xml file and some other bits with an explanation here:
    https://github.com/jmontleon/libvirt-configs/tree/main/MorphOS

    Pegasos 2 requires, or at least works better, with an actual firmware you can grab from the wayback machine. There's no nvram so you need to get on the serial console to boot MorphOS, so I strung together a qemu hook, systemd user service, and expect script to do it for me so it's like a typical experience.

    I created an issue here regarding the audio/network issue, but as of yet I don't think there's much idea what's going wrong. https://osdn.net/projects/qmiga/ticket/48376. (osdn.net has been loading terribly slow so it may take a few tries to load the page)

    Performance is mediocre. Generally the system is usable and responsive. I managed to get some audio to play once or twice from youtube videos, but browsing youtube.com or m.youtube.com is excruciatingly slow.
  • »27.07.23 - 03:59
    Profile
  • Butterfly
    Butterfly
    Mabo
    Posts: 67 from 2010/5/3
    Quote:

    AA5ikkR5SQC6pJSc wrote:
    I could make a qcow2 image, but it's pretty easy to install. I was eventually able to get network and audio to work by making audio load after network initialization. I put a domain xml file and some other bits with an explanation here:
    https://github.com/jmontleon/libvirt-configs/tree/main/MorphOS

    Pegasos 2 requires, or at least works better, with an actual firmware you can grab from the wayback machine. There's no nvram so you need to get on the serial console to boot MorphOS, so I strung together a qemu hook, systemd user service, and expect script to do it for me so it's like a typical experience.

    I created an issue here regarding the audio/network issue, but as of yet I don't think there's much idea what's going wrong. https://osdn.net/projects/qmiga/ticket/48376. (osdn.net has been loading terribly slow so it may take a few tries to load the page)

    Performance is mediocre. Generally the system is usable and responsive. I managed to get some audio to play once or twice from youtube videos, but browsing youtube.com or m.youtube.com is excruciatingly slow.


    I just copied/paste your xml into virt-manager but i get issues :/

    Code:
    2023-07-27T17:10:48.370355Z qemu-system-ppc: -drive if=none,id=hd,format=qcow2,file=/var/lib/libvirt/images/disk.qcow2: Could not open '/var/lib/libvirt/images/disk.qcow2': Permission denied
    2023-07-27 17:10:48.375+0000: shutting down, reason=failed



    Do you launch the xml from the consolle ? Im using Qemu 7 and virt-manager 4 (last one)

    ** issues resolved **
    I disabled " apparmor " 'cause in Ubuntu there are " selinux " and " apparmor " protections -_-

    Bye





    [ Edited by Mabo 27.07.2023 - 22:30 ]
  • »27.07.23 - 16:36
    Profile Visit Website
  • Just looking around
    Posts: 10 from 2023/6/24
    If ubuntu also uses selinux you can try restorevon -v /var/lib/libvirt/images/disk.qcow2.

    If I create a disk through libvirt storage management on Fedora the permissions are:
    $ sudo ls -l /var/lib/libvirt/images/test.qcow2
    -rw-------. 1 root root 21478375424 Jul 28 00:42 /var/lib/libvirt/images/test.qcow2

    If you created it by hand perhaps adjust the permissions or delete and recreate it through virt-manager.

    I'll caution you'll want to use at least qemu 8 to have working audio and network. I believe both are a definite no go prior. 8.1 fixes an issue shutting down.
  • »28.07.23 - 05:45
    Profile
  • Butterfly
    Butterfly
    Mabo
    Posts: 67 from 2010/5/3
    Thank you so much for the tip I will give it a try :)

    The problem is that I copied your configuration; I need to create a new one as soon as possible.
    Anyway it starts but the mouse has a lot of issues it responds but not as the host O_O it goes crazy! :O impossible to use it :|

    Im not so familiar with linux... Just few things in the years Qemu also...

    I was wondering If i clone a Macmini PPC registered MACADDRSS to vm with the license connected to it it will pass the 30mins ?

    Bye
  • »28.07.23 - 16:12
    Profile Visit Website
  • MorphOS Developer
    Piru
    Posts: 587 from 2003/2/24
    From: finland, the l...
    Quote:

    Mabo wrote:
    If i clone a Macmini PPC registered MACADDRSS to vm with the license connected to it it will pass the 30mins ?

    No.
  • »28.07.23 - 16:37
    Profile
  • Just looking around
    Posts: 10 from 2023/6/24
    Quote:

    Mabo wrote:
    Thank you so much for the tip I will give it a try :)

    The problem is that I copied your configuration; I need to create a new one as soon as possible.
    Anyway it starts but the mouse has a lot of issues it responds but not as the host O_O it goes crazy! :O impossible to use it :|

    Im not so familiar with linux... Just few things in the years Qemu also...

    I was wondering If i clone a Macmini PPC registered MACADDRSS to vm with the license connected to it it will pass the 30mins ?

    Bye


    If you created your own try adding a USB Mouse and Keyboard. They'll override the default PS/2. On my laptop PS/2 worked fine, but it was very jittery on my desktop. Replacing them had no ill effect that I could detect on my laptop and made my desktop work much better. You could also try the evTouch Graphics Tablet in addition to or instead of the USB Mouse.
  • »28.07.23 - 19:30
    Profile
  • Just looking around
    Posts: 10 from 2023/6/24
    Quote:

    Andreas_Wolf wrote:
    > actual firmware you can grab from the wayback machine

    I don't know if it makes a difference for emulation, but a newer SmartFirmware version (20040810112413) is being provided on MorphOS Storage.

    https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=13597&forum=11&start=2


    Interestingly that kind of revealed why only one GB of RAM is working with the Pegasos 2 firmware. Seems it's upset about the memory density for some reason.

    I was able to get 2GB to work by emulating a second DIMM. If I understand correctly there are some 2GB DDR DIMMs that folks have used successfully, so I don't really understand why it's not working. As far as I can tell the spd eeprom is being set correctly for the banks/density. Shared some info at https://osdn.net/projects/qmiga/ticket/48449
  • »28.07.23 - 19:36
    Profile
  • Butterfly
    Butterfly
    Mabo
    Posts: 67 from 2010/5/3
    Quote:

    AA5ikkR5SQC6pJSc wrote:
    Quote:

    Mabo wrote:
    Thank you so much for the tip I will give it a try :)

    The problem is that I copied your configuration; I need to create a new one as soon as possible.
    Anyway it starts but the mouse has a lot of issues it responds but not as the host O_O it goes crazy! :O impossible to use it :|

    Im not so familiar with linux... Just few things in the years Qemu also...

    I was wondering If i clone a Macmini PPC registered MACADDRSS to vm with the license connected to it it will pass the 30mins ?

    Bye


    If you created your own try adding a USB Mouse and Keyboard. They'll override the default PS/2. On my laptop PS/2 worked fine, but it was very jittery on my desktop. Replacing them had no ill effect that I could detect on my laptop and made my desktop work much better. You could also try the evTouch Graphics Tablet in addition to or instead of the USB Mouse.


    I tried this options without any luck :(

    But directly from Qemu shell the mouse is a little bit better :| But I think is the hosting machine the problem. An ARM64/aarch 4vCPU 24gb ram in the cloud under Ubuntu 20.04 and Qemu 7.0 I will try to install MorphOS via shell and import the qcow2 from there :)
  • »28.07.23 - 20:10
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Andreas_Wolf
    Posts: 12136 from 2003/5/22
    From: Germany
    > If I understand correctly there are some 2GB DDR DIMMs
    > that folks have used successfully

    As far as I have understood, those with working 2 GiB RAM in their revision 2B5 boards usually use(d) two 1 GiB modules, not one 2 GiB module, but I may be mistaken.
  • »28.07.23 - 20:21
    Profile