cmprovision icon indicating copy to clipboard operation
cmprovision copied to clipboard

cmprovision working on cm5

Open jcaptitude opened this issue 1 year ago • 22 comments

Hi,

I've just got some CM5s and installed the cmprovision on cm5. The static ip was setup following this issue

But it seems that it cannot detect any CM5 connected to it.

The dnsmasq log only shows 'no address range available for DHCP request via wlan0' after start up And the rpiboot log stops at 'Waiting for BCM2835/6/7/2711/2712...'

So I'm wondering if cmprovision is able to work on CM5?

The OS installed on CM5 is 'Raspberry Pi OS (64-bit)'

jcaptitude avatar Dec 13 '24 23:12 jcaptitude

I believe rpi-sb-provisioner is the preferred tool on CM5 which should support a superset of the cmprovsion features (although some are implemented differently) https://github.com/raspberrypi/rpi-sb-provisioner

Re "rpiboot" please can you make sure that you are using the very latest APT release of rpiboot. Early versions of the bootloader (including bootfiles.bin) won't boot on a CM5 or Pi500.

timg236 avatar Dec 16 '24 15:12 timg236

The dnsmasq log only shows 'no address range available for DHCP request via wlan0' after start up

I do not have a CM5, but am guessing that it is advertising a different GUID, and that you need to modify /var/lib/cmprovision/etc/dnsmasq.conf to add: dhcp-match=set:client_is_a_pi,97,whatever-guid-cm5-is-using to solve the detection problem. Then you will likely run into the next hurdle that it doesn't serve a kernel suitable for CM5. Will require that you patch up https://github.com/raspberrypi/scriptexecutor to build new kernel and .dtb using a suitable kernel config for CM5, and toss the result in `/var/lib/cmprovision/scriptexecute

maxnet avatar Dec 16 '24 17:12 maxnet

Add: dhcp-match=set:client_is_a_pi,97,0:35:69:50:52

To DNSmasq :-) and it will attempt to boot.

jayjayseal avatar Jan 20 '25 15:01 jayjayseal

I had the same problem, and after adding the line: dhcp-match=set:client_is_a_pi,97,0:35:69:50:52 to the DNSmasq configuration, the device attempted to boot. However, after copying the data from the /boot partition of a compatible Raspberry Pi CM5 image, I encountered the error:

file /var/lib/cmprovision/scriptexecute/71da75ea/armstub8-2712.bin not found

Full log:

