# Vanilla qemuarm full multi partition emulation?

**URL:** <https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339>\
**Category:** General Discussions\
**Created:** [December 9, 2019, 11:55am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339 "2019-12-09T11:55:15Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 9, 2019, 11:55am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/1 "2019-12-09T11:55:15Z")

</div>

Basically I want to emulate a typical setup with boot + 2x rootfs + data on qemuarm, so I can properly test that my configs etc are populated correctly on /data running on standard runqemu script from yocto.

I followed [QEMU, the FAST! processor emulator](https://hub.mender.io/t/qemu-the-fast-processor-emulator/420) but ran into problems, since I am running the build inside a VM in hyper-V, then the KVM part fails.

When adding:

_MACHINE = “qemuarm”_  
_INHERIT += “mender-full-bios rm\_work”_

then it only creates ext4, and no uefiimg.

When trying:

[https://docs.mender.io/2.2/devices/yocto-project/raw-flash/example-qemu](https://docs.mender.io/2.2/devices/yocto-project/raw-flash/example-qemu)

_INHERIT += “mender-full-ubi”_  
_MACHINE = “vexpress-qemu-flash”_

I get error to set “MENDER\_IS\_ON\_MTDID”.

So I used:

_MENDER\_MTDIDS = “nand0=40000000.flash,nand1=60000000.flash”_  
_MENDER\_IS\_ON\_MTDID = “60000000.flash”_

After that I got warnings:

_WARNING: gkcontroller-emulated-1.0-r0 do\_image\_tar: Unknown MTDID type 40000000.flash,nand, setting UBI block overhead to 0_  
_WARNING: gkcontroller-emulated-1.0-r0 do\_image\_tar: Unknown MTDID type 40000000.flash,nand, setting UBI overhead to 0_  
_WARNING: gkcontroller-emulated-1.0-r0 do\_image\_tar: Could not find MENDER\_IS\_ON\_MTDID (60000000.flash) in MENDER\_MTDPARTS (). Returning UBI size of zero._

Then I get failure on do\_image\_ext4:

_DEBUG: Executing python function prepare\_excluded\_directories_  
_DEBUG: Python function prepare\_excluded\_directories finished_  
_DEBUG: Executing python function set\_image\_size_  
_WARNING: Unknown MTDID type 40000000.flash,nand, setting UBI block overhead to 0_  
_WARNING: Unknown MTDID type 40000000.flash,nand, setting UBI overhead to 0_  
_WARNING: Could not find MENDER\_IS\_ON\_MTDID (60000000.flash) in MENDER\_MTDPARTS (). Returning UBI size of zero._  
_WARNING: Could not find MENDER\_IS\_ON\_MTDID (60000000.flash) in MENDER\_MTDPARTS (). Returning UBI size of zero._  
_WARNING: Could not find MENDER\_IS\_ON\_MTDID (60000000.flash) in MENDER\_MTDPARTS (). Returning UBI size of zero._  
_DEBUG: 322636.000000 = 322636 \* 1.000000_  
_DEBUG: 322636.000000 = max(322636.000000, -90112)[322636.000000] + 1_  
_DEBUG: 322636.000000 = int(322636.000000)_  
_DEBUG: 322636 = aligned(322636)_  
_DEBUG: returning 322636_  
_DEBUG: Python function set\_image\_size finished_  
_DEBUG: Executing python function extend\_recipe\_sysroot_  
_NOTE: Direct dependencies are [‘virtual:native:/build/…/poky/meta/recipes-extended/pigz/pigz\_2.4.bb:do\_populate\_sysroot’, '/home/emil$_  
_NOTE: Installed into sysroot: []_  
_NOTE: Skipping as already exists in sysroot: [‘pigz-native’, ‘depmodwrapper-cross’, ‘update-rc.d-native’, ‘cross-localedef-native’, ‘pbzip2-native’, 'opkg-utils-nat$_  
_DEBUG: Python function extend\_recipe\_sysroot finished_  
_DEBUG: Executing shell function do\_image\_ubifs_  
_Error: too large LEB size 8388608, maximum is 2097152_  
_WARNING: exit code 255 from a shell command._  
_ERROR: Function failed: do\_image\_ubifs (log file is located at /build/tmp-glibc/work/vexpress\_qemu-oe-linux-gnueabi/gkcontroller-emula$_

Then, going back to a straight qemuarm build, it does not produce the uefiimg as mentioned (no imagetypes variable specified, should I):

_MACHINE = “qemuarm”_  
_INHERIT += “mender-full-bios rm\_work”_  
_RM\_WORK\_EXCLUDE = “wic-tools”_  
_PATCHRESOLVE = “noop”_

_MENDER\_STORAGE\_TOTAL\_SIZE\_MB = “2048”_  
_MENDER\_BOOT\_PART\_SIZE\_MB = “40”_  
_MENDER\_DATA\_PART\_SIZE\_MB = “512”_

So no matter which machine / image combination I try I run into different problems. I really tried to follow the guides and try every combination of config partition variables etc, but I always run into some error.

Then I tried adding:

_MENDER\_FEATURES\_ENABLE\_append = " mender-image-uefi"_

But then I got:

_ERROR: Nothing PROVIDES ‘u-boot’_  
_u-boot was skipped: Either UBOOT\_MACHINE or UBOOT\_CONFIG must be set in the qemuarm machine configuration._  
_ERROR: Required build target ‘gkcontroller-emulated’ has no buildable providers._  
_Missing or unbuildable dependency chain was: [‘my-distro-image’, ‘u-boot’]_

So I guess that’s why you chose x86-64 as an example because it has:

_UBOOT\_MACHINE ?= “qemu-x86\_64\_defconfig”_  
_KERNEL\_IMAGETYPE = “bzImage”_

Hope someone can help, thanks! 🙂

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [December 9, 2019, 12:32pm UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/2 "2019-12-09T12:32:59Z")

</div>

We use all of the qemu targets internally in our Q/A so they should all work, but might require getting the variables correct.

We do provide custom machines for our testing, and you can take a look here,

> **[mendersoftware/meta-mender](https://github.com/mendersoftware/meta-mender/tree/master/meta-mender-qemu/conf/machine)**
>
> Yocto Project meta layer for the Mender client. Contribute to mendersoftware/meta-mender development by creating an account on GitHub.

To get everything setup correctly.

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 9, 2019, 1:01pm UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/3 "2019-12-09T13:01:03Z")

</div>

Thanks for the quick response

I try:

_MACHINE = “vexpress-qemu”_  
_INHERIT += “mender-full-ubi”_  
…  
_MENDER\_STORAGE\_TOTAL\_SIZE\_MB = “2048”_  
_MENDER\_DATA\_PART\_SIZE\_MB = “512”_

Then I get “MENDER\_MTDIDS must be defined”.

I add:

_MENDER\_MTDIDS = “nor0=40000000.flash”_

Then I get:

_| DEBUG: Python function extend\_recipe\_sysroot finished_  
_| DEBUG: Executing shell function do\_image\_ubifs_  
_| Error: too large LEB size 8388480, maximum is 2097152_  
_| WARNING: exit code 255 from a shell command._

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [December 9, 2019, 1:01pm UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/4 "2019-12-09T13:01:58Z")

</div>

> [@emilm](#):
>
> INHERIT += “mender-full-ubi”

You do not need this for the `vexpress-qemu`

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 9, 2019, 1:18pm UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/5 "2019-12-09T13:18:27Z")

</div>

Thank you so much!

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 10, 2019, 10:09am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/6 "2019-12-10T10:09:57Z")

</div>

Is there a reason why there is no qemuarm but vexpress?

The reason is that it has it’s own patch to reduce to 256M RAM and other things I don’t want, like the custom kernel config. Is it straight forward to use qemuarm as a machine or is it something I should worry about?

Thanks!

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 10, 2019, 10:31am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/7 "2019-12-10T10:31:31Z")

</div>

Yes, it is because qemuarm doesn’t support U-Boot, only direct kernel boot. We need to be able to test U-Boot inside QEMU.

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 10, 2019, 10:58am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/8 "2019-12-10T10:58:46Z")

</div>

Understood, thanks.

What do you suggest if I need more than 256M RAM? I was thinking of pulling out the bits so it works with UBOOT/GRUB without being vexpress specific, so it’s not constrained to that RAM etc.

Or is it enough to override the recipe with a patch file with the same name? (meta-mender/meta-mender-qemu/recipes-kernel/linux/linux-yocto/reduce-memory-to-256m.patch)

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 10, 2019, 11:41am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/9 "2019-12-10T11:41:21Z")

</div>

You will need the revert that patch yes, and also change [this line](https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-qemu/scripts/mender-qemu#L125). I was doing this very recently myself for some debugging work, so I know it works.

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 10, 2019, 11:51pm UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/10 "2019-12-10T23:51:11Z")

</div>

Thanks again.

I did:  
SRC\_URI\_remove = " file://reduce-memory-to-256m.patch"  
In my layer which has higher priority.

Then I saw that it was untouched, which is what I want, right?:

memory@60000000 {  
device\_type = “memory”;  
reg = \<0x60000000 **0x40000000** \>;  
};

However, it never manages to load , it stopped at:

```
## Starting EFI application at 60100000 ...
Welcome to GRUB!

lock: OK
lock: OK

error: not a regular file.
```

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 11, 2019, 7:33am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/11 "2019-12-11T07:33:33Z")

</div>

How are you launching QEMU? Can you give me the full output?

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 11, 2019, 8:34am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/12 "2019-12-11T08:34:30Z")

