Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update qemu-user-static to version 8.0.4 #246

Merged
merged 8 commits into from
Nov 22, 2023
44 changes: 17 additions & 27 deletions download-qemu-static.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
#!/bin/bash -ex

set -xe
if [ "$(uname -m)" == "x86_64" ]; then
set -eux

if [ "$(uname -m)" = "x86_64" ]; then
docker run --rm --privileged multiarch/qemu-user-static:register --reset
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B.: We can leave this as is since the binfmt_misc registration will be the same for any version.

fi

export QEMU_STATIC_VERSION=v7.2.0-1
qemu_aarch64_sha256=dce64b2dc6b005485c7aa735a7ea39cb0006bf7e5badc28b324b2cd0c73d883f
qemu_arm_sha256=9f07762a3cd0f8a199cb5471a92402a4765f8e2fcb7fe91a87ee75da9616a806
qemu_ppc64le_sha256=a8855b9a9cdefbe2163d9f7851fb71c77207d816451237caed616eb9b03229ac
qemu_s390x_sha256=a438ab2f7c2e0f0ffe63992bccedaf60d789cfb1849e035c0764bda7d9e73a9a

set +e
rm qemu-*-static
set -e

wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-aarch64-static
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-arm-static
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-ppc64le-static
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-s390x-static

sha256sum qemu-*-static

sha256sum qemu-aarch64-static | grep -F "${qemu_aarch64_sha256}"
sha256sum qemu-arm-static | grep -F "${qemu_arm_sha256}"
sha256sum qemu-ppc64le-static | grep -F "${qemu_ppc64le_sha256}"
sha256sum qemu-s390x-static | grep -F "${qemu_s390x_sha256}"
rm -f qemu-*-static

chmod +x qemu-aarch64-static
chmod +x qemu-arm-static
chmod +x qemu-ppc64le-static
chmod +x qemu-s390x-static
version='8.1.2'
build='ds-1'
curl -sL \
"http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user-static_${version}+${build}_amd64.deb" |
dpkg-deb --extract - ./deb-tmp
mv ./deb-tmp/usr/bin/qemu-*-static ./
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not moving too many aarches here? I don't know how many come with the deb file, but the fact that we could remove arm and things still work sounds to me like we're blowing up the image unnecessarily here?

Perhaps it's better to go back to an explicit for-loop?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really hurt since only those that we explicitly ADD/COPY in the build files get used.
(It's similar to having the .git directory in the build context -- it's there, but we don't care since we don't touch it.)

Even the temporary directory and moving those files isn't really necessary.
I.e., we could just dpkg-deb --extract - ./qemu-user-static and then COPY ./qemu-user-static/usr/bin/qemu-aarch64-static /usr/bin/ in the Dockerfiles.
(I just didn't do that yet since I didn't want to argue for or against it.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I was thinking this would be called during the docker build, but if it's just happening in the build context, then obviously that's not an issue.

I.e., we could just dpkg-deb --extract - ./qemu-user-static and then COPY ./qemu-user-static/usr/bin/qemu-aarch64-static /usr/bin/ in the Dockerfiles.
(I just didn't do that yet since I didn't want to argue for or against it.)

That could be a nice improvement IMO.

rm -rf ./deb-tmp
sha256sum --check << 'EOF'
f5c0f9f9e1499c6907bb293a250d9a015ea99e304654e0ab9fb38fd72efad7ce qemu-aarch64-static
d7d7dcbaf1a2a58fc3a42465ae5a253b1cef1bcb08c6e8bb8dd22be8cfdaadeb qemu-arm-static
mbargull marked this conversation as resolved.
Show resolved Hide resolved
79a95114ab8b6f7d6d570bd6eeb81d8ed57f4d5210503a826a13fa26502a3bee qemu-ppc64le-static
e9c1ee2d9bf7e9aea9f59fd39837084f2c223676e656a5261f893b2de1b4e7bb qemu-s390x-static
EOF
Loading