Author Topic: Alarmz On Qemu  (Read 10007 times)

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« on: December 07, 2015, 10:42:37 am »
Ok so I thought this would be easy but I am (probably) one step in over my head so maybe someone can help.

QEMU has native support for the Zaurus line of product under ARM emulation.  After a little google search it seemed running a debian install worked good so why not get ALARMZ going.

So the steps I have done so far is as follows.

I had to create a raw disk image to run from, so did this to make a 6gig image.

Code: [Select]
dd if=/dev/null of=alarm.img bs=1M seek=6114
Then I had to format the image.

Code: [Select]
mkfs.ext4 -F alarm.img
Then I mounted it and untar the file system just like you would on real hardware.

Code: [Select]
mkdir /mnt/alarm
mount -t ext4 -o loop alarm.img /mnt/alarm
bsdtar xvf alarm-zaurus-c3x00-minimal-rootfs-october2015.tar.xz -C /mnt/alarm/

Now I thought that would be it, start up the VM and watch the magic happen.  Unfortunately no such luck.

Code: [Select]
qemu-system-arm -machine spitz alarm.img

qemu: fatal: Trying to execute code outside RAM or ROM at 0x00800000

R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=00800000
PSR=400001d3 -Z-- A svc32
FPSCR: 00000000
Aborted

So I'm not sure where to go from here.  Looking at other start-up strings it does seem like I might be missing -kernel and  -initrd files but have no idea where to get them.

If anyone can point me in a direction I'll try to do the leg work
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #1 on: December 07, 2015, 01:07:48 pm »
Ok, got the machine to boot at least using the zImage found in the file system.  It now kernel panics though which is for sure over my head.

Code: [Select]
qemu-system-arm -M terrier alarm.img -m 64 -kernel zImage-4.2.3-c3x00 -append root=/dev/sda
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
    • View Profile
    • http://github.com/greguu
Alarmz On Qemu
« Reply #2 on: December 08, 2015, 04:02:50 am »
Quote from: TheWalt
Ok, got the machine to boot at least using the zImage found in the file system.  It now kernel panics though which is for sure over my head.

Code: [Select]
qemu-system-arm -M terrier alarm.img -m 64 -kernel zImage-4.2.3-c3x00 -append root=/dev/sda

Hi TheWalt,

sorry I have been away for some time.

Try to append  "root=/dev/sda1" and use  "-M borzoi"

Cheers!
« Last Edit: December 08, 2015, 04:04:16 am by daalnroti »
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #3 on: December 08, 2015, 09:03:47 am »
I get the same error, and then kernel panic.

Code: [Select]
Inconsistency detected by ld.so: dynamic-link.h: 190: elf_get_dynamic_info: Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

UPDATE:

I forgot to edit the alarm.img fstab and boot.cfg.  Now that I have modified that I get the following error.

Code: [Select]
/sbin/init: error while loading shared libraries: librt.so.1: cannot open shared object file
Will continue to hack away
« Last Edit: December 08, 2015, 10:01:22 am by TheWalt »
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #4 on: December 08, 2015, 10:51:47 am »
Ok, so I made a new image file with a partition this time to match the default config.  I am starting the VM with the following which makes it use the image as a SD card, and uses the same string as in boot.cfg minus the error reporting so I can see what is happening.

Code: [Select]
qemu-system-arm -M borzoi -sd alarm2.img -m 64 -kernel zImage-4.2.3-c3x00 -append 'root=/dev/mmcblk0p1 rootfstype=ext4 fbcon=rotate:1 noinitrd cpufreq-pxa2xx.pxa27x_maxfreq=624' -portrait
Unfortunately it still stops after mount.  Any ideas would be appreciated.

[img]http://www.jevack.com/hosted/qemu_alarm1.png\" border=\"0\" class=\"linked-image\" /]
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
    • View Profile
    • http://github.com/greguu
Alarmz On Qemu
« Reply #5 on: December 08, 2015, 11:43:26 pm »
Quote from: TheWalt
Ok, so I made a new image file with a partition this time to match the default config.  I am starting the VM with the following which makes it use the image as a SD card, and uses the same string as in boot.cfg minus the error reporting so I can see what is happening.

Code: [Select]
qemu-system-arm -M borzoi -sd alarm2.img -m 64 -kernel zImage-4.2.3-c3x00 -append 'root=/dev/mmcblk0p1 rootfstype=ext4 fbcon=rotate:1 noinitrd cpufreq-pxa2xx.pxa27x_maxfreq=624' -portrait
Unfortunately it still stops after mount.  Any ideas would be appreciated.

[img]http://www.jevack.com/hosted/qemu_alarm1.png\" border=\"0\" class=\"linked-image\" /]

Hi, what version of qemu are you using ?

I tested here with QEMU emulator version 2.4.0.1,

My alarm.img has ext4 and is actually recognized as "mmcblk0" but boots fine using same command you posted.

I suggest you try again and re-download all the files to make sure nothing is corrupt.

Cheers!
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #6 on: December 09, 2015, 09:34:00 am »
HA!

I was running from 2.0.0 and when I updated to 2.4.1 it worked!

Now to get networking and should be good to go.  Thanks for the heads up on the QEMU version, considering how old the Z is I'd never thougth that would be the issue.
« Last Edit: December 09, 2015, 09:34:20 am by TheWalt »
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
    • View Profile
    • http://github.com/greguu
Alarmz On Qemu
« Reply #7 on: December 10, 2015, 02:02:18 am »
Quote from: TheWalt
HA!

I was running from 2.0.0 and when I updated to 2.4.1 it worked!

Now to get networking and should be good to go.  Thanks for the heads up on the QEMU version, considering how old the Z is I'd never thougth that would be the issue.

