Adding Support for Rock Pi E to use Balena OS

Hi everyone,

I want to add Rock Pi E to the supported devices that can use Balena OS. I was able to build an image for the Rock Pi E using Yocto without the Balena OS layers. The problem is that I’m trying first to get familiar with the Balena OS build by running the balena barys build script for the Rock Pi 4B but I’m getting errors with the do_compile() of mkfs-hostapp-native.bb. Here is the error logs:

| DEBUG: Executing shell function do_compile
| #1 [internal] load build definition from Dockerfile
| #1 transferring dockerfile: 219B done
| #1 DONE 0.1s
| 
| #2 [internal] load .dockerignore
| #2 transferring context: 2B done
| #2 DONE 0.1s
| 
| #3 [internal] load metadata for docker.io/library/debian:stretch
| #3 DONE 1.4s
| 
| #4 [1/3] FROM docker.io/library/debian:stretch@sha256:c5c5200ff1e9c73ffbf188b4a67eb1c91531b644856b4aefe86a58d2f0cb05be
| #4 DONE 0.0s
| 
| #5 [internal] load build context
| #5 transferring context: 334B done
| #5 DONE 0.1s
| 
| #6 [2/3] RUN apt-get update && apt-get install -y 	ca-certificates 	iptables
| #6 CACHED
| 
| #7 [3/3] COPY create.* /usr/bin/
| #7 CACHED
| 
| #8 exporting to image
| #8 exporting layers done
| #8 writing image sha256:e6b6f46f07bd55bc3f8704281a1e2370e112cc8fa2f461c6d18886e6db3e3ce1 0.1s done
| #8 DONE 0.1s
| Error response from daemon: invalid reference format
| WARNING: exit code 1 from a shell command.

If anyone had this issue with the Rock Pi 4B build I would appreciate any guidance. I want to get this solved before going and try to build a Balena OS for the Rock Pi E because this way I would be able to tell if any new issue is the Balena OS layer or the Rock Pi E BSP files.

Any help is appreciated. Thanks!

1 Like

Hello @Willy welcome to the balena community.

As mentioned via e-mail please follow the Custom Board support instructions from here → Customer Board Support - Balena Documentation

We also recorded a live video on creating a Custom Board Support some months ago, in case you would like to get inspired → IoT Happy Hour #45: Building balenaOS for a Device - YouTube

From here, let us know how we can help you more :slight_smile:

And if i’m not wrong this is the repository of the balenaOS Rockpi 4 Pro → GitHub - balena-os/balena-rockpro64

Check it out to get the BSPs and more.

Hi. You can also look at the other Radxa boards that we support. Here is the repo: GitHub - balena-os/balena-radxa
Feel free to send the PR for the support for Rock Pi E in that repository.
Do let us know if the doc for new board support shared by my colleague Marc needs any adjustment.

1 Like

Thanks @mpous for pointing me to that video resource, it’s a good example to follow and very helpful.

In terms of the repo I’m using the one pointed by @floion which is the one for Radxa boards like the Rock Pi E.

I already cloned the repo and now I’m trying to do a test build without changing anything on the repo for the Rock Pi 4B but I’m having the error mentioned above with a meta-balena task. Link of the task for reference here.

This happens either I ran it manually or using the barys script. I would like to know if this is an issue of my dev environment ( ran the Rock Pi E yocto build last week in this same env) that may need specific version for the Rock Pi 4B balena build or I have to select an specific branch of the repo? (Right now I just cloned the master branch)

Also do you recommend me go ahead an add the Rock Pi E files to this repo and then try the balena build for the Rock Pi E? Or do you think that my approach of doing the Rock Pi 4B balena build first is better?

Also a feedback for the Customer Board Support documentation is that in the section that is called Building it references the meta-balena readme but there is not much information on how to run the barys or the balena-build.sh scripts. Would be good to have examples on how to run those scripts there as well. In my case I used the examples that are in the Radxa board repo.

Thanks both for your help and your quick response.

1 Like

Nevermind, reinstalling Docker solved the issue.

1 Like

If anyone get the following message:

