[PATCH 3/3] Collect all modules from modules.{ccwmap|networking} on s390x (#522519)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 scripts/mk-images.s390 |   54 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390
index b3e9db1..94b72f2 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 \
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux