Options for running CM3 on current upstream kernel?

Hey Pavel,
Looks like CM3 DTS files have just been added to what will become mainline v6.3 ( https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3-io.dts) ! I can certainly build armbian against 6.1 with a patch to add the DTS+DTSI from there though have some issues with it (can’t see SD card / USB not working / had to edit to enable PCIe).
HTH
h-e-w

Hey h-e-w, thanks for your important info. I am just a bit disappointed there has been no official radxa response for weeks as the vendor has the ultimate information and knows the answers.

Best regards,

Pavel.

can you try our bsp?

./bsp linux latest

Thanks for your suggestion.

This is my first experience with your bsp. The CM3 patch does not seem to fit. Maybe I am doing something wrong. I just started “./bsp linux latest” in the cloned bsp repo:

pavel@precision:~/personal-work/bsp$ ./bsp linux latest
main: Pulling from radxa-repo/bsp
a8ca11554fce: Pull complete 
a820af0dd4bc: Pull complete 
Digest: sha256:c3b164ecb70ca44514cdb7d6c3ef30f0dd0c194c436129e570d60cf0fccbf863
Status: Downloaded newer image for ghcr.io/radxa-repo/bsp:main
ghcr.io/radxa-repo/bsp:main
/home/pavel/personal-work/bsp/.src/linux /home/pavel/personal-work/bsp
Initialized empty Git repository in /home/pavel/personal-work/bsp/.src/linux/.git/
remote: Finding sources: 100% (83380/83380)
remote: Total 83380 (delta 3625), reused 16526 (delta 3625)
Receiving objects: 100% (83380/83380), 237.22 MiB | 4.53 MiB/s, done.
Resolving deltas: 100% (3625/3625), done.
From https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux
 * [new tag]             v6.1.12    -> v6.1.12
Updating files: 100% (78711/78711), done.
HEAD is now at 129c15b60 Linux 6.1.12
HEAD is now at 129c15b60 Linux 6.1.12
Running custom_source_action from /home/pavel/personal-work/bsp/linux/latest/0002-common/overlays.sh
/home/pavel/personal-work/bsp/linux/latest/0002-common /home/pavel/personal-work/bsp/.src/linux /home/pavel/personal-work/bsp
/home/pavel/personal-work/bsp/.src/overlays /home/pavel/personal-work/bsp/linux/latest/0002-common /home/pavel/personal-work/bsp/.src/linux /home/pavel/personal-work/bsp
Initialized empty Git repository in /home/pavel/personal-work/bsp/.src/overlays/.git/
fatal: ambiguous argument 'FETCH_HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
remote: Enumerating objects: 216, done.
remote: Counting objects: 100% (216/216), done.
remote: Compressing objects: 100% (145/145), done.
remote: Total 216 (delta 162), reused 83 (delta 64), pack-reused 0
Receiving objects: 100% (216/216), 46.69 KiB | 1.61 MiB/s, done.
Resolving deltas: 100% (162/162), done.
From https://github.com/radxa/overlays
 * branch            23d0c4ae350f1ab94d72e7fe486f120826504401 -> FETCH_HEAD
HEAD is now at 23d0c4a Set overlays to be explicitly compatible with ROCK 3C
HEAD is now at 23d0c4a Set overlays to be explicitly compatible with ROCK 3C
/home/pavel/personal-work/bsp/linux/latest/0002-common /home/pavel/personal-work/bsp/.src/linux /home/pavel/personal-work/bsp
/home/pavel/personal-work/bsp/.src/linux /home/pavel/personal-work/bsp
Applying: arm64: dts: rockchip: enable tsadc for ROCK 4C+
Checking patch arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts...
Applied patch arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts cleanly.
Applying: arm64: dts: rockchip: Add rk3566 based Radxa Compute Module 3
Checking patch arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3.dtsi...
Applied patch arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3.dtsi cleanly.
Applying: arm64: dts: rockchip: Add Radxa Compute Module 3 IO board
Checking patch arch/arm64/boot/dts/rockchip/Makefile...
error: while searching for:
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pinenote-v1.2.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-a.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-roc-pc.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-soquartz-blade.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-soquartz-cm4.dtb

