Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config
@ 2022-04-14 17:28 Francis Laniel
  2022-04-14 17:28 ` [Buildroot] [RFC PATCH v1 1/1] qemu_x86_64_docker: add new qemu defconfig Francis Laniel
  2022-04-19 21:16 ` [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Francis Laniel @ 2022-04-14 17:28 UTC (permalink / raw)
  To: buildroot; +Cc: Gerome Burlats, Romain Naour, Francis Laniel

Hi.


First, I hope you are fine and the same for your relatives.

In this contribution, I added a new qemu config for x86_64.
This configuration is mainly based on qemu_x86_64_defconfig but it adds kernel
CONFIG_ to be able to use docker.
It also adds package related to docker like DOCKER_CLI and CONTAINERD.

The CONFIG_ options added were checked with moby check-config script [1].

I was able to build and execute the image with start-qemu.sh:
Welcome to Buildroot
buildroot login: root
# docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

Sadly, the image has to a bit big (more than 300M) but I think it is fine since
this image will only be used for virtualization.

If you say any way to improve this contribution, feel free to share it!

Francis Laniel (1):
  qemu_x86_64_docker: add new qemu defconfig

 DEVELOPERS                             |   2 +
 board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
 board/qemu/x86_64_docker/post-build.sh |  11 +++
 board/qemu/x86_64_docker/readme.txt    |   7 ++
 configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
 5 files changed, 181 insertions(+)
 create mode 100644 board/qemu/x86_64_docker/linux.config
 create mode 100755 board/qemu/x86_64_docker/post-build.sh
 create mode 100644 board/qemu/x86_64_docker/readme.txt
 create mode 100644 configs/qemu_x86_64_docker_defconfig


Best regards and thank you in advance.
---
[1] https://github.com/moby/moby/blob/master/contrib/check-config.sh
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [RFC PATCH v1 1/1] qemu_x86_64_docker: add new qemu defconfig
  2022-04-14 17:28 [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Francis Laniel
@ 2022-04-14 17:28 ` Francis Laniel
  2022-04-19 21:16 ` [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Arnout Vandecappelle
  1 sibling, 0 replies; 4+ messages in thread
From: Francis Laniel @ 2022-04-14 17:28 UTC (permalink / raw)
  To: buildroot; +Cc: Gerome Burlats, Romain Naour, Francis Laniel

This defconfig permits building an image with a "docker" ready kernel and docker
related software installed.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
 DEVELOPERS                             |   2 +
 board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
 board/qemu/x86_64_docker/post-build.sh |  11 +++
 board/qemu/x86_64_docker/readme.txt    |   7 ++
 configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
 5 files changed, 181 insertions(+)
 create mode 100644 board/qemu/x86_64_docker/linux.config
 create mode 100755 board/qemu/x86_64_docker/post-build.sh
 create mode 100644 board/qemu/x86_64_docker/readme.txt
 create mode 100644 configs/qemu_x86_64_docker_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index ca9decb58f..8a6374977a 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -969,6 +969,8 @@ F:	package/ipmitool/
 F:	package/odhcploc/
 
 N:	Francis Laniel <flaniel@linux.microsoft.com>
+F:	board/qemu/x86_64_docker
+F:	configs/qemu_x86_64_docker_defconfig
 F:	package/pahole/
 F:	package/sysdig/
 F:	package/tbb/
diff --git a/board/qemu/x86_64_docker/linux.config b/board/qemu/x86_64_docker/linux.config
new file mode 100644
index 0000000000..e64b1e76e3
--- /dev/null
+++ b/board/qemu/x86_64_docker/linux.config
@@ -0,0 +1,112 @@
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_CGROUPS=y
+CONFIG_MEMCG=y
+CONFIG_BLK_CGROUP=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_CFS_BANDWIDTH=y
+CONFIG_RT_GROUP_SCHED=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_RDMA=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CPUSETS=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_CGROUP_PERF=y
+CONFIG_CGROUP_BPF=y
+CONFIG_CGROUP_MISC=y
+CONFIG_USER_NS=y
+CONFIG_SMP=y
+CONFIG_HYPERVISOR_GUEST=y
+CONFIG_PARAVIRT=y
+# CONFIG_GCC_PLUGINS is not set
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_BLK_DEV_THROTTLING=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_XFRM_USER=m
+CONFIG_INET=y
+CONFIG_INET_ESP=y
+CONFIG_NETFILTER=y
+CONFIG_BRIDGE_NETFILTER=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+CONFIG_NETFILTER_XT_MATCH_IPVS=y
+CONFIG_IP_VS=y
+CONFIG_IP_VS_PROTO_TCP=y
+CONFIG_IP_VS_PROTO_UDP=y
+CONFIG_IP_VS_RR=y
+CONFIG_IP_VS_NFCT=y
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_NAT=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_BRIDGE=y
+CONFIG_BRIDGE_VLAN_FILTERING=y
+CONFIG_VLAN_8021Q=y
+CONFIG_NET_SCHED=y
+CONFIG_NET_CLS_CGROUP=y
+CONFIG_CGROUP_NET_PRIO=y
+# CONFIG_WIRELESS is not set
+CONFIG_PCI=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_VIRTIO=y
+CONFIG_ATA=y
+CONFIG_ATA_PIIX=y
+CONFIG_NETDEVICES=y
+CONFIG_DUMMY=y
+CONFIG_MACVLAN=y
+CONFIG_IPVLAN=y
+CONFIG_VXLAN=y
+CONFIG_VETH=y
+CONFIG_VIRTIO_NET=y
+CONFIG_NE2K_PCI=y
+CONFIG_8139CP=y
+# CONFIG_WLAN is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_VIRTIO_CONSOLE=y
+CONFIG_HW_RANDOM_VIRTIO=m
+CONFIG_DRM=y
+CONFIG_DRM_QXL=y
+CONFIG_DRM_VIRTIO_GPU=y
+CONFIG_DRM_BOCHS=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_HDA_INTEL=y
+CONFIG_SND_HDA_GENERIC=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_UHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_BALLOON=y
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_EXT4_FS_SECURITY=y
+CONFIG_AUTOFS4_FS=y
+CONFIG_OVERLAY_FS=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_KEYS=y
+CONFIG_SECURITY=y
+CONFIG_SECURITY_SELINUX=y
+CONFIG_SECURITY_APPARMOR=y
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_UNWINDER_FRAME_POINTER=y
diff --git a/board/qemu/x86_64_docker/post-build.sh b/board/qemu/x86_64_docker/post-build.sh
new file mode 100755
index 0000000000..bf83a002c2
--- /dev/null
+++ b/board/qemu/x86_64_docker/post-build.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -u
+set -e
+
+# Add a console on tty1
+if [ -e ${TARGET_DIR}/etc/inittab ]; then
+    grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
+	sed -i '/GENERIC_SERIAL/a\
+tty1::respawn:/sbin/getty -L  tty1 0 vt100 # QEMU graphical window' ${TARGET_DIR}/etc/inittab
+fi
diff --git a/board/qemu/x86_64_docker/readme.txt b/board/qemu/x86_64_docker/readme.txt
new file mode 100644
index 0000000000..a7bf2b4e32
--- /dev/null
+++ b/board/qemu/x86_64_docker/readme.txt
@@ -0,0 +1,7 @@
+Run the emulation with:
+
+  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext4,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_64_docker_defconfig
+
+Optionally add -smp N to emulate a SMP system with N CPUs.
+
+The login prompt will appear in the graphical window.
diff --git a/configs/qemu_x86_64_docker_defconfig b/configs/qemu_x86_64_docker_defconfig
new file mode 100644
index 0000000000..359b1ae75f
--- /dev/null
+++ b/configs/qemu_x86_64_docker_defconfig
@@ -0,0 +1,49 @@
+# Architecture
+BR2_x86_64=y
+
+# System
+BR2_SYSTEM_DHCP="eth0"
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# The "just enough" size for all packages is 270M (found by dichotomy fround
+# 60M).
+# We add "extra" 50M so dockerd can mount /var/lib/docker and there is a bit
+# of space for some small docker images.
+BR2_TARGET_ROOTFS_EXT2_SIZE="320M"
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Image
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64_docker/post-build.sh"
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
+# Linux headers same as kernel
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.18"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64_docker/linux.config"
+BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+
+# host-qemu for gitlab testing
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
+
+# docker related package
+BR2_PACKAGE_DOCKER_CLI=y
+BR2_PACKAGE_DOCKER_COMPOSE=y
+BR2_PACKAGE_CONTAINERD=y
+BR2_PACKAGE_DOCKER_ENGINE=y
+
+# We need to be able to connect to https:// to pull docker images.
+BR2_PACKAGE_CA_CERTIFICATES=y
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config
  2022-04-14 17:28 [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Francis Laniel
  2022-04-14 17:28 ` [Buildroot] [RFC PATCH v1 1/1] qemu_x86_64_docker: add new qemu defconfig Francis Laniel
@ 2022-04-19 21:16 ` Arnout Vandecappelle
  2022-04-21 16:30   ` Francis Laniel
  1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2022-04-19 21:16 UTC (permalink / raw)
  To: Francis Laniel, buildroot; +Cc: Gerome Burlats, Romain Naour



On 14/04/2022 19:28, Francis Laniel wrote:
> Hi.
> 
> 
> First, I hope you are fine and the same for your relatives.
> 
> In this contribution, I added a new qemu config for x86_64.
> This configuration is mainly based on qemu_x86_64_defconfig but it adds kernel
> CONFIG_ to be able to use docker.
> It also adds package related to docker like DOCKER_CLI and CONTAINERD.

  We don't like adding "demo" defconfigs that are basically another defconfig 
with some packages enabled. It's true that there is some value to knowing which 
combination of packages can provide a certain super-feature, but the problem is 
that the basic config (in this case, qemu_x86_64) is not going to be useful for 
most people.

  In this particular case, there isn't even that much "combination". Just 
docker-engine and docker-cli.

  The kernel config options do have value, but these should instead be set by 
containerd (or docker-engine, or docker-proxy, as appropriate), using 
CONTAINERD_LINUX_CONFIG_FIXUPS.


  Regards,
  Arnout


> 
> The CONFIG_ options added were checked with moby check-config script [1].
> 
> I was able to build and execute the image with start-qemu.sh:
> Welcome to Buildroot
> buildroot login: root
> # docker run --rm hello-world
> Unable to find image 'hello-world:latest' locally
> latest: Pulling from library/hello-world
> 2db29710123e: Pull complete
> Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
> Status: Downloaded newer image for hello-world:latest
> 
> Hello from Docker!
> This message shows that your installation appears to be working correctly.
> 
> Sadly, the image has to a bit big (more than 300M) but I think it is fine since
> this image will only be used for virtualization.
> 
> If you say any way to improve this contribution, feel free to share it!
> 
> Francis Laniel (1):
>    qemu_x86_64_docker: add new qemu defconfig
> 
>   DEVELOPERS                             |   2 +
>   board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
>   board/qemu/x86_64_docker/post-build.sh |  11 +++
>   board/qemu/x86_64_docker/readme.txt    |   7 ++
>   configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
>   5 files changed, 181 insertions(+)
>   create mode 100644 board/qemu/x86_64_docker/linux.config
>   create mode 100755 board/qemu/x86_64_docker/post-build.sh
>   create mode 100644 board/qemu/x86_64_docker/readme.txt
>   create mode 100644 configs/qemu_x86_64_docker_defconfig
> 
> 
> Best regards and thank you in advance.
> ---
> [1] https://github.com/moby/moby/blob/master/contrib/check-config.sh
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config
  2022-04-19 21:16 ` [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Arnout Vandecappelle
@ 2022-04-21 16:30   ` Francis Laniel
  0 siblings, 0 replies; 4+ messages in thread
From: Francis Laniel @ 2022-04-21 16:30 UTC (permalink / raw)
  To: buildroot, Arnout Vandecappelle; +Cc: Gerome Burlats, Romain Naour

Hi.

Le mardi 19 avril 2022, 22:16:43 BST Arnout Vandecappelle a écrit :
> On 14/04/2022 19:28, Francis Laniel wrote:
> > Hi.
> > 
> > 
> > First, I hope you are fine and the same for your relatives.
> > 
> > In this contribution, I added a new qemu config for x86_64.
> > This configuration is mainly based on qemu_x86_64_defconfig but it adds
> > kernel CONFIG_ to be able to use docker.
> > It also adds package related to docker like DOCKER_CLI and CONTAINERD.
> 
>   We don't like adding "demo" defconfigs that are basically another
> defconfig with some packages enabled. It's true that there is some value to
> knowing which combination of packages can provide a certain super-feature,
> but the problem is that the basic config (in this case, qemu_x86_64) is not
> going to be useful for most people.
> 
>   In this particular case, there isn't even that much "combination". Just
> docker-engine and docker-cli.
> 
>   The kernel config options do have value, but these should instead be set
> by containerd (or docker-engine, or docker-proxy, as appropriate), using
> CONTAINERD_LINUX_CONFIG_FIXUPS.

Sorry, I did not check docker-engine.mk before writing this contribution.
I was not aware of PACKAGE_NAME_LINUX_CONFIG_FIXUPS and will rework my sysdig 
0.29.1 contribution to make use ot it!

> 
>   Regards,
>   Arnout
> 
> > The CONFIG_ options added were checked with moby check-config script [1].
> > 
> > I was able to build and execute the image with start-qemu.sh:
> > Welcome to Buildroot
> > buildroot login: root
> > # docker run --rm hello-world
> > Unable to find image 'hello-world:latest' locally
> > latest: Pulling from library/hello-world
> > 2db29710123e: Pull complete
> > Digest:
> > sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
> > Status: Downloaded newer image for hello-world:latest
> > 
> > Hello from Docker!
> > This message shows that your installation appears to be working correctly.
> > 
> > Sadly, the image has to a bit big (more than 300M) but I think it is fine
> > since this image will only be used for virtualization.
> > 
> > If you say any way to improve this contribution, feel free to share it!
> > 
> > Francis Laniel (1):
> >    qemu_x86_64_docker: add new qemu defconfig
> >   
> >   DEVELOPERS                             |   2 +
> >   board/qemu/x86_64_docker/linux.config  | 112 +++++++++++++++++++++++++
> >   board/qemu/x86_64_docker/post-build.sh |  11 +++
> >   board/qemu/x86_64_docker/readme.txt    |   7 ++
> >   configs/qemu_x86_64_docker_defconfig   |  49 +++++++++++
> >   5 files changed, 181 insertions(+)
> >   create mode 100644 board/qemu/x86_64_docker/linux.config
> >   create mode 100755 board/qemu/x86_64_docker/post-build.sh
> >   create mode 100644 board/qemu/x86_64_docker/readme.txt
> >   create mode 100644 configs/qemu_x86_64_docker_defconfig
> > 
> > Best regards and thank you in advance.
> > ---
> > [1] https://github.com/moby/moby/blob/master/contrib/check-config.sh

Best regards.


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-21 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-14 17:28 [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Francis Laniel
2022-04-14 17:28 ` [Buildroot] [RFC PATCH v1 1/1] qemu_x86_64_docker: add new qemu defconfig Francis Laniel
2022-04-19 21:16 ` [Buildroot] [RFC PATCH v1 0/1] New "docker" ready qemu config Arnout Vandecappelle
2022-04-21 16:30   ` Francis Laniel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox