summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch45
-rw-r--r--recipes-containers/lxc/lxc_git.bb1
2 files changed, 46 insertions, 0 deletions
diff --git a/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch b/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch
new file mode 100644
index 00000000..760ebe64
--- /dev/null
+++ b/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch
@@ -0,0 +1,45 @@
1From 2789860daaa7780e1542bb1c60a89860e5661739 Mon Sep 17 00:00:00 2001
2From: Xiangyu Chen <xiangyu.chen@windriver.com>
3Date: Wed, 1 Mar 2023 09:25:35 +0800
4Subject: [PATCH] template: if busybox contains init, use it in container
5
6The lxc test code using busybox template, some cases would be failed or hang
7if the init progress not from busybox. This cause ptest report lots of failed.
8
9The changes is checking whether the busybox has built-in init, if it has,use it.
10
11Upstream-Status: Inappropriate [embedded specific]
12
13Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
14---
15 templates/lxc-busybox.in | 14 ++++++++++----
16 1 file changed, 10 insertions(+), 4 deletions(-)
17
18diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
19index dab7c1faf..e2beae7a4 100755
20--- a/templates/lxc-busybox.in
21+++ b/templates/lxc-busybox.in
22@@ -184,10 +184,16 @@ configure_busybox()
23 return 1
24 fi
25
26- # copy bash binary as the container init
27- if ! cp "$(which bash)" "${rootfs}/sbin/init"; then
28- echo "ERROR: Failed to copy bash binary"
29- return 1
30+ # checking whether busybox has init or not
31+ if ! ${rootfs}/bin/busybox --list | grep "init" > /dev/null; then
32+ # copy bash binary as the container init
33+ if ! cp "$(which bash)" "${rootfs}/sbin/init"; then
34+ echo "ERROR: Failed to copy bash binary"
35+ return 1
36+ fi
37+ else
38+ # relink /sbin/init
39+ ln "${rootfs}/bin/busybox" "${rootfs}/sbin/init"
40 fi
41
42
43--
442.34.1
45
diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb
index d695467b..bf9ff5f3 100644
--- a/recipes-containers/lxc/lxc_git.bb
+++ b/recipes-containers/lxc/lxc_git.bb
@@ -44,6 +44,7 @@ SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-5.0;protocol=https \
44 file://templates-use-curl-instead-of-wget.patch \ 44 file://templates-use-curl-instead-of-wget.patch \
45 file://0001-download-don-t-try-compatbility-index.patch \ 45 file://0001-download-don-t-try-compatbility-index.patch \
46 file://tests-our-init-is-not-busybox.patch \ 46 file://tests-our-init-is-not-busybox.patch \
47 file://0001-template-if-busybox-contains-init-use-it-in-containe.patch \
47 file://dnsmasq.conf \ 48 file://dnsmasq.conf \
48 file://lxc-net \ 49 file://lxc-net \
49 " 50 "