Debian image for raspberry pi 3 convertion fail

Hi. I’m trying to convert a Debian (NOT raspbian) image. I’m generating the image using vmdb2 and it works fine before conversion.

I’m using mender-convert 2.2.0 tag and running it from docker using (docker-mender-convert):

mender-convert ((2.2.0))$ MENDER_ARTIFACT_NAME=release-1 ./docker-mender-convert --disk-image input/myimage.img --config configs/raspberrypi3_config

Doing it directly doesn’t work. It still use the kernel from debian and doesn’t boot from mender uboot.

I changed the config.txt to do that, just deleted kernel and initramfs definition and then it boot the uboot from mender-convert. The problem then is that it doesn’t boot any kernel.

I’m doing something wrong? how do I make this work?
I don’t know if the mender convert is prepared to use the initramfs and kernel from debian.

Thanks for the help!
–joa

Hi,

Never tested using Debian images built with vmdb2, but it is a very interesting use-case.

You probably need to do some minor tweaks of the various Raspberry Pi configuration files, majority of the logic is https://github.com/mendersoftware/mender-convert/blob/master/configs/raspberrypi_config.

You can also have a look at the boot.scr file which contains the logic that U-Boot will execute to boot the device. It for sure does not contain anything initramfs related, so might need to tweak this one.

Hi @mirzak,

Thanks for replying. Yes, I took some time and follow the scripts on mender convert. I finally get the uboot running, the problem was that the config.txt file of debian defines the kernel and initramfs and the mender_convert script doesn’t override that value. I changed that (commented all) and then I have uboot running.

My problem now is that the bootscr is looking for a kernel to boot (zImage or uImage) and debian uses initramfs and vmlinux. My line of work will follow that. Any comment or help is appreciated .

Just for some context this work I’m doing is for a open hardware and software project called Librerouter (https://librerouter.org/). The repo whit the image building is here (https://gitlab.com/librerouter/miniserver).

You can override the default boot.scr with something that is compatible with your environment using hooks/overrides

The boot.scr we use is generated here, which work as source of inspiration.

Hey. Getting back to this.

I managed to get a bootable image:

  • First I had to build uboot from your fork to ARCH=arm64. With this bootloader I could boot the debian kernel.
  • Then I had to change the bootscript to add the initramfs like this:
setenv kernel_addr_r 0x20000000
setenv ramdisk_addr_r 0x30000000

load mmc 0 ${fdt_addr_r} bcm2837-rpi-3-b.dtb

fdt addr ${fdt_addr_r}
fdt get value bootargs /chosen bootargs

run mender_setup
mmc dev ${mender_uboot_dev}

setenv bootargs "root=${mender_kernel_root} rw elevator=deadline fsck.repair=yes net.ifnames=0 cma=64M rootwait"

if load ${mender_uboot_root} ${kernel_addr_r} /vmlinuz; then
    if load ${mender_uboot_root} ${ramdisk_addr_r} /initrd.img; then
        booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
    else
        echo "No initramfs found."
    fi
else
    echo "No bootable Kernel found."
fi
run mender_try_to_recover
  • Using mender-convert I convert the debian image and then copy this files.

With this I have a debian imagen booting using kernel and initramfs from debian.

I’m having a problem now when using mender-client. When I try to execute it I get an error from fw_printenv:

$ mender show-artifact
WARN[0000] No server URL(s) specified in mender configuration. 
WARN[0000] Server entry 1 has no associated server URL. 
ERRO[0000] Failed to read the current active partition: No match between boot and root partitions.: fork/exec /usr/sbin/fw_printenv: no such file or directory 

The fw_printenv binary is there and if I try to execute it I get the same error.

Any hint how to continue? Thanks for the support!

My guess is that the fw_printenv binary is for a different CPU architecture or some such. What does the following show?

$ file /usr/bin/mender
$ file /usr/sbin/fw_printenv

What is your OS/Distro on the board?

Hey @drewmoseley! Yes, that was the problem. I Checked the /usr/bin/fw_printenv but the system is using the /usr/sbin/fw_printenv installed by mender-convert and this one is 32bits.

I’m working on my scripts to delete the binaries installed by mender-convert and use the system ones. Thanks!

1 Like