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.