Mender - Tinkerboard - Python.h

Device description

Tinker-Board-S

Hello all,
I am currently working on implementing a Mender Integeration on a Tinker-Board-S.
As soon as I use the mender-uboot feature I unfortunately run into the following error!

Setup

Using this layers: !(I use Dunfell)!

BBLAYERS ?= " \
  ${TOPDIR}/../layers/poky/meta \
  ${TOPDIR}/../layers/poky/meta-poky \
  ${TOPDIR}/../layers/poky/meta-yocto-bsp \
  ${TOPDIR}/../layers/meta-openembedded/meta-oe \
  ${TOPDIR}/../layers/meta-openembedded/meta-python \
  ${TOPDIR}/../layers/meta-openembedded/meta-networking \
  ${TOPDIR}/../layers/meta-mender/meta-mender-core \
  ${TOPDIR}/../meta-rockchip \
  ${TOPDIR}/../meta-player \
  "

And im using this local.conf

#
# MENDER CONFIGS
#
MENDER_ARTIFACT_NAME = "TinkerBoardTest"

# controls Mender features ...
MENDER_FEATURES_ENABLE_append = " \
    mender-image \
    mender-image-bios \
    mender-uboot \
    mender-systemd \
    mender-client-install \
    mender-growfs-data \
    "

MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
MENDER_STORAGE_TOTAL_SIZE_MB = "2048"
MENDER_DATA_PART_SIZE_MB = "128"

IMAGE_INSTALL_append = " mender-connect"

There is a change in the u-boot script on meta-rockchip (dunfell)

Link to change : git.yoctoproject.org

Problem / Error

I have shortened the entire log a bit and collected only the most important messages. (If it is needed I can also provide the entire log)

| scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: No such file or directory

[4140]| # include <Python.h>

[4141]| ^~~~~~~~~~

[4142]| compilation terminated.

[4143]| error: command 'gcc' failed with exit status 1

[4144]| scripts/dtc/pylibfdt/Makefile:27: recipe for target 'scripts/dtc/pylibfdt/_libfdt.so' failed

[4145]| make[3]: *** [scripts/dtc/pylibfdt/_libfdt.so] Error 1

[4146]| scripts/Makefile.build:432: recipe for target 'scripts/dtc/pylibfdt' failed

[4147]| make[2]: *** [scripts/dtc/pylibfdt] Error 2

[4148]| scripts/Makefile.build:432: recipe for target 'scripts/dtc' failed

[4149]| make[1]: *** [scripts/dtc] Error 2

[4150]| Makefile:551: recipe for target 'scripts' failed

[4151]| make: *** [scripts] Error 2

[4152]| WARNING: exit code 2 from a shell command.

[4153]| ERROR: Execution of '/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/u-boot/1_2020.01-r0/temp/run.do_mender_uboot_auto_configure.17462' failed with exit code 2

[4154]NOTE: recipe u-boot-1_2020.01-r0: task do_mender_uboot_auto_configure: Failed

[4155]ERROR: Task (/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/../layers/poky/meta/recipes-bsp/u-boot/u-boot_2020.01.bb:do_mender_uboot_auto_configure) failed with exit code '1'

Allready tested !

https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg122172.html

Install python-dev on build machine
sudo apt-get install python-dev (tried python2-dev and python3-dev)

I would be very pleased with any suggestion
Thanks Sebastian

1 Like

@SebSauer Did you try to add this layer : meta-mender-community/meta-mender-rockchip at dunfell · mendersoftware/meta-mender-community · GitHub

Isn’t it same board as you’re using? Please see: Asus Tinker Board

Thanks.

@MarekBelisko Thanks for the response.
Yes after some setbacks with my approach, I did everything exactly as described in the documentation.

Only one change I extended:

MENDER_FEATURES_ENABLE_append = " mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-image-uefi"

to :

MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

This was followed by a huge wall of text (did not copy) into this error:
I actually didn’t expect grub-efi anymore.

| cc1: all warnings being treated as errors
| make[2]: *** [Makefile:6922: grub-core/fs/libgrubmods_a-cpio.o] Error 1
| make[2]: *** Waiting for unfinished jobs....
| In file included from ../grub-2.02/grub-core/fs/cpio_be.c:51:
| ../grub-2.02/grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file':
| ../grub-2.02/grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|    58 |   data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize));
|       |                             ~~^~~~~~~~~
| ../grub-2.02/grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|    60 |     *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime));
|       |                           ~~^~~~~~
| ../grub-2.02/grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|    61 |   modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode));
|       |                          ~~^~~~~
| ../grub-2.02/grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|    62 |   namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize));
|       |                           ~~^~~~~~~~~
| cc1: all warnings being treated as errors
| make[2]: *** [Makefile:6936: grub-core/fs/libgrubmods_a-cpio_be.o] Error 1
| make[2]: Leaving directory '/home/s/mender-rockchip/build/tmp/work/x86_64-linux/grub-efi-native/2.02-r0/build'
| make[1]: *** [Makefile:11247: all-recursive] Error 1
| make[1]: Leaving directory '/home/s/mender-rockchip/build/tmp/work/x86_64-linux/grub-efi-native/2.02-r0/build'
| make: *** [Makefile:3467: all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/s/mender-rockchip/build/tmp/work/x86_64-linux/grub-efi-native/2.02-r0/temp/log.do_compile.773806)
ERROR: Task (virtual:native:/home/s/mender-rockchip/build/../sources/poky/meta/recipes-bsp/grub/grub-efi_2.02.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2417 tasks of which 0 didn't need to be rerun and 1 failed.

In my research, I found this:

Therefore directly here my Distro_Features:

bitbake -e | grep ^DISTRO_FEATURES
DISTRO_FEATURES="acl alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt                                     libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse                                  libc-getlogin libc-idn libc-inet-anl libc-libm libc-locales libc-locale-code                                    libc-memusage libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams                    libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc                                       libc-posix-wchar-io largefile opengl ptest multiarch wayland vulkan systemd pulseaudio bluez5 gobject-introspection-data ldconfig mender-uboot mender-image-sd mender-image mender-install mender-systemd"
DISTRO_FEATURES_BACKFILL="pulseaudio sysvinit bluez5 gobject-introspection-data ldconfig  mender-uboot mender-image-sd     mender-grub     mender-image     mender-image-uefi     mender-install     mender-systemd  systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED="sysvinit  mender-grub mender-image-uefi sysvinit"
DISTRO_FEATURES_DEFAULT="acl alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11"
DISTRO_FEATURES_FILTER_NATIVE="api-documentation"
DISTRO_FEATURES_FILTER_NATIVESDK="api-documentation"
DISTRO_FEATURES_LIBC="ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt                                    libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse                                        libc-getlogin libc-idn libc-inet-anl libc-libm libc-locales libc-locale-code                                      libc-memusage libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams                                   libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc                                        libc-posix-wchar-io"
DISTRO_FEATURES_LIBC_DEFAULT="ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt                                    libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse                                        libc-getlogin libc-idn libc-inet-anl libc-libm libc-locales libc-locale-code                                      libc-memusage libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams                                   libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc                                        libc-posix-wchar-io"
DISTRO_FEATURES_LIBC_class-nativesdk="ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt                                    libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse                                 libc-getlogin libc-idn libc-inet-anl libc-libm libc-locales libc-locale-code                                     libc-memusage libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams                                   libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc                                        libc-posix-wchar-io"
DISTRO_FEATURES_NATIVE="x11 ipv6 xattr"
DISTRO_FEATURES_NATIVESDK="x11 libc-charsets libc-locales libc-locale-code"

@SebSauer ok I’ll try to build locally and get back to you if I spot something. So you’re using dunfell now or other branch (as from board integration topic?). Thanks.

Thanks!
After my failures I really went back and did it like in the tutorial so im on thud now!

/sources$ ls
meta-mender  meta-mender-community  meta-openembedded  meta-rockchip  poky

/sources/meta-mender$ git branch
* (HEAD detached at mender/thud)

/sources/meta-mender-community$ git branch
* (HEAD detached at mender/thud)

sources/meta-openembedded$ git branch
* (HEAD detached at oe/thud)

sources/meta-rockchip$ git branch
* (HEAD detached at yocto/thud)

/sources/poky$ git branch
* (HEAD detached at yocto/thud)

Should be all on “thud”

1 Like

I have the same issue as @SebSauer :confused:

@SebSauer so it works on thud and not on dunfell right?

So when I run it with the Dunfell Branches I run into the Python.h error (which is why I started the thread)

ALL ON DUNFELL:

BBLAYERS ?= " \
  /sources/poky/meta \
  /sources/poky/meta-poky \
  /sources/poky/meta-yocto-bsp \
  /sources/meta-mender/meta-mender-core \
  /sources/meta-openembedded/meta-oe \
  /sources/meta-rockchip \

I set it up again and only with local.conf changes: (only this!)
and bbappend adapted

MACHINE = "tinker-board-s"
MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

The second case, occurred only because I tried Asus Tinker Board
And the grub-errors appear there. Here also only the changes in local.conf as above.

Thanks!

bump
Are there any updates ? @MarekBelisko

@SebSauer Sorry wasn’t working last week due family issues, I’ll start test build today :wink:

1 Like

@SebSauer made some progress but seems stock 2020.01 for this board cannot be compiled and it error with:
Error: SPL image is too large (size 0x11000 than 0x8000) I’m checking what can be removed in order to fit SPL to this size ;). So if you can use thud release temporarily until this is resolved … :wink:

