Hello!
I am using openwrt for custom hardware. As few different configuration need to be built for different used hardware following compile.sh
script implemented:
#!/bin/bash
#Put Openwrt config for new board to './openwrt-configs' directory with '.config' suffix
# so this script can work with it.
name="$0";
boardsdir="./openwrt-configs";
show_boards() {
echo -n "Available board names:";
local itr=0;
for l in $(ls -1 $boardsdir/*.config|sed -e 's/\.config//g'|sed -e 's/.*\///g');do
if [ $itr == "0" ];then
echo ; echo " ";
itr=5;
fi;
echo -n "$l ";
itr=$(expr $itr - 1);
done
echo;echo;
};
show_usage() {
echo;
echo "USAGE:";
echo " $name [command or boardname]";
echo ;
echo "Where [command] can be one of:";
echo " list to list available boards configs to compile.";
echo " help to show this help.";
echo " usage to show this help.";
echo ;
echo "Example:";
echo " $name list";
echo " or";
echo " $name zbt-we1326";
echo;
};
compile() {
local boardname="$1";
local configfile="$boardsdir/$boardname.config";
if [ ! -f "$configfile" ];then
echo;
echo " No such config file found. Use 'list' argument to see available configs.";
echo;
return;
fi
if [ ! -d "./feeds" ];then
./scripts/feeds update -a
./scripts/feeds install -a
fi
cp "$configfile" ./.config;
yes "" | make oldconfig;
make download;
# Rebuild linux kernel to prevent incompatibility list between targets.
if [ -d "build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7" ];then
rm -rf ./build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7;
fi
make -j $(nproc --ignore=3);
echo " Done.";
};
if [ X"$1" = X"" ]; then
show_usage;
exit 0;
fi
case "$1" in
list)
show_boards;
;;
help|usage)
show_usage;
;;
*)
compile "$1";
;;
esac
I am able to build image by running ./compile.sh lorawan_gateway_ethernet
on PC.
Now I am trying to automatize images build process. Want to start image building on each merge to master at Gitlab server.
So I decided to use docker for it.
Here is my docker-compose.yml
file:
version: "2"
services:
openwrt:
build:
context: .
dockerfile: Dockerfile
container_name: openwrt_imx6ull
volumes:
- /home/al/docker/openwrt_imx6ull/:/home/build/bin
/home/build/bin/"
command: bash -c "./docker_compile_all.sh"
Here is Dockerfile
:
FROM debian:latest
RUN apt-get update -qq &&\
apt-get install -y \
build-essential \
curl \
file \
gawk \
gettext \
git \
libncurses5-dev \
libssl-dev \
python2.7 \
python3 \
rsync \
subversion \
sudo \
swig \
unzip \
wget \
zlib1g-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN useradd -c "OpenWrt Builder" -m -d /home/build -G sudo -s /bin/bash build
COPY --chown=build:build . /home/build/openwrt/
RUN chown build:build /home/build/openwrt
USER build
ENV HOME /home/build
WORKDIR /home/build/openwrt/
and script that creates separate folder for each build process docker_compile_all.sh
:
dt="/home/build/bin/"$(date '+%Y_%m_%d_%H_%M_%S/');
mkdir "$dt"
./compile.sh lorawan_gateway_ethernet
ls /home/build/openwrt/bin/targets/imx6ull/cortexa7/
cp -R /home/build/openwrt/bin/targets/imx6ull/cortexa7/ "$dt"
But unfortunately get errors trying to build it under Docker using files above.
Here is error I am facing:
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHK scripts/mod/devicetable-offsets.h
CC [M] drivers/net/ppp/ppp_async.o
CC [M] drivers/net/ppp/pppox.o
CC [M] drivers/net/ppp/pppoe.o
fixdep: error opening depfile: drivers/net/ppp/.pppoe.o.d: No such file or directory
make[8]: *** [scripts/Makefile.build:333: drivers/net/ppp/pppoe.o] Error 2
make[8]: *** Deleting file 'drivers/net/ppp/pppoe.o'
make[7]: *** [scripts/Makefile.build:585: drivers/net/ppp] Error 2
make[6]: *** [scripts/Makefile.build:585: drivers/net] Error 2
make[5]: *** [Makefile:1053: drivers] Error 2
make[5]: Leaving directory '/home/build/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7/linux-4.14.199'
make[4]: *** [Makefile:28: /home/build/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7/linux-4.14.199/.modules] Error 2
make[4]: Leaving directory '/home/build/openwrt/target/linux/imx6ull'
make[3]: *** [Makefile:13: compile] Error 2
make[3]: Leaving directory '/home/build/openwrt/target/linux'
time: target/linux/compile#1.95#0.49#5.70
make[2]: *** [target/Makefile:25: target/linux/compile] Error 2
make[2]: Leaving directory '/home/build/openwrt'
make[1]: *** [target/Makefile:18: /home/build/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_compile] Error 2
make[1]: Leaving directory '/home/build/openwrt'
make: *** [/home/build/openwrt/include/toplevel.mk:227: world] Error 2
I am pretty sure that everything is ok with compile.sh
script as it is used for years and problem in Docker files. Could someone suggest some ideas what might be wrong?