Great, good to know you got it going. For networking, qemu does a pass through mode by default, so setting your Z to dhcp and maybe editing resolv.conf should be enough.

If you want to be able to SSH to the Z you may need to look into "-net user,hostfwd=tcp::2222-:22" then you should be able to SSH to localhost:2222 and get into the Z.
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Alarmz On Qemu
« Reply #8 on: December 11, 2015, 12:41:44 am »
Excellent progress, Walt!
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

dmarschal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Alarmz On Qemu
« Reply #9 on: December 13, 2015, 03:29:50 am »
Hello!
I'm trying to get qemu to work. No luck so far. I'm on windows 7 and did all the steps mentioned in this thread.

I've made a 1G image, formatted to ext4, extracted the minimal rootfs and copied the kernel to the root dir if it helps.

I always get the following error:
Code: [Select]
zImage-4.2.3-c3x00: No such file or directory
qemu: could not load kernel 'zImage-4.2.3-c3x00'

qemu version is 2.4.93

command line is
Code: [Select]
qemu-system-arm -M spitz -sd alarm3.img -m 64 -kernel /zImage-4.2.3-c3x00 -append "root=/dev/mmcblk0p1 rootfstype=ext4 fbcon=rotate:1 noinitrd cpufreq-pxa2xx.pxa27x_maxfreq=624" -portrait
Thank you in advance for any help.
« Last Edit: December 13, 2015, 03:32:47 am by dmarschal »

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #10 on: December 14, 2015, 09:13:09 am »
Quote from: dmarschal
I always get the following error:
Code: [Select]
zImage-4.2.3-c3x00: No such file or directory
qemu: could not load kernel 'zImage-4.2.3-c3x00'

command line is
Code: [Select]
qemu-system-arm -M spitz -sd alarm3.img -m 64 -kernel /zImage-4.2.3-c3x00 -append "root=/dev/mmcblk0p1 rootfstype=ext4 fbcon=rotate:1 noinitrd cpufreq-pxa2xx.pxa27x_maxfreq=624" -portrait

Sounds like it just can't find the file, assuming you extracted it to a folder try using the full path to the zimage IE  c:\zaurusfiles\zImage-4.2.3-c3x00 or wherever it exist on your system.
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM

dmarschal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Alarmz On Qemu
« Reply #11 on: December 14, 2015, 10:03:53 am »
Quote from: TheWalt
Quote from: dmarschal
I always get the following error:
Code: [Select]
zImage-4.2.3-c3x00: No such file or directory
qemu: could not load kernel 'zImage-4.2.3-c3x00'

command line is
Code: [Select]
qemu-system-arm -M spitz -sd alarm3.img -m 64 -kernel /zImage-4.2.3-c3x00 -append "root=/dev/mmcblk0p1 rootfstype=ext4 fbcon=rotate:1 noinitrd cpufreq-pxa2xx.pxa27x_maxfreq=624" -portrait

Sounds like it just can't find the file, assuming you extracted it to a folder try using the full path to the zimage IE  c:\zaurusfiles\zImage-4.2.3-c3x00 or wherever it exist on your system.

It Works! Thank You so much!!!

I did not think the kernel is not loaded from the image file.

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
    • View Profile
    • http://github.com/greguu
Alarmz On Qemu
« Reply #12 on: December 15, 2015, 12:56:40 am »
Quote from: TheWalt
HA!

I was running from 2.0.0 and when I updated to 2.4.1 it worked!

Now to get networking and should be good to go.  Thanks for the heads up on the QEMU version, considering how old the Z is I'd never thougth that would be the issue.

Hi TheWalt.

did you have any success with the network?

I realized the qemu-system-arm does not allow the use of the virtual pcnet driver (pcnet is included as kernel module in ALARMZ)

If you found a way to get it working let me know, I guess I there might be a limitation and additional kernel modules may be required.

Cheers!
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
    • View Profile
    • http://github.com/greguu
Alarmz On Qemu
« Reply #13 on: December 15, 2015, 02:40:52 am »
Hi,
just as a note. ArchLinuxArm does not support qemu at all. I searched the alarm forums about qemu and the response is "not supported".
Saying that , there might be still a way to get networking going and I will put some effort in, but it is not my priority.
I only use qemu to test new build kernels boot process, not to test apps or network.
For testing apps etc, I recommend to use a SD card with alarm on it, so you test on SD first before going "production" on the CF card.
This way you can keep your main alarm on the CF "clean". I hope this makes sense, as there is no speed benefit from running qemu
and compiling applications under qemu is not recommended.
Cheers!
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

TheWalt

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Alarmz On Qemu
« Reply #14 on: December 15, 2015, 01:01:02 pm »
Quote from: daalnroti
Hi,
just as a note. ArchLinuxArm does not support qemu at all. I searched the alarm forums about qemu and the response is "not supported".
Saying that , there might be still a way to get networking going and I will put some effort in, but it is not my priority.
I only use qemu to test new build kernels boot process, not to test apps or network.
For testing apps etc, I recommend to use a SD card with alarm on it, so you test on SD first before going "production" on the CF card.
This way you can keep your main alarm on the CF "clean". I hope this makes sense, as there is no speed benefit from running qemu
and compiling applications under qemu is not recommended.
Cheers!

I unfortunately came to the same realization with networking, only loopback and IR (irda0) seems supported / detected.  I really only wanted to get this working so anyone who did not own physical hardware could still compile for the Z.

But I got to thinking, really all someone would need is a system that compiled against the armv5 right?  I wonder what other low end system would be compatible that could be purchased.
- Gemini PDA | WiFi - Android 7.1.1
- GPD Pocket | Ubuntu Mate 18.10
- Zaurus SL-C3100 | ArchLinuxARM