-- Journal begins at Tue 2024-10-22 15:54:18 EEST, ends at Mon 2025-01-20 19:42:16 EET. -- Jan 20 19:26:20 pi3 systemd[1]: Starting cmprovision-dnsmasq... Jan 20 19:26:20 pi3 dnsmasq[474]: dnsmasq: syntax check OK. Jan 20 19:26:20 pi3 dnsmasq[491]: started, version 2.85 DNS disabled Jan 20 19:26:20 pi3 dnsmasq[491]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile Jan 20 19:26:20 pi3 dnsmasq-dhcp[491]: DHCP, IP range 172.20.0.2 -- 172.20.255.255, lease time 1h Jan 20 19:26:20 pi3 dnsmasq-tftp[491]: TFTP root is /var/lib/cmprovision/scriptexecute Jan 20 19:26:20 pi3 systemd[1]: Started cmprovision-dnsmasq. Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 available DHCP range: 172.20.0.2 -- 172.20.255.255 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 vendor class: PXEClient:Arch:00000:UNDI:002001 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 DHCPDISCOVER(eth0) 2c:cf:67:c4:ac:a4 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 tags: client_is_a_pi, eth0 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 DHCPOFFER(eth0) 172.20.57.156 2c:cf:67:c4:ac:a4 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 requested options: 1:netmask, 3:router, 43:vendor-encap, 60:vendor-class, Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 requested options: 66:tftp-server, 67:bootfile-name, 128, 129, Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 requested options: 130, 131, 132, 133, 134, 135 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 next server: 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 1 option: 53 message-type 2 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 54 server-identifier 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 51 lease-time 1h Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 58 T1 30m Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 59 T2 52m30s Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 1 netmask 255.255.0.0 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 28 broadcast 172.20.255.255 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 3 router 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 9 option: 60 vendor-class 50:58:45:43:6c:69:65:6e:74 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 17 option: 97 client-machine-id 00:35:69:50:52:80:41:b0:00:67:c4:ac:a4:ea... Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 32 option: 43 vendor-encap 06:01:03:0a:04:00:50:58:45:09:14:00:00:11... Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 available DHCP range: 172.20.0.2 -- 172.20.255.255 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 vendor class: PXEClient:Arch:00000:UNDI:002001 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 DHCPREQUEST(eth0) 172.20.57.156 2c:cf:67:c4:ac:a4 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 tags: client_is_a_pi, eth0 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 DHCPACK(eth0) 172.20.57.156 2c:cf:67:c4:ac:a4 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 next server: 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 1 option: 53 message-type 5 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 54 server-identifier 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 51 lease-time 1h Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 58 T1 30m Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 59 T2 52m30s Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 1 netmask 255.255.0.0 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 28 broadcast 172.20.255.255 Jan 20 19:41:44 pi3 dnsmasq-dhcp[491]: 1076043725 sent size: 4 option: 3 router 172.20.0.1 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: error 0 Early terminate received from 172.20.57.156 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/config.txt to 172.20.57.156 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/config.txt to 172.20.57.156 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: file /var/lib/cmprovision/scriptexecute/71da75ea/pieeprom.sig not found Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/bcm2712-rpi-5-b.dtb to 172.20.57.156 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//config.txt to 172.20.57.156 Jan 20 19:41:44 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//config.txt to 172.20.57.156 Jan 20 19:41:45 pi3 dnsmasq-tftp[491]: error 0 Early terminate received from 172.20.57.156 Jan 20 19:41:45 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/kernel_2712.img to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/initramfs_2712 to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/bcm2712-rpi-cm5-cm5io.dtb to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//overlays/overlay_map.dtb to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//overlays/bcm2712d0.dtbo to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//config.txt to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//overlays/dwc2.dtbo to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea//cmdline.txt to 172.20.57.156 Jan 20 19:41:50 pi3 dnsmasq-tftp[491]: file /var/lib/cmprovision/scriptexecute/71da75ea/armstub8-2712.bin not found Jan 20 19:41:54 pi3 dnsmasq-tftp[491]: sent /var/lib/cmprovision/scriptexecute/71da75ea/kernel_2712.img to 172.20.57.156

pirvu17 avatar Jan 20 '25 17:01 pirvu17

Well you need to compile a new kernel for the 2712 chip too.... and i managed to compile one that is working and booting. Though i'm stuck at the Welcome to buildroot prompt myself. It seems to be working but it's not starting the copy process.

I'm probably compiling wrong here Using the default raspberry5_defconfig (it is a rpi5 not a CM though. for CM5 there is no defconfig that i have found)

jayjayseal avatar Jan 23 '25 14:01 jayjayseal

I'm probably compiling wrong here Using the default raspberry5_defconfig (it is a rpi5 not a CM though. for CM5 there is no defconfig that i have found)

You normally would compile things using this buildroot project: https://github.com/raspberrypi/scriptexecutor/

The scripting merges two kernel configuration files.

It expects you to supply a bare bones kernel configuration file without any modules. For CM4 that was this one: https://github.com/raspberrypi/scriptexecutor/blob/master/scriptexecute/board/kernelconfig-cm4.armv7 Which was originally created by running: "cat bcm2711_defconfig |grep -v =m" in the directory of the kernel source code that has the configuration (arch/arm/configs or arch/arm64/configs)

And on top of that there is a configuration file with the extras cmprovision expects to be statically compiled into the kernel (not as module): https://github.com/raspberrypi/scriptexecutor/blob/master/scriptexecute/board/kernelconfig-scriptexecute.fragment This are options necessary to support GPIO (to test for jumpers set, used by the labelling mechanism), support for flashing EEPROM firmware with flashrom, etc. As well as the alternative dwc2 USB driver (necessary to allow communication over USB Ethernet gadget instead of Ethernet IF you want to use that option).

You will also need to change the buildroot configuration to tell it to build the cm5 DTB file from kernel source: https://github.com/raspberrypi/scriptexecutor/blob/master/scriptexecute/configs/scriptexecute_cm4_defconfig#L21

And probably need to change the architecture to aarch64 instead of 32-bit arm.

