xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: xen-devel@lists.xenproject.org
Cc: "Luis R. Rodriguez" <mcgrof@suse.com>
Subject: [PATCH v11 1/3] xencommons: move module list into a generic place
Date: Wed, 30 Jul 2014 09:40:01 -0700	[thread overview]
Message-ID: <1406738403-7138-2-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1406738403-7138-1-git-send-email-mcgrof@do-not-panic.com>

From: "Luis R. Rodriguez" <mcgrof@suse.com>

This will allow us to share the same module list with
systemd, and lets us upkeep it in one place. Document this
while at it on the top level README and expand on the wiki:

http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules

In order to upkeep parallelism builds be explicit about the
requirement to complete all actions before any installation
targets.

Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 README                                             | 12 ++++++++
 config/Linux.modules                               | 20 ++++++++++++
 tools/hotplug/Linux/Makefile                       | 14 ++++++---
 .../Linux/init.d/{xencommons => xencommons.in}     | 16 +---------
 tools/hotplug/Linux/update-modules.sh              | 36 ++++++++++++++++++++++
 5 files changed, 79 insertions(+), 19 deletions(-)
 create mode 100644 config/Linux.modules
 rename tools/hotplug/Linux/init.d/{xencommons => xencommons.in} (89%)
 create mode 100755 tools/hotplug/Linux/update-modules.sh

diff --git a/README b/README
index 9bbe734..0c8c7aa 100644
--- a/README
+++ b/README
@@ -183,3 +183,15 @@ There are optional targets as part of Xen's top-level makefile that will
 download and build tboot: install-tboot, build-tboot, dist-tboot, clean-tboot.
 These will download the latest tar file from the SourceForge site using wget,
 then build/install/dist according to Xen's settings.
+
+Required Kernel modules
+======================
+
+Xen has a set of Kernel modules which the init scripts ensure to load before
+before starting Xen guests. The list of modules are maintained in one place:
+
+  * config/$(XEN_OS).modules
+
+For more details refer to:
+
+http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
diff --git a/config/Linux.modules b/config/Linux.modules
new file mode 100644
index 0000000..8a764df
--- /dev/null
+++ b/config/Linux.modules
@@ -0,0 +1,20 @@
+# The file supports a simple language, comments are ignored, and if you there
+# are module replacements this can be listed by using a pipe to show preference
+# for the first module, followed by the older module.
+
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+# Prefer to load blktap2 if found, otherwise load blktap
+blktap2|blktap
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index d5de9e6..3d2d344 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -33,17 +33,23 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all:
+all: $(XENCOMMONS_INITD)
+
+$(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules $(XENCOMMONS_INITD).in
+	$(XEN_ROOT)/tools/hotplug/Linux/update-modules.sh \
+		$(XEN_ROOT) \
+		$(XEN_OS) \
+		$(XENCOMMONS_INITD) > $@
 
 .PHONY: build
-build:
+build: all
 
 .PHONY: install
 install: all install-initd install-scripts install-udev
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
-install-initd:
+install-initd: all
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
 	[ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
@@ -55,7 +61,7 @@ install-initd:
 	$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
 
 .PHONY: install-scripts
-install-scripts:
+install-scripts: all
 	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
 		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons.in
similarity index 89%
rename from tools/hotplug/Linux/init.d/xencommons
rename to tools/hotplug/Linux/init.d/xencommons.in
index 4ebd636..3939bcc 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons.in
@@ -57,21 +57,7 @@ do_start () {
         local time=0
 	local timeout=30
 
-	modprobe xen-evtchn 2>/dev/null
-	modprobe xen-gntdev 2>/dev/null
-	modprobe xen-gntalloc 2>/dev/null
-	modprobe xen-blkback 2>/dev/null
-	modprobe xen-netback 2>/dev/null
-	modprobe xen-pciback 2>/dev/null
-	modprobe evtchn 2>/dev/null
-	modprobe gntdev 2>/dev/null
-	modprobe netbk 2>/dev/null
-	modprobe blkbk 2>/dev/null
-	modprobe xen-scsibk 2>/dev/null
-	modprobe usbbk 2>/dev/null
-	modprobe pciback 2>/dev/null
-	modprobe xen-acpi-processor 2>/dev/null
-	modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null
+	@LOAD_MODULES@
 	mkdir -p /var/run/xen
 
 	if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
diff --git a/tools/hotplug/Linux/update-modules.sh b/tools/hotplug/Linux/update-modules.sh
new file mode 100755
index 0000000..692d220
--- /dev/null
+++ b/tools/hotplug/Linux/update-modules.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+set -e
+
+IFS=''
+
+XEN_ROOT=$1
+XEN_OS=$2
+XENCOMMONS_INITD=$3
+
+cat  $XEN_ROOT/config/${XEN_OS}.modules	| (
+	while read l ; do
+		if echo $l | egrep -q "^#" ; then
+			continue
+		fi
+		if echo "$l" | egrep -q "\|" ; then
+			m1=${l%%|*}
+			m2=${l#*|}
+			echo "        modprobe $m1 2>/dev/null || modprobe $m2 2>/dev/null"
+		else
+			echo "        modprobe $l 2>/dev/null"
+		fi
+	done
+) > ${XENCOMMONS_INITD}.modules
+
+cat  ${XENCOMMONS_INITD}.in	| (
+	while read l ; do
+		if echo "$l" | egrep -q "@LOAD_MODULES@" ; then
+			cat ${XENCOMMONS_INITD}.modules
+		else
+			echo $l
+		fi
+	done
+)
+
+rm -f ${XENCOMMONS_INITD}.modules
-- 
2.0.1

  reply	other threads:[~2014-07-30 16:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 16:40 [PATCH v11 0/3] xen: add systemd support Luis R. Rodriguez
2014-07-30 16:40 ` Luis R. Rodriguez [this message]
2014-07-30 16:40 ` [PATCH v11 2/3] autoconf: xen: enable explicit preference option for xenstored preference Luis R. Rodriguez
2015-09-07 16:28   ` George Dunlap
2015-09-07 20:29     ` Luis R. Rodriguez
2014-07-30 16:40 ` [PATCH v11 3/3] systemd: add xen systemd service and module files Luis R. Rodriguez
2014-08-04 14:10 ` [PATCH v11 0/3] xen: add systemd support Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406738403-7138-2-git-send-email-mcgrof@do-not-panic.com \
    --to=mcgrof@do-not-panic.com \
    --cc=mcgrof@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).