error: patch failed: arch/arm64/boot/dts/rockchip/Makefile:74
Checking patch arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3-io.dts...
Applying patch arch/arm64/boot/dts/rockchip/Makefile with 1 reject...
Rejected hunk #1.
Applied patch arch/arm64/boot/dts/rockchip/rk3566-radxa-cm3-io.dts cleanly.
Patch failed at 0003 arm64: dts: rockchip: Add Radxa Compute Module 3 IO board
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
bsp

sorry, please run

$ cd bsp
$ git submodule init
$ git submodule update
$ ./bsp linux latest

Naoki, thanks a lot.

I moved past the patching OK, but got stuck at the first make. This is log with bash -x in the bsp script, and “make V=1” in the bsp_make function. The fixdep binary gets compiled to arm64 OK, but the subsequent /bin/sh complains about exec format - is the fixdep binary supposed to be for arm64?

...
Patchset 0200-upstream has been applied.
+ false
+ popd
/home/pavel/personal-work/bsp
+ bsp_prepare
+ return
+ [[ -n '' ]]
+ false
+ bsp_make defconfig
+ tee -a /home/pavel/personal-work/bsp/.src/build.log
++ bsp_version
++ make -C /home/pavel/personal-work/bsp/.src/linux -s kernelversion
+ local kernelversion=6.1.12
++ nproc
+ make V=1 -C /home/pavel/personal-work/bsp/.src/linux -j12 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=aarch64-linux-gnu-gcc KDEB_COMPRESS=xz KDEB_CHANGELOG_DIST=unstable DPKG_FLAGS=-d LOCALVERSION=-latest KERNELRELEASE=6.1.12-1-latest KDEB_PKGVERSION=6.1.12-1 defconfig
make: Entering directory '/home/pavel/personal-work/bsp/.src/linux'
make -f ./scripts/Makefile.build obj=scripts/basic
  aarch64-linux-gnu-gcc -Wp,-MMD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11 -Wdeclaration-after-statement         -o scripts/basic/fixdep scripts/basic/fixdep.c   
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[1]: *** [scripts/Makefile.host:111: scripts/basic/fixdep] Error 126
make[1]: *** Deleting file 'scripts/basic/fixdep'
make: *** [Makefile:633: scripts_basic] Error 2
make: Leaving directory '/home/pavel/personal-work/bsp/.src/linux'
++ docker inspect bsp '--format={{.State.ExitCode}}'
+ DOCKER_EXIT_CODE=2
+ docker container rm bsp
bsp
+ return 2

Thanks a lot,

Pavel.

fixdep for arm64 is required to make working linux-headers package.

please run

$ sudo apt install qemu-user-static

Naoki, thanks a lot, that seems to help, debs built, image with the 6.1.12 kernel rbuilt and mounted on loopback OK, will try to flash the CM3 now.

Please would you consider adding the package to the apt install list in https://radxa-doc.github.io/software/dev/index.html ?

Also the submodule update to https://github.com/radxa-repo/bsp/blob/main/README.md

Thanks a lot,

Pavel.

Hi,

Can you share the CM3 image with kernel 6.1? (Trying to replace RPi CM4)

My camera drivers only support kernel 5.4 and later so current kernel 4.x image doesn’t work.

Thanks

Hello KenSense, have you got some luck with CM3 image with kernel 6.1?

thanks

I finally tested the “bsp latest + rbuild -k latest-image.deb radxa-cm3-io bullseye cli” image built in March, with kernel 6.1. CM3+ Radxa IO board boots OK, but there is no ethernet device present in /sys/class/net (the official radxa debian image with the old kernel 4.13 runs network OK).

Before trying to resolve this issue with Radxa I decided to use the currently latest versions. BSP compiled 6.4.11 OK.

I did ‘git pull’ in my rbuild directory with no problem, updated to

commit 37b820b75460a6e385a5cd753ca506d52ece5032 (HEAD -> main, origin/main, origin/HEAD)
Author: ZHANG Yuntian <95260730+RadxaYuntian@users.noreply.github.com>
Date:   Fri Aug 18 20:01:04 2023 +0800

    Add ca-certificates

Command ‘./rbuild -k linux-image-6.4.11-1-latest_6.4.11-1_arm64.deb radxa-cm3-io bullseye cli’ failed with swapon issues in docker:

