WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Qemu-arm e piCore 14.x amrv6  (Read 1830 times)

Offline DesobedecoMinhaImaginacao

  • Newbie
  • *
  • Posts: 12
Qemu-arm e piCore 14.x amrv6
« on: December 13, 2023, 12:19:11 PM »
How to run PiCore 14.x armv6 on qemu-arm?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #1 on: December 13, 2023, 01:15:51 PM »
Hi DesobedecoMinhaImaginacao
Check the  .info  file:
http://tinycorelinux.net/14.x/x86/tcz/qemu_arm.tcz.info

Offline DesobedecoMinhaImaginacao

  • Newbie
  • *
  • Posts: 12
Re: Qemu-arm e piCore 14.x amrv6
« Reply #2 on: December 15, 2023, 10:35:16 AM »
Where are the files  kernel4922v7.img 9.0.3v7.gz  bcm2709-rpi-2-b.dtb ?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #3 on: December 15, 2023, 10:56:14 AM »
Hi DesobedecoMinhaImaginacao
You will need to download the  piCore-14.0.1.zip  file:
http://tinycorelinux.net/14.x/armv6/releases/RPi/
Unzip it and you will find a  .img  file.

See this post on how to mount the file and access its contents:
https://forum.tinycorelinux.net/index.php/topic,24063.msg151721.html#msg151721

The version numbers will be different. The example is for piCore version 9.

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 160
Re: Qemu-arm e piCore 14.x amrv6
« Reply #4 on: December 15, 2023, 12:48:12 PM »
https://forum.tinycorelinux.net/index.php/topic,24063.msg151721.html#msg151721

Hi, RIch.

lsblk returns no partitions.
Also, qemu (not arm) forces me to manually load pcre, on x86_64. And the bridge tutorial dont works (it tries to load conf from tcloop folder?)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #5 on: December 15, 2023, 02:30:21 PM »
Hi CardealRusso
I just tried it under TC10 x86 with  util-linux.tcz  installed.

It worked for me:
Code: [Select]
tc@E310:~/piCore14$ unzip piCore-14.0.1.zip
Archive:  piCore-14.0.1.zip
  inflating: piCore-14.0.1.img       
 extracting: piCore-14.0.1.img.md5.txt 
tc@E310:~/piCore14$ sudo losetup --show --find --partscan piCore-14.0.1.img
/dev/loop295
tc@E310:~/piCore14$ sudo lsblk /dev/loop295
NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop295       7:295  0  84M  0 loop
|-loop295p1 259:0    0  64M  0 loop
`-loop295p2 259:1    0  16M  0 loop
tc@E310:~/piCore14$ mkdir P1 P2
tc@E310:~/piCore14$ sudo mount /dev/loop295p1 P1
tc@E310:~/piCore14$ sudo mount /dev/loop295p2 P2
tc@E310:~/piCore14$ sudo lsblk -f /dev/loop295
NAME        FSTYPE LABEL      UUID                                 MOUNTPOINT
loop295                                                           
|-loop295p1 vfat   piCore_14  BCF7-359C                            /home/tc/piCore14/P1
`-loop295p2 ext4   piCore_TCE c662e9d0-0e6f-49e1-8f9d-959d394da370 /home/tc/piCore14/P2
tc@E310:~/piCore14$

Where are the files  kernel4922v7.img 9.0.3v7.gz  bcm2709-rpi-2-b.dtb ?
Here are the files:
Code: [Select]
tc@E310:~/piCore14$ ls -l P1/bcm2709-rpi-2-b.dtb
-rwxr-xr-x 1 root root 30594 Aug 20 19:39 P1/bcm2709-rpi-2-b.dtb
tc@E310:~/piCore14$ ls -l P1/kernel6125v7.img
-rwxr-xr-x 1 root root 6571680 Aug 20 19:39 P1/kernel6125v7.img
tc@E310:~/piCore14$ grep -m1 "v7.gz" P1/config.txt
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz followkernel
tc@E310:~/piCore14$

The equivalent of  9.0.3v7.gz  would be  rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz.
You can create a single file version like this:
Code: [Select]
cat P1/rootfs-piCore-14.0.gz P1/modules-6.1.25-piCore-v7.gz > 14.0.1v7.gz

Offline DesobedecoMinhaImaginacao

  • Newbie
  • *
  • Posts: 12
Re: Qemu-arm e piCore 14.x amrv6
« Reply #6 on: December 16, 2023, 02:02:27 AM »
I followed all the tips.  However, the following command line:

sudo mount /dev/loop89p1 P1/

Generates the following error message:

/dev/loop89p1: Can't open blockdev
mount: /mnt/sda1/ParaUso/i686/home/tc/Downloads/P1: special device /dev/loop89p1 does not exist.
dmesg(1) may have more information after failed mount system call.

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 160
Re: Qemu-arm e piCore 14.x amrv6
« Reply #7 on: December 16, 2023, 03:08:35 AM »
/dev/loop89p1: Can't open blockdev
The same thing happened to me.
That worked:
Code: [Select]
tc@box:/mnt/md0/test/picore$ sudo partx -a -v piCore-14.0.1.img
partition: none, disk: piCore-14.0.1.img, lower: 0, upper: 0
Trying to use '/dev/loop215' for the loop device
/dev/loop215: partition table type 'dos' detected
range recount: max partno=2, lower=0, upper=0
/dev/loop215: partition #1 added
/dev/loop215: partition #2 added
tc@box:/mnt/md0/test/picore$ sudo mount /dev/loop215p1 P1
tc@box:/mnt/md0/test/picore$ sudo mount /dev/loop215p2 P2
tc@box:/mnt/md0/test/picore$

