BalenaOS OrangePi One building custom balenaOS image with additional Kernel Devicetree

Hello!

So i made a card with orange pi one balenaOS image, but it doesnt have support for i2c, and spi at the moment, and there is no mechanism in balenaOS to change dtoverlay in runtime

So my plan is to build custom orange-pi-one balenaOS image with some additional features like:
i2c support, spi support

Is there any guide regarding this?

I assume that i have to clone this:
git@github.com:balena-os/balena-allwinner.git
Then
git submodule update --init --recursive
Then add layers/meta-balena-allwinner/orange-pi-one.conf similiar to orange-pi-lite.conf

@TYPE: Machine

#@NAME: orange-pi-one

#@DESCRIPTION: Machine configuration for the orange-pi-one, base on allwinner H3 CPU

require conf/machine/include/sun8i.inc

KERNEL_DEVICETREE = "sun8i-h3-orangepi-one.dtb \

overlay/sun8i-h3-analog-codec.dtbo \

overlay/sun8i-h3-cir.dtbo \

overlay/sun8i-h3-fixup.scr \

overlay/sun8i-h3-i2c0.dtbo \

overlay/sun8i-h3-i2c1.dtbo \

overlay/sun8i-h3-i2c2.dtbo \

overlay/sun8i-h3-pps-gpio.dtbo \

overlay/sun8i-h3-pwm.dtbo \

overlay/sun8i-h3-spdif-out.dtbo \

overlay/sun8i-h3-spi-add-cs1.dtbo \

overlay/sun8i-h3-spi-jedec-nor.dtbo \

overlay/sun8i-h3-spi-spidev.dtbo \

overlay/sun8i-h3-uart1.dtbo \

overlay/sun8i-h3-uart2.dtbo \

overlay/sun8i-h3-uart3.dtbo \

overlay/sun8i-h3-usbhost0.dtbo \

overlay/sun8i-h3-usbhost2.dtbo \

overlay/sun8i-h3-usbhost3.dtbo \

overlay/sun8i-h3-w1-gpio.dtbo \

"

UBOOT_MACHINE = “orangepi_one_defconfig”

DEFAULTTUNE = “cortexa7hf-neon-vfpv4”

Then i have to make
./balena-yocto-scripts/build/barys -m orange-pi-one

Unfortunately i got error

NOTE: Running task 1251 of 3762 (/home/adam/balena-allwinner/build/…/layers/meta-rust/recipes-devtools/rust/rust-cross_1.33.0.bb:do_rust_gen_targets)
NOTE: recipe rust-cross-arm-1.33.0-r0: task do_rust_create_wrappers: Succeeded
NOTE: Running task 1252 of 3762 (virtual:native:/home/adam/balena-allwinner/build/…/layers/poky/meta/recipes-support/libxslt/libxslt_1.1.33.bb:do_fetch)
ERROR: qemu-native-3.1.0-r0 do_compile: oe_runmake failed
ERROR: qemu-native-3.1.0-r0 do_compile: Function failed: do_compile (log file is located at /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/temp/log.do_compile.1197)
ERROR: Logfile of failure stored in: /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/temp/log.do_compile.1197
NOTE: recipe qemu-native-3.1.0-r0: task do_compile: Failed
ERROR: Task (/home/adam/balena-allwinner/build/…/layers/poky/meta/recipes-devtools/qemu/qemu-native_3.1.0.bb:do_compile) failed with exit code ‘1’
NOTE: Running task 1253 of 3762 (/home/adam/balena-allwinner/build/…/layers/poky/meta/recipes-support/libgpg-error/libgpg-error_1.35.bb:do_unpack)
NOTE: recipe rust-cross-arm-1.33.0-r0: task do_rust_gen_targets: Started
NOTE: recipe rust-cross-arm-1.33.0-r0: task do_rust_gen_targets: Succeeded
NOTE: recipe libgpg-error-1.35-r0: task do_unpack: Started
NOTE: recipe libxslt-native-1.1.33-r0: task do_fetch: Started
NOTE: recipe libgpg-error-1.35-r0: task do_unpack: Succeeded
NOTE: recipe libxslt-native-1.1.33-r0: task do_fetch: Succeeded
NOTE: recipe linux-mainline-4.19.76+gitAUTOINC+555161ee1b-r0: task do_configure: Succeeded
NOTE: recipe vala-native-0.42.5-r0: task do_compile: Succeeded
NOTE: recipe libgpg-error-native-1.35-r0: task do_configure: Succeeded
NOTE: recipe glibc-2.29-r0: task do_install: Succeeded
NOTE: recipe rust-llvm-native-1.33.0-r0: task do_compile: Succeeded
NOTE: Tasks Summary: Attempted 1253 tasks of which 0 didn’t need to be rerun and 1 failed.

Log “/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/temp/log.do_compile.1197” (100 last lines):

