Build Kernel Modules on CI servers for balenaOS

Hello Folks!

I understood that building images that contains RUN [ "cross-build-start" ] and the RUN [ "cross-build-end" ] make us build images for ARM devices from a x86 system.

So, I’m trying to build a kernel module for our device. On my machine (OSX) it builds just fine and I’m able to run the container to copy the output of the build. The problem is when I’m running on Azure Pipelines CI/CD, it looks like the cross build doesn’t work.

So basically I have this Dockerfile:

FROM balenalib/armv7hf-debian:latest-run

RUN [ "cross-build-start" ]

RUN install_packages curl \
    wget \
    tar \
    build-essential \
    libelf-dev \
    awscli \
    bc \
    flex \
    libssl-dev \
    python \
    libusb-1.0-0 \
    kmod

WORKDIR /build

COPY . .

ENV VERSION='2.26.0+rev1' RESIN_MACHINE_NAME='asus-tinker-board-s'
#'2.31.5+rev1'

RUN chmod -R 777 /build \   
    && chmod +x ./build-module.sh \
    && chmod +x ./workarounds.sh

RUN ./build-module.sh $RESIN_MACHINE_NAME $VERSION ./src \
    && ls -l && ls -l ./src

RUN [ "cross-build-end" ]

CMD [ "cp", "/build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input_mod.ko", "/out" ]

And this build script build.sh:

#!/bin/bash

rm -rf out
rm -rf dist
rm *.tar.gz

# Build the Elo MultiTouch kernel module
docker build . -t elo-touch:build

# Copy the .ko file 
docker run --rm -v $PWD/out:/out -t elo-touch:build

# Glue Elo MultiTouch daemon binaries with the kernel module
mkdir dist
cp -R elo-mt-usb dist/
cp out/elo_mt_input_mod.ko dist/elo-mt-usb
cp install.sh dist/

tar -zcvf elo-mt-driver.tar.gz dist/

And basically this CI file azure-pipelines.yml:

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

steps:
- bash: ./build.sh
  displayName: Build Kernel Module

So, if you call ./build.sh on your machine you will have the tar.gz built properly. However, if I ran on pipelines, it show me this:

standard_init_linux.go:207: exec user process caused "exec format error"
cp: cannot stat 'out/elo_mt_input_mod.ko': No such file or directory

I know the first line on this error is because of arch mismatch, but, I thought by using the cross-build-start/end that problem would be solved…

Can someone shed a light on it? Am I missing something? Why does it work on my OSX and not on a clean Ubuntu image VM?

Thanks! Really appreciate any input.

Hello,
Is there any more output from the CI run?

Hello @telpahn,

This is all the log from the point of ./build.sh step happen:

##[section]Starting: Build Kernel Module
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.148.2
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
==============================================================================
Generating script.
Script contents:
./build.sh
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/db236af7-0624-48b0-9f01-dea5baae5bfb.sh
Sending build context to Docker daemon  591.4kB

Step 1/10 : FROM balenalib/armv7hf-debian:latest-run
latest-run: Pulling from balenalib/armv7hf-debian
fac132c5d16f: Pulling fs layer
90ab5a7107fb: Pulling fs layer
3d05eec875fd: Pulling fs layer
6033079446a2: Pulling fs layer
fb07daf78e1e: Pulling fs layer
01e2aac8028b: Pulling fs layer
6b612ea6b2c9: Pulling fs layer
59fbed078424: Pulling fs layer
6033079446a2: Waiting
fb07daf78e1e: Waiting
01e2aac8028b: Waiting
6b612ea6b2c9: Waiting
59fbed078424: Waiting
90ab5a7107fb: Verifying Checksum
90ab5a7107fb: Download complete
fac132c5d16f: Verifying Checksum
fac132c5d16f: Download complete
3d05eec875fd: Verifying Checksum
3d05eec875fd: Download complete
6033079446a2: Verifying Checksum
6033079446a2: Download complete
fb07daf78e1e: Verifying Checksum
fb07daf78e1e: Download complete
01e2aac8028b: Verifying Checksum
01e2aac8028b: Download complete
6b612ea6b2c9: Verifying Checksum
6b612ea6b2c9: Download complete
59fbed078424: Verifying Checksum
59fbed078424: Download complete
fac132c5d16f: Pull complete
90ab5a7107fb: Pull complete
3d05eec875fd: Pull complete
6033079446a2: Pull complete
fb07daf78e1e: Pull complete
01e2aac8028b: Pull complete
6b612ea6b2c9: Pull complete
59fbed078424: Pull complete
Digest: sha256:b760a465bf2e4830d5e4bea089e15fab2d33acaa43f78cb2693a6c9d07ddc9e6
Status: Downloaded newer image for balenalib/armv7hf-debian:latest-run
 ---> 4c509a18d7ba
Step 2/10 : RUN [ "cross-build-start" ]
 ---> Running in c68884bcb5de
Removing intermediate container c68884bcb5de
 ---> e576652e73f1
Step 3/10 : RUN install_packages curl     wget     tar     build-essential     libelf-dev     awscli     bc     flex     libssl-dev     python     libusb-1.0-0     evtest     kmod
 ---> Running in 77bcd2bf0bc2
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.52.1-5+deb9u9).
tar is already the newest version (1.29b-1.1).
tar set to manually installed.
The following additional packages will be installed:
  binutils bzip2 cpp cpp-6 dh-python docutils-common dpkg-dev g++ g++-6 gcc
  gcc-6 libasan3 libatomic1 libc-dev-bin libc6-dev libcc1-0 libdpkg-perl
  libexpat1 libgcc-6-dev libgdbm3 libgomp1 libisl15 libmpc3 libmpdec2 libmpfr4
  libperl5.24 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
  libpython3-stdlib libpython3.5-minimal libpython3.5-stdlib libsigsegv2
  libstdc++-6-dev libubsan0 linux-libc-dev m4 make mime-support patch perl
  perl-modules-5.24 python-minimal python2.7 python2.7-minimal python3
  python3-botocore python3-chardet python3-colorama python3-dateutil
  python3-docutils python3-jmespath python3-minimal python3-pkg-resources
  python3-pyasn1 python3-requests python3-roman python3-rsa python3-s3transfer
  python3-six python3-urllib3 python3.5 python3.5-minimal sgml-base xml-core
  xz-utils
