|
| 1 | +# qemu-register |
| 2 | + |
1 | 3 | [](https://circleci.com/gh/hypriot/qemu-register) |
2 | 4 |
|
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 | +
|
6 | 27 | ``` |
7 | 28 |
|
| 29 | +## How this works |
8 | 30 |
|
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 . |
10 | 41 | ``` |
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*' |
12 | 47 | -rwxr-xr-x 1 root root 6192520 Apr 27 11:25 /qemu-aarch64 |
13 | 48 | -rwxr-xr-x 1 root root 5606984 Apr 27 11:25 /qemu-arm |
14 | 49 | -rwxr-xr-x 1 root root 5987464 Apr 27 11:25 /qemu-ppc64le |
15 | 50 |
|
16 | | -docker run --rm hypriot/qemu-register /qemu-arm --version |
| 51 | +$ docker run --rm hypriot/qemu-register /qemu-arm --version |
17 | 52 | qemu-arm version 4.2.0 |
18 | 53 | Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers |
19 | 54 |
|
20 | | -docker run --rm hypriot/qemu-register /qemu-aarch64 --version |
| 55 | +$ docker run --rm hypriot/qemu-register /qemu-aarch64 --version |
21 | 56 | qemu-aarch64 version 4.2.0 |
22 | 57 | Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers |
23 | 58 |
|
24 | | -docker run --rm hypriot/qemu-register /qemu-ppc64le --version |
| 59 | +$ docker run --rm hypriot/qemu-register /qemu-ppc64le --version |
25 | 60 | qemu-ppc64le version 4.2.0 |
26 | 61 | Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers |
27 | 62 |
|
28 | | -docker run --rm hypriot/qemu-register /qemu-riscv64 --version |
| 63 | +$ docker run --rm hypriot/qemu-register /qemu-riscv64 --version |
29 | 64 | qemu-riscv64 version 4.2.0 |
30 | 65 | Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers |
31 | 66 | ``` |
32 | 67 |
|
33 | | - |
34 | 68 | ### Run the resulting Docker image to register the Qemu interpreters |
| 69 | + |
35 | 70 | ``` |
36 | 71 | docker run --rm --privileged hypriot/qemu-register |
37 | 72 | ``` |
38 | 73 |
|
39 | | - |
40 | 74 | ### Buy us a beer! |
41 | 75 |
|
42 | 76 | This FLOSS software is funded by donations only. Please support us to maintain and further improve it! |
|
0 commit comments