make[1]: *** [/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs…
CC arm-linux-user/linux-user/mmap.o
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:222:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
222 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
| ^~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET_ ## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
CC mipsel-linux-user/accel/tcg/user-exec-stub.o
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:223:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
223 | IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
| ^~~~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET_ ## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
CC mipsel-linux-user/linux-user/main.o
CC mipsel-linux-user/linux-user/syscall.o
make[1]: *** [/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs…
CC mipsel-linux-user/linux-user/strace.o
CC aarch64-linux-user/linux-user/syscall.o
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:253:16: error: static declaration of ‘gettid’ follows non-static declaration
253 | _syscall0(int, gettid)
| ^~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:184:13: note: in definition of macro ‘_syscall0’
184 | static type name (void)
| ^~~~
In file included from /usr/include/unistd.h:1170,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/include/qemu/osdep.h:90,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:20:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
34 | extern _pid_t gettid (void) _THROW;
| ^~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:222:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
222 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
| ^~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET
## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:223:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
223 | IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
| ^~~~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET
## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
make: *** [Makefile:483: subdir-mips64-linux-user] Error 2
CC mipsel-linux-user/linux-user/mmap.o
CC mipsel-linux-user/linux-user/signal.o
CC mipsel-linux-user/linux-user/elfload.o
make[1]: *** [/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs…
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:253:16: error: static declaration of ‘gettid’ follows non-static declaration
253 | _syscall0(int, gettid)
| ^~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:184:13: note: in definition of macro ‘_syscall0’
184 | static type name (void)
| ^~~~
CC aarch64-linux-user/linux-user/strace.o
In file included from /usr/include/unistd.h:1170,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/include/qemu/osdep.h:90,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:20:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
34 | extern _pid_t gettid (void) _THROW;
| ^~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:222:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
222 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
| ^~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET
## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/ioctls.h:223:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
223 | IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
| ^~~~~~~~~~~~
/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/syscall.c:4750:23: note: in definition of macro ‘IOCTL’
4750 | { TARGET
## cmd, cmd, #cmd, access, 0, { VA_ARGS } },
| ^~~
make[1]: *** [/home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs…
make: *** [Makefile:483: subdir-arm-linux-user] Error 2
In file included from /usr/include/string.h:494,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/include/qemu/osdep.h:84,
from /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/elfload.c:2:
In function ‘strncpy’,
inlined from ‘fill_psinfo’ at /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/elfload.c:3158:12,
inlined from ‘fill_note_info’ at /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/elfload.c:3340:5,
inlined from ‘elf_core_dump’ at /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/qemu-3.1.0/linux-user/elfload.c:3489:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:483: subdir-aarch64-linux-user] Error 2
ERROR: oe_runmake failed
make: *** [Makefile:483: subdir-mipsel-linux-user] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at /home/adam/balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/3.1.0-r0/temp/log.do_compile.1197)

My system:
Ubuntu 19.10

I’m not sure if i’m doing everything ok, so that’s why im not putting issue yet

Hello Adam,

I’ve reached out to our devices support team to take a look at this. In the mean time, have you taken a look at this guide? It might have some useful information for you.

Cheers!

Hi Adam, I noticed that error is referred to here: https://patchwork.kernel.org/patch/10998911/

It might be worthwhile to patch that file, and just see if that allows you to proceed with your build.

The ‘syscall.c’ file should be sitting in ‘balena-allwinner/build/tmp/work/x86_64-linux/qemu-native/2.11.1-r0/qemu-2.11.1/linux-user’ folder.

Hope that helps, thanks.

Hi, thank you very much
At the moment i will try to compile with jenkins_build.sh script, it looks like the environment is dockerized, so maybe problem will disappear

Hi, please let us know if that works for you.

Hello
jenkins script succesfuly build this image

But i still can’t get image that will support i2c in Orange pi one
Unfortunately i just have no proper knowledge to do that

Like i asked - do you have any tutorial how to start with yocto, or adjust own board?

Hello, would you be able to give us support access to the device please (action in the dashboard), so we can take a look if anything is missing from the built image to support those protocols. We also need the device id, so please feel free to DM it to me, if you would like to keep that information private.

I sent you ID etc in DM

Hi there,

Are you able to test building in an older version of Ubuntu, for example 16.04.6 LTS?

Please let us know the results of that test.

Hi, i dont have chance to build on that system

But building isn’t a problem using jenkins_build.sh script - it have dockeried version of builder, so image were builded

But it’s still doesn’t have i2c enabled - probably i have no knowledge how to really enable it

Most likely you need to look at modifying armbian.txt, but we can’t provide more help as this is a community supported board and we don’t prioritize its support internally.

So there is armbian.txt support in balena?

The same situation is for orange pi zero, that looks like is officialy supported by you
I assume that same steps that we need to make in orange pi zero we need also to make in orange pi one, should we switch to this board?

Hi,
Both Orange Pi Zero and One are supported. They work with the balena platform. But in terms of extending the features for these boards, it’s currently on community support, meaning we don’t actively contribute there.

We checked with our devices team and they suggest that what you need should be possible to add similarly how it was done by us for Artik board. See the following commit for an example:

So, for Orange Pi, the general idea would be

mkdir /sys/kernel/config/device-tree/overlays/spi
cat "the spidev overlay" > /sys/kernel/config/device-tree/overlays/spi/dtbo

where “the spidev overlay” is the overlay for their specific machine

Hope it helps to make progress.

We will check of course and try to achieve that.

In my honest opinion orange pi one and orange pi zero is not supported in BalenaOS atm.
Chronyd is not working, any electronic interface not working, so what’s the purpouse?

I bought these boards because i thought it’s good replacement for Raspberry Pi (it works great with Balena, everything works), and i thought that where something is on your main website (Try BalenaOS) is working also.
There is no information that is community supported on the main webpage.

Without any electronic interface this board is useless in term of our business

Thanks for your help.
Have a great day

We have opened internal issues to track your request (and website suggestion) and we’ll let you know when there are any updates.

Thank you very much!

We had managed to add some overlays into final image, and this allow us to enable I2C for example

Unfortunately there is no real-rtc support for ds1307 in builded image