Skip to content

Commit

Permalink
Add aarch64 usermode emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
sfalexrog authored and urpylka committed Nov 19, 2020
1 parent 4d07c5c commit bea1c00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN apt-get update \
&& apt-get clean

COPY ./qemu-arm-static /usr/share/qemu-arm-static
COPY ./qemu-aarch64-static /usr/share/qemu-aarch64-static
COPY ./qemu-wrapper.c /tmp/src/qemu-wrapper.c
RUN gcc -static /tmp/src/qemu-wrapper.c -O3 -s -o /usr/share/qemu-wrapper && rm -rf /tmp/src

Expand Down
7 changes: 5 additions & 2 deletions img-tool
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,16 @@ fix_partuuid() {
add_settings() {
# TEMPLATE: add_settings <MOUNT_POINT>

local REGISTER=':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-wrapper:'
local REGISTER_ARMV7=':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-wrapper:'
local REGISTER_AARCH64=':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:'
if [[ $(arch) != 'armv7l' ]]; then
rich_echo "Enable qemu-arm-static"
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc 2> /dev/null || true
echo ${REGISTER} > /proc/sys/fs/binfmt_misc/register 2> /dev/null || true
echo ${REGISTER_ARMV7} > /proc/sys/fs/binfmt_misc/register 2> /dev/null || true
echo ${REGISTER_AARCH64} > /proc/sys/fs/binfmt_misc/register 2> /dev/null || true
cp '/usr/share/qemu-wrapper' "${MOUNT_POINT}/usr/bin/qemu-wrapper"
cp '/usr/share/qemu-arm-static' "${MOUNT_POINT}/usr/bin/qemu-arm-static"
cp '/usr/share/qemu-aarch64-static' "${MOUNT_POINT}/usr/bin/qemu-aarch64-static"
else rich_echo "qemu-arm-static is not need"
fi

Expand Down
Binary file added qemu-aarch64-static
Binary file not shown.

0 comments on commit bea1c00

Please sign in to comment.