[Buildroot] [RFC PATCH 2/5] board/guest: documentation and sample files
Francois Perrad
fperrad at gmail.com
Tue Mar 17 15:56:29 UTC 2020
Signed-off-by: Francois Perrad <francois.perrad at gadz.org>
---
board/guest/Dockerfile | 3 +++
board/guest/readme.txt | 53 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 board/guest/Dockerfile
create mode 100644 board/guest/readme.txt
diff --git a/board/guest/Dockerfile b/board/guest/Dockerfile
new file mode 100644
index 000000000..712a134c9
--- /dev/null
+++ b/board/guest/Dockerfile
@@ -0,0 +1,3 @@
+FROM scratch
+ADD rootfs.tar /
+CMD ["/bin/ash"]
diff --git a/board/guest/readme.txt b/board/guest/readme.txt
new file mode 100644
index 000000000..0ee9d6b15
--- /dev/null
+++ b/board/guest/readme.txt
@@ -0,0 +1,53 @@
+Container - Guest
+
+Intro
+=====
+
+Buildroot supports some OS-level virtualization tools: Docker, LXC, systemd-nspawn.
+These tools are built on an host image.
+
+A container could be created from a rootfs (guest image) built by Buildroot with a guest_*_defconfig
+
+The following defconfig are available:
+ - guest_arm_a7_defconfig
+ - guest_arm_a9_defconfig
+ - guest_x86_64_defconfig
+
+The artifact produced by these defconfig is the file output/images/rootfs.tar.
+The guest has no bootloader, no kernel, no init system.
+
+How to with Docker
+==================
+
+A Docker image could created with a Dockerfile and few commands are needed:
+
+ # dockerd &
+
+ $ cat Dockerfile
+ FROM scratch
+ ADD rootfs.tar /
+ CMD ["/bin/ash"]
+ $ docker build --tag br:guest .
+ $ docker images
+ REPOSITORY TAG IMAGE ID CREATED SIZE
+ br guest 0c54c85a3452 42 seconds ago 1.75MB
+
+The Docker image could be exported and imported with the commands `docker save` and `docker load`.
+
+And the Docker image could be launched:
+
+ $ docker run -it br:guest
+ / # ls -l /bin/sh
+ lrwxrwxrwx 1 root root 7 Mar 11 15:46 /bin/sh -> busybox
+ / # exit
+
+How to with systemd-nspawn
+==========================
+
+Extract rootfs.tar in a directory container.
+
+ # systemd-nspawn -D container
+ # ls -l /bin/sh
+ lrwxrwxrwx 1 1002 1002 7 Mar 11 15:46 /bin/sh -> busybox
+ # exit
+
--
2.17.1
More information about the buildroot
mailing list