Suggested packages:
  binutils-doc bzip2-doc cpp-doc gcc-6-locales debian-keyring bison gcc-6-doc
  libstdc++6-6-dbg gcc-multilib manpages-dev autoconf automake libtool gdb
  gcc-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan3-dbg
  liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg
  libquadmath0-dbg glibc-doc libstdc++-6-doc m4-doc make-doc ed diffutils-doc
  perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl python-doc
  python-tk python2.7-doc binfmt-support python3-doc python3-tk python3-venv
  docutils-doc fonts-linuxlibertine | ttf-linux-libertine texlive-lang-french
  texlive-latex-base texlive-latex-recommended python3-setuptools doc-base
  python3-cryptography python3-idna python3-openssl python3-socks
  python3.5-venv python3.5-doc sgml-base-doc debhelper
Recommended packages:
  fakeroot libalgorithm-merge-perl evemu-tools libfl-dev manpages manpages-dev
  libfile-fcntllock-perl liblocale-gettext-perl libssl-doc file rename
  libpaper-utils python3-pil python3-pygments
The following NEW packages will be installed:
  awscli bc binutils build-essential bzip2 cpp cpp-6 dh-python docutils-common
  dpkg-dev evtest flex g++ g++-6 gcc gcc-6 kmod libasan3 libatomic1
  libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libelf-dev libexpat1
  libgcc-6-dev libgdbm3 libgomp1 libisl15 libmpc3 libmpdec2 libmpfr4
  libperl5.24 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
  libpython3-stdlib libpython3.5-minimal libpython3.5-stdlib libsigsegv2
  libssl-dev libstdc++-6-dev libubsan0 libusb-1.0-0 linux-libc-dev m4 make
  mime-support patch perl perl-modules-5.24 python python-minimal python2.7
  python2.7-minimal python3 python3-botocore python3-chardet python3-colorama
  python3-dateutil python3-docutils python3-jmespath python3-minimal
  python3-pkg-resources python3-pyasn1 python3-requests python3-roman
  python3-rsa python3-s3transfer python3-six python3-urllib3 python3.5
  python3.5-minimal sgml-base wget xml-core xz-utils
