From 893233382111bd1752ee5f054c5d03c3ee8add6b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Wed, 28 Mar 2012 08:23:32 +0000 Subject: [PATCH] - rel 2; module-init-tools needs old find_modules_by_class version Changed files: geninitrd-svn.patch -> 2.14 geninitrd.spec -> 2.203 --- geninitrd-svn.patch | 94 +++++++++++++++++++++++++++++++++++++++------ geninitrd.spec | 4 +- 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/geninitrd-svn.patch b/geninitrd-svn.patch index 7581203..a2efb9f 100644 --- a/geninitrd-svn.patch +++ b/geninitrd-svn.patch @@ -1,15 +1,85 @@ -Index: geninitrd +Index: functions =================================================================== ---- geninitrd (wersja 12474) -+++ geninitrd (kopia robocza) -@@ -792,8 +792,8 @@ - if (c ~ "^" dev_pattern "$") partition = c; - } +--- functions (wersja 12519) ++++ functions (kopia robocza) +@@ -167,10 +167,21 @@ + printf "/dev/mapper/%s" $(dm_name "$node") + } -- $4 ~ partition { maj = $1; min = $2; } -- $1 ~ maj && $2 ~ min { partition = $4; } -+ $4 == partition { maj = $1; min = $2; } -+ $1 == maj && $2 == min { partition = $4; } +-# find modules by class eg ++# find modules by class + # find_modules_by_class 0106 - finds modules for SATA devices in the system + # find_modules_by_class 0c03 - finds modules for USB controllers + find_modules_by_class() { ++ if (modprobe --version | grep -q "^kmod"); then ++ find_modules_by_class_kmod $@ ++ else ++ find_modules_by_class_mit $@ ++ fi ++} ++ ++# find modules by class (kmod version) ++# find_modules_by_class 0106 - finds modules for SATA devices in the system ++# find_modules_by_class 0c03 - finds modules for USB controllers ++find_modules_by_class_kmod() { + local req_class="$1" i j modaliases - END { - if (maj >= 0 && min >= 0) { + if [ ! -d "/sys/devices" ]; then +@@ -206,3 +217,56 @@ + } + ' + } ++ ++# find modules by class (module-init-tools version) ++# find_modules_by_class 0106 - finds modules for SATA devices in the system ++# find_modules_by_class 0c03 - finds modules for USB controllers ++find_modules_by_class_mit() { ++ local req_class="$1" ++ ++ pcimap="/lib/modules/$kernel/modules.pcimap" ++ ++ lspci=$(find_tool /sbin/lspci) ++ if [ ! -x "$lspci" ]; then ++ warn "Failed to execute lspci. Is pciutils package installed?" ++ fi ++ ++ # no pcimap, nothing to lookup from ++ if [ ! -f "$pcimap" ]; then ++ warn "No $pcimap file. Cannot find modules for desired class!" ++ return ++ fi ++ ++ if [ -z "$lspci" ]; then ++ return ++ fi ++ ++ LC_ALL=C lspci -p "$pcimap" -kvmmn | awk -vreq_class="${req_class}" ' ++ BEGIN { skip_modules[notexisting_module]=""; modules[1]=""; xhci=""; ehci=""; ohci=""; uhci="" } ++ /^Slot:/ { found=0 } ++ /^Class:/ { if (req_class == $2) { found=1 } } ++ /^Driver:/ { if (found) { ++ module=$2; ++ if (module == "xhci_hcd") { ++ xhci="xhci_hcd" ++ } else if (module == "ehci_hcd") { ++ ehci="ehci_hcd" ++ } else if (module == "ohci_hcd") { ++ ohci="ohci_hcd" ++ } else if (module == "uhci_hcd") { ++ uhci="uhci_hcd" ++ } else if (!(module in skip_modules)) { ++ modules[cnt]=module ++ } ++ skip_modules[module]=1; ++ }; ++ found=0 ++ } ++ END { ++ # xhci/ehci/ohci/uhci hack to preserve such order ++ printf "%s %s %s %s ", xhci, ehci, ohci, uhci; ++ for (i in modules) { printf "%s ", modules[i]; }; ++ } ++ ' ++} ++ + diff --git a/geninitrd.spec b/geninitrd.spec index dd2e588..e080937 100644 --- a/geninitrd.spec +++ b/geninitrd.spec @@ -7,7 +7,7 @@ Summary: Creates an initial ramdisk image for preloading modules Summary(pl.UTF-8): Narzędzie do tworzenia inicjalnego ramdysku używanego przy starcie systemu Name: geninitrd Version: 12517 -Release: 1 +Release: 2 License: GPL Group: Applications/System Source0: %{name}-%{version}.tar.gz @@ -96,7 +96,7 @@ bieżących informacji zawartych w /etc/modules.conf. %patch0 -p1 %patch1 -p1 %endif -#%patch2 -p0 +%patch2 -p0 %build %{__make} -- 2.44.0