maxnet avatar Jan 30 '25 19:01 maxnet

This is one i got from Buildroot, I also upgraded to buildroot-2024.08.1 because the one in the scriptexecutor is really out of date and will not compile anymore.

BR2_aarch64=y
BR2_cortex_a76=y
BR2_ARM_FPU_VFPV4=y

BR2_TOOLCHAIN_BUILDROOT_CXX=y

BR2_SYSTEM_DHCP="eth0"

# Linux headers same as kernel, a 6.1 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y

BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,17f135b742c4edb340afb365873c3a574f7e16cb)/linux-17f135b742c4edb340afb365873c3a574f7e16cb.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2712"

# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2712-rpi-5-b"

BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y

BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi5/config_5.txt"

# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi5/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi5/post-image.sh"

# Enable compressed kernel module support
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_XZ=y
BR2_PACKAGE_KMOD=y
BR2_PACKAGE_HOST_KMOD_XZ=y

jayjayseal avatar Jan 31 '25 12:01 jayjayseal

The buildroot defconfigs you seem to be using, will give you an empty buildroot operating system project, without any software packages installed (only a kernel with all the kitchen sink modules, and busybox) Keep in mind that buildroot defconfigs with names like raspberry5_defconfig concern buildroot's configuration, that configures which things (both applications and kernel) buildroot should build. Not to be confused with kernel configuration defconfigs that have names like bcm2711_defconfig.

You really want to use the existing scriptexecute_cm4_defconfig buildroot configuration as base instead, as that has the right list of applications, and only change the kernel version, kernel configuration, dtb and architecture to suit CM5.

If buildroot no longer works under your Linux version, upgrading buildroot to a later version itself shouldn't be a problem, as our own changes live in a different folder than the core buildroot stuff (BR2_EXTERNAL construct) The buildroot version upgrade part shouldn't be much more complicated than:

  • changing the version number in build.sh: https://github.com/raspberrypi/scriptexecutor/blob/640d74972f0d775c3bee112d80e5b25b4a64ed25/build.sh#L3 to say 2024.02.10
  • Toss the new buildroot-2024.02.10.tar.gz from the buildroot site in the folder.
  • run ./build.sh which do will extract buildroot, but probably will bail out complaining about legacy options
  • make -C buildroot-2024.02.10 BR2_EXTERNAL="$PWD/scriptexecute" menuconfig
  • fix settings there, change architecture and kernel to your liking, uncheck legacy option
  • make -C buildroot-2024.02.10 BR2_EXTERNAL="$PWD/scriptexecute" savedefconfig
  • run ./build.sh

maxnet avatar Jan 31 '25 14:01 maxnet

Hi, immediately get push back to the Buildroot login. When i start the init.d script manually i get a

VCHI Initialization failed

error. Now this only gets the temperature of the CPU. But you can get this other ways too Changed

TEMP=vcgencmd measure_temp`

TEMP=${TEMP:5}`

to

TEMP=cat /sys/class/thermal/thermal_zone0/temp`

TEMP=$((TEMP/1000))`

But when i change this (and on the server in the script it fetches as well)...... The script will then run and it starts to copy but has no output to the screen when it starts at boot with init.d.... when it's run manually from the command line it does have an output. So I'm missing a setting i guess :)

BR2_aarch64=y BR2_cortex_a76=y BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_GLOBAL_PATCH_DIR="board/raspberrypi/patches" BR2_DOWNLOAD_FORCE_CHECK_HASHES=y BR2_TARGET_GENERIC_HOSTNAME="scriptexecute" BR2_TARGET_GENERIC_ROOT_PASSWD="raspberry" BR2_TARGET_GENERIC_GETTY_PORT="tty1" BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y BR2_SYSTEM_DHCP="eth0" BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/board/overlay/" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_TARBALL=y BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,576cc10e1ed50a9eacffc7a05c796051d7343ea4)/linux-576cc10e1ed50a9eacffc7a05c796051d7343ea4.tar.gz" BR2_LINUX_KERNEL_DEFCONFIG="bcm2712" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/board/kernelconfig-scriptexecute.fragment" BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/logo.png" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2712-rpi-5-b broadcom/bcm2712d0-rpi-5-b overlays/dwc2-overlay overlays/spi-gpio40-45-overlay" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y BR2_PACKAGE_XZ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y BR2_PACKAGE_MMC_UTILS=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_FLASHROM=y BR2_PACKAGE_PARTED=y BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_LIBARCHIVE=y BR2_PACKAGE_LIBARCHIVE_BSDTAR=y BR2_PACKAGE_ZLIB=y BR2_PACKAGE_LIBSYSFS=y BR2_PACKAGE_JITTERENTROPY_LIBRARY=y BR2_PACKAGE_LIBGPIOD2=y BR2_PACKAGE_LIBGPIOD2_TOOLS=y BR2_PACKAGE_LIBCURL=y BR2_PACKAGE_LIBCURL_CURL=y BR2_PACKAGE_UTIL_LINUX_BINARIES=y BR2_PACKAGE_NANO=y BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_CPIO_XZ=y BR2_PACKAGE_RPI_PINCTRL=y

