Skip to content

Commit

Permalink
fix: added missing script for mainline aarch64
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Jul 26, 2023
1 parent 61411d3 commit 3b0d57a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
30 changes: 24 additions & 6 deletions images/generated-images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
FROM mainline-src as mainline-src
FROM ubuntu:bionic

ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /home/ubuntu

COPY /*.deb /home/ubuntu/
COPY /version /home/ubuntu/
COPY --from=mainline-src /mainline-src/ /home/ubuntu/mainline-src/

RUN apt-get update && apt-get install -y \
bc \
bison \
build-essential \
clang \
curl \
dbus \
flex \
git \
iproute2 \
iputils-ping \
kmod \
libcap-dev \
libelf-dev \
libssl-dev \
llvm \
net-tools \
openssh-server \
Expand All @@ -24,20 +33,29 @@ RUN apt-get update && apt-get install -y \
systemd \
udev \
wget && \
apt-get install -s '^gcc-[0-9]*$' && \
curl -LO https://cmake.org/files/v3.19/cmake-3.19.8-Linux-$(uname -m).tar.gz && \
tar -xaf cmake-3.19.8-Linux-$(uname -m).tar.gz && \
rm -vf cmake-3.19.8-Linux-$(uname -m).tar.gz && \
mv cmake-3.19.8-Linux-$(uname -m) /opt/cmake-3.19.8 && \
ln -sf /opt/cmake-3.19.8/bin/* /usr/bin/

COPY /* /home/ubuntu/

RUN apt install -y --fix-broken ./*.deb || exit 1 && \
ln -sf /opt/cmake-3.19.8/bin/* /usr/bin/ && \
apt install -y --fix-broken ./*.deb || exit 1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -v ./*.deb && \
rm -v ./*.deb Dockerfile* && \
find /lib/modules -name '*.ko' -delete ; \
cd mainline-src && \
git config --global user.name "user" && \
git config --global user.email "[email protected]" && \
git checkout cod/mainline/$(cat /home/ubuntu/version) && \
cp /lib/modules/$(ls /lib/modules/ | head -1)/build/.config . \
make prepare0 && \
rm -rf /lib/modules/$(ls /lib/modules/ | head -1)/build/scripts && \
cp -rf scripts /lib/modules/$(ls /lib/modules/ | head -1)/build/ && \
cd .. && \
rm -rf mainline-src && \
echo "" > /etc/machine-id && echo "" > /var/lib/dbus/machine-id && \
sed -ie '/^ConditionVirtualization.*/d' /lib/systemd/system/systemd-timesyncd.service ; \
sed -i -e 's/^AcceptEnv LANG LC_\*$/#AcceptEnv LANG LC_*/' /etc/ssh/sshd_config && \
echo 'UseDNS no' >> /etc/ssh/sshd_config && \
echo "root:root" | chpasswd
3 changes: 3 additions & 0 deletions images/generated-images/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch

COPY /mainline-src/ /mainline-src/
13 changes: 13 additions & 0 deletions images/generated-images/mainline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,16 @@ cd ../../..

cp Makefile generated/
ls generated/$CANONARCH/mainline | xargs -I@ cp Dockerfile Dockerfile.kernel generated/$CANONARCH/mainline/@

# ubuntu mainline packages provide wrong scripts to build drivers: we need to add the source code
# to recompile those scripts and be able to compile kernel modules.
if [[ -d generated/aarch64 ]] ; then
[[ ! -d mainline-src ]] && \
git clone git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack mainline-src
find Dockerfile generated/aarch64 -name Dockerfile | sed 's/Dockerfile//g' | sed '/^$/d' | \
while read DIR; do
VERSION=$(echo $DIR | rev | cut -d/ -f2 | rev)
echo $VERSION > ${DIR}/version
done
docker build -t mainline-src -f Dockerfile.source .
fi

0 comments on commit 3b0d57a

Please sign in to comment.