How to run Qemu?

AmigaOne X5000 platform specific issues related to Linux only.
Post Reply
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

How to run Qemu?

Post by Roland »

I succeeded to install Qemu for Fedora, but I would need some advice how to run it... I'm trying to use it with a Ubuntu 12.04 (32-bit intel) which I have copied to a .img file. The Qemu manual lists a huge amount of options but I have not the slightest idea how to choose the needed ones! Could those who has used Qemu earlier succesfully please give some example of a working string needed to run it? Thank you!
- Roland -
User avatar
xeno74
Posts: 9349
Joined: Fri Mar 23, 2012 7:58 am

Re: How to run Qemu?

Post by xeno74 »

Roland wrote:Could those who has used Qemu earlier succesfully please give some example of a working string needed to run it? Thank you!
Hi Roland,

Here are some examples of QEMU commands:

Windows NT 4.0 x86:

Code: Select all

qemu-system-i386 -hda /home/christian/Virtual-machines/NT4.disk -m 2047 -monitor stdio -net nic,model=pcnet -net user
Lubuntu 14.04 PowerPC (KVM PR):

Code: Select all

qemu-system-ppc -cpu G4 -M mac99 -enable-kvm -m 2047 -g 1024x768x32 -bios /usr/share/openbios/openbios-ppc -cdrom /home/christian/Downloads/lubuntu-14.04-desktop-powerpc.iso -boot order=d -net nic,model=rtl8139 -net user
S.u.S.E. Linux 5.0 x86:

Code: Select all

qemu-system-i386 -hda Harddisk_2.raw -m 2047 -monitor stdio -net nic,model=ne2k_pci -net user -vga cirrus -cdrom 001.iso -boot d
S.u.S.E. Linux 4.2 x86:

Code: Select all

qemu-system-i386 -hda suselinux42-disk1.qcow2 -m 2047 -monitor stdio -net nic,model=ne2k_pci -net user,hostfwd=::2222-10.0.2.21:22 -cdrom suse-linux-4.2-1.iso -vga cirrus
MPC8544ds PowerPC board with SliTaz:

Code: Select all

qemu-system-ppc -cpu e500v2 -M mpc8544ds -m 2047 -bios /home/christian/Downloads/u-boot.e500 -nographic -kernel /home/christian/Downloads/linux-3.18-e500v2/uImage-3.18-rc6 -initrd /home/christian/distro/slitaz25.gz -net nic,vlan=0,model=e1000 -net user,vlan=0
e500v2 board with SliTaz:

Code: Select all

qemu-system-ppc -cpu e500v2 -M ppce500 -m 2047 -bios /home/christian/Downloads/u-boot.e500 -nographic -kernel /home/christian/Downloads/linux-3.18-e500v2/uImage-3.18-rc6 -initrd /home/christian/distro/slitaz25.gz -net nic,vlan=0,model=e1000 -net user,vlan=0
P5020DS PowerPC board with SliTaz:

Code: Select all

qemu-system-ppc64 -cpu e5500 -M mpc8544ds -m 2047 -nographic -kernel /home/christian/Downloads/uImage-p5020ds-64b.bin -initrd /home/christian/distro/slitaz25.gz -net nic,vlan=0,model=e1000 -net user,vlan=0 -machine dt_compatible=fsl,,P5020DS
Raspberry Pi:

Code: Select all

qemu-system-arm -name Raspberry-Pi -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive file=2016-02-26-raspbian-jessie.img,index=0,media=disk,format=raw -net nic -net user -redir tcp:2222::22
Further information about QEMU: X1000 QEMU thread

Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: How to run Qemu?

Post by Roland »

xeno74 wrote:
Hi Roland,

Here are some examples of QEMU commands:
...
Thank you! I will try to compile a suitable one using those...

But in what format are the boot disk files in your examples (-hda ...) ? There was not any in the .img format...? When I yesterday did a first try with a .img file created with dd I got an error message about geometry...
---
I did now a new try using parameters from your examples, but I still get stuck immediately to the geometry problem:

