OSDN Git Service

0-auto-detect: keep module loading order as before
authorChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 21 Jul 2016 15:22:32 +0000 (23:22 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 21 Jul 2016 15:22:32 +0000 (23:22 +0800)
Commit bdf2b690 uses 'sort -u' which changes module loading order.
It causes some issues. For example, on a device with two graphic
cards, the driver of the discrete graphic card may be loaded first
that causes black screen issue.

Use the simple awk script to remove duplicate items but keep the
order unchanged.

initrd/scripts/0-auto-detect

index 8189830..0caa34a 100644 (file)
@@ -1,6 +1,6 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2016/03/03
+# Last updated 2016/07/21
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -17,7 +17,7 @@ auto_detect()
        echo 'esac; done; }' >> $tmp
        sed -i '/brcmfmac/d' $tmp
        source $tmp
-       cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | sort -u | dev2mod
+       cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | awk '!seen[$0]++' | dev2mod
        cat /sys/devices/virtual/wmi/*/modalias | dev2mod
 }