jayjayseal avatar Feb 06 '25 07:02 jayjayseal

You do have the default cmprovision cmdline.txt ? If tgere is no cmdline the kernel may default to a builtin one that may include an option to send output to serial console. Can also try setting something like console=tty1 explicitly.

maxnet avatar Feb 06 '25 20:02 maxnet

It was that!

i added console=tty1 before readjumper script="...." and it started to work!

Now back to trying to see if it all works again :)

jayjayseal avatar Feb 07 '25 09:02 jayjayseal

Hey!

I am currently facing the same problem: I would be happy to use the 'cmprovision' tool for the CM5.

@jayjayseal Is your system working? Can I see/find your changes somewhere? @maxnet Are there plans to add CM5 support to the official 'cmprovision' tool?

Thank you both in advance!

Dude90 avatar Apr 11 '25 15:04 Dude90

@maxnet Are there plans to add CM5 support to the official 'cmprovision' tool?

Not my call to make. While I hang around as I like to see stuff I once write to be used, I am no longer officially involved.

maxnet avatar Apr 11 '25 17:04 maxnet

@maxnet Thank you for your answer. I forwarded the question directly to the Raspberry Pi team here. Unfortunately no answer yet.

In the meantime I tried to add CM5 support to the cmprovision tool myself, using the answers above. Unfortunately I was not successful. In following I am shortly describing my steps. Maybe someone can have a look at it and help get the CM5 provisioning to work.

Thank you!

  1. Added "dhcp-match=set:client_is_a_pi,97,0:35:69:50:52" to /var/lib/cmprovision/etc/dnsmasq.conf -> CM5 on a CM5IO is recognized correctly by the cmprovision tool, gets an IP and NFS boot is initialized but fails
  2. Replaced buildroot-2019.11.1.tar.gz with the current version buildroot-2025.02.tar.gz and updated the version in build.sh
  3. Created a kernelconfig-cm5.armv7 by executing cat bcm2712_defconfig | grep -v =m on the ARM64 BCM2712 config for Kernel 6.6 (taken from here). Placed kernelconfig-cm5.armv7 in /scriptexecute/boards
  4. Changed architecture, kernel, config-file and dts in scriptexecutor/configs/scriptexecute_cm4_defconfig (final defconfig below)
  5. Executed ./build.sh -> Fails (expected)
  6. Executed make -C buildroot-2025.02 BR2_EXTERNAL="$PWD/scriptexecute" menuconfig. Checked/Changed architecture, processor-type (A76), headers (6.6), kernel, etc. (final defconfig below) + unchecked all legacy options Resulting final scriptexecute_cm4_defconfig:
