Skip to content

Commit 089043c

Browse files
committed
Update README.md
Added the sample of external using. Cleanup
1 parent 1a5741a commit 089043c

File tree

1 file changed

+45
-11
lines changed

1 file changed

+45
-11
lines changed

README.md

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,76 @@
1+
# qemu-register
2+
13
[![Build Status](https://circleci.com/gh/hypriot/qemu-register.svg?style=svg)](https://circleci.com/gh/hypriot/qemu-register)
24

3-
### Build Docker image
4-
```
5-
./build.sh
5+
qemu-register – is the docker-image providing `qemu-static` binaries for your cross-platform projects.
6+
7+
A simple way to register `qemu` usermode emulation binaries for your kernel:
8+
9+
```docker
10+
FROM hypriot/qemu-register as qemu
11+
12+
# Fetching your base image (you can select another one)
13+
FROM alpine
14+
15+
# Coping compiled binaries to your image
16+
COPY --from=qemu /qemu-aarch64 /qemu-arm
17+
COPY --from=qemu /qemu-aarch64 /qemu-aarch64
18+
COPY --from=qemu /qemu-aarch64 /qemu-ppc64le
19+
COPY --from=qemu /qemu-aarch64 /qemu-riscv64
20+
21+
# Coping & executing script for registering qemu in the kernel
22+
COPY --from=qemu /register.sh /register.sh
23+
RUN /register.sh --reset
24+
25+
# PUT HERE YOUR INSTRUCTIONS!!!
26+
627
```
728

29+
## How this works
830

9-
### Check Qemu binaries and versions
31+
Starting with the Linux kernel 4.8, there's a mechanism in the kernel to load the interpreter specified in your `binfmt_misc` ahead of time (and make sure it stays in memory even if the interpreter file is deleted or moved). This is described in better detail in [this blog post by npmccallum](https://npmccallum.gitlab.io/post/foreign-architecture-docker/), [nmpccallum`s github](https://github.com/npmccallum/qemu-register) and in the [kernel binfmt_misc docs](https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst).
32+
33+
### Build Docker image
34+
35+
If you wanna build your own qemu-register using next instruction:
36+
37+
```bash
38+
git clone https://github.com/hypriot/qemu-register.git
39+
cd qemu-register
40+
docker build -t hypriot/qemu-register:local .
1041
```
11-
docker run --rm hypriot/qemu-register sh -c 'ls -al /qemu*'
42+
43+
### Check Qemu binaries and versions
44+
45+
```bash
46+
$ docker run --rm hypriot/qemu-register sh -c 'ls -al /qemu*'
1247
-rwxr-xr-x 1 root root 6192520 Apr 27 11:25 /qemu-aarch64
1348
-rwxr-xr-x 1 root root 5606984 Apr 27 11:25 /qemu-arm
1449
-rwxr-xr-x 1 root root 5987464 Apr 27 11:25 /qemu-ppc64le
1550

16-
docker run --rm hypriot/qemu-register /qemu-arm --version
51+
$ docker run --rm hypriot/qemu-register /qemu-arm --version
1752
qemu-arm version 4.2.0
1853
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
1954

20-
docker run --rm hypriot/qemu-register /qemu-aarch64 --version
55+
$ docker run --rm hypriot/qemu-register /qemu-aarch64 --version
2156
qemu-aarch64 version 4.2.0
2257
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
2358

24-
docker run --rm hypriot/qemu-register /qemu-ppc64le --version
59+
$ docker run --rm hypriot/qemu-register /qemu-ppc64le --version
2560
qemu-ppc64le version 4.2.0
2661
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
2762

28-
docker run --rm hypriot/qemu-register /qemu-riscv64 --version
63+
$ docker run --rm hypriot/qemu-register /qemu-riscv64 --version
2964
qemu-riscv64 version 4.2.0
3065
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
3166
```
3267

33-
3468
### Run the resulting Docker image to register the Qemu interpreters
69+
3570
```
3671
docker run --rm --privileged hypriot/qemu-register
3772
```
3873

39-
4074
### Buy us a beer!
4175

4276
This FLOSS software is funded by donations only. Please support us to maintain and further improve it!

0 commit comments

Comments
 (0)