This commit is contained in:
JuniorJPDJ 2021-07-03 23:16:26 +02:00 committed by GitHub
commit d5f4bd0d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 23 deletions

View File

@ -1,36 +1,40 @@
FROM ubuntu:bionic AS build
FROM ubuntu:focal AS build
COPY uml.config /uml.config
ENV LINUX_VERSION linux-4.19.57
ENV LINUX_DOWNLOAD_URL https://cdn.kernel.org/pub/linux/kernel/v4.x/${LINUX_VERSION}.tar.xz
ENV LINUX_VERSION linux-5.10.47
ENV LINUX_DOWNLOAD_URL https://cdn.kernel.org/pub/linux/kernel/v5.x/${LINUX_VERSION}.tar.xz
RUN apt-get update \
&& apt-get -y install build-essential flex bison xz-utils wget ca-certificates bc linux-headers-4.15.0-47-generic \
&& apt-get -y install build-essential flex bison xz-utils wget ca-certificates bc \
&& wget ${LINUX_DOWNLOAD_URL} \
&& tar xJf ${LINUX_VERSION}.tar.xz \
&& rm ${LINUX_VERSION}.tar.xz \
&& cd ${LINUX_VERSION} \
&& cp /uml.config .config \
&& make ARCH=um -j10 \
&& make ARCH=um olddefconfig \
&& make ARCH=um -j17 \
&& mv ./linux / \
&& cd .. \
&& rm -rf ${LINUX_VERSION}
FROM xena/alpine
FROM debian:testing-slim
COPY --from=build /linux /linux
ADD https://xena.greedo.xeserv.us/files/slirp /slirp
# Add slirp
RUN apt-get update && apt-get install --no-install-recommends -y slirp wget && rm -rf /var/lib/apt/lists/*
# Add Tini
ENV TINI_VERSION v0.18.0
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /chroot/tini
RUN chmod +x /chroot/tini
# Set up chroot
RUN cd /chroot \
&& wget -O - http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.0-x86_64.tar.gz | tar xz \
&& chmod +x /linux \
&& chmod +x /slirp
RUN wget -O - http://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.0-x86_64.tar.gz | tar xz -C /chroot
COPY --from=build /linux /linux
COPY init.sh /chroot/init.sh
COPY resolv.conf /chroot/etc/resolv.conf
RUN chmod +x /linux /chroot/tini && echo "nameserver 10.0.2.3" > /chroot/etc/resolv.conf && sed -i 's/https/http/g' /chroot/etc/apk/repositories
COPY runlinux.sh /runlinux.sh
CMD /runlinux.sh
ENTRYPOINT [ "/runlinux.sh" ]

View File

@ -2,11 +2,11 @@
mount -t proc proc proc/
mount -t sysfs sys sys/
ifconfig eth0 10.0.2.14 netmask 255.255.255.240 broadcast 10.0.2.15
route add default gw 10.0.2.2
ip link set eth0 up
ip address add 10.0.2.15/24 dev eth0
ip route add default via 10.0.2.2
reset
uname -av
echo "networking set up"
exec /tini /bin/sh
exec /tini /bin/ash -- -i

View File

@ -1,2 +0,0 @@
nameserver 1.1.1.1
nameserver 8.8.8.8

View File

@ -1,4 +1,4 @@
#!/bin/sh
export TMP=/chroot
exec /chroot/tini /linux root=/dev/root rootflags=/chroot rootfstype=hostfs rw mem=128M udb0=alpine-root verbose eth0=slirp,,/slirp init=/init.sh
exec /chroot/tini /linux root=/dev/root rootflags=/chroot rootfstype=hostfs rw mem=128M udb0=alpine-root verbose eth0=slirp,,slirp-fullbolt init=/init.sh