summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-09-14 13:46:45 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-09-15 12:14:28 -1000
commit08c4b18dc972a862d4c8cdcc365ba5215399109f (patch)
tree2ec5b417b633e1abfeb0fca4fbdad18c41aa9217 /scripts
parentec718c574e4822d60b9bbad8f0016d0b851a994d (diff)
downloadanaconda-08c4b18dc972a862d4c8cdcc365ba5215399109f.tar.gz
anaconda-08c4b18dc972a862d4c8cdcc365ba5215399109f.tar.xz
anaconda-08c4b18dc972a862d4c8cdcc365ba5215399109f.zip
Collect all modules from modules.{ccwmap|networking} on s390x (#522519)
Collect all modules listed in modules.ccwmap and modules.networking for inclusion in the initrd.img for s390x. Removed some module names from mk-images.s390 that don't appear to exist anywhere in the kernel RPM anymore. Use $S390EXTRAMODS to list modules for inclusion that are not in a mapfile. Added expandModuleDeps() to make sure dependent modules are collected.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mk-images.s39054
1 files changed, 50 insertions, 4 deletions
diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390
index b3e9db1a5..94b72f23d 100644
--- a/scripts/mk-images.s390
+++ b/scripts/mk-images.s390
@@ -17,10 +17,56 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-S390SCSIMODS="zfcp tape390"
-S390DASDMODS=" dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod"
-S390NETMODS="ctc netiucv smsgiucv lcs qdio qeth ccwgroup crypto_api xfrm_nalgo"
-S390MODS="$S390SCSIMODS $S390DASDMODS $S390NETMODS"
+collectModuleNames() {
+ grep -v "^#" ${KERNELROOT}/lib/modules/${version}/modules.${1} | \
+ cut -d ' ' -f 1 | sort | uniq | \
+ sed -e 's|\.ko$||g' | \
+ tr '\n' ' '
+}
+
+expandModuleDeps() {
+ MODS="$*"
+ DEPS=
+
+ DEPSFILE="$(mktemp ${TMPDIR:-/tmp}/moduledeps.XXXXXX)"
+ echo "${MODS}" | tr ' ' '\n' > "${DEPSFILE}"
+
+ cd ${KERNELROOT}
+
+ while [ true ]; do
+ beforeCount="$(wc -l "${DEPSFILE}" | cut -d ' ' -f 1)"
+
+ while read module ; do
+ modulePath="$(find ${KERNELROOT}/lib/modules/${version} -name "${module}.ko")"
+ if [ -z "${modulePath}" ]; then
+ echo "ERROR: Missing ${module}.ko on s390" >&2
+ continue
+ fi
+
+ deps="$(modinfo -F depends ${modulePath})"
+
+ if [ ! -z "${deps}" ]; then
+ echo "${deps}" | tr ',' '\n' >> ${DEPSFILE}
+ fi
+ done < "${DEPSFILE}"
+
+ sort "${DEPSFILE}" | uniq > "${DEPSFILE}.new"
+ mv "${DEPSFILE}.new" "${DEPSFILE}"
+ afterCount="$(wc -l "${DEPSFILE}" | cut -d ' ' -f 1)"
+
+ if [ ${beforeCount} -eq ${afterCount} ]; then
+ break
+ fi
+ done
+
+ cat "${DEPSFILE}" | tr '\n' ' '
+ rm -f "${DEPSFILE}"
+}
+
+S390CCWMODS="$(collectModuleNames ccwmap)"
+S390NETMODS="$(collectModuleNames networking)"
+S390EXTRAMODS="dasd_diag_mod smsgiucv"
+S390MODS="$(expandModuleDeps $S390CCWMODS $S390NETMODS $S390EXTRAMODS)"
makeBootImages() {
makeinitrd --initrdto $TOPDESTPATH/images/initrd.img \