SVN: geninitrd/trunk/functions
Author: arekm Date: Thu Apr 25 09:02:05 2013 New Revision: 12654 Modified: geninitrd/trunk/functions Log: Handle ehci_pci module, too (this whole function is crap). Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Apr 25 09:02:05 2013 @@ -212,6 +212,8 @@ module=$1 if (module == xhci_hcd) { xhci=xhci_hcd + } else if (module == ehci_pci) { + ehci_pci=ehci_pci } else if (module == ehci_hcd) { ehci=ehci_hcd } else if (module == ohci_hcd) { @@ -225,7 +227,7 @@ } END { # xhci/ehci/ohci/uhci hack to preserve such order - printf %s %s %s %s , xhci, ehci, ohci, uhci; + printf %s %s %s %s %s , xhci, ehci_pci, ehci, ohci, uhci; for (i in modules) { printf %s , modules[i]; }; } ' @@ -262,6 +264,8 @@ module = $2; if (module == xhci_hcd) { xhci = xhci_hcd + } else if (module == ehci_pci) { + ehci_pci=ehci_pci } else if (module == ehci_hcd) { ehci = ehci_hcd } else if (module == ohci_hcd) { @@ -277,7 +281,7 @@ } END { # xhci/ehci/ohci/uhci hack to preserve such order - printf %s %s %s %s , xhci, ehci, ohci, uhci; + printf %s %s %s %s %s , xhci, ehci_pci, ehci, ohci, uhci; for (i in modules) { printf %s , modules[i]; } } ' ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Thu Apr 25 09:20:17 2013 New Revision: 12655 Modified: geninitrd/trunk/functions Log: Load ehci_platform, too. Load xhci as last (follow dracut way). Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Apr 25 09:20:17 2013 @@ -207,15 +207,17 @@ fi echo $modaliases | xargs modprobe --set-version $kernel -aRn | awk ' - BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } + BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci_pci=; ehci_hcd=; ehci_platform=; ohci=; uhci= } { module=$1 if (module == xhci_hcd) { xhci=xhci_hcd + } else if (module == ehci_hcd) { + ehci_hcd=ehci_hcd } else if (module == ehci_pci) { ehci_pci=ehci_pci - } else if (module == ehci_hcd) { - ehci=ehci_hcd + } else if (module == ehci_platform) { + ehci_platform=ehci_platform } else if (module == ohci_hcd) { ohci=ohci_hcd } else if (module == uhci_hcd) { @@ -226,8 +228,8 @@ skip_modules[module]=1; } END { - # xhci/ehci/ohci/uhci hack to preserve such order - printf %s %s %s %s %s , xhci, ehci_pci, ehci, ohci, uhci; + # ehci/ohci/uhci/xhci hack to preserve such order + printf %s %s %s %s %s %s , ehci_hcd, ehci_pci, ehci_platform, ohci, uhci, xhci; for (i in modules) { printf %s , modules[i]; }; } ' @@ -257,17 +259,19 @@ fi LC_ALL=C lspci -p $pcimap -kvmmn | awk -vreq_class=${req_class} ' - BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } + BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci_pci=; ehci_hcd=; ehci_platform=; 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_hcd = ehci_hcd } else if (module == ehci_pci) { ehci_pci=ehci_pci - } else if (module == ehci_hcd) { - ehci = ehci_hcd + } else if (module == ehci_platform) { + ehci_platform=ehci_platform } else if (module == ohci_hcd) { ohci = ohci_hcd } else if (module == uhci_hcd) { @@ -280,8 +284,8 @@ found=0 } END { - # xhci/ehci/ohci/uhci hack to preserve such order - printf %s %s %s %s %s , xhci, ehci_pci, ehci, ohci, uhci; + # ehci/ohci/uhci/xhci hack to preserve such order + printf %s %s %s %s %s %s , ehci_hcd, ehci_pci, ehci_platform, ohci, uhci, xhci; for (i in modules) { printf %s , modules[i]; } } ' ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Tue Apr 17 18:50:53 2012 New Revision: 12552 Modified: geninitrd/trunk/functions Log: dm_subsystem: ignore dmsetup output if exit code is not zero Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Apr 17 18:50:53 2012 @@ -159,7 +159,7 @@ dm_subsystem() { local node=$1 out out=$(dmsetup info -c --noheadings -o subsystem $node) - if [ -n $out ]; then + if [ $? -eq 0 -a -n $out ]; then echo $out return fi ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Mon Apr 16 18:02:52 2012 New Revision: 12548 Modified: geninitrd/trunk/functions Log: workaround for subsystem being empty on lvm2 2.02.72 on 2.6.16 kernel Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Apr 16 18:02:52 2012 @@ -157,8 +157,16 @@ # node can be /dev/dm-0, /dev/mapper/name # @return subsystem name dm_subsystem() { - local node=$1 - dmsetup info -c --noheadings -o subsystem $node + local node=$1 out + out=$(dmsetup info -c --noheadings -o subsystem $node) + if [ -n $out ]; then + echo $out + return + fi + + # for very old kernels (2.6.16), subsystem is empty, assume LVM + # TODO: fix this if needed to have crypt as well + echo LVM } # resolve any dm node to it's full path in /dev/mapper ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Fri Mar 30 18:28:15 2012 New Revision: 12531 Modified: geninitrd/trunk/functions Log: More local variables (in find_modules_by_class_mit). Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Fri Mar 30 18:28:15 2012 @@ -227,7 +227,7 @@ # 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 + local req_class=$1 pcimap lspci pcimap=/lib/modules/$kernel/modules.pcimap ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Thu Mar 29 19:12:08 2012 New Revision: 12525 Modified: geninitrd/trunk/functions Log: Handle case when no modaliases were found. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Mar 29 19:12:08 2012 @@ -193,6 +193,11 @@ j=$(dirname $i) modaliases=$modaliases $(cat $j/modalias) done + + if [ -z $modaliases ]; then + return + fi + echo $modaliases | xargs modprobe --set-version $kernel -aRn | awk ' BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } { ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Wed Mar 28 10:23:55 2012 New Revision: 12520 Modified: geninitrd/trunk/functions Log: Unfortunately module-init-tools modprobe doesn't work with new way. Provide old find_modules_by_class() for mit and new for kmod. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Mar 28 10:23:55 2012 @@ -167,10 +167,21 @@ printf /dev/mapper/%s $(dm_name $node) } -# 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 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]; }; + } + ' +} + ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Wed Mar 28 10:44:51 2012 New Revision: 12521 Modified: geninitrd/trunk/functions Log: no need for subshells, formatting Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Mar 28 10:44:51 2012 @@ -6,7 +6,7 @@ # # @param string $fstab location of /etc/fstab # @return false on failure -# +# # Sets global variables: # - $rootdev # - $rootdev_add @@ -171,7 +171,7 @@ # 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 + if modprobe --version | grep -q ^kmod; then find_modules_by_class_kmod $@ else find_modules_by_class_mit $@ @@ -233,7 +233,7 @@ # no pcimap, nothing to lookup from if [ ! -f $pcimap ]; then - warn No $pcimap file. Cannot find modules for desired class! + warn No $pcimap file. Cannot find modules for desired class! return fi @@ -242,31 +242,31 @@ 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]; }; - } + 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]; } + } ' } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Sat Mar 24 21:58:34 2012 New Revision: 12516 Modified: geninitrd/trunk/functions Log: Dry run for modprobe. We need names only. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Mar 24 21:58:34 2012 @@ -182,7 +182,7 @@ j=$(dirname $i) modaliases=$modaliases $(cat $j/modalias) done - echo $modaliases | xargs modprobe --set-version $kernel -aR | awk ' + echo $modaliases | xargs modprobe --set-version $kernel -aRn | awk ' BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } { module=$1 ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Sat Mar 24 21:49:55 2012 New Revision: 12515 Modified: geninitrd/trunk/functions Log: Our find_modules_by_class() relied on lspci and on modules.pcimap file generated by module-init-tools. Unfortunately kmod no longer generates modules.pcimap. Rewrite to use sysfs and modprobe only. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Mar 24 21:49:55 2012 @@ -171,51 +171,38 @@ # 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() { - local req_class=$1 + local req_class=$1 i j modaliases - 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! + if [ ! -d /sys/devices ]; then + warn No /sys/devices/ found. Is /sys mounted? 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]; }; - } + for i in $(grep -li ^0x${req_class} /sys/devices/pci*/*/class); do + j=$(dirname $i) + modaliases=$modaliases $(cat $j/modalias) + done + echo $modaliases | xargs modprobe --set-version $kernel -aR | awk ' + BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } + { + module=$1 + 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; + } + 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]; }; + } ' } - ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Sat Mar 24 21:06:02 2012 New Revision: 12513 Modified: geninitrd/trunk/functions Log: Warn about missing pcimap file (unfortunately kmod doesn't generate it). Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Mar 24 21:06:02 2012 @@ -182,6 +182,7 @@ # no pcimap, nothing to lookup from if [ ! -f $pcimap ]; then + warn No $pcimap file. Cannot find modules for desired class! return fi ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Sat Mar 24 21:40:24 2012 New Revision: 12514 Modified: geninitrd/trunk/functions Log: Properly skip duplicated when finding modules. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Mar 24 21:40:24 2012 @@ -191,7 +191,7 @@ fi LC_ALL=C lspci -p $pcimap -kvmmn | awk -vreq_class=${req_class} ' - BEGIN { skip_modules[1]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } + BEGIN { skip_modules[notexisting_module]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } /^Slot:/ { found=0 } /^Class:/ { if (req_class == $2) { found=1 } } /^Driver:/ { if (found) { @@ -207,8 +207,7 @@ } else if (!(module in skip_modules)) { modules[cnt]=module } - skip_modules[cnt]=module; - cnt++; + skip_modules[module]=1; }; found=0 } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Wed Oct 26 21:52:24 2011 New Revision: 12391 Modified: geninitrd/trunk/functions Log: Use lspci only for finding kernel modules. Our shell code was full of bugs. Also try to preserve xhci/ehco/ohci/uhci modules loading order. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Oct 26 21:52:24 2011 @@ -189,23 +189,33 @@ return fi - set -- $($lspci -n | awk -vclass=$req_class '$2 == class: {split($3, p, :); printf(0x%s 0x%s\n, p[1], p[2])}') - - req_class=0x${req_class}00 - - local PCI_ANY_ID=0x pci_module vendor device subvendor subdevice class class_mask driver_data - while read pci_module vendor device subvendor subdevice class class_mask driver_data; do - # ignore program interface (last two digits) - we want any - class_mask=$(($class_mask 0xff00)) - # some devices (like hcd) have very specific class - class=$(($class $class_mask)) - [ $(($req_class $class_mask)) = $class ] || continue - # match vendor - [ $1 = $vendor -o $vendor = $PCI_ANY_ID ] || continue - # match device, allow PCI_ANY_ID - [ $2 = $device -o $device = $PCI_ANY_ID ] || continue - - echo $pci_module - done $pcimap + lspci -p $pcimap -kvmmn | awk -vreq_class=${req_class} ' + BEGIN { skip_modules[1]=; 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[cnt]=module; + cnt++; + }; + 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]; }; + } + ' } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Wed Oct 26 21:57:08 2011 New Revision: 12392 Modified: geninitrd/trunk/functions Log: Space at the end allways. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Oct 26 21:57:08 2011 @@ -213,7 +213,7 @@ } END { # xhci/ehci/ohci/uhci hack to preserve such order - printf %s %s %s %s, xhci, ehci, ohci, uhci; + printf %s %s %s %s , xhci, ehci, ohci, uhci; for (i in modules) { printf %s , modules[i]; }; } ' ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Wed Oct 26 21:58:54 2011 New Revision: 12393 Modified: geninitrd/trunk/functions Log: LC_ALL=C for lspci call in case if someone translates things. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Oct 26 21:58:54 2011 @@ -189,7 +189,7 @@ return fi - lspci -p $pcimap -kvmmn | awk -vreq_class=${req_class} ' + LC_ALL=C lspci -p $pcimap -kvmmn | awk -vreq_class=${req_class} ' BEGIN { skip_modules[1]=; modules[1]=; xhci=; ehci=; ohci=; uhci= } /^Slot:/ { found=0 } /^Class:/ { if (req_class == $2) { found=1 } } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Wed Jul 27 08:34:34 2011 New Revision: 12272 Modified: geninitrd/trunk/functions Log: use stat(1) instead of ls(1) to figure out device minor node number Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Jul 27 08:34:34 2011 @@ -108,7 +108,7 @@ # which they got from blkid program fs was specifed as UUID= in fstab dm_lvm2_name() { local node=$1 - local dm_minor + local dm_minor stat if [ ! -b $node ]; then echo 2 dm_lvm2_name: $node is not a block device @@ -120,7 +120,8 @@ dm_minor=${node#/dev/dm-} ;; /dev/mapper/*) - dm_minor=$(ls -lL $node | awk '{print $6}') + stat=$(stat -L --format=%T $node) || die stat failed: $node + dm_minor=$((0x$stat)) ;; esac ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Wed Jul 27 08:59:14 2011 New Revision: 12277 Modified: geninitrd/trunk/functions Log: use stat format busybox understands too Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Jul 27 08:59:14 2011 @@ -120,7 +120,7 @@ dm_minor=${node#/dev/dm-} ;; /dev/mapper/*) - stat=$(stat -L --format=%T $node) || die stat failed: $node + stat=$(stat -L -c %T $node) || die stat failed: $node dm_minor=$((0x$stat)) ;; esac ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Tue Mar 15 21:42:30 2011 New Revision: 12200 Modified: geninitrd/trunk/functions Log: dm_lvm2_name(): /dev/mapper/xyz can be a symlink to real device. Dereference when checking. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Mar 15 21:42:30 2011 @@ -120,7 +120,7 @@ dm_minor=${node#/dev/dm-} ;; /dev/mapper/*) - dm_minor=$(ls -l $node | awk '{print $6}') + dm_minor=$(ls -lL $node | awk '{print $6}') ;; esac ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: arekm Date: Mon Mar 7 11:00:52 2011 New Revision: 12196 Modified: geninitrd/trunk/functions Log: Better error msg. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Mar 7 11:00:52 2011 @@ -97,7 +97,7 @@ fi if [ ! -r $rootdev ]; then - echo 2 $function: can't find real device for $rootdev + echo 2 $function: rootfs device file $rootdev doesn't exist return 1 fi ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd mod-blkid.sh mod-bootsplash.sh mod-condecor.sh mod-depmod2...
Author: arekm Date: Sat Feb 19 08:54:20 2011 New Revision: 12161 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd geninitrd/trunk/mod-blkid.sh geninitrd/trunk/mod-bootsplash.sh geninitrd/trunk/mod-condecor.sh geninitrd/trunk/mod-depmod24.sh geninitrd/trunk/mod-dmraid.sh geninitrd/trunk/mod-fbsplash.sh geninitrd/trunk/mod-ide.sh geninitrd/trunk/mod-luks.sh geninitrd/trunk/mod-lvm.sh geninitrd/trunk/mod-md.sh geninitrd/trunk/mod-multipath.sh geninitrd/trunk/mod-nfs.sh geninitrd/trunk/mod-sata.sh geninitrd/trunk/mod-scsi.sh geninitrd/trunk/mod-suspend.sh geninitrd/trunk/mod-tuxonice.sh geninitrd/trunk/mod-udev.sh geninitrd/trunk/mod-uvesafb.sh Log: Report RCSID for loaded modules, too. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Feb 19 08:54:20 2011 @@ -165,3 +165,24 @@ local node=$1 printf /dev/mapper/%s $(dm_name $node) } + +# checks option in /proc/cmdline +# returns: +# $1-set if option is set without any value +# value if option has some value specified +get_cmdline_string='get_cmdline() { +local opt=$1 cmdline +read cmdline /proc/cmdline + +for arg in $cmdline; do +if [ ${arg} = ${opt} ]; then +echo ${opt}-set +return +fi +if [ ${arg##${opt}=} != ${arg} ]; then +echo ${arg##${opt}=} +return +fi +done +}' +eval $get_cmdline_string Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Sat Feb 19 08:54:20 2011 @@ -124,6 +124,7 @@ local mod for mod in $GENINITRD_MODS; do + debug # mod-$mod: $RCSID eval setup_mod_$mod done } Modified: geninitrd/trunk/mod-blkid.sh == --- geninitrd/trunk/mod-blkid.sh(original) +++ geninitrd/trunk/mod-blkid.shSat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: blkid USE_BLKID=${USE_BLKID:-yes} Modified: geninitrd/trunk/mod-bootsplash.sh == --- geninitrd/trunk/mod-bootsplash.sh (original) +++ geninitrd/trunk/mod-bootsplash.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: bootsplash BOOT_SPLASH=${BOOT_SPLASH:-no} Modified: geninitrd/trunk/mod-condecor.sh == --- geninitrd/trunk/mod-condecor.sh (original) +++ geninitrd/trunk/mod-condecor.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: condecor FB_CON_DECOR=${FB_CON_DECOR:-no} Modified: geninitrd/trunk/mod-depmod24.sh == --- geninitrd/trunk/mod-depmod24.sh (original) +++ geninitrd/trunk/mod-depmod24.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: depmod for 2.4 kernel # Finds module dependencies Modified: geninitrd/trunk/mod-dmraid.sh == --- geninitrd/trunk/mod-dmraid.sh (original) +++ geninitrd/trunk/mod-dmraid.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: dmraid USE_DMRAID=${USE_DMRAID:-yes} Modified: geninitrd/trunk/mod-fbsplash.sh == --- geninitrd/trunk/mod-fbsplash.sh (original) +++ geninitrd/trunk/mod-fbsplash.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: fbsplash FB_SPLASH=${FB_SPLASH:-no} Modified: geninitrd/trunk/mod-ide.sh == --- geninitrd/trunk/mod-ide.sh (original) +++ geninitrd/trunk/mod-ide.sh Sat Feb 19 08:54:20 2011 @@ -1,5 +1,6 @@ #!/bin/sh -# +RCSID='$Revision: 12159 $ $Date: 2011-02-17 23:16:30 +0100 (czw) $' + # geninitrd mod: ide PREIDEMODS=-ide-core unknown -ide-detect -ide-disk -ide-gd_mod @@ -99,7 +100,7 @@ }' /usr/share/pci-database/ide.pci`
SVN: geninitrd/trunk: functions mod-ide.sh
Author: arekm Date: Sat Feb 19 08:56:43 2011 New Revision: 12162 Modified: geninitrd/trunk/functions geninitrd/trunk/mod-ide.sh Log: Revert, this wasn't meant to be in previous commit. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Feb 19 08:56:43 2011 @@ -165,24 +165,3 @@ local node=$1 printf /dev/mapper/%s $(dm_name $node) } - -# checks option in /proc/cmdline -# returns: -# $1-set if option is set without any value -# value if option has some value specified -get_cmdline_string='get_cmdline() { -local opt=$1 cmdline -read cmdline /proc/cmdline - -for arg in $cmdline; do -if [ ${arg} = ${opt} ]; then -echo ${opt}-set -return -fi -if [ ${arg##${opt}=} != ${arg} ]; then -echo ${arg##${opt}=} -return -fi -done -}' -eval $get_cmdline_string Modified: geninitrd/trunk/mod-ide.sh == --- geninitrd/trunk/mod-ide.sh (original) +++ geninitrd/trunk/mod-ide.sh Sat Feb 19 08:56:43 2011 @@ -100,7 +100,7 @@ }' /usr/share/pci-database/ide.pci` [ -n $module ] idemodules=$idemodules $module done - if [ $(get_cmdline ide) = reverse ]; then + if is_yes $(awk ' /ide=reverse/ { print yes } ' /proc/cmdline); then new_idemodules= for nc in idemodules; do new_idemodules=$nc $new_idemodules ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: wiget Date: Thu Feb 3 11:41:23 2011 New Revision: 12106 Modified: geninitrd/trunk/functions Log: Use DM subsystem name not UUID for LVM/crypt detection Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Feb 3 11:41:23 2011 @@ -75,9 +75,9 @@ case $rootdev in /dev/mapper/*) - local dm_uuid=$(dm_uuid $rootdev) - case $dm_uuid in - LVM-*) + local dm_subsystem=$(dm_subsystem $rootdev) + case $dm_subsystem in + LVM) local node node=$(dm_lvm2_name $rootdev) || return 1 if [ $node ]; then @@ -85,7 +85,7 @@ fi return 0 ;; - CRYPT-*) + CRYPT) return 0 ;; esac @@ -152,12 +152,12 @@ dmsetup info -c --noheadings $node | awk -F: '{print $1}' } -# get UUID for DM node +# get subsystem name for DM node # node can be /dev/dm-0, /dev/mapper/name -# @return UUID -dm_uuid() { +# @return subsystem name +dm_subsystem() { local node=$1 - dmsetup info -c --noheadings $node | awk -F: '{print $8}' + dmsetup info -c --noheadings -o subsystem $node } # resolve any dm node to it's full path in /dev/mapper ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: wiget Date: Thu Feb 3 11:41:28 2011 New Revision: 12107 Modified: geninitrd/trunk/functions Log: Simplify dm_name() Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Feb 3 11:41:28 2011 @@ -149,7 +149,7 @@ # @return DM name dm_name() { local node=$1 - dmsetup info -c --noheadings $node | awk -F: '{print $1}' + dmsetup info -c --noheadings -o name $node } # get subsystem name for DM node ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: wiget Date: Wed Feb 2 17:23:30 2011 New Revision: 12101 Modified: geninitrd/trunk/functions Log: Allow rootfs on crypted device Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Feb 2 17:23:30 2011 @@ -64,15 +64,33 @@ esac case $rootdev in - /dev/dm-* | /dev/mapper/*) + /dev/dm-*) local node - node=$(dm_lvm2_name $rootdev) || return 1 + node=$(dm_longname $rootdev) || return 1 if [ $node ]; then rootdev=$node fi ;; esac + case $rootdev in + /dev/mapper/*) + local dm_uuid=$(dmsetup info -c --noheadings $rootdev | awk -F: '{print $8}') + case $dm_uuid in + LVM-*) + local node + node=$(dm_lvm2_name $rootdev) || return 1 + if [ $node ]; then + rootdev=$node + fi + return 0 + ;; + CRYPT-*) + return 0 + ;; + esac + esac + if [ $rootFs = nfs ]; then rootdev=/dev/nfs return 0 ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: wiget Date: Wed Feb 2 17:23:35 2011 New Revision: 12102 Modified: geninitrd/trunk/functions Log: Simplify dm_longname() Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Feb 2 17:23:35 2011 @@ -148,10 +148,6 @@ # try to resolve /dev/dm-0 to item from /dev/mapper dir dm_longname() { local node=$1 - local ret - local dm_major=$(awk '$2 == device-mapper {print $1}' /proc/devices) - local dm_minor=${node#/dev/dm-} - - local dm_name=$(dmsetup info -c --noheadings -j $dm_major -m $dm_minor | awk -F: '{print $1}') + local dm_name=$(dmsetup info -c --noheadings $node | awk -F: '{print $1}') echo /dev/mapper/$dm_name } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd
Author: glen Date: Wed Feb 2 18:15:10 2011 New Revision: 12103 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd Log: rename dm_* helpers to avoid confision what they do and make them more generic Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Feb 2 18:15:10 2011 @@ -66,7 +66,7 @@ case $rootdev in /dev/dm-*) local node - node=$(dm_longname $rootdev) || return 1 + node=$(dm_node $rootdev) || return 1 if [ $node ]; then rootdev=$node fi @@ -75,7 +75,7 @@ case $rootdev in /dev/mapper/*) - local dm_uuid=$(dmsetup info -c --noheadings $rootdev | awk -F: '{print $8}') + local dm_uuid=$(dm_uuid $rootdev) case $dm_uuid in LVM-*) local node @@ -145,9 +145,23 @@ echo $lvm_path } -# try to resolve /dev/dm-0 to item from /dev/mapper dir -dm_longname() { +# resolve /dev/dm-0, /dev/mapper/name +# @return DM name +dm_name() { local node=$1 - local dm_name=$(dmsetup info -c --noheadings $node | awk -F: '{print $1}') - echo /dev/mapper/$dm_name + dmsetup info -c --noheadings $node | awk -F: '{print $1}' +} + +# get UUID for DM node +# node can be /dev/dm-0, /dev/mapper/name +# @return UUID +dm_uuid() { + local node=$1 + dmsetup info -c --noheadings $node | awk -F: '{print $8}' +} + +# resolve any dm node to it's full path in /dev/mapper +dm_node() { + local node=$1 + printf /dev/mapper/%s $(dm_name $node) } Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Wed Feb 2 18:15:10 2011 @@ -460,7 +460,7 @@ if [[ $devpath = /dev/dm-* ]]; then # /dev/dm-3 - /dev/mapper/sil_ahbgadcbchfc3 - devpath=$(dm_longname $devpath) + devpath=$(dm_node $devpath) fi if [ -L $devpath ] ! is_lvm $devpath; then ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Wed Apr 2 13:53:10 2008 New Revision: 9690 Modified: geninitrd/trunk/functions Log: - Look up one device that matches the search parameter with blkid Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Wed Apr 2 13:53:10 2008 @@ -34,7 +34,7 @@ fi local label=${rootdev#LABEL=} - local dev=$(/sbin/blkid -t LABEL=$label -o device) + local dev=$(/sbin/blkid -l -t LABEL=$label -o device) if [ $dev ]; then if [ ! -r $dev ]; then echo 2 $function: blkid returned device $dev which doesn't exist @@ -51,7 +51,7 @@ fi local uuid=${rootdev#UUID=} - local dev=$(/sbin/blkid -t UUID=$uuid -o device) + local dev=$(/sbin/blkid -l -t UUID=$uuid -o device) if [ $dev ]; then if [ ! -r $dev ]; then ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd
Author: glen Date: Sat Jan 19 20:47:58 2008 New Revision: 9184 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd Log: - nfsroot patch from wolverine Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Jan 19 20:47:58 2008 @@ -73,6 +73,11 @@ ;; esac + if [ $rootFs = nfs ]; then + rootdev=/dev/nfs + return 0 + fi + if [ ! -r $rootdev ]; then echo 2 $function: can't find real device for $rootdev return 1 Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Sat Jan 19 20:47:58 2008 @@ -1953,7 +1953,11 @@ if [ $INITRDFS = initramfs ]; then inst_d /newroot - [ ! -e $DESTDIR/$rootdev ] inst $rootdev /dev + if [ $rootdev = /dev/nfs ]; then + echo rootfs on NFS root=/dev/nfs + else + [ ! -e $DESTDIR/$rootdev ] inst $rootdev /dev + fi # Parsing root parameter # We support passing root as hda3 /dev/hda3 0303 0x0303 and 303 add_linuxrc -'EOF' ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Sat Jan 19 20:48:29 2008 New Revision: 9185 Modified: geninitrd/trunk/functions Log: - fix flow Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Jan 19 20:48:29 2008 @@ -91,6 +91,12 @@ dm_lvm2_name() { local node=$1 local dm_minor + + if [ ! -b $node ]; then + echo 2 dm_lvm2_name: $node is not a block device + return 1 + fi + case $node in /dev/dm-*) dm_minor=${node#/dev/dm-} @@ -100,11 +106,6 @@ ;; esac - if [ ! -b $node ]; then - echo 2 dm_lvm2_name: $node is not a block device - return 1 - fi - local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}' | xargs) if [ -z $lvm_path ]; then # XXX: this could happen also for non-lvm nodes? ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Thu Nov 1 18:30:15 2007 New Revision: 8951 Modified: geninitrd/trunk/functions Log: - more information why lvdisplay failed to resolve lvm name Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Nov 1 18:30:15 2007 @@ -95,10 +95,23 @@ ;; esac + if [ ! -b $node ]; then + echo 2 dm_lvm2_name: $node is not a block device + return 1 + fi + local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}' | xargs) if [ -z $lvm_path ]; then # XXX: this could happen also for non-lvm nodes? - echo 2 lvdisplay couldn't find device-mapper node with minor $dm_minor. try running 'vgscan --mknodes'. + cat 2 -EOF + LVM doesn't recognize device-mapper node with minor $dm_minor + + In case your Physical Volumes are device mapper nodes, you should add to lvm.conf: + types = [ device-mapper, 254 ] + + In case the LVM nodes are not present yet, it could be fixed by running: + # vgscan --mknodes + EOF return 2 fi if [ ! -r $lvm_path ]; then ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Tue Oct 30 16:07:28 2007 New Revision: 8898 Modified: geninitrd/trunk/functions Log: - more detailed error messages when processing fstab and lvm Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Oct 30 16:07:28 2007 @@ -17,9 +17,9 @@ local function=${PROGRAM:+$PROGRAM: }find_root local rootopt - eval $(awk '/^[\t ]*#/ {next} {if ( $2 == / ) {print rootdev=\ $1 \\nrootFs=\ $3 \\nrootopt=\ $4 \}}' $fstab) + eval $(awk '!/^[\t ]*#/ $2 == / {printf(rootdev=\%s\\nrootFs=\%s\\nrootopt=\%s\\n, $1, $3, $4)}' $fstab) if [ -z $rootdev ]; then - echo 2 $function: can't find real device for rootfs + echo 2 $function: can't find fstab entry for root mountpoint return 1 fi @@ -35,7 +35,11 @@ local label=${rootdev#LABEL=} local dev=$(/sbin/blkid -t LABEL=$label -o device) - if [ $dev -a -r $dev ]; then + if [ $dev ]; then + if [ ! -r $dev ]; then + echo 2 $function: blkid returned device $dev which doesn't exist + return 2 + fi rootdev=$dev fi ;; @@ -49,7 +53,11 @@ local uuid=${rootdev#UUID=} local dev=$(/sbin/blkid -t UUID=$uuid -o device) - if [ $dev -a -r $dev ]; then + if [ $dev ]; then + if [ ! -r $dev ]; then + echo 2 $function: blkid returned device $dev which doesn't exist + return 2 + fi rootdev=$dev fi ;; @@ -87,7 +95,16 @@ ;; esac - local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}') + local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}' | xargs) + if [ -z $lvm_path ]; then + # XXX: this could happen also for non-lvm nodes? + echo 2 lvdisplay couldn't find device-mapper node with minor $dm_minor. try running 'vgscan --mknodes'. + return 2 + fi + if [ ! -r $lvm_path ]; then + echo 2 lvdisplay returned $lvm_path which doesn't exist in filesystem; try running 'vgscan --mknodes'. + return 2 + fi echo $lvm_path } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Tue Oct 23 21:30:13 2007 New Revision: 8843 Modified: geninitrd/trunk/functions Log: - we can grab the proper lvm path from lvdisplay output Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Oct 23 21:30:13 2007 @@ -77,25 +77,9 @@ # which they got from blkid program fs was specifed as UUID= in fstab dm_lvm2_name() { local node=$1 - - # redirect output to tmpfile so we won't get subshell - local tmp ret - tmp=$(mktemp) || return 1 - - /sbin/lvdisplay -c 2/dev/null | awk -F: '{print $1}' $tmp - while read dev; do - count=$(ls -Ll $dev $node | awk '{print $5, $6}' | sort -u | wc -l) - if [ $count = 1 ]; then - ret=$dev - break - fi - done $tmp - rm -f $tmp - - if [ -z $ret ]; then - ret=$node - fi - echo $ret + local dm_minor=${node#/dev/dm-} + local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}') + echo $lvm_path } # try to resolve /dev/dm-0 to item from /dev/mapper dir ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Tue Oct 23 21:39:59 2007 New Revision: 8844 Modified: geninitrd/trunk/functions Log: - handle /dev/mapper/* also properly Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Oct 23 21:39:59 2007 @@ -77,7 +77,16 @@ # which they got from blkid program fs was specifed as UUID= in fstab dm_lvm2_name() { local node=$1 - local dm_minor=${node#/dev/dm-} + local dm_minor + case $node in + /dev/dm-*) + dm_minor=${node#/dev/dm-} + ;; + /dev/mapper/*) + dm_minor=$(ls -l $node | awk '{print $6}') + ;; + esac + local lvm_path=$(/sbin/lvdisplay -c 2/dev/null | awk -F: -vn=$dm_minor '{node=$1; major=$12; minor=$13; if (n == minor) print node}') echo $lvm_path } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Mon Oct 22 19:24:37 2007 New Revision: 8837 Modified: geninitrd/trunk/functions Log: - more consistent lookup of long device-mapper name Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Oct 22 19:24:37 2007 @@ -102,10 +102,9 @@ dm_longname() { local node=$1 local ret + local dm_major=$(awk '$2 == device-mapper {print $1}' /proc/devices) + local dm_minor=${node#/dev/dm-} - ret=$(find /dev -type b | xargs ls -l | LC_ALL=C sort -k5,6 | grep -B1 $node | awk '{print $NF; exit}') - if [ -z $ret ]; then - ret=$node - fi - echo $ret + local dm_name=$(devmap_name $dm_major:$dm_minor) + echo /dev/mapper/$dm_name } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Mon Oct 22 19:25:46 2007 New Revision: 8838 Modified: geninitrd/trunk/functions Log: - use dmsetup from device-mapper pkg not devmap_name from multipath-tools Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Oct 22 19:25:46 2007 @@ -105,6 +105,6 @@ local dm_major=$(awk '$2 == device-mapper {print $1}' /proc/devices) local dm_minor=${node#/dev/dm-} - local dm_name=$(devmap_name $dm_major:$dm_minor) + local dm_name=$(dmsetup info -c --noheadings -j $dm_major -m $dm_minor | awk -F: '{print $1}') echo /dev/mapper/$dm_name } ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd
Author: glen Date: Thu Oct 11 17:16:19 2007 New Revision: 8807 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd Log: - rootfs on lvm and dmraid hooks Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Oct 11 17:16:19 2007 @@ -97,3 +97,15 @@ fi echo $ret } + +# try to resolve /dev/dm-0 to item from /dev/mapper dir +dm_longname() { + local node=$1 + local ret + + ret=$(find /dev -type b | xargs ls -l | LC_ALL=C sort -k5,6 | grep -B1 $node | awk '{print $NF; exit}') + if [ -z $ret ]; then + ret=$node + fi + echo $ret +} Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Thu Oct 11 17:16:19 2007 @@ -493,13 +493,23 @@ return $rc } +# find modules for $devpath find_modules_for() { - if [ -z $1 ]; then - echo ERROR: no argument passed to find_modules_for() - is your /etc/fstab correct? 2 - exit + local devpath=$1 + if [ -z $devpath ]; then + die No argument passed to find_modules_for() - is your /etc/fstab correct? fi - if is_yes `echo $1 | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print yes; }'`; then + # /dev/dm-3 - /dev/mapper/sil_ahbgadcbchfc3 + case $devpath in + /dev/dm-*) + devpath=$(dm_longname $devpath) + ;; + esac + + echo find modules for $devpath + + if is_yes `echo $devpath | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print yes; }'`; then if [ ! -x /usr/bin/pcidev -a -z $NFS_ETH_MODULES ] ; then die root on NFS but /usr/bin/pcidev not found. Please install correct pci-database package and rerun $PROGRAM. fi @@ -512,19 +522,40 @@ usenfs=yes echo Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel 2 echo or you will have problems like init(xx) being child process of swapper(1). 2 - elif is_yes `echo $1 | awk '/^\/dev\/md/ { print yes; }'`; then - find_modules_softraid $1 - elif is_yes $(echo $1 | awk '/^\/dev\/(sd|scsi)/ { print yes; }') ; then + elif is_yes `echo $devpath | awk '/^\/dev\/md/ { print yes; }'`; then + find_modules_softraid $devpath + elif is_yes $(echo $devpath | awk '/^\/dev\/(sd|scsi)/ { print yes; }') ; then find_modules_scsi - elif is_yes `echo $1 | awk '/^\/dev\/(hd|ide)/ { print yes; }'` ; then - find_modules_ide $1 - elif is_yes `echo $1 | awk '/\/dev\/rd\// { print yes; }'` ; then + elif is_yes `echo $devpath | awk '/^\/dev\/(hd|ide)/ { print yes; }'` ; then + find_modules_ide $devpath + elif is_yes `echo $devpath | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print yes; }'`; then + set -x + # dmraid nodes taken from: `dmraid -l` output + if [ ! -x /usr/sbin/dmraid ]; then + die root on dmraid but /usr/sbin/dmraid not found. + fi + + # XXX dmraid could say to us that /dev/dm-3 consists from /dev/sda, /dev/sdb + + # get blockdev itself (without partition) + local node blockdev + blockdev=${devpath%%[0-9]*} + blockdev=${blockdev#/dev/mapper/} + for node in $(dmraid -r -cdevpath,raidname |awk -F, -vv=$blockdev '{if ($2 == v) print $1}'); do + find_modules_for $node + done + + # XXX probably should detect + findmodule dm-mirror + + set +x + elif is_yes `echo $devpath | awk '/\/dev\/rd\// { print yes; }'` ; then findmodule DAC960 - elif is_yes `echo $1 | awk '/\/dev\/ida\// { print yes; }'` ; then + elif is_yes `echo $devpath | awk '/\/dev\/ida\// { print yes; }'` ; then findmodule cpqarray - elif is_yes `echo $1 | awk '/\/dev\/cciss\// { print yes; }'` ; then + elif is_yes `echo $devpath | awk '/\/dev\/cciss\// { print yes; }'` ; then findmodule cciss - elif is_yes `echo $1 | awk '/\/dev\/ataraid\// { print yes; }'`; then + elif is_yes `echo $devpath | awk '/\/dev\/ataraid\// { print yes; }'`; then find_modules_ide findmodule ataraid ataraidmodules=`awk '/ataraid_hostadapter/ ! /^[\t ]*#/ { print $3; }' $modulefile` @@ -536,15 +567,15 @@ findmodule $n done # check to see if we need to set up a loopback filesystem - elif is_yes
SVN: geninitrd/trunk/functions
Author: glen Date: Sat Oct 6 00:47:27 2007 New Revision: 8791 Modified: geninitrd/trunk/functions Log: - library functions shouldn't exit Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Sat Oct 6 00:47:27 2007 @@ -58,7 +58,7 @@ case $rootdev in /dev/dm-* | /dev/mapper/*) local node - node=$(dm_lvm2_name $rootdev) || exit + node=$(dm_lvm2_name $rootdev) || return 1 if [ $node ]; then rootdev=$node fi @@ -80,7 +80,7 @@ # redirect output to tmpfile so we won't get subshell local tmp ret - tmp=$(mktemp) || exit + tmp=$(mktemp) || return 1 /sbin/lvdisplay -c 2/dev/null | awk -F: '{print $1}' $tmp while read dev; do ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: hawk Date: Mon Jul 16 14:31:52 2007 New Revision: 8678 Modified: geninitrd/trunk/functions Log: - check /dev/mapper/* too while testing if rootdev is LVM Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Jul 16 14:31:52 2007 @@ -53,15 +53,14 @@ rootdev=$dev fi ;; - esac - - if [[ $rootdev = /dev/dm-* ]]; then + /dev/dm-* | /dev/mapper/*) local node node=$(dm_lvm2_name $rootdev) || exit if [ $node ]; then rootdev=$node fi - fi + ;; + esac if [ ! -r $rootdev ]; then echo 2 $function: can't find real device for $rootdev ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: hawk Date: Mon Jul 16 16:22:54 2007 New Revision: 8681 Modified: geninitrd/trunk/functions Log: - check /dev/dm-*, /dev/mapper/* after checking LABEL=*, UUID=* Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Mon Jul 16 16:22:54 2007 @@ -53,6 +53,9 @@ rootdev=$dev fi ;; + esac + + case $rootdev in /dev/dm-* | /dev/mapper/*) local node node=$(dm_lvm2_name $rootdev) || exit ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd
Author: arekm Date: Tue Apr 3 12:18:55 2007 New Revision: 8409 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd Log: Create additional devices like xfs logdev. Verbose copying of devices. Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Tue Apr 3 12:18:55 2007 @@ -9,18 +9,23 @@ # # Sets global variables: # - $rootdev +# - $rootdev_add # - $rootFS # find_root() { local fstab=$1 local function=${PROGRAM:+$PROGRAM: }find_root + local rootopt - eval $(awk '/^[\t ]*#/ {next} {if ( $2 == / ) {print rootdev=\ $1 \\nrootFs=\ $3 \}}' $fstab) + eval $(awk '/^[\t ]*#/ {next} {if ( $2 == / ) {print rootdev=\ $1 \\nrootFs=\ $3 \\nrootopt=\ $4 \}}' $fstab) if [ -z $rootdev ]; then echo 2 $function: can't find real device for rootfs return 1 fi + # additional devices needed (xfs logdev) + rootdev_add=$(echo $rootopt | awk -F',' '{ for (i=1; i=NF; i++) { if ($i ~ /^logdev=/) { gsub(/^logdev=/, NIL, $i); print $i; } } }') + case $rootdev in LABEL=*) if [ ! -x /sbin/blkid ]; then Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Tue Apr 3 12:18:55 2007 @@ -252,7 +252,7 @@ return fi debug $1 - $2 - cp $1 $2 + cp -HR $1 $2 } find_modules_softraid() { @@ -958,6 +958,7 @@ debug Using $rootdev as device for rootfs find_modules_for $rootdev +[ -n $rootdev_add ] find_modules_for $rootdev_add findmodule -$rootFs @@ -1057,7 +1058,7 @@ mkdir -p $MNTIMAGE/etc mkdir -p $MNTIMAGE/dev resume_dev=$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf) - cp -HR /dev/snapshot $resume_dev $MNTIMAGE/dev + inst /dev/snapshot $resume_dev $MNTIMAGE/dev inst /etc/suspend.conf $MNTIMAGE/etc/suspend.conf inst /usr/sbin/resume $MNTIMAGE/bin/resume echo resume $s @@ -1202,7 +1203,7 @@ [ -e $MNTIMAGE/$f ] continue debug echo copying $f # this works fine with and without devfs - cp -HR $f $MNTIMAGE/$f + inst $f $MNTIMAGE/$f done done @@ -1281,7 +1282,7 @@ for device in $PVDEVICES; do # if LVM on RAID then device might be copied already in gen_softraid [ -e $MNTIMAGE/dev/$(basename $device) ] continue - cp -HR $device $MNTIMAGE/dev/ + inst $device $MNTIMAGE/dev/ done fi echo mount -t proc none /proc $s @@ -1395,9 +1396,12 @@ initrd_gen_procdata fi +# additional devs always needed +[ ! -e $MNTIMAGE/$rootdev_add ] inst $rootdev_add $MNTIMAGE/dev + if [ $INITRDFS = initramfs ]; then mkdir -p $MNTIMAGE/newroot - [ ! -e $MNTIMAGE/$rootdev ] cp -HR $rootdev $MNTIMAGE/dev + [ ! -e $MNTIMAGE/$rootdev ] inst $rootdev $MNTIMAGE/dev # Parsing root parameter # We support passing root as hda3 /dev/hda3 0303 0x0303 and 303 cat 'EOF' $s ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk: functions geninitrd
Author: glen Date: Thu Feb 8 19:24:34 2007 New Revision: 8241 Modified: geninitrd/trunk/functions geninitrd/trunk/geninitrd Log: - allow setting prefix for function messages via $PROGRAM global Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Feb 8 19:24:34 2007 @@ -14,7 +14,7 @@ # find_root() { local fstab=$1 - local function='find_root' + local function=${PROGRAM:+$PROGRAM: }find_root eval $(awk '/^[\t ]*#/ {next} {if ( $2 == / ) {print rootdev=\ $1 \\nrootFs=\ $3 \}}' $fstab) if [ -z $rootdev ]; then Modified: geninitrd/trunk/geninitrd == --- geninitrd/trunk/geninitrd (original) +++ geninitrd/trunk/geninitrd Thu Feb 8 19:24:34 2007 @@ -14,7 +14,8 @@ # RCSID='$Id$' -VERSION=$(echo $RCSID | awk '{print $3}') +R=${RCSID#* * }; VERSION=${R%% *} +PROGRAM=${0##*/} . /etc/rc.d/init.d/functions . /etc/geninitrd/functions ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Thu Feb 8 19:38:59 2007 New Revision: 8244 Modified: geninitrd/trunk/functions Log: - correct comment Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Feb 8 19:38:59 2007 @@ -68,7 +68,7 @@ } # resolve /dev/dm-0 to lvm2 node -# which they got from /proc/partitions when rootfs is UUID= +# which they got from blkid program fs was specifed as UUID= in fstab dm_lvm2_name() { local node=$1 ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
SVN: geninitrd/trunk/functions
Author: glen Date: Thu Feb 8 20:06:31 2007 New Revision: 8245 Modified: geninitrd/trunk/functions Log: - outputs nothing actually as it sets two parameters Modified: geninitrd/trunk/functions == --- geninitrd/trunk/functions (original) +++ geninitrd/trunk/functions Thu Feb 8 20:06:31 2007 @@ -5,7 +5,6 @@ # Find root device from fstab. # # @param string $fstab location of /etc/fstab -# @output string root device: /dev/hda1, /dev/sys/rootfs, etc # @return false on failure # # Sets global variables: ___ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit