# Problems adding dtparam and dtoverlay variables in /boot/config.txt

**URL:** <https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976>\
**Category:** Project help\
**Tags:** support, raspberrypi4, balenacloud\
**Created:** [July 24, 2024, 4:23pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976 "2024-07-24T16:23:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![embedded](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@embedded](https://forums.balena.io/u/embedded)\
**Post date:** [July 24, 2024, 4:23pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/1 "2024-07-24T16:23:42Z")

</div>

hi

I have a complete python program running and working correctly on RPI4 CM using IO Board. My boot/config.txt file have the following configurations for the two MIPI-CSI Cameras which I want to add to my Balena Image in order to have the program working with Balena OS.

```auto
# One ov5647 camera in MIPI-CSI0 interface
# One ov5647 camera in MIPI-CSI1 interface
#camera_auto_detect=1
dtoverlay=ov5647,cam0
dtoverlay=ov5647,cam1

# For sd card
dtoverlay=sd0,overclock_50=50

```

In my fleet configurations RESIN\_HOST\_CONFIG\_dtoverlay I added the following configurations:  
`"vc4-kms-v3d", "spi01cs", "ov5647,cam0", "ov5647,cam1", "max98357a", "sd0,overclock_50=50"`

Then when I run balena ssh to get access to it and run the command:

```auto
cat /mnt/boot/config.txt

```

I got the result:

```auto
dtoverlay=ov5647
dtparam=cam0
dtoverlay=ov5647
dtparam=cam1
dtoverlay=sd0
dtparam=overclock_50=50

```

How to ensure that cam0, cam1 and overclock\_50=50 values are not parsed as different parameters?

---

<div class="post-metadata">

**Author:** ![embedded](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@embedded](https://forums.balena.io/u/embedded)\
**Post date:** [July 24, 2024, 4:40pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/2 "2024-07-24T16:40:14Z")

</div>

As the documentation says [here](https://docs.balena.io/reference/OS/advanced/), the Supervisor v16+ modifies each parameter to be on its own line in order to avoid the 80 character line limit imposed by config.txt. It is the recommended method of setting one or more overlays with their own parameters. This parsing will only be done if the value is a valid string, so if it doesn’t begin with a quote `"`, the value will be parsed as a single string and not split into several lines.

So I change this:  
`"vc4-kms-v3d", "spi0-1cs", "ov5647,cam0", "ov5647,cam1", "max98357a", "sd0,overclock_50=50"`

To this:  
`“vc4-kms-v3d”, “spi0-1cs”, ov5647,cam0, “max98357a”, ov5647,cam1, “sd0,overclock\_50=50”

However still don’t work. Still get:

```auto
dtoverlay=ov5647
dtparam=cam0
dtoverlay=ov5647
dtparam=cam1
dtoverlay=sd0
dtparam=overclock_50=50

```

---

<div class="post-metadata">

**Author:** ![shaunmulligan1](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan1/32/9857_2.png) [@shaunmulligan1](https://forums.balena.io/u/shaunmulligan1)\
**Post date:** [July 24, 2024, 4:56pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/3 "2024-07-24T16:56:05Z")

</div>

Hi @embedded what is the failure mode that you are seeing when the `dtparam`s are set on individual lines? Do you find that `cam1` is not activating? As far as I understand the config.txt you posted above should be valid and work on raspberry pi OS, is that not the case for you?

---

<div class="post-metadata">

**Author:** ![shaunmulligan1](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan1/32/9857_2.png) [@shaunmulligan1](https://forums.balena.io/u/shaunmulligan1)\
**Post date:** [July 24, 2024, 5:16pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/4 "2024-07-24T17:16:07Z")

</div>

The reason I ask what error you are seeing and how this is failing for you is that because according to [https://www.raspberrypi.com/documentation/computers/configuration.html#part3.2](https://www.raspberrypi.com/documentation/computers/configuration.html#part3.2) of the bootloader documentation the config.txt you want and the one balenaOS creates for you are functionally equivalent since the Overlay parameters are only in scope until the next overlay is loaded. So the first `dtparam=cam0` will only apply to first `dtoverlay=ov5647` and `dtparam=cam1` will only apply to the second `dtoverlay=ov5647`. So the result is the same. If the cameras are not enumerating correctly on balenaOS it could be that the problem is elsewhere.

---

<div class="post-metadata">

**Author:** ![embedded](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@embedded](https://forums.balena.io/u/embedded)\
**Post date:** [July 30, 2024, 3:38pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/5 "2024-07-30T15:38:30Z")

</div>

Hi

Indeed. The problem is no longer due to wrong settings in the /boot/config.txt file, but rather to the lack of libcamera in the balena image (which usually is a default in rpi images I guess).

I’m trying to install libcamera from docker with the following configuration:

```auto
FROM balenalib/raspberrypicm4-ioboard-python:3.11-bullseye-run

# Update and install dependencies including git
RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    meson \
    ninja-build \
    python3-dev \
    python3-pip \
    git \
    libboost-dev \
    libgnutls28-dev \
    libjpeg-dev \
    libpng-dev \
    libtiff-dev \
    libevent-dev \
    libunwind-dev \
    libdrm-dev \
    libexif-dev \
    libxkbcommon-dev \
    qtbase5-dev \
    qtchooser \
    qt5-qmake \
    qtbase5-dev-tools && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Clone the libcamera repository
RUN git clone https://git.libcamera.org/libcamera/libcamera.git /usr/local/src/libcamera

# Change directory to libcamera source
WORKDIR /usr/local/src/libcamera

# List the contents to verify the clone
RUN ls -la

# Setup the meson build system
RUN meson setup build

# Build and install libcamera
RUN ninja -C build
RUN ninja -C build install

```

However the build is always failing:

```auto
[Error] Some services failed to build:
[Error] Service: my-service
[Error] Error: The command '/bin/sh -c meson setup build' returned a non-zero code: 1
[Info] Built on c617b98
[Error] Not deploying release.

```

I also tried with the [RPI fork](https://github.com/raspberrypi/libcamera) of libcamera, but without success. There is some problem with the meson package.

---

<div class="post-metadata">

**Author:** ![shaunmulligan1](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan1/32/9857_2.png) [@shaunmulligan1](https://forums.balena.io/u/shaunmulligan1)\
**Post date:** [August 14, 2024, 3:18pm UTC](https://forums.balena.io/t/problems-adding-dtparam-and-dtoverlay-variables-in-boot-config-txt/370976/6 "2024-08-14T15:18:32Z")

</div>

Hey there, I just tried this from my CM4 which is running `FROM balenalib/raspberrypi3-debian:build` and then just did an `apt install libcamera-apps` which appears to work. It does need to install about 231MB of packages but it works 😃

It could be that for some reason the `raspberrypicm4-ioboard-python` base image doesn’t include the correct set of available source lists. So one way forward is to just switch your base image to the one above and install python, etc as you need. It should give you the same performance and functionality as the CM4 base image.
