Raspberry Pi 4 ubuntu arm64

Hi there,

I am trying to convert an existing ubuntu arm64 image for an Raspberry Pi 4 to the correct partition layout including uboot etc.

So far I managed to build the image with a custom config:

    RASPBERRYPI_CONFIG="raspberrypi4"
    RASPBERRYPI_KERNEL_IMAGE="vmlinuz"
    MENDER_KERNEL_IMAGETYPE="zImage"
    MENDER_DEVICE_TYPE="raspberrypi4"
    MENDER_BOOT_PART_SIZE_MB="256"
    MENDER_STORAGE_TOTAL_SIZE_MB="16000"
    source configs/raspberrypi_config

Built with:
MENDER_ARTIFACT_NAME=release-0.1 ./docker-mender-convert --disk-image input/raspi.img --config configs/raspberrypi4_custom_config --overlay rootfs_overlay_demo/

Unfortunately the image fails at boot with the following error message:
#- Error: “mender_setup” not defined
Full output below:

I am quite lost where to proceed from here. The image is pretty much a vanilla ubuntu arm64 20.04.

Does anybody have any clues what is going on here?

Best,
Felix

Hi @felixsteghofer.

It looks like it was not successful in replacing U-Boot during the mender-convert process.

Please take a look here,

I would guess that there is something in this logic that does not match your case, and which might need a fix.

Hi @mirzak,

I appreciate your help and found my missing RASPBERRYPI_BOOTLOADER_IMAGE might cause the issue. I wanted to add that but one question arised that I could not answer by searching in the doc.

Where is the custom u-boot built, in my case for the raspberry pi with 64 bit? I could only find information for Yocto based images where presumably a custom u-boot is built.

I checked the resulting image that mender-convert created and the u-boot is still the same as in the “stock” input image.

=> sry, was too fast. Could find the script at https://github.com/mendersoftware/mender-convert-integration-scripts
Only have to migrate that for 64 bit

Best,
Felix

Hi @mirzak

I do now have a working uboot (took some time to debug kernel panics, this is pretty new for me).
Steps I took:

  • crosscompiled a custom 64bit u-boot (branch mender-rpi_2020.01 from https://github.com/mendersoftware/uboot-mender with “rpi_4_defconfig”)
  • created a custom boot.scr with mkimage -C none -A arm64 -T script -d boot.cmd boot.scr

At the moment my boot.cmd is a mess copy pasted from the existing ubuntu boot.scr and the one from mender-convert-integration-scripts:

fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
fdt move ${fdt_addr} ${fdt_addr_r}
run mender_setup
mmc dev ${mender_uboot_dev}
if load ${mender_uboot_root} ${ramdisk_addr_r} /boot/vmlinuz; then
    kernel_size=${filesize}
    unzip ${ramdisk_addr_r} ${kernel_addr_r}
    setenv kernel_size ${filesize}
    setenv try_boot "booti"
    load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initrd.img
    setenv ramdisk_param "${ramdisk_addr_r}:${filesize}"
    for cmd in ${try_boot}; do
         echo "Booting Ubuntu (with ${cmd}) from ${devtype} ${devnum}:${partition}..."
         ${cmd} ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}
     done
else
    echo "No bootable Kernel found."
fi
run mender_try_to_recover
 
# Recompile with:
# mkimage -C none -A arm64 -T script -d boot.cmd boot.scr

At first glance, do you spot anything that makes this config unusable with mender? E.g. for the safe updates?

Im also interested in making this work. Was there any progress on this?

I’m also interested in this topic, anyone has successfully converted ubuntu image and is able to boot up?

As of now, I have been fighting Mender and Ubuntu Server versions (20.x and 21.x), but have not been able to get a bootable image. The latest status is:

  1. Fresh Ubuntu 20 Server x64 on RPI4 install

  2. Shutdown RPI4 and modified partition structure to match Mender’s expected layout (not sure if this is needed, just grasping at straws after a month…

  3. Booted RPI4 again to confirm new layout did not bork the system. Shutdown after confirmation.

  4. Imaged using

    
    sudo dd if=/dev/sdg of=~/mender-convert/input/goldenimage.img status=progress
    
    

    Note: Other options used in the past included the use of the sparse option to speed up imaging. This did not seem to matter, but it could be counterindicated, I do not know.

  5. Resulting goldenimage.img converted without customizations in config files, and the conversion process completes without unexpected warnings or errors (size warnings and other items were expected).

  6. Image written using dd using reverse of previous process.

  7. RPI4 booted, but nothing occurs. Black screen from display output…

annnnnnd nothin’… dead topic… fun…