for my understanding you tried a Dunfell build ? or did you run into this error with Thud ?
Big thanks for helping

Yes dunfell, but I made some fixes to overcome issues you had (basically need to do board integration for dunfell branch)

1 Like

Asking for support here: [meta-rockchip] dunfell: u-boot build issue when added patch to u-boot :wink:

Hi @MarekBelisko,

@SebSauer and me are also facing this issue, do you have any update on this? Or any idea how to proceed?

Hmm no response from meta-rochchip guys. I’ll take a look again why mender code extend SPL and then it fails to compile.

1 Like

To be honest, I don’t think it is mender related.

As far as I see the issue comes from here: meta-mender-community/u-boot_%.bbappend at dunfell · mendersoftware/meta-mender-community · GitHub

We copied this patch manually to our layer. When I remove this layer the build finishes. But the sdimg is wrong, doesn’t boot.

From my understanding of Boot option - Rockchip open source Document and README.rockchip - doc/README.rockchip - U-boot source code (v2020.01) - Bootlin (Chapter Booting from an SD card) I think we should do something like this in bbappend (NOT working! just an idea):

DEPENDS += "u-boot-mkimage-native "

UBOOT_ROCKCHIP_BINARY = "u-boot-rockchip.img"
UBOOT_IMAGE_ROCKCHIP ?= "u-boot-rockchip-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
UBOOT_SYMLINK_ROCKCHIP ?= "u-boot-rockchip-${MACHINE}.${UBOOT_SUFFIX}"

# "0x6000"
UBOOT_ROCKCHIP_BINARY_SIZE="24576"

do_compile_append_rk3288() {
    dd if=/dev/zero of=${UBOOT_ROCKCHIP_BINARY} bs=1M count=0 seek=${UBOOT_ROCKCHIP_BINARY_SIZE}
    dd if=${B}/${SPL_BINARY} of=${UBOOT_ROCKCHIP_BINARY} seek=64
    dd if=${B}/u-boot-dtb.img of=${UBOOT_ROCKCHIP_BINARY} seek=16384
}

do_deploy_append_rk3288() {
    install -m 644 ${B}/${UBOOT_ROCKCHIP_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE_ROCKCHIP}
    install -m 644 ${B}/u-boot-dtb.img ${DEPLOYDIR}/

    cd ${DEPLOYDIR}
    rm -f ${UBOOT_ROCKCHIP_BINARY} ${UBOOT_SYMLINK_ROCKCHIP}
    ln -sf ${UBOOT_IMAGE_ROCKCHIP} ${UBOOT_SYMLINK_ROCKCHIP}
    ln -sf ${UBOOT_IMAGE_ROCKCHIP} ${UBOOT_ROCKCHIP_BINARY}
}