Unfortunately no luck with qemu.

Code: [Select]
QEMU_AUDIO_DRV=none qemu-system-arm -M raspi2 -m 1G -kernel kernel6125.img  -initrd rootfs-piCore-14.0.gz  -append "elevator=deadline rootwait quiet nortc nozswap dwc_otg.lpm_enable=0  root=/dev/ram0" -dtb bcm2709-rpi-2-b.dtb -serial stdio -sd ../piCore-14.0.1.img
Code: [Select]
WARNING: Image format was not specified for '../piCore-14.0.1.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-arm: Invalid SD card size: 84 MiB
SD card size has to be a power of 2, e.g. 128 MiB.
You can resize disk images with 'qemu-img resize <imagefile> <new-size>'
(note that this will lose data if you make the image smaller than it currently is).
« Last Edit: December 16, 2023, 03:13:43 AM by CardealRusso »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #8 on: December 16, 2023, 05:39:02 AM »
Hi CardealRusso
From the qemu_arm info file:
Quote
                example howto:
                $ qemu-img create -f qcow2 piCore.img 1G
                $ QEMU_AUDIO_DRV=none qemu-system-arm -M raspi2 -m 1G -kernel \
                  kernel4922v7.img -initrd 9.0.3v7.gz -append "elevator=deadline \
                  rootwait quiet nortc nozswap dwc_otg.lpm_enable=0 \
                  root=/dev/ram0" -dtb bcm2709-rpi-2-b.dtb -serial stdio \
                  -sd piCore.img

That  initrd  is not complete:
Quote
-kernel kernel6125.img  -initrd rootfs-piCore-14.0.gz  -append "elevator=deadline

Depending on whether or not you can specify multiple file names for  -initrd  in
qemu_arm, you can try one of these two methods:
... The equivalent of  9.0.3v7.gz  would be  rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz.
You can create a single file version like this:
Code: [Select]
cat P1/rootfs-piCore-14.0.gz P1/modules-6.1.25-piCore-v7.gz > 14.0.1v7.gz

Wrong image file:
Quote
-sd ../piCore-14.0.1.img
The example shows first creating an image file for qemu to use as a disk:
Code: [Select]
qemu-img create -f qcow2 piCore.img 1GAnd then specifying that disk in the command:
Code: [Select]
-sd piCore.img

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 160
Re: Qemu-arm e piCore 14.x amrv6
« Reply #9 on: December 16, 2023, 06:00:41 AM »
Code: [Select]
cat P1/rootfs-piCore-14.0.gz P1/modules-6.1.25-piCore-v7.gz > 14.0.1v7.gz
Code: [Select]
qemu-img create -f qcow2 piCore.img 1G[/quote]

Thanks.

qemu now runs without any errors or warnings, but nothing happens...Although there is high CPU usage from qemu on htop, qemu remains with a black screen without any sign of activity. Is this supposed to take hours to start?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #10 on: December 16, 2023, 06:33:11 AM »
Hi CardealRusso
The first thing you should check is to make sure you are
not mixing files for different architectures (armV6, armV7, etc.).
Everything in the example I posted was for armV7.

If you look in  P1/config.txt  it lists which files are compatible:
Code: [Select]
[PI0]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore.gz followkernel
kernel kernel6125.img

[PI02]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz followkernel
kernel kernel6125v7.img

[PI1]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore.gz followkernel
kernel kernel6125.img

[PI2]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz followkernel
kernel kernel6125v7.img

[PI3]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7.gz followkernel
kernel kernel6125v7.img

[PI4]
initramfs rootfs-piCore-14.0.gz,modules-6.1.25-piCore-v7l.gz followkernel
kernel kernel6125v7l.img

[ALL]
cmdline cmdline.txt
Unfortunately, it does not tell you which  .dtb  file to use.

As far as speed is concerned, I seem to recall very slow
execution on machines that don't have hardware support
for the kvm-KERNEL.tcz  drivers.

Offline DesobedecoMinhaImaginacao

  • Newbie
  • *
  • Posts: 12
Re: Qemu-arm e piCore 14.x amrv6
« Reply #11 on: December 17, 2023, 12:02:37 PM »
After following Rich and CardealRusso's tips, the qemu command, instead of emulating, issues the error message:

Could not initialize SDL(x11 not available) - exiting.
SDL and SDL2 they are installed.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11226
Re: Qemu-arm e piCore 14.x amrv6
« Reply #12 on: December 17, 2023, 09:41:28 PM »
Hi DesobedecoMinhaImaginacao
I don't think it's saying that SDL is missing. It's complaining
that  X11  is missing. It can't find a GUI.

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 160
Re: Qemu-arm e piCore 14.x amrv6
« Reply #13 on: December 24, 2023, 05:52:54 AM »
Hi, RIch.

With a for loop, I tried all possible combinations, with raspi0, raspi2, -cpu arm1176 and all the dtb and none worked.
Maybe I'm missing something. I hope someone succeeds in emulating and shares how. By the way, I managed to emulate debian without much difficulty (a very old version)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14552
Re: Qemu-arm e piCore 14.x amrv6
« Reply #14 on: December 24, 2023, 05:56:34 AM »
As I recall, @bmarkus had modified the initrd of an early version of piCore to allow it to work with qemu.