Giter VIP home page Giter VIP logo

dockerfile-qemu-arm-chroot's Introduction

Overview

Run ARM binaries from within a docker container on your x86_64 system. This can assist with cross compiling ARM systems from within docker, or a variety of other tasks.

ScreenShot

Assumption

This assumes a docker host kernel with binfmt_misc support (module or built-in).

There are two pieces to this docker PoC. A data container (where we store our images) and the actual emulation system image.

Installation

  1. add an ARM system image to data/images in this directory for later mounting on loopback interface (once we're in the docker container)
  1. build the data image container (make inside data/) -- this stores your system images in a separate container than the running system

  2. run the data container once (if you don't understand why, see https://docs.docker.com/userguide/dockervolumes/).

  3. build the qemu-arm image (run make inside qemu-arm/).

Basically:

pushd data && make
docker run --name qemu-arm_data --entrypoint="/bin/true" -d qemu-arm-data
popd
pushd qemu-arm
make
popd
docker run --privileged -t -i --rm --volumes-from qemu-arm_data qemu-arm

In container, make sure binfmt is mounted (mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc)

Running

now in the docker container shell:

If mounting a system image:

mkdir -p /chroot
mount -o loop /data/images/<your image>.bin /chroot
cd /chroot
cp /usr/bin/qemu-arm-static /chroot/usr/bin/qemu-arm-static
chroot . /bin/sh

Otherwise just cd into your system image folder, copy qemu-arm-static into chroot/usr/bin and then chroot . /bin/sh.

Try running uname -a or running some files inside your chroot.

Troubleshooting

  • Maybe your host docker kernel doesn't have binfmt_misc support. I build a custom boot2docker kernel for this here.

  • Try checking update-binfmts --display to see if qemu-arm-static is registered

  • Make sure binfmts is mounted (mount) - if not mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc

Related reading

dockerfile-qemu-arm-chroot's People

Contributors

dweinstein avatar neophob avatar

Watchers

 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.