What do you think @MarekBelisko

@ruben did you try to build image using only meta-rockchip on dunfell release? I tried and u-boot build fine. Issue only happens when meta-mender-community patches are added to u-boot then it overflow SPL size (didn’t find cause yet though). So to debug this issue I would try

  • build image using meta-rockchip without mender and verify if it boots (I don’t have board so cannot try it :wink: )
  • be aware that mender integration for rochchip on dunfell branch is obsolete and not up to date so I tried to update it with following patch:
index d6fe02c..0c52076 100644
--- a/meta-mender-rockchip/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/meta-mender-rockchip/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -1,4 +1,12 @@
-DEPENDS += "u-boot-mkimage-native"
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+DEPENDS += "u-boot-mkimage-native python3-native"
+
+MENDER_UBOOT_AUTO_CONFIGURE = "0"
+
+SRC_URI_remove = "file://0001-Add-missing-header-which-fails-on-recent-GCC.patch"
+SRC_URI += "file://0001-Mender-offset-size-for-env.patch \
+           file://0002-More-mender-defines.patch"
 
 UBOOT_ROCKCHIP_BINARY = "u-boot-rockchip.img"
 UBOOT_IMAGE_ROCKCHIP ?= "u-boot-rockchip-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"

I’ve added patches here: From d322a5393af423b6341724c1f7aea7cc99dfd0df Mon Sep 17 00:00:00 2001From: Ma - Pastebin.com

With those changes there is overflow issue I wasn’t able to resolve it and also asked on meta-rockchip but no reply. So those are things I did so I think it can be good start :wink: for someone who have platform to try. Thanks.

Hi @MarekBelisko

thanks for your response. I already tried a build without mender integration. This build boots and works so far. But I tested not too much.

I am a little bit confused about partitioning. In Yocto build without mender the partitioning is based on wic-file in meta-rockchip layer:
tinkerboard.wks

include rk3288-boot.wks

part / --align 131072 --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root

bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"

rk3288-boot.wks

# Disk layout
# Note that the reference documentation refers to 512 byte disk sectors, but
# wic uses 1KB blocks
#
#   Partition   Start Sector    Number of Sectors
#   loader1     64              8000
#   reserved1   8064            128
#   reserved2   8192            8192
#   loader2     16384           8192
#   atf         24576           8192
#   boot        32768           229376
#   root        262144          -
#

part loader1    --align 32     --size 4000K            --ondisk ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=idbloader.img"
part reserved1  --align 4032   --size 64K              --ondisk ${RK_BOOT_DEVICE}
part reserved2  --align 4096   --size 4096K            --ondisk ${RK_BOOT_DEVICE}
part loader2    --align 8192   --size 4096K            --ondisk ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=u-boot.bin"
part atf        --align 12288  --size 4096K            --ondisk ${RK_BOOT_DEVICE}
part /boot      --align 16384  --size=114688K --active --ondisk ${RK_BOOT_DEVICE} --source bootimg-partition --fstype=vfat --label boot --sourceparams="loader=u-boot"

This also matches with the documentation in rockchip wiki and u-boot sources from my last post.

When I do the mender integration I get only 4 partitions:

  • bootloader
  • a
  • b
  • data

What do you think belongs to which partition? My idea would be

  • bootloader partition contains loader1 and loader2 (spl and u-boot)
    bootloader needs to be patched to load kernel from rootfs (not sure if possible or already done). And bootloader partition must be designed to have loader1 (spl) at sector 64 and u-boot at sector 16384.
    @mirzak Perhaps you can help here as you did the initial setup for the tinkerboard?

Thanks and best regards
Ruben

Hi @ruben yes this could be definitely problem if image is not partitioned properly. I think mender wks is missing rk3288-boot.wks include IMO. But yes @mirzak probably knows more.