Skip to main content
Topic: Can I make an ARMtix virtual machine (on x86_64)? (Read 660 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Can I make an ARMtix virtual machine (on x86_64)?

ARMtix images are the folder of the system, so I cannot try that on virt-manager that use iso.
I tried to make an Alpine qemu VM but I cannot boot.

Is it possible to run an arm VM?

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #1
I do it as follows:
1) create disk image with
Code: [Select]
dd if=/dev/zero of=root.img bs=1G count=4
2) create partitions on this image
3) mount partitions, unpack rootfs
4) add uboot
After that i run qemu-system-aarch64 and get working VM
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #2
Can you clarify to how do 2, 3 and 4?

Code: [Select]
pacman -S qemu-headless-arch-extra
resolving dependencies...
warning: cannot resolve "libbpf.so=0-64", a dependency of "qemu-headless-arch-extra"
:: The following package cannot be upgraded due to unresolvable dependencies:
      qemu-headless-arch-extra

:: Do you want to skip the above package for this upgrade? [y/N]
error: failed to prepare transaction (could not satisfy dependencies)
:: unable to satisfy dependency 'libbpf.so=0-64' required by qemu-headless-arch-extra

Can I use that package? But some problem when installing it.
Or do I need "qemu-emulators-full"?

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #3
2)
Code: [Select]
modprobe loop
cfdisk /dev/loop0
Create partitions as you need. You can use any other tool like gparted as well.
3) After you created partitions you can mount them as usual, they will be present as /dev/loop0p1 etc. Unpack with tar xf
4) An example is here but it's not actually best one i had
I didn't try headless qemu, just have qemu-system-aarch64 (don't remember from which package)
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #4
You need to use losetup to mount the image in /dev/loop0.
Man page:
Quote
EXAMPLE
       The following commands can be used as an example of using the loop device.

           # dd if=/dev/zero of=~/file.img bs=1024k count=10
           # losetup --find --show ~/file.img
           /dev/loop0
           # mkfs -t ext2 /dev/loop0
           # mount /dev/loop0 /mnt
           ...
           # umount /dev/loop0
           # losetup --detach /dev/loop0

I made 2 partitions with cfdisk.
But I can't see them no /dev/loop0p1 etc.
Only cfdisk shows them.

Anyway the link states that:
Quote
If you created loopback drive image (e.g. you formatted the whole disk file as single partition w/0 partition scheme) you should use 0:0 instead of 0:1 as device address.


Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #5
Yes, i forgot to mention losetup. As for partition, if you remove /dev/loop0 and then add it again via losetup, the partitions should appear
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #6
I made one ext4 partition.
losetup made /dev/loop0.
I mounted that on a folder, mnt.
And I copied the ARMtix archive there.

I made boot.cmd file:
Code: [Select]
setenv bootargs "root=/dev/loop0 rw rootwait console=ttyAMA0"
load scsi 0:0 ${kernel_addr_r} /Image
load scsi 0:0 ${ramdisk_addr_r} /initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}

Is that correct? I put it in mnt/boot.
There I copied u-boot.bin and I made the u-boot file:

Code: [Select]
mkimage -A arm -T script -d boot.cmd boot.scr

When I run
Code: [Select]
qemu-system-aarch64 -machine virt -cpu cortex-a53 -smp 2 -m 1024 -bios u-boot.bin 
(from mnt/boot) I just get a qemu prompt:

Code: [Select]
QEMU 7.2.0 monitor - type 'help' for more information
(qemu)

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #7
If you use single partition, adjust paths in boot.cmd to match actual kernel and initramfs locations.
As for logs, you can find serial tty in qemu outputs menu (don't remember where it actually is, also don't have it installed atm)
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #8
Code: [Select]
setenv bootargs "root=/dev/loop0 rw rootwait console=ttyAMA0"
load scsi 0:0 ${kernel_addr_r} /boot/Image
load scsi 0:0 ${ramdisk_addr_r} /boot/initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr}

Is "root=/dev/loop0" correct?
Or do I need to mount that for qemu and specify the folder?

Are kernel and initramfs locations specified in the correct way?

I mounted /dev/loop0 on mnt in my home, it is not working.

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #9
Root argument must point at partition name seen by VM. I think, if you specify it in root=PARTUUID= format, it should work. The kernel and initramfs look correct.
If you doubt, you can try to switch to serial tty menu right after starting qemu and insert commands from boot.cmd
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #10
I tried
Code: [Select]
setenv bootargs "root=PARTUUID=4bb433d4-4b2b-4b83-90c8-0d39108d72a3 rw rootwait console=ttyAMA0"
That is /dev/loop0 UUID.

Using ctrl+alt+2 I can change qemu tty and I can see "fatal: no kernel available" and bad CRC.

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #11
Did you make loop0 a loop device or does it actually contain partitions (mbr/gpt)?
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #12
Code: [Select]
dd if=/dev/zero of=~/file.img bs=1G count=4
losetup --find --show ~/file.img
/dev/loop0
mkfs.ext4 /dev/loop0
mount /dev/loop0 mnt
tar -xf armtix-dinit-20230101.tar.xz -C /some/folder/
rsync -avxHAX --progress /some/folder/* mnt/

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #13
Again, try to play with uboot commands in this command line. You may need to initialize disk subsystem (which can be either scsi or virtio)
ARMtix

Re: Can I make an ARMtix virtual machine (on x86_64)?

Reply #14
How can I initialize disk subsystem?
How do I know if it is scsi or virtio?