ERROR: balena-image-initramfs-1.0-r0 do_rootfs: The postinstall intercept hook 'update_desktop_database' failed, details in /home/chiwilly/Documents/balena/balena-radxa/build/tmp/work/rockpi_e_rk3328-poky-linux/balena-image-initramfs/1.0-r0/temp/log.do_rootfs
ERROR: Logfile of failure stored in: /home/chiwilly/Documents/balena/balena-radxa/build/tmp/work/rockpi_e_rk3328-poky-linux/balena-image-initramfs/1.0-r0/temp/log.do_rootfs.3454
ERROR: Task (/home/chiwilly/Documents/balena/balena-radxa/build/../layers/meta-balena/meta-balena-common/recipes-core/images/balena-image-initramfs.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4381 tasks of which 4380 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/chiwilly/Documents/balena/balena-radxa/build/../layers/meta-balena/meta-balena-common/recipes-core/images/balena-image-initramfs.bb:do_rootfs
Summary: There were 2 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

NOTE: Installing complementary packages ...  (skipped already provided packages )
NOTE: Running intercept scripts:
NOTE: > Executing update_desktop_database intercept ...
NOTE: Exit code 127. Output:
/home/chiwilly/Documents/balena/balena-radxa/build/tmp/work/rockpi_e_rk3328-poky-linux/balena-image-initramfs/1.0-r0/intercept_scripts-eaf9f76bd308e6081e291a6f7a017b3125f6c40169b01ca5db92bf3c0fb85641/update_desktop_database: 7: update-desktop-database: not found

ERROR: The postinstall intercept hook 'update_desktop_database' failed, details in /home/chiwilly/Documents/balena/balena-radxa/build/tmp/work/rockpi_e_rk3328-poky-linux/balena-image-initramfs/1.0-r0/temp/log.do_rootfs
DEBUG: Python function do_rootfs finished

Just run git restore * in the poky directory

Hello @floion,

Do you have any idea on how to solve this?

Found resin image on mmc 1
Loading resinOS_uEnv.txt from mmc device 1 partition 4
Loading extra_uEnv.txt from mmc device 1 partition 4
0 bytes read in 2 ms (0 Bytes/s)
Import extra_uEnv.txt in environment
Loading bootcount.env from mmc device 1 partition 4
No bootcount.env file. Setting bootcount=0 in environment

I think that I have something missing in my recipes but I can’t figure out what. Let me know if you need me to push to the balena-radxa repo the changes that I have so you or anyone from the Balena team can check them?

Thanks

Hi. After you get that printed, is there any other error you get? There’s no error in what you pasted there so not sure what the issue is.

Also, is this from a development build? If it is not, then you won’t get a login console if that’s what you are expecting

I believe that I’m building a development image using the following command balena-yocto-scripts/build/barys -k -d -m rockpi-e-rk3328 due to the -d that I’m passing.

At the point of the last post I was getting stuck there; now I get to the Starting Kernel... message but the kernel never starts. I think that my issue is with the balena-image.inc file. Here is the full log for reference:

DDR version 1.16 20190528
ID:0x805 N
In
DDR3
333MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
ddrconfig:1
OUT
Boot1 Release Time: May 13 2019 17:34:36, version: 2.50
ChipType = 0x11, 232
mmc2:cmd1,20
emmc reinit
mmc2:cmd1,20
emmc reinit
mmc2:cmd1,20
SdmmcInit=2 1
mmc0:cmd5,20
SdmmcInit=0 0
BootCapSize=0
UserCapSize=30528MB
FwPartOffset=2000 , 0
StorageInit ok = 19221
Raw SecureMode = 0
SecureInit read PBA: 0x4
SecureInit read PBA: 0x404
SecureInit read PBA: 0x804
SecureInit read PBA: 0xc04
SecureInit read PBA: 0x1004
SecureInit ret = 0, SecureMode = 0
atags_set_bootdev: ret:(0)
GPT part:  0, name:        idbloader, start:0x40, size:0x1f40
GPT part:  1, name:            uboot, start:0x4000, size:0x2000
GPT part:  2, name:            trust, start:0x6000, size:0x2000
GPT part:  3, name:       resin-boot, start:0x14000, size:0x28000
GPT part:  4, name:      resin-rootA, start:0x3c000, size:0xfa000
GPT part:  5, name:      resin-rootB, start:0x136000, size:0xfa000
GPT part:  6, name:      resin-state, start:0x230000, size:0xa000
GPT part:  7, name:       resin-data, start:0x23a000, size:0x65800
find part:uboot OK. first_lba:0x4000.
find part:trust OK. first_lba:0x6000.
LoadTrust Addr:0x6000
No find bl30.bin
No find bl32.bin
Load uboot, ReadLba = 4000
Load OK, addr=0x200000, size=0xa0e40
RunBL31 0x10000
NOTICE:  BL31: v1.3(debug):0e4d696
NOTICE:  BL31: Built : 09:22:40, Aug 27 2019
NOTICE:  BL31:Rockchip release version: v1.3
INFO:    ARM GICv2 driver initialized
INFO:    Using opteed sec cpu_context!
INFO:    boot cpu mask: 1
INFO:    plat_rockchip_pmu_init: pd status 0xe
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9


U-Boot 2019.10 (Apr 26 2020 - 08:20:25 +0000)

Model: Radxa ROCK Pi E
DRAM:  1022 MiB
PMIC:  RK8050 (on=0x40, off=0x00)
MMC:   rksdmmc@ff500000: 1, rksdmmc@ff520000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: Radxa ROCK Pi E
Net:   eth0: ethernet@ff540000
Hit any key to stop autoboot:  0 
Scanning mmc devices 0 1 2
Card did not respond to voltage select!
Card did not respond to voltage select!
24 bytes read in 3 ms (7.8 KiB/s)
Found resin image on mmc 1
Loading resinOS_uEnv.txt from mmc device 1 partition 4
Loading extra_uEnv.txt from mmc device 1 partition 4
0 bytes read in 1 ms (0 Bytes/s)
Import extra_uEnv.txt in environment
Loading bootcount.env from mmc device 1 partition 4
No bootcount.env file. Setting bootcount=0 in environment
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:5...
Found U-Boot script /boot/boot.scr
2581 bytes read in 11 ms (228.5 KiB/s)
## Executing script at 00500000
Boot script loaded from mmc 1
149 bytes read in 10 ms (13.7 KiB/s)
23044104 bytes read in 1041 ms (21.1 MiB/s)
71062 bytes read in 14 ms (4.8 MiB/s)
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Device Tree to 000000003deb2000, end 000000003df2bfff ... OK

Starting kernel ...

I’m forking the balena-radxa repo so I can share with you guys all the files and changes that I made to run the image build. As soon as is ready I will post a link to it here.

1 Like

Hi there,

Here is the link to our development repository where we forked balena-radxa and added the files and changes that we made to build the image.

If you get to “Starting kernel” and nothing after that it may be that there is a problem with the serial console. Are you using the correct baudrate? 1500000 ?

Yes, that’s the baudrate that I’m using. I also attached a logic analyzer to see if there was any other communication happening at other baudrate but no signs of any signal as well.

Anyways, the company that I work for decided to go forward and wants to use your Custom Device Support service for this device. Thanks a lot for your help!

1 Like