0

I am trying to boot HypriotOS (https://github.com/hypriot/image-builder-rpi/releases/) RPi images from QEMU

I am using the kernels from https://github.com/dhruvvyas90/qemu-rpi-kernel and preparing the image for QEMU using https://github.com/duquesnay/prepare-hypriot-qemu

I've tested that the root partition in the image is mountable and it looks fine to me:

$ sudo fdisk -lu hypriotos-rpi-v1.1.3-qemu01.imgDisco hypriotos-rpi-v1.1.3-qemu01.img: 8 GiB, 8589934592 bytes, 16777216 sectores
Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 512 bytes
Tipo de etiqueta de disco: dos
Identificador del disco: 0x00000000

Disposit.                        Inicio Comienzo    Final Sectores Tamaño Id Tipo
hypriotos-rpi-v1.1.3-qemu01.img1            2048   133119   131072    64M  c W95 FAT32 (LBA)
hypriotos-rpi-v1.1.3-qemu01.img2          133120 16777215 16644096     8G 83 Linux

$ sudo mount -o loop,offset=68157440 hypriotos-rpi-v1.1.3-qemu01.img /mnt/

$ ls /mnt/
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

However, when trying to boot with the following parameters it fails:

$ export APPEND_ARGS="root=/dev/sda2 panic=1 rw loglevel=8 console=ttyAMA0,115200"

$ qemu-system-arm -cpu arm1176 -m 256 -M versatilepb -no-reboot \
    -dtb ../../qemu-rpi-kernel/versatile-pb.dtb -serial stdio -append "${APPEND_ARGS}" \
    -kernel ../../qemu-rpi-kernel/kernel-qemu-4.4.34-jessie \
    -net nic -net user,restrict=off -hda hypriotos-rpi-v1.1.3-qemu01.img

The output shows that /dev/sda2 is detected on boot but for some reason the kernel keeps complaining about not being able to mount it:

/dev/sda2 detected but not mounted

| improve this question | | | | |
0

The key to solve this was strictly following the instructions about the DTB in https://github.com/dhruvvyas90/qemu-rpi-kernel#choosing-a-kernel-image

Choosing a kernel image

This repository contains three types of kernel images:

  • kernel-qemu-4.*.*-buster are the most recent images, which are compatible with Raspbian Buster and Stretch. To use these images, you'll need the versatile-pb.dtb file which is also contained in this repository. Unless you are positive you need a different kernel, the most recent of these images is probably what you want.

  • kernel-qemu-4.*.*-stretch are images compatible with Raspbian Stretch and Jessie. To use these images, you'll need the versatile-pb.dtb file which is also contained in this repository.

  • kernel-qemu-4.4.*-jessie are images compatible with Raspbian Jessie and Wheezy.

  • kernel-qemu-3.10.25-wheezy is the original image from xecdesign.com, which is compatible with Raspbian Wheezy only.

This two commands successfully started the image:

Kernel 4.19.50-buster:

$ qemu-system-arm -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "${APPEND_ARGS}" -kernel ../../qemu-rpi-kernel/kernel-qemu-4.19.50-buster -dtb ../../qemu-rpi-kernel/versatile-pb.dtb -net nic -net user,restrict=off -drive file=hypriotos-rpi-v1.1.3-qemu01.img,index=0,media=disk,format=raw

Kernel 4.4.34-jessie

$ qemu-system-arm -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "${APPEND_ARGS}" -kernel ../../qemu-rpi-kernel/kernel-qemu-4.4.34-jessie -net nic -net user,restrict=off -drive file=hypriotos-rpi-v1.1.3-qemu01.img,index=0,media=disk,format=raw
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.