Running chromiumos arm64 generic build on qemu+kvm

2,097 views
Skip to first unread message

Ravishankar S

unread,
Apr 25, 2021, 12:09:32 PM4/25/21
to Chromium OS Discussion
Hello,

Is it possible to get chromiumos running on qemuy+kvm on aarch64 machine ?

I tried to to get an image from here:


But the images dont seem to be UEFI compliant. The EFI System Partition is empty and I am not able to get it booting with this command


qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host -enable-kvm \
-device usb-ehci -device usb-kbd  -device usb-mouse -usb -serial stdio  \
-device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on \
-device virtio-blk-device,drive=hd \
-drive if=none,file=chromiumos_image.bin,format=raw,id=hd   \
-netdev user,id=mynet   \
-device virtio-net-device,netdev=mynet \
-bios edk2-aarch64-code.fd -no-reboot

Also how can i download images from the ci builds ? I am not able to find the build artifacts at this location for example:


I am also not able to get a pre-built image from here:


How can i get access ?

Thanks and Regards,



Mike Frysinger

unread,
Apr 25, 2021, 1:51:48 PM4/25/21
to ravishan...@gmail.com, Chromium OS Discussion
On Sun, Apr 25, 2021 at 12:09 PM Ravishankar S <ravishan...@gmail.com> wrote:
Is it possible to get chromiumos running on qemuy+kvm on aarch64 machine ?

we had some devs internally get it going

I tried to to get an image from here:


But the images dont seem to be UEFI compliant. The EFI System Partition is empty and I am not able to get it booting with this command


qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host -enable-kvm \
-device usb-ehci -device usb-kbd  -device usb-mouse -usb -serial stdio  \
-device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on \
-device virtio-blk-device,drive=hd \
-drive if=none,file=chromiumos_image.bin,format=raw,id=hd   \
-netdev user,id=mynet   \
-device virtio-net-device,netdev=mynet \
-bios edk2-aarch64-code.fd -no-reboot


Also how can i download images from the ci builds ? I am not able to find the build artifacts at this location for example:


I am also not able to get a pre-built image from here:


How can i get access ?

it says permission denied, but that's just the website being confusing.  that file doesn't actually exist.  which makes sense as R45 is ancient.

here's the most recent one:
-mike

Mike Frysinger

unread,
Apr 26, 2021, 1:32:14 AM4/26/21
to Ravishankar S, Chromium OS Discussion
use the test image.  we intend on deleting the qemu image since it's no longer relevant.
-mike

On Mon, Apr 26, 2021 at 12:18 AM Ravishankar S <ravishan...@gmail.com> wrote:
Thanks Mike.

However I am not able to find the  chromiumos_qemu_image.tar.xz file in the arm64 generic build. Its present in the amd64 build.

It seems like this build artifact is not produced for the arm64 build ? 

Ravishankar S

unread,
Apr 27, 2021, 12:47:29 PM4/27/21
to Chromium OS Discussion, Mike Frysinger, Chromium OS Discussion, Ravishankar S
Thanks Mike.

However I am not able to find the  chromiumos_qemu_image.tar.xz file in the arm64 generic build. Its present in the amd64 build.

It seems like this build artifact is not produced for the arm64 build ? 



On Sunday, April 25, 2021 at 11:21:48 PM UTC+5:30 Mike Frysinger wrote:

Ravishankar S

unread,
Apr 27, 2021, 12:48:49 PM4/27/21
to Chromium OS Discussion, Mike Frysinger, Chromium OS Discussion, Ravishankar S
So the results is same as before. The following command (here I use the aarch32 in kvm)

qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host,aarch64=off -enable-kvm -device usb-ehci -device usb-kbd  -device usb-mouse -usb -serial stdio  -device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on -device virtio-blk-device,drive=hd -drive if=none,file=chromiumos_test_image.bin,index=0,media=disk,cache=unsafe,format=raw,id=hd   -netdev user,id=mynet   -device virtio-net-device,netdev=mynet -bios edk2-arm-code.fd -no-reboot

I get dropped off at the EFI Shell and the EFI partition is empty. I think some different method of booting/bootloader will be needed on the qemu aarch64 system. The  EDK2 BIOS is not working. If I dont use the -bios nothing happens at all (no booting)

Could you suggest some other boot loading method. 

EDK2 UEFI Shell: 
FS0:\> dir
FSOpen: Open '.' Success
Directory of: FS0:\
          0 File(s)           0 bytes
          0 Dir(s)
FSOpen: Open '\' Success
FS0:\> ls 

Thanks and Regards


