Update to Buildroot 2019.05.1, Debian Buster, and consistent semicolons
This commit is contained in:
parent
e518652752
commit
b806ff0a26
|
|
@ -1,12 +1,15 @@
|
|||
FROM debian:stretch-slim
|
||||
FROM debian:buster-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y \
|
||||
bzip2 \
|
||||
curl \
|
||||
gcc \
|
||||
gnupg dirmngr \
|
||||
make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# pub 1024D/ACC9965B 2006-12-12
|
||||
# Key fingerprint = C9E9 416F 76E6 10DB D09D 040F 47B7 0C55 ACC9 965B
|
||||
|
|
@ -16,7 +19,7 @@ RUN gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C9E9416F76E61
|
|||
|
||||
ENV BUSYBOX_VERSION 1.31.0
|
||||
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
tarball="busybox-${BUSYBOX_VERSION}.tar.bz2"; \
|
||||
curl -fL -o busybox.tar.bz2 "https://busybox.net/downloads/$tarball"; \
|
||||
curl -fL -o busybox.tar.bz2.sig "https://busybox.net/downloads/$tarball.sig"; \
|
||||
|
|
@ -28,15 +31,15 @@ RUN set -ex; \
|
|||
WORKDIR /usr/src/busybox
|
||||
|
||||
# CONFIG_LAST_SUPPORTED_WCHAR: see https://github.com/docker-library/busybox/issues/13 (UTF-8 input)
|
||||
# As long as we rely on libnss, we have to have libc.so anyhow, so
|
||||
# we've removed CONFIG_STATIC here for now... :cry:
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
\
|
||||
setConfs=' \
|
||||
CONFIG_AR=y \
|
||||
CONFIG_FEATURE_AR_CREATE=y \
|
||||
CONFIG_FEATURE_AR_LONG_FILENAMES=y \
|
||||
CONFIG_LAST_SUPPORTED_WCHAR=0 \
|
||||
# As long as we rely on libnss, we have to have libc.so anyhow, so
|
||||
# we've removed CONFIG_STATIC here for now... :cry:
|
||||
'; \
|
||||
\
|
||||
unsetConfs=' \
|
||||
|
|
@ -72,28 +75,30 @@ RUN set -ex; \
|
|||
grep -q "^$confV\$" .config; \
|
||||
done;
|
||||
|
||||
RUN set -ex \
|
||||
&& make -j "$(nproc)" \
|
||||
RUN set -eux; \
|
||||
make -j "$(nproc)" \
|
||||
busybox \
|
||||
&& ./busybox --help \
|
||||
&& mkdir -p rootfs/bin \
|
||||
&& ln -vL busybox rootfs/bin/ \
|
||||
; \
|
||||
./busybox --help; \
|
||||
mkdir -p rootfs/bin; \
|
||||
ln -vL busybox rootfs/bin/; \
|
||||
\
|
||||
&& ln -vL "$(which getconf)" rootfs/bin/getconf \
|
||||
ln -vL "$(which getconf)" rootfs/bin/getconf; \
|
||||
\
|
||||
# hack hack hack hack hack
|
||||
# with glibc, static busybox uses libnss for DNS resolution :(
|
||||
&& mkdir -p rootfs/etc \
|
||||
&& cp /etc/nsswitch.conf rootfs/etc/ \
|
||||
&& mkdir -p rootfs/lib \
|
||||
&& ln -sT lib rootfs/lib64 \
|
||||
&& set -- \
|
||||
mkdir -p rootfs/etc; \
|
||||
cp /etc/nsswitch.conf rootfs/etc/; \
|
||||
mkdir -p rootfs/lib; \
|
||||
ln -sT lib rootfs/lib64; \
|
||||
set -- \
|
||||
rootfs/bin/busybox \
|
||||
rootfs/bin/getconf \
|
||||
/lib/"$(gcc -print-multiarch)"/libnss*.so.* \
|
||||
# libpthread is part of glibc: http://stackoverflow.com/a/11210463/433558
|
||||
/lib/"$(gcc -print-multiarch)"/libpthread*.so.* \
|
||||
&& while [ "$#" -gt 0 ]; do \
|
||||
; \
|
||||
while [ "$#" -gt 0 ]; do \
|
||||
f="$1"; shift; \
|
||||
fn="$(basename "$f")"; \
|
||||
if [ -e "rootfs/lib/$fn" ]; then continue; fi; \
|
||||
|
|
@ -108,15 +113,15 @@ RUN set -ex \
|
|||
$1 ~ /^\// { print $1; next } \
|
||||
$2 == "=>" && $3 ~ /^\// { print $3; next } \
|
||||
'); \
|
||||
done \
|
||||
done; \
|
||||
\
|
||||
&& chroot rootfs /bin/getconf _NPROCESSORS_ONLN \
|
||||
chroot rootfs /bin/getconf _NPROCESSORS_ONLN; \
|
||||
\
|
||||
&& chroot rootfs /bin/busybox --install /bin
|
||||
chroot rootfs /bin/busybox --install /bin
|
||||
|
||||
# download a few extra files from buildroot (/etc/passwd, etc)
|
||||
RUN set -ex; \
|
||||
buildrootVersion='2019.05'; \
|
||||
RUN set -eux; \
|
||||
buildrootVersion='2019.05.1'; \
|
||||
mkdir -p rootfs/etc; \
|
||||
for f in passwd shadow group; do \
|
||||
curl -fL -o "rootfs/etc/$f" "https://git.busybox.net/buildroot/plain/system/skeleton/etc/$f?id=$buildrootVersion"; \
|
||||
|
|
@ -143,9 +148,9 @@ RUN set -ex; \
|
|||
rm buildroot-device-table.txt
|
||||
|
||||
# create missing home directories
|
||||
RUN set -ex \
|
||||
&& cd rootfs \
|
||||
&& for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
RUN set -eux; \
|
||||
cd rootfs; \
|
||||
for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
user="${userHome%%=*}"; \
|
||||
home="${userHome#*=}"; \
|
||||
home="./${home#/}"; \
|
||||
|
|
@ -160,11 +165,11 @@ RUN set -ex \
|
|||
RUN chroot rootfs /bin/sh -xec 'true'
|
||||
|
||||
# ensure correct timezone (UTC)
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
ln -vL /usr/share/zoneinfo/UTC rootfs/etc/localtime; \
|
||||
[ "$(chroot rootfs date +%Z)" = 'UTC' ]
|
||||
|
||||
# test and make sure DNS works too
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/ \
|
||||
&& chroot rootfs /bin/sh -xec 'nslookup google.com' \
|
||||
&& rm rootfs/etc/resolv.conf
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/; \
|
||||
chroot rootfs /bin/sh -xec 'nslookup google.com'; \
|
||||
rm rootfs/etc/resolv.conf
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ RUN gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C9E9416F76E61
|
|||
|
||||
ENV BUSYBOX_VERSION 1.31.0
|
||||
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
tarball="busybox-${BUSYBOX_VERSION}.tar.bz2"; \
|
||||
curl -fL -o busybox.tar.bz2 "https://busybox.net/downloads/$tarball"; \
|
||||
curl -fL -o busybox.tar.bz2.sig "https://busybox.net/downloads/$tarball.sig"; \
|
||||
|
|
@ -36,7 +36,7 @@ RUN sed -i 's/^struct kconf_id \*$/static &/g' scripts/kconfig/zconf.hash.c_ship
|
|||
|
||||
# CONFIG_LAST_SUPPORTED_WCHAR: see https://github.com/docker-library/busybox/issues/13 (UTF-8 input)
|
||||
# see http://wiki.musl-libc.org/wiki/Building_Busybox
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
\
|
||||
setConfs=' \
|
||||
CONFIG_AR=y \
|
||||
|
|
@ -84,26 +84,28 @@ RUN set -ex; \
|
|||
grep -q "^$confV\$" .config; \
|
||||
done;
|
||||
|
||||
RUN set -ex \
|
||||
&& make -j "$(nproc)" \
|
||||
RUN set -eux; \
|
||||
make -j "$(nproc)" \
|
||||
busybox \
|
||||
&& ./busybox --help \
|
||||
&& mkdir -p rootfs/bin \
|
||||
&& ln -vL busybox rootfs/bin/ \
|
||||
&& chroot rootfs /bin/busybox --install /bin
|
||||
; \
|
||||
./busybox --help; \
|
||||
mkdir -p rootfs/bin; \
|
||||
ln -vL busybox rootfs/bin/; \
|
||||
chroot rootfs /bin/busybox --install /bin
|
||||
|
||||
# grab a simplified getconf port from Alpine we can statically compile
|
||||
RUN set -x \
|
||||
&& aportsVersion="v$(cat /etc/alpine-release)" \
|
||||
&& curl -fsSL \
|
||||
RUN set -eux; \
|
||||
aportsVersion="v$(cat /etc/alpine-release)"; \
|
||||
curl -fsSL \
|
||||
"https://git.alpinelinux.org/cgit/aports/plain/main/musl/getconf.c?h=${aportsVersion}" \
|
||||
-o /usr/src/getconf.c \
|
||||
&& gcc -o rootfs/bin/getconf -static -Os /usr/src/getconf.c \
|
||||
&& chroot rootfs /bin/getconf _NPROCESSORS_ONLN
|
||||
; \
|
||||
gcc -o rootfs/bin/getconf -static -Os /usr/src/getconf.c; \
|
||||
chroot rootfs /bin/getconf _NPROCESSORS_ONLN
|
||||
|
||||
# download a few extra files from buildroot (/etc/passwd, etc)
|
||||
RUN set -ex; \
|
||||
buildrootVersion='2019.05'; \
|
||||
RUN set -eux; \
|
||||
buildrootVersion='2019.05.1'; \
|
||||
mkdir -p rootfs/etc; \
|
||||
for f in passwd shadow group; do \
|
||||
curl -fL -o "rootfs/etc/$f" "https://git.busybox.net/buildroot/plain/system/skeleton/etc/$f?id=$buildrootVersion"; \
|
||||
|
|
@ -130,9 +132,9 @@ RUN set -ex; \
|
|||
rm buildroot-device-table.txt
|
||||
|
||||
# create missing home directories
|
||||
RUN set -ex \
|
||||
&& cd rootfs \
|
||||
&& for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
RUN set -eux; \
|
||||
cd rootfs; \
|
||||
for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
user="${userHome%%=*}"; \
|
||||
home="${userHome#*=}"; \
|
||||
home="./${home#/}"; \
|
||||
|
|
@ -147,11 +149,11 @@ RUN set -ex \
|
|||
RUN chroot rootfs /bin/sh -xec 'true'
|
||||
|
||||
# ensure correct timezone (UTC)
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
ln -vL /usr/share/zoneinfo/UTC rootfs/etc/localtime; \
|
||||
[ "$(chroot rootfs date +%Z)" = 'UTC' ]
|
||||
|
||||
# test and make sure DNS works too
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/ \
|
||||
&& chroot rootfs /bin/sh -xec 'nslookup google.com' \
|
||||
&& rm rootfs/etc/resolv.conf
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/; \
|
||||
chroot rootfs /bin/sh -xec 'nslookup google.com'; \
|
||||
rm rootfs/etc/resolv.conf
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
FROM debian:stretch-slim
|
||||
FROM debian:buster-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y \
|
||||
bzip2 \
|
||||
curl \
|
||||
gcc \
|
||||
|
|
@ -18,7 +20,8 @@ RUN apt-get update && apt-get install -y \
|
|||
rsync \
|
||||
unzip \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# we grab buildroot for it's uClibc toolchain
|
||||
|
||||
|
|
@ -30,9 +33,9 @@ RUN gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys AB07D806D2CE7
|
|||
|
||||
# https://buildroot.org/download.html
|
||||
# https://buildroot.org/downloads/?C=M;O=D
|
||||
ENV BUILDROOT_VERSION 2019.05
|
||||
ENV BUILDROOT_VERSION 2019.05.1
|
||||
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
tarball="buildroot-${BUILDROOT_VERSION}.tar.bz2"; \
|
||||
curl -fL -o buildroot.tar.bz2 "https://buildroot.org/downloads/$tarball"; \
|
||||
curl -fL -o buildroot.tar.bz2.sign "https://buildroot.org/downloads/$tarball.sign"; \
|
||||
|
|
@ -44,7 +47,7 @@ RUN set -ex; \
|
|||
tar -xf buildroot.tar.bz2 -C /usr/src/buildroot --strip-components 1; \
|
||||
rm buildroot.tar.bz2*
|
||||
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
\
|
||||
cd /usr/src/buildroot; \
|
||||
\
|
||||
|
|
@ -153,10 +156,16 @@ RUN set -ex; \
|
|||
done;
|
||||
|
||||
# http://www.finnie.org/2014/02/13/compiling-busybox-with-uclibc/
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
# force a particular GNU arch for "host-gmp" (otherwise it fails on some arches)
|
||||
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
|
||||
make -C /usr/src/buildroot HOST_GMP_CONF_OPTS="--build='"$gnuArch"'" -j "$(nproc)" toolchain
|
||||
make -C /usr/src/buildroot \
|
||||
HOST_GMP_CONF_OPTS="--build='"$gnuArch"'" \
|
||||
# building host-tar:
|
||||
# configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
|
||||
FORCE_UNSAFE_CONFIGURE=1 \
|
||||
-j "$(nproc)" \
|
||||
toolchain
|
||||
ENV PATH /usr/src/buildroot/output/host/usr/bin:$PATH
|
||||
|
||||
# pub 1024D/ACC9965B 2006-12-12
|
||||
|
|
@ -167,7 +176,7 @@ RUN gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys C9E9416F76E61
|
|||
|
||||
ENV BUSYBOX_VERSION 1.31.0
|
||||
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
tarball="busybox-${BUSYBOX_VERSION}.tar.bz2"; \
|
||||
curl -fL -o busybox.tar.bz2 "https://busybox.net/downloads/$tarball"; \
|
||||
curl -fL -o busybox.tar.bz2.sig "https://busybox.net/downloads/$tarball.sig"; \
|
||||
|
|
@ -179,7 +188,7 @@ RUN set -ex; \
|
|||
WORKDIR /usr/src/busybox
|
||||
|
||||
# CONFIG_LAST_SUPPORTED_WCHAR: see https://github.com/docker-library/busybox/issues/13 (UTF-8 input)
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
\
|
||||
setConfs=' \
|
||||
CONFIG_AR=y \
|
||||
|
|
@ -222,22 +231,23 @@ RUN set -ex; \
|
|||
grep -q "^$confV\$" .config; \
|
||||
done;
|
||||
|
||||
RUN set -ex \
|
||||
&& make -j "$(nproc)" \
|
||||
RUN set -eux; \
|
||||
make -j "$(nproc)" \
|
||||
CROSS_COMPILE="$(basename /usr/src/buildroot/output/host/usr/*-buildroot-linux-uclibc*)-" \
|
||||
busybox \
|
||||
&& ./busybox --help \
|
||||
&& mkdir -p rootfs/bin \
|
||||
&& ln -vL busybox rootfs/bin/ \
|
||||
; \
|
||||
./busybox --help; \
|
||||
mkdir -p rootfs/bin; \
|
||||
ln -vL busybox rootfs/bin/; \
|
||||
\
|
||||
&& ln -vL ../buildroot/output/target/usr/bin/getconf rootfs/bin/ \
|
||||
ln -vL ../buildroot/output/target/usr/bin/getconf rootfs/bin/; \
|
||||
\
|
||||
&& chroot rootfs /bin/getconf _NPROCESSORS_ONLN \
|
||||
chroot rootfs /bin/getconf _NPROCESSORS_ONLN; \
|
||||
\
|
||||
&& chroot rootfs /bin/busybox --install /bin
|
||||
chroot rootfs /bin/busybox --install /bin
|
||||
|
||||
# install a few extra files from buildroot (/etc/passwd, etc)
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
mkdir -p rootfs/etc; \
|
||||
for f in passwd shadow group; do \
|
||||
ln -vL \
|
||||
|
|
@ -264,9 +274,9 @@ RUN set -ex; \
|
|||
' ../buildroot/system/device_table.txt | bash -Eeuo pipefail -x
|
||||
|
||||
# create missing home directories
|
||||
RUN set -ex \
|
||||
&& cd rootfs \
|
||||
&& for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
RUN set -eux; \
|
||||
cd rootfs; \
|
||||
for userHome in $(awk -F ':' '{ print $3 ":" $4 "=" $6 }' etc/passwd); do \
|
||||
user="${userHome%%=*}"; \
|
||||
home="${userHome#*=}"; \
|
||||
home="./${home#/}"; \
|
||||
|
|
@ -281,11 +291,11 @@ RUN set -ex \
|
|||
RUN chroot rootfs /bin/sh -xec 'true'
|
||||
|
||||
# ensure correct timezone (UTC)
|
||||
RUN set -ex; \
|
||||
RUN set -eux; \
|
||||
ln -vL /usr/share/zoneinfo/UTC rootfs/etc/localtime; \
|
||||
[ "$(chroot rootfs date +%Z)" = 'UTC' ]
|
||||
|
||||
# test and make sure DNS works too
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/ \
|
||||
&& chroot rootfs /bin/sh -xec 'nslookup google.com' \
|
||||
&& rm rootfs/etc/resolv.conf
|
||||
RUN cp -L /etc/resolv.conf rootfs/etc/; \
|
||||
chroot rootfs /bin/sh -xec 'nslookup google.com'; \
|
||||
rm rootfs/etc/resolv.conf
|
||||
|
|
|
|||
Loading…
Reference in New Issue