CM3 module using Buildroot

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

The closest one, that I know of is this,

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 as reference, and you should be good on your way.

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?

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.

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.

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, and maybe try running these steps manually to isolate the problem

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.

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

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 :smiley:

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.

Time to connect the serial console :slight_smile:

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:

# 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

1 Like

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!

1 Like

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

1 Like

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?

If you run,

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

what does printenv bootargs show you?

The argument ends up root=

Obviously I do not have that variable defined.

You should be able to do:

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

To prevent it from expanding ${mender_kernel_root}

1 Like

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.

1 Like

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

It should just be:

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.