Ravishankar S

unread,
Apr 29, 2021, 12:28:57 AM4/29/21
to Chromium OS Discussion, Mike Frysinger, Chromium OS Discussion, Ravishankar S
Can I download the u-boot binary somewhere that is able to boot the chromium arm64 os image in qemu ?

Thanks and Regards

Mike Frysinger

unread,
Apr 29, 2021, 12:31:09 AM4/29/21
to Ravishankar S, Chromium OS Discussion
we don't build or ship u-boot in general, or for arm64.
there might be one out there unrelated to CrOS, but it's not something we'd track.
-mike

Ravishankar S

unread,
Apr 29, 2021, 11:11:40 AM4/29/21
to Chromium OS Discussion, Mike Frysinger, Chromium OS Discussion, Ravishankar S
So I take it that its impossible to boot chromiumos on qemu arm. Have to try my luck on x86. 

Mike Frysinger

unread,
Apr 29, 2021, 11:12:26 AM4/29/21
to Ravishankar S, Chromium OS Discussion
it's not impossible ... some devs internally have done it.  it just isn't well documented & ready to go off the shelf.
-mike

Avi Thor

unread,
Apr 30, 2021, 11:15:01 AM4/30/21
to vap...@chromium.org, Ravishankar S, Chromium OS Discussion
if its not impossible can you do it 

--
--
Chromium OS Discussion mailing list: chromium-...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-discuss
---
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-dis...@chromium.org.

Ravishankar S

unread,
May 6, 2021, 12:04:59 PM5/6/21
to Chromium OS Discussion, THOR...@oshkosh.k12.wi.us, Ravishankar S, Chromium OS Discussion, Mike Frysinger
Its not supported. Wish I had read the documentation


"Some boards do not generate VM images. amd64-generic and betty (for ARC, internal only) are recommended. Using cros_vm for non-X86 boards is currently not supported."

Ravishankar S

unread,
May 7, 2021, 12:00:39 PM5/7/21
to Chromium OS Discussion, Ravishankar S, THOR...@oshkosh.k12.wi.us, Chromium OS Discussion, Mike Frysinger
Would request google to make the arm64 build vm bootable. Its certainly not possible for normal users like me.

Thanks

Ravishankar S

unread,
May 9, 2021, 12:58:04 AM5/9/21
to Chromium OS Discussion, Ravishankar S, THOR...@oshkosh.k12.wi.us, Chromium OS Discussion, Mike Frysinger, Simon Glass
Here is the result of my latest experiment

I just used a normal linux kernel from debian and its initrd and tried to boot into the chromiumos rootfs. It does boot to a certain point before it stops.

qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host -enable-kvm  -kernel vmlinuz-4.19.0-14-arm64  -initrd initrd.img-4.19.0-14-arm64 -append 'console=ttyAMA0 loglevel=7 init=/sbin/init cros_secure drm.trace=0x106 root=/dev/vda3 rootfstype=ext2 rootwait ro  dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1' -device usb-ehci -device usb-kbd  -device usb-mouse -usb  -serial stdio -device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on -device virtio-blk-device,drive=hd -drive if=none,file=chromiumos_test_image.bin,format=raw,id=hd  -netdev user,id=mynet   -device virtio-net-device,netdev=mynet 

Begin: Will now check root file system ... fsck from util-linux 2.33.1
[/sbin/fsck.ext4 (1) -- /dev/vda3] fsck.ext4 -a -C0 /dev/vda3 
/dev/vda3 has unsupported feature(s): FEATURE_R24 FEATURE_R25 FEATURE_R26 FEATURE_R27 FEATURE_R28 FEATURE_R29 FEATURE_R30 FEATURE_R31
e2fsck: Get a newer version of e2fsck!
fsck exited with status code 8
done.
Warning: File system check failed but did not detect errors
[   39.248750] EXT4-fs (vda3): mounting ext2 file system using the ext4 subsystem
[   39.253173] EXT4-fs (vda3): mounted filesystem without journal. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
[   39.826639] random: init: uninitialized urandom read (12 bytes read)
[   42.255552] random: crng init done
[   42.312577] init: early-failure main process (275) terminated with status 124
[   42.450515] EXT4-fs warning (device vda1): ext4_enable_quotas:5879: Failed to enable quota tracking (type=0, err=-3). Please run e2fsck to fix.
[   42.454119] EXT4-fs (vda1): mount failed
[   42.462040] chromeos-boot-alert: self_repair
chromeos-boot-alert: self_repair[   42.464714] init: udev pre-start process (280) killed by ABRT signal

