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-binfmt-conf.sh to support loongarch64 #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion containers/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM busybox
ENV QEMU_BIN_DIR=/usr/bin
ADD ./register.sh /register
ADD https://raw.githubusercontent.com/qemu/qemu/e75941331e4cdc05878119e08635ace437aae721/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
ADD https://raw.githubusercontent.com/qemu/qemu/f8d1ae82623fef4e7fb796efbaaa2ddc63594d09/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
RUN chmod +x /qemu-binfmt-conf.sh
COPY qemu-*-static /usr/bin/
ENTRYPOINT ["/register"]
4 changes: 2 additions & 2 deletions containers/latest/register.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

QEMU_BIN_DIR=${QEMU_BIN_DIR:-/usr/bin}

QEMU_SUFFIX=${QEMU_SUFFIX:--static}
Copy link

@leavelet leavelet May 14, 2024

Choose a reason for hiding this comment

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

qemu-user-static shoud be statically linked. Simply rename qemu-user to qemu-user-static will not work as expected. So -static suffix is not optional.

Copy link
Author

Choose a reason for hiding this comment

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

qemu-user-static shoud be statically linked. Simply rename qemu-user to qemu-user-static will not work as expected. So -static suffix is not optional.

This was the default behavior before. I just added the variable default value so that it can be configured through variables.

Choose a reason for hiding this comment

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

I don't think the default value should be changed. -static is necessary for binfmt to work properly.


if [ ! -d /proc/sys/fs/binfmt_misc ]; then
echo "No binfmt support in the kernel."
Expand All @@ -20,4 +20,4 @@ if [ "${1}" = "--reset" ]; then
find /proc/sys/fs/binfmt_misc -type f -name 'qemu-*' -exec sh -c 'echo -1 > {}' \;
fi

exec /qemu-binfmt-conf.sh --qemu-suffix "-static" --qemu-path "${QEMU_BIN_DIR}" $@
exec /qemu-binfmt-conf.sh --qemu-suffix "${QEMU_SUFFIX}" --qemu-path "${QEMU_BIN_DIR}" $@