BR2_aarch64=y
BR2_cortex_a76=y
BR2_ARM_FPU_VFPV2=y
BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
# BR2_UCLIBC_INSTALL_UTILS is not set
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="scriptexecute"
BR2_TARGET_GENERIC_ROOT_PASSWD="raspberry"
BR2_TARGET_GENERIC_GETTY_PORT="tty1"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/board/overlay/"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rpi-6.6.y"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/board/kernelconfig-cm5.armv7"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_SCRIPTEXECUTE_PATH)/board/kernelconfig-scriptexecute.fragment"
BR2_LINUX_KERNEL_XZ=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-5-b broadcom/bcm2712-rpi-cm5-cm5io overlays/dwc2-overlay overlays/spi-gpio40-45-overlay"
BR2_PACKAGE_E2FSPROGS=y
# BR2_PACKAGE_E2FSPROGS_FSCK is not set
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_FLASHROM=y
BR2_PACKAGE_PARTED=y
BR2_PACKAGE_RPI_USERLAND=y
BR2_PACKAGE_LIBARCHIVE=y
BR2_PACKAGE_LIBARCHIVE_BSDTAR=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_LIBSYSFS=y
BR2_PACKAGE_JITTERENTROPY_LIBRARY=y
BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_LIBCURL_CURL=y
# BR2_PACKAGE_LIBCURL_PROXY_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_COOKIES_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_EXTRA_PROTOCOLS_FEATURES is not set
BR2_PACKAGE_ARGP_STANDALONE=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_XZ=y
# BR2_TARGET_ROOTFS_TAR is not set
  1. Executed make -C buildroot-2025.02 BR2_EXTERNAL="$PWD/scriptexecute" savedefconfig
  2. Executed build.sh -> Failed for firmware
  3. Added the following to scriptexecutor/buildroot-2025.02/.config
BR2_PACKAGE_RPI_FIRMWARE_CUSTOM=y
BR2_PACKAGE_RPI_FIRMWARE_CUSTOM_DEFAULT=y
BR2_PACKAGE_RPI_FIRMWARE_CUSTOM_BOOT=""
  1. Executed build.sh -> Success, except for the copy of zImage which in my case is just Image
  2. Copied the output files as well as the Image to /var/lib/cmprovision/scriptexecute. Renamed Image to kernel_2712.img.
  3. Added "console=tty1" to /var/lib/cmprovision/scriptexecute/cmdline.txt.
  4. Tested provisioning on a CM5 on a CM5IO -> NFS-log seems mostly ok, however the CM5 does not boot. No HDMI and no UART ouput. Dnsmasq log:

Apr 15 12:55:25 cm5provision dnsmasq-dhcp[601]: DHCP packet received on eth0 which has no address Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 available DHCP range: 172.20.0.2 -- 172.20.255.255 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 vendor class: PXEClient:Arch:00000:UNDI:002001 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 DHCPDISCOVER(eth0) 2c:cf:67:b8:11:1c Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 tags: client_is_a_pi, eth0 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 DHCPOFFER(eth0) 172.20.75.219 2c:cf:67:b8:11:1c Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 requested options: 1:netmask, 3:router, 43:vendor-encap, 60:vendor-class, Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 requested options: 66:tftp-server, 67:bootfile-name, 128, 129, Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 requested options: 130, 131, 132, 133, 134, 135 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 next server: 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 1 option: 53 message-type 2 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 54 server-identifier 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 51 lease-time 1h Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 58 T1 30m Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 59 T2 52m30s Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 1 netmask 255.255.0.0 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 28 broadcast 172.20.255.255 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 3 router 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 9 option: 60 vendor-class 50:58:45:43:6c:69:65:6e:74 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 17 option: 97 client-machine-id 00:35:69:50:52:80:41:c0:00:67:b8:11:1c:f9... Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 32 option: 43 vendor-encap 06:01:03:0a:04:00:50:58:45:09:14:00:00:11... Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 available DHCP range: 172.20.0.2 -- 172.20.255.255 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 vendor class: PXEClient:Arch:00000:UNDI:002001 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 DHCPREQUEST(eth0) 172.20.75.219 2c:cf:67:b8:11:1c Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 tags: client_is_a_pi, eth0 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 DHCPACK(eth0) 172.20.75.219 2c:cf:67:b8:11:1c Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 next server: 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 1 option: 53 message-type 5 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 54 server-identifier 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 51 lease-time 1h Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 58 T1 30m Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 59 T2 52m30s Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 1 netmask 255.255.0.0 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 28 broadcast 172.20.255.255 Apr 15 12:55:33 cm5provision dnsmasq-dhcp[601]: 2403529415 sent size: 4 option: 3 router 172.20.0.1 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: file /var/lib/cmprovision/scriptexecute/bea1cef9/config.txt not found for 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/config.txt to 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: file /var/lib/cmprovision/scriptexecute/pieeprom.sig not found for 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/bcm2712-rpi-5-b.dtb to 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/config.txt to 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/config.txt to 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: error 0 Early terminate received from 172.20.75.219 Apr 15 12:55:33 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/kernel_2712.img to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/scriptexecute.img to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/bcm2712-rpi-cm5-cm5io.dtb to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: file /var/lib/cmprovision/scriptexecute/overlays/overlay_map.dtb not found for 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: file /var/lib/cmprovision/scriptexecute/overlays/bcm2712d0.dtbo not found for 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/config.txt to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/overlays/dwc2.dtbo to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/overlays/spi-gpio40-45.dtbo to 172.20.75.219 Apr 15 12:55:34 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/cmdline.txt to 172.20.75.219 Apr 15 12:55:35 cm5provision dnsmasq-tftp[601]: file /var/lib/cmprovision/scriptexecute/armstub8-2712.bin not found for 172.20.75.219 Apr 15 12:55:39 cm5provision dnsmasq-tftp[601]: sent /var/lib/cmprovision/scriptexecute/kernel_2712.img to 172.20.75.219

