Coder Social home page Coder Social logo

kurtstam / add-aarch64-qemu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from balena-io-library/armv7hf-debian-qemu

7.0 2.0 4.0 12.95 MB

An ARM base image that includes the modified QEMU from https://github.com/resin-io/qemu/commits/qemu-execve

License: Apache License 2.0

Shell 57.59% Go 42.41%

add-aarch64-qemu's Introduction

Add cross-build capability to a Centos 7 image.

Intro

If you are like me and you are interested in building containers for the aarch64/arm64 chip architecture then you have come to the right place. This git repo adds qemu to an aarch64 Alpine 3.5 image. It also contains a go based script that allows you do start intercepting all shell commands and start executing them on qemu. This allows you to build aarch64 images on a x86 machine like dockerhub!

Use the cross-build container

We've already done the work below and our container can be found here:

https://hub.docker.com/r/project31/aarch64-centos-qemu/

Now you can start using it in your Dockerfile. Simply use

FROM docker.io/project31/aarch64-centos-qemu
RUN [ "cross-build-start" ]
...
whatever you need to do in your Dockerfile
...
RUN [ "cross-build-end" ]

For a working example see: https://hub.docker.com/r/project31/aarch64-docker-openvpn/~/dockerfile/ That's it! Or you can read on if you want to build it yourself.

Build the static aarch64 qemu binary

Feel free to skip this if you don't want to build your own qemu as a static qemu binary is already provided in the bin directory. This binary emulates a aarch64 architure while running on x86. To build it, we added a build script in the qemu directory. This script is meant to be executed inside a debian container, so use

docker run -it debian bash

and then run the build script. If you want to build a static qemu image for plain arm, you should change the --target-list=aarch64-linux-user configuration option to --target-list=arm-linux-user. Make sure to only ship one qemu library in your docker container, or the resin-xbuild.go script may get tripped up. Finally copy the qemu binary into the bin directory of this project.

Build the cross-build scripts.

Feel free to skip this step if you don't want to compile your own scripts. The cross-build scripts are meant to be executed on x86. So if you want to rebuild this script please use GOARCH=amd64. A compiled version is already supplied in the bin directory.

Build the Docker base container.

To build the docker container use

docker build . 

Reference

[1] Build ARM container on x86: https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/

add-aarch64-qemu's People

Contributors

kurtstam avatar petrosagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.