</div>

Hello and thanks for your quick reply!

qemu-system-arm -m 512M -kernel /home/emil/yoctoroot/build/tmp-glibc/deploy/images/vexpress-qemu/u-boot.elf -net nic,macaddr=52:54:00:76:75:ef -net user,hostfwd=tcp::8822-:22 -display vnc=:23 -nographic -M vexpress-a9 -drive file=/home/emil/yoctoroot/build/tmp-glibc/deploy/images/vexpress-qemu/myimage-vexpress-qemu-grub.uefiimg,if=sd,format=raw

```
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument

U-Boot 2019.01 (Dec 09 2019 - 21:59:56 +0000)

DRAM: 512 MiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC: MMC: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: smc911x-0
Hit any key to stop autoboot: 0
MMC Device 1 not found
no mmc device at slot 1
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
**Unable to read file /**
Found EFI removable media binary efi/boot/bootarm.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disks on mmc...
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 5 disks
WARNING: booting without device tree
447488 bytes read in 155 ms (2.8 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
WARNING: booting without device tree
## Starting EFI application at 60100000 ...
Welcome to GRUB!

lock: OK
lock: OK

error: not a regular file.

```

This runs with the 256M patch applied. Hangs when not.

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 11, 2019, 8:51am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/13 "2019-12-11T08:51:21Z")

</div>

> [@emilm](#):
>
> ```auto
> qemu-system-arm -m 512M
> 
> ```

You need to set this to `1G` because that is what is recorded in the device tree after you removed the patch. Otherwise the OS will try to write into memory which doesn’t exist.

---

<div class="post-metadata">

**Author:** ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)\
**Post date:** [December 11, 2019, 8:56am UTC](https://hub.mender.io/t/vanilla-qemuarm-full-multi-partition-emulation/1339/14 "2019-12-11T08:56:38Z")

</div>

Nice catch! And thanks for the quick answer! 🙂