Dude90 avatar Apr 15 '25 13:04 Dude90

Short Update: By changing to a HDMI-HDMI cable (from a HDMI-DP cable) I was able to get the following display output. Directly after the content in the picture is displayed, the screen becomes black.

Image

Dude90 avatar Apr 15 '25 15:04 Dude90

In the meantime I was finally successful provision a CM5. I am currently cleaning up all my files and will provide them here afterwards in some form (e.g. pull request, forked,...).

What I was not able to put into operation is the "recovery" of an CM5, e.g. setting a USB cable connection and a jumper to disable eMMC boot and by doing this trigger a new provision of a SOM that already has been provisioned. For the CM4 this always worked fine and was kind of handy. @maxnet Can you explain to me in more detail how this was realized? In the manual it states:

This will cause the Compute Module to perform a USB boot, in which case the provisioning server will transfer the files of the utility OS over USB. After the utility OS has booted, it will contact the provisioning server over Ethernet to receive further instructions, and download additional files (e.g. the OS image to be written to eMMC) as usual.

In which mode does rpiboot start the SOM, mass-storage or recovery? If in mass-storage I don't get when and where the utility OS is copied to the SOM? Is in recovery I would assume the boot order to be somehow manipulated in order to perform a network boot even if the eMMC holds a valid image? I would be very happy if you could shed some light on this.

Thank you!

Dude90 avatar Apr 17 '25 15:04 Dude90

I am done sorting my files. This is the procedure which I followed to create a provision station for CM5 SOM:

  1. Setup a normal cmprovision system, using the files and documentation in this repository.
  2. Build a new scriptexecute OS using the following source: https://github.com/Dude90/scriptexecutor/tree/cm5_support. Just clone it and execute build.sh (not as root).
  3. Copy the output files from step 2 (the files can be found in the folder output) to var/lib/cmprovision/scriptexecute on your cmprovision system from step 1 (replace or delete old files in this folder).
  4. On your cmprovision system copy the file /boot/overlay/bcm2712d0.dtbo to var/lib/cmprovision/scriptexecute/overlays. Hint: Even though this file seems to be intended for 32bit systems it is somehow required for CM5 provision (which is using 64bit).
  5. On your cmprovision system add the CM5 GUID by pasting dhcp-match=set:client_is_a_pi,97,0:35:69:50:52 in /var/lib/cmprovision/etc/dnsmasq.conf.
  6. If you want to get a working final temperature of the SOMs after provision, change line 95 and 96 in /var/lib/cmprovision/resources/views/scriptexecute.blade.php as follows:
95   TEMP=`cat /sys/class/thermal/thermal_zone0/temp`
96   …-g "http://{{ $server }}/scriptexecute?serial={{ $cm->serial }}&alldone=1&temp=$((TEMP/1000))&verify={{ $project->verify }}"

Done! After this steps I have been able to use the provision station for CM5 SOMs.

Only the recovering of an already programmed SOM using a USB connection and the rpi_boot jumper is not working (see my last post). I would still be happy to get some feedback here.

I can give no guarantee that everything is working properly using the described setup but I hope this maybe helps somebody!

Dude90 avatar Apr 23 '25 17:04 Dude90

@maxnet Can you explain to me in more detail how this was realized? In the manual it states