Hangs after this...

So I now think that it may be possible to do qemu boot provided we have the chromiumos  kenel in the required format.

Wwe also need kernel command line arguments. I used strings command on the kernel partition binary and here is see as:

console= loglevel=7 init=/sbin/init cros_secure drm.trace=0x106 root=/dev/dm-0 \
rootwait ro dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 \
dm="1 vroot none ro 1,0 4096000 verity payload=PARTUUID=%U/PARTNROFF=1 hashtree=PARTUUID=%U/PARTNROFF=1 hashstart=4096000 alg=sha256 root_hexdigest=96e1179060196a27c5488136d3a7761638b999c2a5efa2fc445fe6d2a864622e salt=83e1d5be3708190380b12a25b0b774e904d19e944352bf6a0601cde172213593" \
noinitrd cros_debug vt.global_cursor_default=0 kern_guid=%U 

Not sure if the %U is expanded to something before passing it to kernel though

Thanks and Regards,
Ravishankar

Simon Glass

unread,
May 10, 2021, 12:28:37 PM5/10/21
to Ravishankar S, Chromium OS Discussion, THOR...@oshkosh.k12.wi.us, Mike Frysinger
Hi Ravishankar,

On Sun, 9 May 2021 at 01:37, Ravishankar S <ravishan...@gmail.com> wrote:
>
> Further progress I have made on this.
>
> I am now able to extract the kernel from the vmlinuz.bin FIT file ..
>
> rreddy78@jetson-nano:/media/rreddy78/TOSHIBA/JetsonNano$ dumpimage -T flat_dt -p 0 -o Image.bin vmlinuz.bin
> Extracted:
> Image 0 (kernel@1)
> Description: unavailable
> Created: Fri Apr 23 07:54:38 2021
> Type: Kernel Image (no loading done)
> Compression: lz4 compressed
> Data Size: 8923387 Bytes = 8714.25 KiB = 8.51 MiB
>
> Now when I try to boot with this kernel as follows:
>
> qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host -enable-kvm -kernel vmlinuz-4.19.188-11540-arm64 \
> -append 'console=ttyAMA0 init=/sbin/init boot=local rootwait ro noresume noswap loglevel=7 noinitrd root=/dev/vda3 cros_legacy cros_debug' \
> -device usb-ehci -device usb-kbd -device usb-mouse -usb -serial stdio -device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on \
> -device virtio-blk-device,drive=hd -drive if=none,file=/media/rreddy78/TOSHIBA/JetsonNano/chromiumos_test_image.bin,format=raw,id=hd \
> -netdev user,id=mynet -device virtio-net-device,netdev=mynet
>
> Booting is fine but startup appplications could not be loaded.
>
> [ 3.336536] LoadPin: load pinning can be disabled.
> [ 3.338181] LoadPin: kernel-module pinned obj="/lib/modules/4.19.188-11540-gfe9315762f7a/kernel/drivers/block/zram/zram.ko" pid=464 cmdline="modprobe zram"
> [ 3.344208] zram: Added device: zram0
> [ 3.388374] init: vpd-log main process (324) terminated with status 1
> [ 3.405534] zram0: detected capacity change from 0 to 2041921536
> [ 3.419916] Adding 1994060k swap on /dev/zram0. Priority:-2 extents:1 across:1994060k SS
> [ 3.465982] init: cgroups main process (320) terminated with status 1
> [ 3.743650] init: tcsd main process (640) terminated with status 137
> [ 3.745828] init: tcsd main process ended, respawning
> [ 4.354987] init: machine-info pre-start process (539) terminated with status 1
> [ 5.304259] audit: type=1326 audit(1577923202.897:2): auid=4294967295 uid=247 gid=247 ses=4294967295 subj=kernel pid=1598 comm="attestationd" exe="/usr/sbin/attestationd" sig=0 arch=c00000b7 syscall=198 compat=0 ip=0x7a2298574c code=0x7ffc0000
> [ 6.720455] init: ui main process (1189) terminated with status 2
> [ 7.170846] init: machine-info pre-start process (1798) terminated with status 1
> [ 8.800725] init: ui main process (2047) terminated with status 2
> [ 9.241381] init: machine-info pre-start process (2274) terminated with status 1
> [ 10.861583] init: ui main process (2521) terminated with status 2
> [ 11.254688] init: machine-info pre-start process (2748) terminated with status
>
> It looks like there is some problem running the applications. Maybe with some small adjustments we should be able to get it to run..
>
> Now I am not sure if this is caused because as I understand the user space of ChromiumOS is all 32 bit ? I am running qemu+kvm in 64 bit mode,

