Skip to content

Commit 54ff9f3

Browse files
committed
Support of register --reset
1 parent a8966d4 commit 54ff9f3

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

register/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM busybox
22
ENV QEMU_BIN_DIR=/usr/bin
33
ADD ./register.sh /register
4-
CMD /register
4+
ENTRYPOINT ["/register"]

register/register.sh

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

3-
43
QEMU_BIN_DIR=${QEMU_BIN_DIR:-/usr/bin}
54

65

@@ -16,6 +15,22 @@ if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
1615
fi
1716

1817

18+
if [ "${1}" = "--reset" ]; then
19+
(
20+
cd /proc/sys/fs/binfmt_misc
21+
for file in *; do
22+
case "${file}" in
23+
status|register)
24+
;;
25+
*)
26+
echo -1 > "${file}"
27+
;;
28+
esac
29+
done
30+
)
31+
fi
32+
33+
1934
# probe cpu type
2035
cpu=`uname -m`
2136
case "$cpu" in
@@ -59,7 +74,6 @@ if [ $cpu != "ppc" ] ; then
5974
echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:${QEMU_BIN_DIR}/qemu-ppc-static:' > /proc/sys/fs/binfmt_misc/register
6075
fi
6176
if [ $cpu != "m68k" ] ; then
62-
echo 'Please check cpu value and header information for m68k!'
6377
echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:${QEMU_BIN_DIR}/qemu-m68k-static:' > /proc/sys/fs/binfmt_misc/register
6478
fi
6579
if [ $cpu != "mips" ] ; then

0 commit comments

Comments
 (0)