Cannot give much guidance with that. Do not have a CM5, so do not know if it has any quirks in regards to USB booting. (My day job is not in the embeddded field, but more devops/site reliability engineering related. And do not need compute modules for hobby).

It just works by letting rpiboot feed the same Linux kernel and initramfs (containing the scriptexecute utility operating system) that is used when network booting over USB.

So do would expect that if booting those files by network boot works, it would also workover USB, provided right jumper is set (or button is pressed on normal Pi 5). But again have not tried it...

In which mode does rpiboot start the SOM, mass-storage or recovery?

Neither, tells rpiboot to use the files in the scriptexecute folder.

After those files are booted on the CM over USB, the scriptexecute startup script will contact server for further instructions over Ethernet. The bootloader's network boot functionality is not used in that case, as rpiboot can simply boot same files over USB. If jumper is set it will not boot from eMMC, just does the rpiboot USB method.

maxnet avatar Apr 24 '25 02:04 maxnet

Thank you for the explanation. I wasn't aware that a USB boot is possible with rpiboot by simply giving it a directory with the boot files.

I tried it again but I always run into the following error, independent of the bootcode5.bin I put in the /var/lib/cmprovision/scriptexecute folder:

Apr 24 13:08:47 cm5provision2 rpiboot[391]: Waiting for BCM2835/6/7/2711/2712... Apr 24 13:08:47 cm5provision2 rpiboot[391]: Loading: /var/lib/cmprovision/scriptexecute/bootcode5.bin Apr 24 13:08:49 cm5provision2 rpiboot[391]: Sending bootcode.bin Apr 24 13:08:50 cm5provision2 rpiboot[391]: Failed control transfer (-7,24) Apr 24 13:08:50 cm5provision2 rpiboot[391]: Failed to write correct length, returned -7

I also tried the current bootcode5.bin coming with the rpiboot tool, same result. Maybe there is still something wrong with my bootcode5.bin or there is a general problem with rpiboot and the CM5. As many users had reported similar issues in the past (e.g. here) I would guess the latter is the case.

I think I will for now just wait for an update of rpiboot and then try again. Hoping that the recovery function will eventually just start work again 😄

Dude90 avatar Apr 24 '25 11:04 Dude90

It is possible to boot and provision a pi5. But you will have to build a new kernel using buildroot-2024.08.1 along with a few other patches. I have made a new directory in the scriptexecute folder for when a pi5 is detected to use that kernel for example. Since the PI5 has new hardware several things have to be adjusted. In the blade things have to be changed as well.... (From the temperature readings (does not work at all in the current state), all the way up to the status red/green light when it is done provisioning since the path has changed). Since it's quite the change it will take me a while to list them all.

A another thing i changed was the writing of the image to the SD card. It was writing it straight from http to the sdcard. This sometimes failed (probably due to a network blip) So i wrote it to the memory of the pi5 first and then wrote it to the SD card (since then no more issues and failed writes)

Currently checking if curl https is possible (but this might also need a change in the provisioning kernel. since it's not supported by libcurl in the current state) Changing nginx to https was easy even with a redirect from port 80... getting libcurl to understand this on the other hand.

jayjayseal avatar Apr 25 '25 13:04 jayjayseal

This sometimes failed (probably due to a network blip)

May also happen if your image has highly compressible data, e.g. a lot of empty space/zeroes. Those zeroes take very little space in the compressed image it downloads from the server, but writing them to SD card do can take long if it is say a gigabyte worth. If it is busy writing those zeroes to SD card for more than one minute, and it downloads nothing new during that time, nginx closes the connection because it thinks download has stalled.

Can raise the timeout in the nginx config to see if that makes a difference.

E.g.:

on the cmprovision server, edit /etc/nginx/sites-available/cmprovision and toss in the "server" section:

send_timeout 600s;

Run "sudo systemctl restart nginx" afterwards.

maxnet avatar Apr 25 '25 14:04 maxnet

Late response: I switched to rpi-sb-provisioner early this year and it's working fine.

I also tired @Dude90 's new instruction and it also works well! (Thank you for your investigation)

The new problem is when I tried to add eeprom file it always suggests : linux_spi_init: failed to open /dev/spidev0.0: No such file or directory

I have turned on the SPI in raspi-config, so not sure why. I will try again later

jcaptitude avatar Apr 30 '25 17:04 jcaptitude