I'll leave that to others to figure out as you are beyond any
knowledge I might have. I'm also not sure of the state of graphics.

Regards,
Simon



>
> Thanks and Regards,

Ravishankar S

unread,
May 10, 2021, 2:34:18 PM5/10/21
to Chromium OS Discussion, Ravishankar S, THOR...@oshkosh.k12.wi.us, Chromium OS Discussion, Mike Frysinger, Simon Glass
Further progress I have made on this.

I am now able to extract the kernel from the vmlinuz.bin FIT file ..

rreddy78@jetson-nano:/media/rreddy78/TOSHIBA/JetsonNano$ dumpimage -T flat_dt -p 0 -o Image.bin vmlinuz.bin  
Extracted:
 Image 0 (kernel@1)
  Description:  unavailable
  Created:      Fri Apr 23 07:54:38 2021
  Type:         Kernel Image (no loading done)
  Compression:  lz4 compressed
  Data Size:    8923387 Bytes = 8714.25 KiB = 8.51 MiB

Now when I try to boot with this kernel as follows:

qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host -enable-kvm  -kernel vmlinuz-4.19.188-11540-arm64 \
-append 'console=ttyAMA0 init=/sbin/init boot=local rootwait ro noresume noswap loglevel=7 noinitrd root=/dev/vda3 cros_legacy cros_debug' \
-device usb-ehci -device usb-kbd -device usb-mouse -usb  -serial stdio -device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on \
-device virtio-blk-device,drive=hd -drive if=none,file=/media/rreddy78/TOSHIBA/JetsonNano/chromiumos_test_image.bin,format=raw,id=hd  \
-netdev user,id=mynet -device virtio-net-device,netdev=mynet 

Booting is fine but startup appplications could not be loaded.

[    3.336536] LoadPin: load pinning can be disabled.
[    3.338181] LoadPin: kernel-module pinned obj="/lib/modules/4.19.188-11540-gfe9315762f7a/kernel/drivers/block/zram/zram.ko" pid=464 cmdline="modprobe zram"
[    3.344208] zram: Added device: zram0
[    3.388374] init: vpd-log main process (324) terminated with status 1
[    3.405534] zram0: detected capacity change from 0 to 2041921536
[    3.419916] Adding 1994060k swap on /dev/zram0.  Priority:-2 extents:1 across:1994060k SS
[    3.465982] init: cgroups main process (320) terminated with status 1
[    3.743650] init: tcsd main process (640) terminated with status 137
[    3.745828] init: tcsd main process ended, respawning
[    4.354987] init: machine-info pre-start process (539) terminated with status 1
[    5.304259] audit: type=1326 audit(1577923202.897:2): auid=4294967295 uid=247 gid=247 ses=4294967295 subj=kernel pid=1598 comm="attestationd" exe="/usr/sbin/attestationd" sig=0 arch=c00000b7 syscall=198 compat=0 ip=0x7a2298574c code=0x7ffc0000
[    6.720455] init: ui main process (1189) terminated with status 2
[    7.170846] init: machine-info pre-start process (1798) terminated with status 1
[    8.800725] init: ui main process (2047) terminated with status 2
[    9.241381] init: machine-info pre-start process (2274) terminated with status 1
[   10.861583] init: ui main process (2521) terminated with status 2
[   11.254688] init: machine-info pre-start process (2748) terminated with status 

It looks like there is some problem running the applications. Maybe with some small adjustments we should be able to get it to run..

Now I am not sure if this is caused because as I understand the user space of ChromiumOS is all 32 bit ? I am running qemu+kvm in 64 bit mode,

Thanks and Regards,

Ravishankar S

unread,
May 10, 2021, 2:34:42 PM5/10/21
to Chromium OS Discussion, Mike Frysinger, Chromium OS Discussion, Ravishankar S
The kernel in the test image does not seem to support DRM. Not able to use  -device virtio-gpu-pci,virgl=on.

Ravishankar S

unread,
May 13, 2021, 11:06:17 AM5/13/21
to Chromium OS Discussion, Ravishankar S, Mike Frysinger, Chromium OS Discussion
Can CONFIG_DRM_VIRTIO_GPU be enabled for future arm64-generic builds.
I think this is one missing piece for getting it to run on qemu.

And perhaps this script needs adapted: /image_to_vm.sh --board=${BOARD} --test_image

GRUB2 bootloader is EFI compliant and can be included for arm64 qemu image..
Reply all
Reply to author
Forward
0 new messages