Using debian_bullseye_cli.tar rootfs.
Running /debos --artifactdir /home/pavel/personal-work/radxa/rbuild --template-var soc:"rk3566" --template-var kernel_dbg:"" --template-var install_vendor_package:"true" --template-var dkms:"r8125-dkms" --template-var kernel_profile:"" --template-var suite:"bullseye" --template-var flavor:"cli" --template-var partition_type:"gpt" --template-var firmware:"" --template-var overlay:"" --template-var radxa_mirror:"" --template-var rbuild_cmd:"./rbuild -k linux-image-6.4.11-1-latest_6.4.11-1_arm64.deb radxa-cm3-io bullseye cli" --template-var soc_family:"rockchip" --template-var repo_prefix:"" --template-var efi_end:"332MiB" --template-var kernel:"linux-image-6.4.11-1-latest_6.4.11-1_arm64.deb" --template-var header:"linux-headers-6.4.11-1-latest_6.4.11-1_arm64.deb" --template-var distro_mirror:"" --template-var architecture:"arm64" --template-var board:"radxa-cm3-io" --template-var distro:"debian" --template-var image:"radxa-cm3-io_debian_bullseye_cli.img" --template-var rbuild_rev:"37b820b75460a6e385a5cd753ca506d52ece5032" /home/pavel/personal-work/radxa/rbuild/common/image.yaml --internal-image /dev/disk/by-fakemachine-label/fakedisk-0 --internal-image /dev/disk/by-fakemachine-label/fakedisk-1 using uml backend
2023/08/22 11:02:50 ==== Set up swap ====
2023/08/22 11:02:51 ==== Enable swap device ====
4153409536 bytes (4.2 GB, 3.9 GiB) copied, 2 s, 2.1 GB/s
2023/08/22 11:02:53 set -e... | 4096+0 records in
2023/08/22 11:02:53 set -e... | 4096+0 records out
2023/08/22 11:02:53 set -e... | 4294967296 bytes (4.3 GB, 4.0 GiB) copied, 2.06615 s, 2.1 GB/s
2023/08/22 11:02:53 set -e... | Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
2023/08/22 11:02:53 set -e... | no label, UUID=4300a314-1987-4883-b949-86283aaaf50c
2023/08/22 11:02:53 set -e... | swapon: /swapfile_rbuild: swapon failed: Invalid argument
2023/08/22 11:02:53 Action `Enable swap device` failed at stage Run, error: exit status 255

That’s weird, because swapon should work like that. Nevertheless I found the June commit https://github.com/radxa-repo/rbuild/commit/63c6d96a149d3c893f6bd808eb636eb296228e3d + subsequent changes and removed the swap sections from image|intermediate|rootfs.yaml files - no swap would be provided during the build.

After this change the build continued, until it hit missing radxa package radxa-system-config-rockchip:

2023/08/22 11:06:27 ==== Install radxa-system-config-rockchip ====
Get:1 https://deb.debian.org/debian bullseye InRelease [116 kB]                
Get:2 https://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]     
Get:3 https://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:4 https://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:5 https://radxa-repo.github.io/apt bullseye InRelease [3569 B]
Get:6 https://deb.debian.org/debian bullseye/main arm64 Packages [8071 kB]     
Get:7 https://deb.debian.org/debian bullseye/main Translation-en [6240 kB]     
Get:8 https://deb.debian.org/debian bullseye/contrib arm64 Packages [41.0 kB]  
Get:9 https://deb.debian.org/debian bullseye/contrib Translation-en [46.9 kB]  
Get:10 https://deb.debian.org/debian bullseye/non-free arm64 Packages [73.0 kB]
Get:11 https://deb.debian.org/debian bullseye/non-free Translation-en [92.2 kB]
Get:12 https://deb.debian.org/debian bullseye-backports/main arm64 Packages [419 kB]
Get:13 https://deb.debian.org/debian bullseye-backports/main Translation-en [353 kB]
Get:14 https://deb.debian.org/debian bullseye-backports/contrib arm64 Packages [5180 B]
Get:15 https://deb.debian.org/debian bullseye-backports/contrib Translation-en [5984 B]
Get:16 https://deb.debian.org/debian bullseye-backports/non-free arm64 Packages [9876 B]
Get:17 https://deb.debian.org/debian bullseye-backports/non-free Translation-en [27.7 kB]
Get:18 https://deb.debian.org/debian-security bullseye-security/main arm64 Packages [247 kB]
Get:19 https://deb.debian.org/debian-security bullseye-security/main Translation-en [164 kB]
Get:20 https://deb.debian.org/debian-security bullseye-security/non-free Translation-en [464 B]
Get:21 https://deb.debian.org/debian bullseye-updates/main arm64 Packages [14.7 kB]
Get:22 https://deb.debian.org/debian bullseye-updates/main Translation-en [9964 B]
Get:23 https://radxa-repo.github.io/apt bullseye/main all Packages [38.3 kB]   
Get:24 https://radxa-repo.github.io/apt bullseye/main arm64 Packages [48.2 kB] 
Fetched 16.2 MB in 32s (509 kB/s)                                              
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2023/08/22 11:07:05 apt | E: Unable to locate package radxa-system-config-rockchip
2023/08/22 11:07:05 Action `Install radxa-system-config-rockchip` failed at stage Run, error: exit status 100

I could not google out this package anywhere.

@RadxaYuntian & @RadxaNaoki : please can you help with these issues?

Thanks a lot,

Pavel.

Also, since my 6.1 BSP kernel did not run properly on CM3 + IO, I wonder which linux profile should be chosen for BSP https://github.com/radxa-repo/bsp/blob/main/docs/getting_started.md#build-your-first-package . I do not understand the specific profiles (rk356x, rk3328) vs. generic (amlogic, rockchip) vs. version (stable, latest). I would like rk356x latest :slight_smile:
Thanks,

Pavel.

As of the swapon issue - my ZFS does not support raw swapfiles due to the “file with holes” feature. I added a github issue for disabling swap creation with some rbuild parameter https://github.com/radxa-repo/rbuild/issues/26 .

Clean rbuild cloned from github (not just git pull from the previous try in March) did not hit the missing package radxa-system-config-rockchip error, and (after removing the swapon code) built the image based on latest 6.4.11 OK.

This image recognized the network adapters OK, even configured dwc3 composite gadget for udc-ethernet (with issues but that will be sorted out later). For now everything is OK, I can share the build should anyone want to use it. But IMO a list of steps I did would be more useful than just a static image…

Not sure why I didn’t receive email notification for your at mention. Generally when a package is missing that means it is a new package that we have not yet released to production apt repo. In that case you can either use an older commit which did not use the missing package, or use -T flag to use the testing apt repo.

We did update the production repo a few days ago so that package should be available now.

CM3 is currently a WIP product. The supported products for each profile is defined in fork.conf, so for CM3 IO you should use rk356x, which is based on Rockchip 5.10 kernel now.

Probably the issue was caused by me using older rbuild checkout, only updated to the latest git commit. A fresh rbuild today completed OK.

As mentioned in the initial message, I need the latest kernel to be able to work on vanilla features (e.g. the dwc3 in device mode getting stuck when the USB cable is disconnected and not resuming upon cable re-connection). 5.10 is way outdated :slight_smile: But the bsp latest kernel version (6.4.11) seems to run OK, so far.

Thanks for your help.

Please be aware that while we plan to support both mainline kernel and Rockchip kernel (as indicated by the available of stable and latest profiles), rbuild is currently entirely tailored for Rockchip kernel, as such will install a lot of their userland packages.

If you wish to run mainline kernel you should look to use -v flag with rbuild, which will skip the installation of a lot of Rockchip packages.

Thanks for the important info. Can installation of the Rockchip packages make any harm to the running system, or do they just take up space?

Hello Pavel, it would be wonderful if you can share the image…

Thank you very much in advance
Diego

The image will stay 6 days available in https://filebin.net/ym9eg6m9go4wi2ch . It should be with kernel 6.4.11, bullseye cli variant.

For me the key requirement was to be able to update kernel to the latest code) (so that one can communicate with upstream devs), to recompile whole kernel packages (if some key file is changed, resulting in many compilation products), and to recompile individual modules (to work on individual modules). I built the image just twice (the first time I chose kernel which did not produce working ethernet so I could not upload the the compiled kernel packages to CM3). All the other time only working in bsp with the kernel updates.