# CM3 module using Buildroot

**URL:** <https://hub.mender.io/t/cm3-module-using-buildroot/1184>\
**Category:** General Discussions\
**Created:** [October 21, 2019, 8:43am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184 "2019-10-21T08:43:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 21, 2019, 8:43am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/1 "2019-10-21T08:43:38Z")

</div>

Dear Community,

I want to try the setup of the CM3 module using Buildroot.

I would like to ask for feedback on the experience and support of the community by using Mender with Buildroot. Are there people out there successfully using this board for deployment?

Regards

---

<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:** [October 21, 2019, 9:10am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/2 "2019-10-21T09:10:49Z")

</div>

The closest one, that I know of is this,

[https://gitlab.com/aduskett/buildroot/tree/mender-config/board/mender/raspberrypi](https://gitlab.com/aduskett/buildroot/tree/mender-config/board/mender/raspberrypi)

Unclear what the state of this actually is.

But I would recommend you to use above, and what is in [https://github.com/mendersoftware/buildroot-mender](https://github.com/mendersoftware/buildroot-mender) as reference, and you should be good on your way.

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 23, 2019, 5:55pm UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/3 "2019-10-23T17:55:42Z")

</div>

Hi,  
Actually Buildroot does provide some options to bring mender in, although the option comes with Grub2 as well.  
I am testing this at the moment, but I am a bit stuck in defining the Grub for the Pi3.  
Any hints?

---

<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:** [October 24, 2019, 6:23am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/4 "2019-10-24T06:23:42Z")

</div>

Yeah, most parts of the Mender are part of Buildroot is upstream, but the board specific parts need to be provided.

I would not recommend you to go down the GRUB path on Pi3, as never have gotten it to work with GRUB on those specific boards. We simply rely on a U-Boot integration instead , e.g in our Yocto layers.

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 9:42am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/5 "2019-10-25T09:42:18Z")

</div>

Hi Mirzak,

I think I am in a good way with the information provided.  
However, now I am stuck at uBoot, which is not finding the kernel. Most likely some ignorance on my side.

Do you know if the repo you mentioned (mender-config) is a working project?

I’ll keep progress updated.

---

<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:** [October 25, 2019, 9:44am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/6 "2019-10-25T09:44:50Z")

</div>

> [@NXP® i.MX 8MQuad Evaluation Kit (EVK)](https://hub.mender.io/t/nxp-i-mx-8mquad-evaluation-kit-evk/561/6):
>
> Do you know if the repo you mentioned (mender-config) is a working project?

I have never tried it personally so can not comment on if it is functional. But looking at it, it seems to have he major parts in place.

To debug the problem with U-Boot not being able to find the kernel, I would look trough the [boot.scr](https://gitlab.com/aduskett/buildroot/blob/mender-config/board/mender/raspberrypi/boot.cmd), and maybe try running these steps manually to isolate the problem

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 9:58am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/7 "2019-10-25T09:58:05Z")

</div>

So the problem lies in the line of boot.src  
load {mender\_uboot\_root} {kernel\_addr\_r} /boot/uImage  
Gives a file not found

mender\_uboot\_root= mmc 0:2  
kernel\_addr\_r=0x00080000

I will keep exploring.

---

<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:** [October 25, 2019, 10:00am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/8 "2019-10-25T10:00:16Z")

</div>

> [@mvargasevans](#):
>
> /boot/uImage

If you do a `ls mmc 0:2`, is the `uImage` there? I suspect that `BR2_LINUX_KERNEL_INSTALL_TARGET=y` might be missing in your `defconfig`

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 10:17am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/9 "2019-10-25T10:17:21Z")

</div>

When tried ls mmc 0:2 the directory was displayed.  
You are indeed correct, that option was missing and by changing that, the uImage file was found.  
I also had to change the 0006 patch to consider the bcm2710-rpi-cm3.dtb.

By ls mmc 0:2 /boot I can see the above files mentioned.

At boot, it actually says starting kernel, quickly jumps to the image with 4 berries on top and then the screen goes entire black 😃

At least we can say up to this point, this code is able to load uboot and pass a kernel to the system.

Continue digging.

---

<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:** [October 25, 2019, 10:49am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/10 "2019-10-25T10:49:21Z")

</div>

> [@mvargasevans](#):
>
> At boot, it actually says starting kernel, quickly jumps to the image with 4 berries on top and then the screen goes entire black

Time to connect the serial console 🙂

---

<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:** [October 25, 2019, 10:54am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/11 "2019-10-25T10:54:19Z")

</div>

And I think I see the problem. The `bootargs` are missing a `root=` kernel argument in the `boot.scr`.

It should be something like this:

```auto
# This fetches bootargs from the RPi boot firmware which populates it in the dtb file
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
run mender_setup
mmc dev ${mender_uboot_dev}
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage
bootm ${kernel_addr_r} - ${fdt_addr}
run mender_try_to_recover

```

I think that the Raspberry Pi will get the bootargs from `cmdline.txt` file in boot partition. So that one should be updated to contain `root=${mender_kernel_root}`, which is expanded when you run `mender_setup`

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 10:56am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/12 "2019-10-25T10:56:20Z")

</div>

Hi Mirzak,  
Since it is lunch time, I went for a fresh clean make now that we are at this point.  
I’ll be back as soon as the ttyTV show ends and implement that.

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:** [October 25, 2019, 11:02am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/13 "2019-10-25T11:02:13Z")

</div>

Also for reference you can check the script we use in Yocto (which is basically what I posted above),

> <https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in>

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 11:32am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/14 "2019-10-25T11:32:10Z")

</div>

So I did what you indicated but still black.  
This is how `boot.src` looks:

```
setenv bootargs root=${mender_kernel_root} rootwait console=tty1 console=ttyAMA0,115200
run mender_setup
mmc dev ${mender_uboot_dev}
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage
bootm ${kernel_addr_r} - ${fdt_addr}
run mender_try_to_recover

```

Did I understand correctly your suggestion?

---

<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:** [October 25, 2019, 11:33am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/15 "2019-10-25T11:33:29Z")

</div>

> [@mvargasevans](#):
>
> setenv bootargs root=${mender\_kernel\_root} rootwait console=tty1 console=ttyAMA0,115200

If you run,

```auto
setenv bootargs root=${mender_kernel_root} rootwait console=tty1 console=ttyAMA0,115200

```

what does `printenv bootargs` show you?

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 11:35am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/16 "2019-10-25T11:35:12Z")

</div>

The argument ends up root=

Obviously I do not have that variable defined.

---

<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:** [October 25, 2019, 11:36am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/17 "2019-10-25T11:36:09Z")

</div>

> [@mirzak](#):
>
> setenv bootargs root=${mender\_kernel\_root} rootwait console=tty1 console=ttyAMA0,115200

You should be able to do:

```auto
setenv bootargs 'root=${mender_kernel_root} rootwait console=tty1 console=ttyAMA0,115200'

```

To prevent it from expanding `${mender_kernel_root}`

---

<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:** [October 25, 2019, 11:37am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/18 "2019-10-25T11:37:57Z")

</div>

> [@mirzak](#):
>
> fdt addr ${fdt\_addr} && fdt get value bootargs /chosen bootargs

Please note that this is important, to pickup the bootargs from the RPi boot firmware. It will probably boot without this, but you will notice some drop in functionality if you do not pass on the bootargs from RPi bootfirmware to the Linux kernel.

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [October 25, 2019, 11:42am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/19 "2019-10-25T11:42:53Z")

</div>

I did this, but still a black screen.

```
fdt addr ${fdt_addr} && fdt get value bootargs 'root=${mender_kernel_root} rootwait console=tty1 console=ttyAMA0,115200'
run mender_setup
mmc dev ${mender_uboot_dev}
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage
bootm ${kernel_addr_r} - ${fdt_addr}
run mender_try_to_recover
```

---

<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:** [October 25, 2019, 11:45am UTC](https://hub.mender.io/t/cm3-module-using-buildroot/1184/20 "2019-10-25T11:45:27Z")

</div>

It should just be:

```auto
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs

```

And any modification you want to make you need to put in the `cmdline.txt` file that is installed to the boot partition of the RPi.

[Next page](https://hub.mender.io/t/cm3-module-using-buildroot/1184.md?page=2)
