2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

QEMU User Emulator(qemu-user-static)を使うことで簡単にエミュレート環境を作成できる。
ここでは、x86_64のUbuntuでaarch64のエミュレート環境の構築を試した。

環境

CPU: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
OS: Ubuntu 22.04

ホストの設定

QEMUの設定のため、qemu-user-staticをインストール。

$ sudo apt install qemu-user-static

qemu-aarch64がenableとなっている。

$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: F
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

コンテナの起動

aarch64対応のコンテナを起動することができる。

$ docker run --rm -it arm64v8/ubuntu:22.04 /bin/bash

このコンテナではarmv8向けのバイナリが動作する。

# a.c
#include <stdio.h>
int main(void) {
  printf("Hello Arm!\n");
  return 0;
}
$ gcc -march=armv8.3-a a.c
$ ./a.out
Hello Arm!

$ objdump -d a.out 
a.out:     file format elf64-littleaarch64
:
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?