0 upgraded, 77 newly installed, 0 to remove and 4 not upgraded.
Need to get 51.2 MB of archives.
After this operation, 210 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main armhf perl-modules-5.24 all 5.24.1-3+deb9u5 [2722 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main armhf wget armhf 1.18-5+deb9u3 [781 kB]
Get:3 http://deb.debian.org/debian stretch/main armhf libgdbm3 armhf 1.8.3-14 [28.5 kB]
Get:4 http://deb.debian.org/debian stretch/main armhf libperl5.24 armhf 5.24.1-3+deb9u5 [2850 kB]
Get:5 http://deb.debian.org/debian stretch/main armhf perl armhf 5.24.1-3+deb9u5 [219 kB]
Get:6 http://deb.debian.org/debian stretch/main armhf libpython2.7-minimal armhf 2.7.13-2+deb9u3 [389 kB]
Get:7 http://deb.debian.org/debian stretch/main armhf python2.7-minimal armhf 2.7.13-2+deb9u3 [1176 kB]
Get:8 http://deb.debian.org/debian stretch/main armhf python-minimal armhf 2.7.13-2 [40.5 kB]
Get:9 http://deb.debian.org/debian stretch/main armhf mime-support all 3.60 [36.7 kB]
Get:10 http://deb.debian.org/debian stretch/main armhf libexpat1 armhf 2.2.0-2+deb9u1 [64.4 kB]
Get:11 http://deb.debian.org/debian stretch/main armhf libpython2.7-stdlib armhf 2.7.13-2+deb9u3 [1821 kB]
Get:12 http://deb.debian.org/debian stretch/main armhf python2.7 armhf 2.7.13-2+deb9u3 [285 kB]
Get:13 http://deb.debian.org/debian stretch/main armhf libpython-stdlib armhf 2.7.13-2 [20.0 kB]
Get:14 http://deb.debian.org/debian stretch/main armhf python armhf 2.7.13-2 [154 kB]
Get:15 http://deb.debian.org/debian stretch/main armhf libsigsegv2 armhf 2.10-5 [28.3 kB]
Get:16 http://deb.debian.org/debian stretch/main armhf m4 armhf 1.4.18-1 [191 kB]
Get:17 http://deb.debian.org/debian stretch/main armhf flex armhf 2.6.1-1.3 [429 kB]
Get:18 http://deb.debian.org/debian stretch/main armhf libpython3.5-minimal armhf 3.5.3-1+deb9u1 [565 kB]
Get:19 http://deb.debian.org/debian stretch/main armhf python3.5-minimal armhf 3.5.3-1+deb9u1 [1441 kB]
Get:20 http://deb.debian.org/debian stretch/main armhf python3-minimal armhf 3.5.3-1 [35.3 kB]
Get:21 http://deb.debian.org/debian stretch/main armhf libmpdec2 armhf 2.4.2-1 [69.6 kB]
Get:22 http://deb.debian.org/debian stretch/main armhf libpython3.5-stdlib armhf 3.5.3-1+deb9u1 [2085 kB]
Get:23 http://deb.debian.org/debian stretch/main armhf python3.5 armhf 3.5.3-1+deb9u1 [229 kB]
Get:24 http://deb.debian.org/debian stretch/main armhf libpython3-stdlib armhf 3.5.3-1 [18.6 kB]
Get:25 http://deb.debian.org/debian stretch/main armhf dh-python all 2.20170125 [86.8 kB]
Get:26 http://deb.debian.org/debian stretch/main armhf python3 armhf 3.5.3-1 [21.6 kB]
Get:27 http://deb.debian.org/debian stretch/main armhf sgml-base all 1.29 [14.8 kB]
Get:28 http://deb.debian.org/debian stretch/main armhf kmod armhf 23-2 [78.2 kB]
Get:29 http://deb.debian.org/debian stretch/main armhf bzip2 armhf 1.0.6-8.1 [46.6 kB]
Get:30 http://deb.debian.org/debian stretch/main armhf xz-utils armhf 5.2.2-1.2+b1 [263 kB]
Get:31 http://deb.debian.org/debian stretch/main armhf python3-six all 1.10.0-3 [14.4 kB]
Get:32 http://deb.debian.org/debian stretch/main armhf python3-dateutil all 2.5.3-2 [45.2 kB]
Get:33 http://deb.debian.org/debian stretch/main armhf xml-core all 0.17 [23.2 kB]
Get:34 http://deb.debian.org/debian stretch/main armhf docutils-common all 0.13.1+dfsg-2 [200 kB]
Get:35 http://deb.debian.org/debian stretch/main armhf python3-roman all 2.0.0-2 [8226 B]
Get:36 http://deb.debian.org/debian stretch/main armhf python3-docutils all 0.13.1+dfsg-2 [371 kB]
Get:37 http://deb.debian.org/debian stretch/main armhf python3-jmespath all 0.9.0-2 [16.6 kB]
Get:38 http://deb.debian.org/debian stretch/main armhf python3-urllib3 all 1.19.1-1 [77.6 kB]
Get:39 http://deb.debian.org/debian stretch/main armhf python3-pkg-resources all 33.1.1-1 [137 kB]
Get:40 http://deb.debian.org/debian stretch/main armhf python3-chardet all 2.3.0-2 [96.0 kB]
Get:41 http://deb.debian.org/debian stretch/main armhf python3-requests all 2.12.4-1 [101 kB]
Get:42 http://deb.debian.org/debian stretch/main armhf python3-botocore all 1.4.70-1 [1053 kB]
Get:43 http://deb.debian.org/debian stretch/main armhf python3-colorama all 0.3.7-1 [18.1 kB]
Get:44 http://deb.debian.org/debian stretch/main armhf python3-pyasn1 all 0.1.9-2 [34.5 kB]
Get:45 http://deb.debian.org/debian stretch/main armhf python3-rsa all 3.4.2-1 [30.7 kB]
Get:46 http://deb.debian.org/debian stretch/main armhf python3-s3transfer all 0.1.9-1 [36.4 kB]
Get:47 http://deb.debian.org/debian stretch/main armhf awscli all 1.11.13-1 [403 kB]
Get:48 http://deb.debian.org/debian stretch/main armhf bc armhf 1.06.95-9+b3 [101 kB]
Get:49 http://deb.debian.org/debian stretch/main armhf binutils armhf 2.28-5 [3900 kB]
Get:50 http://deb.debian.org/debian stretch/main armhf libc-dev-bin armhf 2.24-11+deb9u4 [253 kB]
Get:51 http://deb.debian.org/debian stretch-updates/main armhf linux-libc-dev armhf 4.9.144-3.1 [1370 kB]
Get:52 http://deb.debian.org/debian stretch/main armhf libc6-dev armhf 2.24-11+deb9u4 [1995 kB]
Get:53 http://deb.debian.org/debian stretch/main armhf libisl15 armhf 0.18-1 [441 kB]
Get:54 http://deb.debian.org/debian stretch/main armhf libmpfr4 armhf 3.1.5-1 [536 kB]
Get:55 http://deb.debian.org/debian stretch/main armhf libmpc3 armhf 1.0.3-1+b2 [32.6 kB]
Get:56 http://deb.debian.org/debian stretch/main armhf cpp-6 armhf 6.3.0-18+deb9u1 [5239 kB]
Get:57 http://deb.debian.org/debian stretch/main armhf cpp armhf 4:6.3.0-4 [18.7 kB]
Get:58 http://deb.debian.org/debian stretch/main armhf libcc1-0 armhf 6.3.0-18+deb9u1 [25.2 kB]
Get:59 http://deb.debian.org/debian stretch/main armhf libgomp1 armhf 6.3.0-18+deb9u1 [64.6 kB]
Get:60 http://deb.debian.org/debian stretch/main armhf libatomic1 armhf 6.3.0-18+deb9u1 [6010 B]
Get:61 http://deb.debian.org/debian stretch/main armhf libasan3 armhf 6.3.0-18+deb9u1 [284 kB]
Get:62 http://deb.debian.org/debian stretch/main armhf libubsan0 armhf 6.3.0-18+deb9u1 [92.9 kB]
Get:63 http://deb.debian.org/debian stretch/main armhf libgcc-6-dev armhf 6.3.0-18+deb9u1 [531 kB]
Get:64 http://deb.debian.org/debian stretch/main armhf gcc-6 armhf 6.3.0-18+deb9u1 [5511 kB]
Get:65 http://deb.debian.org/debian stretch/main armhf gcc armhf 4:6.3.0-4 [5212 B]
Get:66 http://deb.debian.org/debian stretch/main armhf libstdc++-6-dev armhf 6.3.0-18+deb9u1 [1487 kB]
Get:67 http://deb.debian.org/debian stretch/main armhf g++-6 armhf 6.3.0-18+deb9u1 [5665 kB]
Get:68 http://deb.debian.org/debian stretch/main armhf g++ armhf 4:6.3.0-4 [1520 B]
Get:69 http://deb.debian.org/debian stretch/main armhf make armhf 4.1-9.1 [290 kB]
Get:70 http://deb.debian.org/debian stretch/main armhf libdpkg-perl all 1.18.25 [1287 kB]
Get:71 http://deb.debian.org/debian stretch/main armhf patch armhf 2.7.5-1+deb9u1 [106 kB]
Get:72 http://deb.debian.org/debian stretch/main armhf dpkg-dev all 1.18.25 [1595 kB]
Get:73 http://deb.debian.org/debian stretch/main armhf build-essential armhf 12.3 [7342 B]
Get:74 http://deb.debian.org/debian stretch/main armhf libelf-dev armhf 0.168-1 [65.5 kB]
Get:75 http://deb.debian.org/debian stretch/main armhf libssl-dev armhf 1.1.0j-1~deb9u1 [1410 kB]
Get:76 http://deb.debian.org/debian stretch/main armhf libusb-1.0-0 armhf 2:1.0.21-1 [48.7 kB]
Get:77 http://deb.debian.org/debian stretch/main armhf evtest armhf 1:1.33-1+b1 [14.3 kB]
debconf: delaying package configuration, since apt-utils is not installed‌
Fetched 51.2 MB in 1s (26.7 MB/s)‌
Selecting previously unselected package perl-modules-5.24.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 7518 files and directories currently installed.)
Preparing to unpack .../00-perl-modules-5.24_5.24.1-3+deb9u5_all.deb ...
Unpacking perl-modules-5.24 (5.24.1-3+deb9u5) ...
Selecting previously unselected package libgdbm3:armhf.
Preparing to unpack .../01-libgdbm3_1.8.3-14_armhf.deb ...
Unpacking libgdbm3:armhf (1.8.3-14) ...
Selecting previously unselected package libperl5.24:armhf.
Preparing to unpack .../02-libperl5.24_5.24.1-3+deb9u5_armhf.deb ...
Unpacking libperl5.24:armhf (5.24.1-3+deb9u5) ...
Selecting previously unselected package perl.
Preparing to unpack .../03-perl_5.24.1-3+deb9u5_armhf.deb ...
Unpacking perl (5.24.1-3+deb9u5) ...
Selecting previously unselected package libpython2.7-minimal:armhf.
Preparing to unpack .../04-libpython2.7-minimal_2.7.13-2+deb9u3_armhf.deb ...
Unpacking libpython2.7-minimal:armhf (2.7.13-2+deb9u3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../05-python2.7-minimal_2.7.13-2+deb9u3_armhf.deb ...
Unpacking python2.7-minimal (2.7.13-2+deb9u3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../06-python-minimal_2.7.13-2_armhf.deb ...
Unpacking python-minimal (2.7.13-2) ...
Selecting previously unselected package mime-support.
Preparing to unpack .../07-mime-support_3.60_all.deb ...
Unpacking mime-support (3.60) ...
Selecting previously unselected package libexpat1:armhf.
Preparing to unpack .../08-libexpat1_2.2.0-2+deb9u1_armhf.deb ...
Unpacking libexpat1:armhf (2.2.0-2+deb9u1) ...
Selecting previously unselected package libpython2.7-stdlib:armhf.
Preparing to unpack .../09-libpython2.7-stdlib_2.7.13-2+deb9u3_armhf.deb ...
Unpacking libpython2.7-stdlib:armhf (2.7.13-2+deb9u3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../10-python2.7_2.7.13-2+deb9u3_armhf.deb ...
Unpacking python2.7 (2.7.13-2+deb9u3) ...
Selecting previously unselected package libpython-stdlib:armhf.
Preparing to unpack .../11-libpython-stdlib_2.7.13-2_armhf.deb ...
Unpacking libpython-stdlib:armhf (2.7.13-2) ...
Setting up libpython2.7-minimal:armhf (2.7.13-2+deb9u3) ...
Setting up python2.7-minimal (2.7.13-2+deb9u3) ...
Setting up python-minimal (2.7.13-2) ...
Selecting previously unselected package python.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 10119 files and directories currently installed.)
Preparing to unpack .../00-python_2.7.13-2_armhf.deb ...
Unpacking python (2.7.13-2) ...
Selecting previously unselected package libsigsegv2:armhf.
Preparing to unpack .../01-libsigsegv2_2.10-5_armhf.deb ...
Unpacking libsigsegv2:armhf (2.10-5) ...
Selecting previously unselected package m4.
Preparing to unpack .../02-m4_1.4.18-1_armhf.deb ...
Unpacking m4 (1.4.18-1) ...
Selecting previously unselected package flex.
Preparing to unpack .../03-flex_2.6.1-1.3_armhf.deb ...
Unpacking flex (2.6.1-1.3) ...
Selecting previously unselected package libpython3.5-minimal:armhf.
Preparing to unpack .../04-libpython3.5-minimal_3.5.3-1+deb9u1_armhf.deb ...
Unpacking libpython3.5-minimal:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package python3.5-minimal.
Preparing to unpack .../05-python3.5-minimal_3.5.3-1+deb9u1_armhf.deb ...
Unpacking python3.5-minimal (3.5.3-1+deb9u1) ...
Selecting previously unselected package python3-minimal.
Preparing to unpack .../06-python3-minimal_3.5.3-1_armhf.deb ...
Unpacking python3-minimal (3.5.3-1) ...
Selecting previously unselected package libmpdec2:armhf.
Preparing to unpack .../07-libmpdec2_2.4.2-1_armhf.deb ...
Unpacking libmpdec2:armhf (2.4.2-1) ...
Selecting previously unselected package libpython3.5-stdlib:armhf.
Preparing to unpack .../08-libpython3.5-stdlib_3.5.3-1+deb9u1_armhf.deb ...
Unpacking libpython3.5-stdlib:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package python3.5.
Preparing to unpack .../09-python3.5_3.5.3-1+deb9u1_armhf.deb ...
Unpacking python3.5 (3.5.3-1+deb9u1) ...
Selecting previously unselected package libpython3-stdlib:armhf.
Preparing to unpack .../10-libpython3-stdlib_3.5.3-1_armhf.deb ...
Unpacking libpython3-stdlib:armhf (3.5.3-1) ...
Selecting previously unselected package dh-python.
Preparing to unpack .../11-dh-python_2.20170125_all.deb ...
Unpacking dh-python (2.20170125) ...
Setting up libpython3.5-minimal:armhf (3.5.3-1+deb9u1) ...
Setting up libexpat1:armhf (2.2.0-2+deb9u1) ...
Setting up python3.5-minimal (3.5.3-1+deb9u1) ...
Setting up python3-minimal (3.5.3-1) ...
Selecting previously unselected package python3.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 11264 files and directories currently installed.)
Preparing to unpack .../00-python3_3.5.3-1_armhf.deb ...
Unpacking python3 (3.5.3-1) ...
Selecting previously unselected package sgml-base.
Preparing to unpack .../01-sgml-base_1.29_all.deb ...
Unpacking sgml-base (1.29) ...
Selecting previously unselected package kmod.
Preparing to unpack .../02-kmod_23-2_armhf.deb ...
Unpacking kmod (23-2) ...
Selecting previously unselected package wget.
Preparing to unpack .../03-wget_1.18-5+deb9u3_armhf.deb ...
Unpacking wget (1.18-5+deb9u3) ...
Selecting previously unselected package bzip2.
Preparing to unpack .../04-bzip2_1.0.6-8.1_armhf.deb ...
Unpacking bzip2 (1.0.6-8.1) ...
Selecting previously unselected package xz-utils.
Preparing to unpack .../05-xz-utils_5.2.2-1.2+b1_armhf.deb ...
Unpacking xz-utils (5.2.2-1.2+b1) ...
Selecting previously unselected package python3-six.
Preparing to unpack .../06-python3-six_1.10.0-3_all.deb ...
Unpacking python3-six (1.10.0-3) ...
Selecting previously unselected package python3-dateutil.
Preparing to unpack .../07-python3-dateutil_2.5.3-2_all.deb ...
Unpacking python3-dateutil (2.5.3-2) ...
Selecting previously unselected package xml-core.
Preparing to unpack .../08-xml-core_0.17_all.deb ...
Unpacking xml-core (0.17) ...
Selecting previously unselected package docutils-common.
Preparing to unpack .../09-docutils-common_0.13.1+dfsg-2_all.deb ...
Unpacking docutils-common (0.13.1+dfsg-2) ...
Selecting previously unselected package python3-roman.
Preparing to unpack .../10-python3-roman_2.0.0-2_all.deb ...
Unpacking python3-roman (2.0.0-2) ...
Selecting previously unselected package python3-docutils.
Preparing to unpack .../11-python3-docutils_0.13.1+dfsg-2_all.deb ...
Unpacking python3-docutils (0.13.1+dfsg-2) ...
Selecting previously unselected package python3-jmespath.
Preparing to unpack .../12-python3-jmespath_0.9.0-2_all.deb ...
Unpacking python3-jmespath (0.9.0-2) ...
Selecting previously unselected package python3-urllib3.
Preparing to unpack .../13-python3-urllib3_1.19.1-1_all.deb ...
Unpacking python3-urllib3 (1.19.1-1) ...
Selecting previously unselected package python3-pkg-resources.
Preparing to unpack .../14-python3-pkg-resources_33.1.1-1_all.deb ...
Unpacking python3-pkg-resources (33.1.1-1) ...
Selecting previously unselected package python3-chardet.
Preparing to unpack .../15-python3-chardet_2.3.0-2_all.deb ...
Unpacking python3-chardet (2.3.0-2) ...
Selecting previously unselected package python3-requests.
Preparing to unpack .../16-python3-requests_2.12.4-1_all.deb ...
Unpacking python3-requests (2.12.4-1) ...
Selecting previously unselected package python3-botocore.
Preparing to unpack .../17-python3-botocore_1.4.70-1_all.deb ...
Unpacking python3-botocore (1.4.70-1) ...
Selecting previously unselected package python3-colorama.
Preparing to unpack .../18-python3-colorama_0.3.7-1_all.deb ...
Unpacking python3-colorama (0.3.7-1) ...
Selecting previously unselected package python3-pyasn1.
Preparing to unpack .../19-python3-pyasn1_0.1.9-2_all.deb ...
Unpacking python3-pyasn1 (0.1.9-2) ...
Selecting previously unselected package python3-rsa.
Preparing to unpack .../20-python3-rsa_3.4.2-1_all.deb ...
Unpacking python3-rsa (3.4.2-1) ...
Selecting previously unselected package python3-s3transfer.
Preparing to unpack .../21-python3-s3transfer_0.1.9-1_all.deb ...
Unpacking python3-s3transfer (0.1.9-1) ...
Selecting previously unselected package awscli.
Preparing to unpack .../22-awscli_1.11.13-1_all.deb ...
Unpacking awscli (1.11.13-1) ...
Selecting previously unselected package bc.
Preparing to unpack .../23-bc_1.06.95-9+b3_armhf.deb ...
Unpacking bc (1.06.95-9+b3) ...
Selecting previously unselected package binutils.
Preparing to unpack .../24-binutils_2.28-5_armhf.deb ...
Unpacking binutils (2.28-5) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../25-libc-dev-bin_2.24-11+deb9u4_armhf.deb ...
Unpacking libc-dev-bin (2.24-11+deb9u4) ...
Selecting previously unselected package linux-libc-dev:armhf.
Preparing to unpack .../26-linux-libc-dev_4.9.144-3.1_armhf.deb ...
Unpacking linux-libc-dev:armhf (4.9.144-3.1) ...
Selecting previously unselected package libc6-dev:armhf.
Preparing to unpack .../27-libc6-dev_2.24-11+deb9u4_armhf.deb ...
Unpacking libc6-dev:armhf (2.24-11+deb9u4) ...
Selecting previously unselected package libisl15:armhf.
Preparing to unpack .../28-libisl15_0.18-1_armhf.deb ...
Unpacking libisl15:armhf (0.18-1) ...
Selecting previously unselected package libmpfr4:armhf.
Preparing to unpack .../29-libmpfr4_3.1.5-1_armhf.deb ...
Unpacking libmpfr4:armhf (3.1.5-1) ...
Selecting previously unselected package libmpc3:armhf.
Preparing to unpack .../30-libmpc3_1.0.3-1+b2_armhf.deb ...
Unpacking libmpc3:armhf (1.0.3-1+b2) ...
Selecting previously unselected package cpp-6.
Preparing to unpack .../31-cpp-6_6.3.0-18+deb9u1_armhf.deb ...
Unpacking cpp-6 (6.3.0-18+deb9u1) ...
Selecting previously unselected package cpp.
Preparing to unpack .../32-cpp_4%3a6.3.0-4_armhf.deb ...
Unpacking cpp (4:6.3.0-4) ...
Selecting previously unselected package libcc1-0:armhf.
Preparing to unpack .../33-libcc1-0_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libcc1-0:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libgomp1:armhf.
Preparing to unpack .../34-libgomp1_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libgomp1:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libatomic1:armhf.
Preparing to unpack .../35-libatomic1_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libatomic1:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libasan3:armhf.
Preparing to unpack .../36-libasan3_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libasan3:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libubsan0:armhf.
Preparing to unpack .../37-libubsan0_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libubsan0:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package libgcc-6-dev:armhf.
Preparing to unpack .../38-libgcc-6-dev_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libgcc-6-dev:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package gcc-6.
Preparing to unpack .../39-gcc-6_6.3.0-18+deb9u1_armhf.deb ...
Unpacking gcc-6 (6.3.0-18+deb9u1) ...
Selecting previously unselected package gcc.
Preparing to unpack .../40-gcc_4%3a6.3.0-4_armhf.deb ...
Unpacking gcc (4:6.3.0-4) ...
Selecting previously unselected package libstdc++-6-dev:armhf.
Preparing to unpack .../41-libstdc++-6-dev_6.3.0-18+deb9u1_armhf.deb ...
Unpacking libstdc++-6-dev:armhf (6.3.0-18+deb9u1) ...
Selecting previously unselected package g++-6.
Preparing to unpack .../42-g++-6_6.3.0-18+deb9u1_armhf.deb ...
Unpacking g++-6 (6.3.0-18+deb9u1) ...
Selecting previously unselected package g++.
Preparing to unpack .../43-g++_4%3a6.3.0-4_armhf.deb ...
Unpacking g++ (4:6.3.0-4) ...
Selecting previously unselected package make.
Preparing to unpack .../44-make_4.1-9.1_armhf.deb ...
Unpacking make (4.1-9.1) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../45-libdpkg-perl_1.18.25_all.deb ...
Unpacking libdpkg-perl (1.18.25) ...
Selecting previously unselected package patch.
Preparing to unpack .../46-patch_2.7.5-1+deb9u1_armhf.deb ...
Unpacking patch (2.7.5-1+deb9u1) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../47-dpkg-dev_1.18.25_all.deb ...
Unpacking dpkg-dev (1.18.25) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../48-build-essential_12.3_armhf.deb ...
Unpacking build-essential (12.3) ...
Selecting previously unselected package libelf-dev:armhf.
Preparing to unpack .../49-libelf-dev_0.168-1_armhf.deb ...
Unpacking libelf-dev:armhf (0.168-1) ...
Selecting previously unselected package libssl-dev:armhf.
Preparing to unpack .../50-libssl-dev_1.1.0j-1~deb9u1_armhf.deb ...
Unpacking libssl-dev:armhf (1.1.0j-1~deb9u1) ...
Selecting previously unselected package libusb-1.0-0:armhf.
Preparing to unpack .../51-libusb-1.0-0_2%3a1.0.21-1_armhf.deb ...
Unpacking libusb-1.0-0:armhf (2:1.0.21-1) ...
Selecting previously unselected package evtest.
Preparing to unpack .../52-evtest_1%3a1.33-1+b1_armhf.deb ...
Unpacking evtest (1:1.33-1+b1) ...
Setting up libgomp1:armhf (6.3.0-18+deb9u1) ...
Setting up libatomic1:armhf (6.3.0-18+deb9u1) ...
Setting up perl-modules-5.24 (5.24.1-3+deb9u5) ...
Setting up libgdbm3:armhf (1.8.3-14) ...
Setting up libperl5.24:armhf (5.24.1-3+deb9u5) ...
Setting up kmod (23-2) ...
Setting up libcc1-0:armhf (6.3.0-18+deb9u1) ...
Setting up make (4.1-9.1) ...
Setting up libasan3:armhf (6.3.0-18+deb9u1) ...
Setting up mime-support (3.60) ...
Setting up libsigsegv2:armhf (2.10-5) ...
Setting up libubsan0:armhf (6.3.0-18+deb9u1) ...
Setting up libssl-dev:armhf (1.1.0j-1~deb9u1) ...
Setting up linux-libc-dev:armhf (4.9.144-3.1) ...
Setting up m4 (1.4.18-1) ...
Setting up sgml-base (1.29) ...
Setting up libelf-dev:armhf (0.168-1) ...
Setting up bzip2 (1.0.6-8.1) ...
Setting up perl (5.24.1-3+deb9u5) ...
update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/rename.1.gz because associated file /usr/share/man/man1/prename.1.gz (of link group rename) doesn't exist
Setting up evtest (1:1.33-1+b1) ...
Setting up libisl15:armhf (0.18-1) ...
Setting up patch (2.7.5-1+deb9u1) ...
Setting up libusb-1.0-0:armhf (2:1.0.21-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up xz-utils (5.2.2-1.2+b1) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/lzma.1.gz because associated file /usr/share/man/man1/xz.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/unlzma.1.gz because associated file /usr/share/man/man1/unxz.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzcat.1.gz because associated file /usr/share/man/man1/xzcat.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzmore.1.gz because associated file /usr/share/man/man1/xzmore.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzless.1.gz because associated file /usr/share/man/man1/xzless.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzdiff.1.gz because associated file /usr/share/man/man1/xzdiff.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzcmp.1.gz because associated file /usr/share/man/man1/xzcmp.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzgrep.1.gz because associated file /usr/share/man/man1/xzgrep.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzegrep.1.gz because associated file /usr/share/man/man1/xzegrep.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzfgrep.1.gz because associated file /usr/share/man/man1/xzfgrep.1.gz (of link group lzma) doesn't exist
Setting up wget (1.18-5+deb9u3) ...
Setting up libmpfr4:armhf (3.1.5-1) ...
Setting up libmpc3:armhf (1.0.3-1+b2) ...
Setting up binutils (2.28-5) ...
Setting up cpp-6 (6.3.0-18+deb9u1) ...
Setting up libc-dev-bin (2.24-11+deb9u4) ...
Setting up xml-core (0.17) ...
Setting up bc (1.06.95-9+b3) ...
Setting up libc6-dev:armhf (2.24-11+deb9u4) ...
Setting up libpython2.7-stdlib:armhf (2.7.13-2+deb9u3) ...
Setting up libmpdec2:armhf (2.4.2-1) ...
Setting up cpp (4:6.3.0-4) ...
Setting up libgcc-6-dev:armhf (6.3.0-18+deb9u1) ...
Setting up libstdc++-6-dev:armhf (6.3.0-18+deb9u1) ...
Setting up flex (2.6.1-1.3) ...
Setting up libpython3.5-stdlib:armhf (3.5.3-1+deb9u1) ...
Setting up libdpkg-perl (1.18.25) ...
Setting up python2.7 (2.7.13-2+deb9u3) ...
Setting up gcc-6 (6.3.0-18+deb9u1) ...
Setting up g++-6 (6.3.0-18+deb9u1) ...
Setting up libpython-stdlib:armhf (2.7.13-2) ...
Setting up dpkg-dev (1.18.25) ...
Setting up python (2.7.13-2) ...
Setting up python3.5 (3.5.3-1+deb9u1) ...
Setting up libpython3-stdlib:armhf (3.5.3-1) ...
Setting up gcc (4:6.3.0-4) ...
Setting up g++ (4:6.3.0-4) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode

Setting up build-essential (12.3) ...
Processing triggers for sgml-base (1.29) ...
Setting up docutils-common (0.13.1+dfsg-2) ...
Processing triggers for sgml-base (1.29) ...
Setting up python3 (3.5.3-1) ...
Setting up python3-six (1.10.0-3) ...
Setting up python3-colorama (0.3.7-1) ...
Setting up python3-pkg-resources (33.1.1-1) ...
Setting up python3-pyasn1 (0.1.9-2) ...
Setting up python3-chardet (2.3.0-2) ...
Setting up python3-urllib3 (1.19.1-1) ...
Setting up python3-jmespath (0.9.0-2) ...
Setting up dh-python (2.20170125) ...
Setting up python3-dateutil (2.5.3-2) ...
Setting up python3-roman (2.0.0-2) ...
Setting up python3-rsa (3.4.2-1) ...
Setting up python3-docutils (0.13.1+dfsg-2) ...
update-alternatives: using /usr/share/docutils/scripts/python3/rst-buildhtml to provide /usr/bin/rst-buildhtml (rst-buildhtml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html to provide /usr/bin/rst2html (rst2html) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html4 to provide /usr/bin/rst2html4 (rst2html4) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html5 to provide /usr/bin/rst2html5 (rst2html5) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2latex to provide /usr/bin/rst2latex (rst2latex) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2man to provide /usr/bin/rst2man (rst2man) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2odt to provide /usr/bin/rst2odt (rst2odt) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2odt_prepstyles to provide /usr/bin/rst2odt_prepstyles (rst2odt_prepstyles) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2pseudoxml to provide /usr/bin/rst2pseudoxml (rst2pseudoxml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2s5 to provide /usr/bin/rst2s5 (rst2s5) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2xetex to provide /usr/bin/rst2xetex (rst2xetex) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2xml to provide /usr/bin/rst2xml (rst2xml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rstpep2html to provide /usr/bin/rstpep2html (rstpep2html) in auto mode
Setting up python3-requests (2.12.4-1) ...
Setting up python3-botocore (1.4.70-1) ...
Setting up python3-s3transfer (0.1.9-1) ...
Setting up awscli (1.11.13-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Removing intermediate container 77bcd2bf0bc2
 ---> d575880ad69f
Step 4/10 : WORKDIR /build
 ---> Running in 4cd926a84b21
Removing intermediate container 4cd926a84b21
 ---> 956d92e39805
Step 5/10 : COPY . .
 ---> 0a5af0c6d3c6
Step 6/10 : ENV VERSION='2.26.0+rev1' RESIN_MACHINE_NAME='asus-tinker-board-s'
 ---> Running in b7e134e08df7
Removing intermediate container b7e134e08df7
 ---> 625c9f10c1aa
Step 7/10 : RUN chmod -R 777 /build     && chmod +x ./build-module.sh     && chmod +x ./workarounds.sh
 ---> Running in be7dd64dee86
Removing intermediate container be7dd64dee86
 ---> 630a2e530555
Step 8/10 : RUN ./build-module.sh $RESIN_MACHINE_NAME $VERSION ./src     && ls -l && ls -l ./src
 ---> Running in 72f233f0118f
Fetching list from servers
Building images/asus-tinker-board-s/2.26.0+rev1.dev/kernel_modules_headers.tar.gz...
--2019-04-11 02:27:15--  https://files.balena-cloud.com/images/asus-tinker-board-s/2.26.0%2Brev1.dev/kernel_modules_headers.tar.gz‌
Resolving files.balena-cloud.com (files.balena-cloud.com)... ‌52.2.175.150‌, 34.206.9.96, 34.196.237.103, ...‌
Connecting to files.balena-cloud.com (files.balena-cloud.com)|52.2.175.150|:443... ‌connected.‌
HTTP request sent, awaiting response... ‌301 Moved Permanently‌
Location: https://resin-production-img-cloudformation.s3.amazonaws.com/images/asus-tinker-board-s/2.26.0%2Brev1.dev/kernel_modules_headers.tar.gz [following]‌
--2019-04-11 02:27:16--  https://resin-production-img-cloudformation.s3.amazonaws.com/images/asus-tinker-board-s/2.26.0%2Brev1.dev/kernel_modules_headers.tar.gz‌
Resolving resin-production-img-cloudformation.s3.amazonaws.com (resin-production-img-cloudformation.s3.amazonaws.com)... ‌52.216.9.35‌
Connecting to resin-production-img-cloudformation.s3.amazonaws.com (resin-production-img-cloudformation.s3.amazonaws.com)|52.216.9.35|:443... ‌connected.‌
HTTP request sent, awaiting response... ‌200 OK‌
Length: ‌10801837‌ (10M) [application/x-gzip]‌
Saving to: ‘kernel_modules_headers.tar.gz’‌

     0K‌ ‌.‌.......‌.. .....‌.‌.... .......... ..‌.‌....... .........‌.‌  0%‌  409K‌ 26s‌
    50K .......... ......‌.‌... .......... ...‌.‌...... ..........  0%  392K 26s‌
  ... CUT HERE FOR SIZING ...
 10500K ....‌....‌.. ......‌.‌... ....‌...... ...‌.......‌ ........‌  ‌100%‌ 12.1M‌=1.9s‌

2019-04-11 02:27:18 (5.49 MB/s) - ‘kernel_modules_headers.tar.gz’ saved [10801837/10801837]‌

Workaround tinkerboard‌
make: Entering directory '/tmp/tmp.fGgXNkphhw'
  CC [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.dev/elo_mt_input.o
  LD [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.dev/elo_mt_input_mod.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /build/src_asus-tinker-board-s_2.26.0+rev1.dev/elo_mt_input_mod.mod.o
  LD [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.dev/elo_mt_input_mod.ko
make: Leaving directory '/tmp/tmp.fGgXNkphhw'
Building images/asus-tinker-board-s/2.26.0+rev1.prod/kernel_modules_headers.tar.gz...
--2019-04-11 02:27:48--  https://files.balena-cloud.com/images/asus-tinker-board-s/2.26.0%2Brev1.prod/kernel_modules_headers.tar.gz‌
Resolving files.balena-cloud.com (files.balena-cloud.com)... ‌34.206.9.96‌, 34.196.237.103, 52.71.139.107‌, ...‌
Connecting to files.balena-cloud.com (files.balena-cloud.com)|34.206.9.96|:443... ‌connected.‌
HTTP request sent, awaiting response... ‌301 Moved Permanently‌
Location: https://resin-production-img-cloudformation.s3.amazonaws.com/images/asus-tinker-board-s/2.26.0%2Brev1.prod/kernel_modules_headers.tar.gz [following]‌
--2019-04-11 02:27:49--  https://resin-production-img-cloudformation.s3.amazonaws.com/images/asus-tinker-board-s/2.26.0%2Brev1.prod/kernel_modules_headers.tar.gz‌
Resolving resin-production-img-cloudformation.s3.amazonaws.com (resin-production-img-cloudformation.s3.amazonaws.com)... ‌52.216.139.139‌
Connecting to resin-production-img-cloudformation.s3.amazonaws.com (resin-production-img-cloudformation.s3.amazonaws.com)|52.216.139.139|:443... ‌connected.‌
HTTP request sent, awaiting response... ‌200 OK‌
Length: ‌10801837‌ (10M)‌ [application/x-gzip]‌
Saving to: ‘kernel_modules_headers.tar.gz’‌

     0K‌ .......... .....‌.‌.... ....‌...... ..‌.‌....... .‌.........‌  0%‌  396K‌ 26s‌
    50K ........‌.. ......‌.‌... .....‌..... ...‌.‌...... ..‌........  0%  387K 27s‌
   ... CUT HERE FOR SIZING ...
 10450K ......‌.... ....‌...... ..‌........‌ .......... ‌......‌.... 99% 11.0M 0s‌
 10500K ....‌...... ..‌........ ........‌.. .......... ...‌.‌....‌  ‌100%‌ 14.3M‌=1.9s‌

2019-04-11 02:27:51 (5.45 MB/s) - ‘kernel_modules_headers.tar.gz’ saved [10801837/10801837]‌

Workaround tinkerboard‌
make: Entering directory '/tmp/tmp.d7iVx1bpTN'
  CC [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input.o
  LD [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input_mod.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input_mod.mod.o
  LD [M]  /build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input_mod.ko
make: Leaving directory '/tmp/tmp.d7iVx1bpTN'
total 48
-rwxrwxrwx 1 root root  682 Apr 11 02:21 Dockerfile
-rwxrwxrwx 1 root root   33 Apr 11 02:21 README.md
-rwxrwxrwx 1 root root  294 Apr 11 02:21 azure-pipelines.yml
-rwxrwxrwx 1 root root 4180 Apr 11 02:21 build-module.sh
-rwxrwxrwx 1 root root  394 Apr 11 02:21 build.sh
drwxrwxrwx 1 root root 4096 Apr 11 02:21 elo-mt-usb
-rwxrwxrwx 1 root root  439 Apr 11 02:21 install.sh
drwxrwxrwx 1 root root 4096 Apr 11 02:21 src
drwxr-xr-x 3 root root 4096 Apr 11 02:27 src_asus-tinker-board-s_2.26.0+rev1.dev
drwxr-xr-x 3 root root 4096 Apr 11 02:28 src_asus-tinker-board-s_2.26.0+rev1.prod
-rwxrwxrwx 1 root root 1226 Apr 11 02:21 workarounds.sh
total 12
-rwxrwxrwx 1 root root  479 Apr 11 02:21 Makefile
-rwxrwxrwx 1 root root 7609 Apr 11 02:21 elo_mt_input.c
Removing intermediate container 72f233f0118f
 ---> 37795374f220
Step 9/10 : RUN [ "cross-build-end" ]
 ---> Running in 6d1eb397e1ce
Removing intermediate container 6d1eb397e1ce
 ---> 46ed97169199
Step 10/10 : CMD [ "cp", "/build/src_asus-tinker-board-s_2.26.0+rev1.prod/elo_mt_input_mod.ko", "/out" ]
 ---> Running in 6edbd5c75913
Removing intermediate container 6edbd5c75913
 ---> d7194e945c60
Successfully built d7194e945c60
Successfully tagged elo-touch:build
standard_init_linux.go:207: exec user process caused "exec format error"
cp: cannot stat 'out/elo_mt_input_mod.ko': No such file or directory
dist/
dist/install.sh
dist/elo-mt-usb/
dist/elo-mt-usb/cpl
dist/elo-mt-usb/elova
dist/elo-mt-usb/99-elotouch.rules
dist/elo-mt-usb/elorc
dist/elo-mt-usb/cplcmd
dist/elo-mt-usb/eloCreateFifo.sh
dist/elo-mt-usb/loadEloMultiTouchUSB.sh
dist/elo-mt-usb/elomtusbd
##[section]Finishing: Build Kernel Module

@galvesribeiro I assume the machine you are building on is a linux base VM on Azure? I think you are missing binfmt_misc set up as mentioned here Creating custom base images . You also might want to have a read through the original blog post for this feature here: https://www.balena.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/

I is a Ubuntu machine… Let me try install the binfmt_misc package and see what we can get…

@shaunmulligan I’ve tried to install there is no such package on Ubuntu16.04. The closest is binfmt-support and even if I modify the script to install it on the host machine before build the container, I get the problem…

Do I need to install balena CLI or anything else but have Docker on that CI VM to get it to work?

Thanks!

Hi
binfmt_misc appears to be a kernel feature and binfmt_support is the kernel module that enables it in Ubuntu xenial.
To see if it is enabled you could try something like

grep binfmt /proc/mounts 

On my ubuntu 18.04 that produces the following output:

systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=15314 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0

@samothx thanks for the reply.

This is the log for the task that install the package before call ./build.sh including the grep:

##[section]Starting: Install dependencies
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.148.2
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
==============================================================================
Generating script.
Script contents:
sudo apt install -yy binfmt-support && grep binfmt /proc/mounts
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/dc796f13-3e47-4be5-a4b0-e6ec68df00a6.sh

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
binfmt-support is already the newest version (2.1.6-1).
binfmt-support set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 26 not upgraded.
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1366 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
##[section]Finishing: Install dependencies

Ok, took me a while to digest what you are actually doing and I am not an expert on this either, so let me wrap up what I gathered:

  • You are running a script on a ubuntu 16.04 virtual host in a CI env.
  • The script creates a docker image targeted for the arm platform and installs and compiles plenty of software during the build process of that image using the [“cross-build-start”] / [“cross-build-end”] feature.
  • This succeeds and the image should now contain your kernel module in the build folder
  • Now you try to create a container from the image and run it on ubuntu linux to copy the binary kernel module out of the image. This appears to fail.

Looking through the docs that shaun pointed to further up, it looks like you are missing the qemu-arm part that is described in https://www.balena.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/
I think the arm image cannot be executed on x86 hardware without that - no Idea why it would work on OSX.
Generally I think your approach is a bit complicated. If you are creating a service for balena, you could just integrate your module compilation into the services docker file and let the arm builders do the job for you.

ps: not so sure if I got it all right as the other post by shaun states:
‘All resin-base images have a qemu binary which allows them to run on any host that has binfmt_misc setup and docker for mac does . binfmt_misc intercepts system calls to the kernal and uses qemu to emulate.’
The interesting part is ‘and docker for mac does’ so binfmt_misc must be supported by the version of docker you are using and that might be where the problem originates from.

Yay! It works!

The kernel module was properly built! :slight_smile:

So, the problem is… We need to install both binfmt-support AND qemu-arm-static packages from apt. With that everything ran just fine.

All I have to do was to add an extra bash step on the build process and in the end I got this:

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

steps:
- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'sudo apt install -yy binfmt-support qemu-user-static && grep binfmt /proc/mounts'
  displayName: Install host dependencies
- bash: ./build.sh
  displayName: Build Kernel Module
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'elo-mt-driver.tar.gz'
    ArtifactName: 'elo-mt-driver'
  displayName: Publish build artifact

In OSX it works without having to install it as it works docker for mac does have it as @shaunmulligan mentioned.

So, thank you all folks for guide this balena noob! :slight_smile:

We are almost ready to sign the production :slight_smile: