# Yocto RPi Zero 2W cmdline.txt not updating

**URL:** <https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313>\
**Category:** General Discussions\
**Tags:** yocto, mender-client\
**Created:** [November 7, 2024, 8:11pm UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313 "2024-11-07T20:11:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubinstu](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rubinstu/32/2350_2.png) [@rubinstu](https://hub.mender.io/u/rubinstu)\
**Post date:** [November 7, 2024, 8:11pm UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313/1 "2024-11-07T20:11:39Z")

</div>

Hello! I have a Yocto (Kirkstone) build for Raspberry Pi Zero 2W with Mender integrated. File and folder updates work fine, but rootfs updates do not. The rootfs file (ext4) _does_ get written to the second partition (/dev/mmcblk0p3) correctly, but the system still boots from the first rootfs partition (/dev/mmcblk0p2).

It appears that the boot command line (/boot/efi/cmdline.txt) is not being written properly. It is always:

> dwc\_otg.lpm\_enable=0 console=serial0,115200 root=/dev/ **mmcblk0p2** rootfstype=ext4 rootwait

I believe that this should be updated to /dev/mmcblk0p3 (or some environment variable).

Any ideas?

Thank you.

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [November 8, 2024, 11:35am UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313/2 "2024-11-08T11:35:06Z")

</div>

Hi @rubinstu,

Thanks for reaching out! So, in a standard Mender setup for Yocto on a Raspberry Pi, `cmdline` does not provide the root partition. That is chosen by `u-boot`, based on the current update state which is stored in the environment.

I have just given that a test build and validation run, and it seems to work as expected, with the one minor nitpick that I used `scarthgap` as I don’t have a `kirkstone` build ready at the moment.

So are you building something similar to [meta-mender-community/kas/raspberrypi0-2w-64.yml at scarthgap · TheYoctoJester/meta-mender-community · GitHub](https://github.com/TheYoctoJester/meta-mender-community/blob/scarthgap/kas/raspberrypi0-2w-64.yml)? Can you give `scarthgap` a try eventually?

Also sharing the relevant parts of your `local.conf`, MACHINE and DISTRO might be helpful.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![rubinstu](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rubinstu/32/2350_2.png) [@rubinstu](https://hub.mender.io/u/rubinstu)\
**Post date:** [November 8, 2024, 9:36pm UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313/3 "2024-11-08T21:36:48Z")

</div>

Josef, thanks for your response. I started from scratch using scarthgap (not Kirkstone) so we’re in sync.

I had one specific problem that I think fixed; my deployment was using Grub and not U-Boot. Adding this:  
`RPI_USE_U_BOOT = "1"`  
to local.conf switched the bootloader. But the problem still persists.

One thing I noticed is that in some examples, people include “meta-mender-raspberrypi” in bblayers. There is no such layer in the scarthgap branch of meta-mender. (It does exist in kirkstone.) Do we need "“meta-mender-raspberrypi”?

I tried the example using Kas from the community build, but I kind of made a mess of it. I think the instructions assume some things that I’m not clear on.

Here is an excerpt from my bblayers:

```auto
BBLAYERS ?= " \
  /home/stuart/rpi-yocto/poky-scarthgap/meta \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-poky \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-yocto-bsp \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-raspberrypi \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-openembedded/meta-oe \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-openembedded/meta-python \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-openembedded/meta-networking \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-openembedded/meta-multimedia \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-ns-test \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-mender/meta-mender-core \
  /home/stuart/rpi-yocto/poky-scarthgap/meta-mender/meta-mender-demo \
  "

```

And highlights from local.conf:

```auto
MACHINE ??= "raspberrypi0-2w-64"

INIT_MANAGER = "systemd"

# Remove old images after builds

RM_OLD_IMAGE = "1"

ENABLE_UART = "1"

LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"

INHERIT += "extrausers"

IMAGE_INSTALL:append = " sudo"

# Default user name

USER_NAME = "nsuser"

PASSWD = "xxxxxxxxxxxxxxx"

EXTRA_USERS_PARAMS:append = "\

useradd -u 1200 -d /home/${USER_NAME} -s /bin/sh -p '${PASSWD}' ${USER_NAME}; \

usermod -a -G sudo ${USER_NAME}; \

"

# Add support for wifi and bluetooth

IMAGE_INSTALL:append = " linux-firmware-bcm43430 kernel-modules udev-rules-rpi"

# Add Networking

DISTRO_FEATURES:append = " bluez5 bluetooth wifi"

IMAGE_INSTALL:append = " linux-firmware-bcm43430 bluez5 i2c-tools python3-smbus bridge-utils hostapd iptables wpa-supplicant networkmanager"

# Mender Stuff

MENDER_EFI_LOADER = ""

MENDER_BOOT_PART_SIZE_MB = "64"

MENDER_STORAGE_TOTAL_SIZE_MB = "4096"

ARTIFACTIMG_FSTYPE = "ext4"

MENDER_ARTIFACT_NAME = "release-2"

INHERIT += " mender-full"

MENDER_SERVER_URL = "https://hosted.mender.io"

MENDER_TENANT_TOKEN = "xxxxxxxxxxxxxxxx"

RPI_USE_U_BOOT = "1"

MENDER_BOOT_PART_SIZE_MB = "100"

# Deploy Image

IMAGE_FSTYPES += " sdimg rpi-sdimg"

```

Built with:  
`$ bitbake core-image-minimal`

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [November 11, 2024, 8:59am UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313/4 "2024-11-11T08:59:50Z")

</div>

Hi @rubinstu,

So you’re missing two things.

1. the `meta-mender-raspberrypi` layer from [`meta-mender-community`](https://github.com/mendersoftware/meta-mender-community), which brings the required patches to the `u-boot` config, as well as correct setting for `MENDER_EFI_LOADER`
2. the corresponding `MENDER_FEATURES` configuration:

```auto
IMAGE_INSTALL:append = " kernel-image kernel-devicetree"
IMAGE_FSTYPES:remove = " rpi-sdimg"

```

Those are noted in [https://github.com/mendersoftware/meta-mender-community/kas/include/raspberrypi.yml](https://github.com/mendersoftware/meta-mender-community/kas/include/raspberrypi.yml).

If you add those, I’d expect the board to work right away.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![rubinstu](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rubinstu/32/2350_2.png) [@rubinstu](https://hub.mender.io/u/rubinstu)\
**Post date:** [November 11, 2024, 4:28pm UTC](https://hub.mender.io/t/yocto-rpi-zero-2w-cmdline-txt-not-updating/7313/5 "2024-11-11T16:28:30Z")

</div>

Josef, this was exactly what was missing:

- meta-mender-raspberrypi layer (which I knew about but wasn’t completely clear on the details)
- “kernel-image kernel-devicetree” additions.  
It’s working great now. Thank you!
