Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit bda3805

Browse files
author
Dmitry Voytik
committed
build: add --without-kmodules configure flag
Which can be used to exclude kernel modules from rootfs in the image building phase. Otherwise by default included kernel modules are copied to the resulting rootfs image. Signed-off-by: Dmitry Voytik <dmitry.voytik@huawei.com>
1 parent b635717 commit bda3805

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

build/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
all-local: initrd
22

3+
if WITH_KMODULES
4+
export INCLUDE_KMODULES=1
5+
endif
6+
37
if WITH_VBOX
48
initrd-local:
59
bash ./make-initrd.sh vbox

build/make-initrd.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ cp socat /tmp/hyperstart-rootfs/sbin/
1919
cp libm.so.6 /tmp/hyperstart-rootfs/lib64/
2020
cp mount.nfs /tmp/hyperstart-rootfs/sbin/mount.nfs4
2121

22-
if [ "$1"x = "aarch64"x ]; then
23-
echo "build hyperstart for aarch64"
24-
tar -xf modules_aarch64.tar -C /tmp/hyperstart-rootfs/lib/modules
25-
else
26-
tar -xf modules.tar -C /tmp/hyperstart-rootfs/lib/modules
22+
if [ "$INCLUDE_KMODULES"x == "1"x ]; then
23+
if [ "$1"x = "aarch64"x ]; then
24+
echo "build hyperstart for aarch64"
25+
tar -xf modules_aarch64.tar -C \
26+
/tmp/hyperstart-rootfs/lib/modules
27+
else
28+
tar -xf modules.tar -C /tmp/hyperstart-rootfs/lib/modules
29+
fi
2730
fi
2831

2932
# create symlinks to busybox and iptables

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ AS_IF([test "x$enable_daemon" = "xno"],[SYSTEMD_SYSTEMUNIT=no])
7373
AC_SUBST(SYSTEMD_SYSTEMUNIT)
7474
AM_CONDITIONAL(SYSTEMD, test "x${SYSTEMD_SYSTEMUNIT}" != "xno" )
7575

76+
AC_ARG_WITH([kmodules],
77+
AS_HELP_STRING([--without-kmodules],
78+
[Do not include kernel modules in the rootfs]), [],
79+
[])
80+
# by default kernel modules are included
81+
AS_IF([test "x$with_kmodules" = "x"],[with_kmodules=yes])
82+
AM_CONDITIONAL([WITH_KMODULES], [test "x$with_kmodules" = "xyes"])
83+
7684
AC_CHECK_FILE([/usr/include/linux/vm_sockets.h],
7785
[have_vsock=yes], [have_vsock=no])
7886
if test "x$have_vsock" == "xyes"; then
@@ -94,6 +102,7 @@ AC_MSG_RESULT([
94102
95103
with-vbox: ${with_vbox}
96104
with-aarch64: ${with_aarch64}
105+
with-kmodules: ${with_kmodules}
97106
98107
vsock-support: ${have_vsock}
99108

0 commit comments

Comments
 (0)