Skip to content

Commit

Permalink
x86_64-linux-gnu: set centos as the base image
Browse files Browse the repository at this point in the history
build the debian sysroot (linux-image.sh) in a ubuntu container
  • Loading branch information
japaric committed Dec 14, 2020
1 parent 7e6ef2a commit b0f4bd7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
/docker/qemu
15 changes: 15 additions & 0 deletions build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ run() {
fi
fi

if grep -i centos "${dockerfile}" >/dev/null 2>/dev/null; then
# build debian sysroot in a separate ubuntu container
# (only done for x86-linux-gnu ATM)
rm -rf qemu
mkdir qemu
cp linux-image.sh qemu/
docker run \
--rm \
-v "$(pwd)/qemu:/qemu:z" \
-w /qemu \
-i \
-t "ubuntu:16.04" \
sh -c "./linux-image.sh x86_64; chown -R $(id -u):$(id -g) /qemu"
fi

docker build ${cache_from_args[@]+"${cache_from_args[@]}"} --pull -t "${image_name}" -f "${dockerfile}" .

if ! [[ "${version}" =~ alpha ]] && ! [[ "${version}" =~ dev ]]; then
Expand Down
23 changes: 23 additions & 0 deletions docker/Dockerfile.x86_64-unknown-linux-gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM centos:7

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

COPY qemu.sh /
RUN /qemu.sh x86_64 softmmu

COPY dropbear.sh /
RUN /dropbear.sh

# this folder is built by `build-docker-image.sh`
COPY qemu /qemu

COPY linux-runner /

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/linux-runner x86_64"
4 changes: 3 additions & 1 deletion docker/linux-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ main() {
esac

local dependencies=(
ca-certificates
curl
cpio
sharutils
gnupg
Expand All @@ -100,7 +102,7 @@ main() {
local purge_list=()
apt-get update
for dep in "${dependencies[@]}"; do
if ! dpkg -L "${dep}"; then
if ! dpkg -L "${dep}" >/dev/null 2>/dev/null; then
apt-get install --assume-yes --no-install-recommends "${dep}"
purge_list+=( "${dep}" )
fi
Expand Down

0 comments on commit b0f4bd7

Please sign in to comment.