***
Booting from a hard disk...
Geom error
...
***
Last edited by Roland on Wed Jan 31, 2018 12:03 pm, edited 1 time in total.
- Roland -
User avatar
xeno74
Posts: 9349
Joined: Fri Mar 23, 2012 7:58 am

Re: How to run Qemu?

Post by xeno74 »

Roland wrote: But in what format are the boot disk files in your examples (-hda ...) ? There was not any in the .img format...? When I yesterday did a first try with a .img file created with dd I got an error message about unknown geometry...
Please try

Code: Select all

qemu-img create system.img 10G
-- Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: How to run Qemu?

Post by Roland »

xeno74 wrote:Please try

Code: Select all

qemu-img create system.img 10G
Ok, I succeeded to create a new disk image... I also tested that it did not give the geom error, just the 'not bootable' notice as it is still empty.

Now, what is the correct way to copy the contents of my 12.04 partition into that image?

Fedora does not seem have by default any tool that can open an .img file. Thus I switched to Ubuntu-Remix and tried to open it with 'Disk image mounter', but got this error message: "Value too large for defined data type". I also tried to create an image with the strict minimum needed (4G), but it gave the same error. I have 8GB Ram in my X5000.

Would it work to 'dd' that empty image to a real partition, and then again back to an image, or would it just recreate the geometry problem...? If I try that, what is the command to copy all the contents from a disk to another, including the hidden files?

***
Well, I tested that image->partition->image method, and copied the Ubuntu 12.04 files to it as 'root', using the graphical intephase... (there were some 'special files' which the system refused to copy, I wonder how important they are?!) The end result was an image which did not give with Qemu the geom error, but was not bootable, either... So, what to try next??
- Roland -
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: How to run Qemu?

Post by Roland »

@Xeno

One further question occurred to my mind: Should these disk images used with Qemu be 'partition images' or 'full disk images'? The one I tested was a partition image...
- Roland -
User avatar
xeno74
Posts: 9349
Joined: Fri Mar 23, 2012 7:58 am

Re: How to run Qemu?

Post by xeno74 »

Roland wrote: Now, what is the correct way to copy the contents of my 12.04 partition into that image?
In my point of view Ubuntu 12.04 x86 is too slow on QEMU. I would recommend an older or a lightweight Linux distribution for x86 emulation.

-- Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: How to run Qemu?

Post by Roland »

xeno74 wrote:
Roland wrote: Now, what is the correct way to copy the contents of my 12.04 partition into that image?
In my point of view Ubuntu 12.04 x86 is too slow on QEMU. I would recommend an older or a lightweight Linux distribution for x86 emulation.
You are probably right... I happened to found an installation DVD for OpenSuse 13.1, which booted ok (so at least my Qemu installation works) but it was very, very slooow.

But the main issue now is how to create a _bootable_ hard disk image! So far no success, as I described above...

After that I could consider which distro would be the most suitable to run :-).
- Roland -
User avatar
xeno74
Posts: 9349
Joined: Fri Mar 23, 2012 7:58 am

Re: How to run Qemu?

Post by xeno74 »

Roland wrote: But the main issue now is how to create a _bootable_ hard disk image! So far no success, as I described above...

After that I could consider which distro would be the most suitable to run :-).
You could install a x86 Linux distribution with its own installation routine in an img. Sorry, I haven't copied a x86 Linux partition to an img yet. I only copied a PowerPC Linux partition to an img. The PowerPC img is only for our AmigaOnes so we don't need any boot loaders because we have CFE and U-Boot.

-- Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: How to run Qemu?

Post by Roland »

I tested a couple of 'lightweighted' distros with Qemu...

DSL 4.4.10 was a surprice, it was fast to boot and the user interface was not too hevy, either. So far the only one which is in the same scale with the processor power (24Mhz) available. Unfortunately it has not been updated for years (last beta is from 2012), and Firefox was out of date and certificates expired.

SliTaz is still in developement, and it seemed to be up to date in all respect, including the software collection. Unfortunately it was also clearly slower, booting took several minutes and the menus were somewhat sluggish...

There are in Qemu several boot options, but are there any which could give some more power? How about the CPU and accelerator parameters, do they have any effect? Or are we restricted to the '24Mhz' with a 2GHz X5000?
- Roland -
Post Reply