|
|
|
@ -126,13 +126,13 @@ find_block_device() {
@@ -126,13 +126,13 @@ find_block_device() {
|
|
|
|
|
[[ $fs = nfs4 ]] && { echo $dev; return 0;} |
|
|
|
|
[[ $fs = btrfs ]] && { |
|
|
|
|
ls -nLl "$dev" | { |
|
|
|
|
read x x x x maj min x; |
|
|
|
|
maj=${maj//,/}; |
|
|
|
|
echo $maj:$min; |
|
|
|
|
read x x x x maj min x |
|
|
|
|
maj=${maj//,/} |
|
|
|
|
echo $maj:$min |
|
|
|
|
} && return 0 |
|
|
|
|
} |
|
|
|
|
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then |
|
|
|
|
echo $majmin; |
|
|
|
|
echo $majmin |
|
|
|
|
return 0 # we have a winner! |
|
|
|
|
fi |
|
|
|
|
done < /proc/self/mountinfo |
|
|
|
@ -147,13 +147,14 @@ find_block_device() {
@@ -147,13 +147,14 @@ find_block_device() {
|
|
|
|
|
[[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=} |
|
|
|
|
[[ -b $dev ]] || return 1 # oops, not a block device. |
|
|
|
|
ls -nLl "$dev" | { |
|
|
|
|
read x x x x maj min x; |
|
|
|
|
maj=${maj//,/}; |
|
|
|
|
echo $maj:$min; |
|
|
|
|
read x x x x maj min x |
|
|
|
|
maj=${maj//,/} |
|
|
|
|
echo $maj:$min |
|
|
|
|
} && return 0 |
|
|
|
|
fi |
|
|
|
|
done < /etc/fstab |
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
return 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
find_root_block_device() { find_block_device /; } |
|
|
|
@ -196,10 +197,9 @@ check_vol_slaves() {
@@ -196,10 +197,9 @@ check_vol_slaves() {
|
|
|
|
|
# strip space |
|
|
|
|
vg=$(echo $vg) |
|
|
|
|
if [[ $vg ]]; then |
|
|
|
|
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \ |
|
|
|
|
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null) |
|
|
|
|
do |
|
|
|
|
check_block_and_slaves $1 $(get_numeric_dev $pv) \ |
|
|
|
|
&& return 0 |
|
|
|
|
check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0 |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
@ -228,7 +228,7 @@ inst_dir() {
@@ -228,7 +228,7 @@ inst_dir() {
|
|
|
|
|
local target=$(readlink "$file") |
|
|
|
|
ln -sfn "$target" "${initdir}$file" || return 1 |
|
|
|
|
# resolve relative path and recursively install destination |
|
|
|
|
[[ $target == ${target#/} ]] && target=$(dirname "$file")/$target |
|
|
|
|
[[ $target == ${target#/} ]] && target="$(dirname "$file")/$target" |
|
|
|
|
inst_dir "$target" |
|
|
|
|
else |
|
|
|
|
# create directory |
|
|
|
@ -279,7 +279,7 @@ rev_lib_symlinks() {
@@ -279,7 +279,7 @@ rev_lib_symlinks() {
|
|
|
|
|
[[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}" |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
echo ${links} |
|
|
|
|
echo "${links}" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Same as above, but specialized to handle dynamic libraries. |
|
|
|
@ -671,9 +671,10 @@ install_kmod_with_fw() {
@@ -671,9 +671,10 @@ install_kmod_with_fw() {
|
|
|
|
|
local modname=${1##*/} fwdir found |
|
|
|
|
modname=${modname%.ko*} |
|
|
|
|
# no need to go further if the module is already installed |
|
|
|
|
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] && return 0 |
|
|
|
|
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \ |
|
|
|
|
return $? |
|
|
|
|
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \ |
|
|
|
|
&& return 0 |
|
|
|
|
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \ |
|
|
|
|
|| return $? |
|
|
|
|
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do |
|
|
|
|
found='' |
|
|
|
|
for fwdir in $fw_dir; do |
|
|
|
@ -698,13 +699,16 @@ install_kmod_with_fw() {
@@ -698,13 +699,16 @@ install_kmod_with_fw() {
|
|
|
|
|
for_each_kmod_dep() { |
|
|
|
|
local func=$1 kmod=$2 cmd modpapth options |
|
|
|
|
shift 2 |
|
|
|
|
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( \ |
|
|
|
|
local found=0; |
|
|
|
|
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( |
|
|
|
|
local found=0 |
|
|
|
|
while read cmd modpath options; do |
|
|
|
|
[[ $cmd = insmod ]] || continue |
|
|
|
|
$func ${modpath} || exit $? |
|
|
|
|
found=1 |
|
|
|
|
done; [[ $found -eq 0 ]] && exit 1; exit 0;) |
|
|
|
|
done |
|
|
|
|
[[ $found -eq 0 ]] && exit 1 |
|
|
|
|
exit 0 |
|
|
|
|
) |
|
|
|
|
return $? |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -718,16 +722,20 @@ for_each_kmod_dep() {
@@ -718,16 +722,20 @@ for_each_kmod_dep() {
|
|
|
|
|
# This function returns the full filenames of modules that match $1 |
|
|
|
|
filter_kernel_modules () ( |
|
|
|
|
if ! [[ $hostonly ]]; then |
|
|
|
|
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra" "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz" 2>/dev/null' |
|
|
|
|
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"' |
|
|
|
|
filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"' |
|
|
|
|
filtercmd+=' 2>/dev/null' |
|
|
|
|
else |
|
|
|
|
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel 2>/dev/null' |
|
|
|
|
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename ' |
|
|
|
|
filtercmd+='-k $kernel 2>/dev/null' |
|
|
|
|
fi |
|
|
|
|
for modname in $(eval $filtercmd); do |
|
|
|
|
case $modname in |
|
|
|
|
*.ko) "$1" "$modname" && echo "$modname";; |
|
|
|
|
*.ko.gz) gzip -dc "$modname" > $initdir/$$.ko |
|
|
|
|
$1 $initdir/$$.ko && echo "$modname" |
|
|
|
|
rm -f $initdir/$$.ko;; |
|
|
|
|
rm -f $initdir/$$.ko |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
done |
|
|
|
|
) |
|
|
|
@ -744,7 +752,8 @@ instmods() {
@@ -744,7 +752,8 @@ instmods() {
|
|
|
|
|
# This introduces 2 incompatible meanings for =* arguments |
|
|
|
|
# to instmods. We need to decide which one to keep. |
|
|
|
|
if [[ $mod = =ata && -f $srcmods/modules.block ]]; then |
|
|
|
|
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block") |
|
|
|
|
instmods $mpargs \ |
|
|
|
|
$(egrep 'ata|ahci' "${srcmods}/modules.block") |
|
|
|
|
elif [ -f $srcmods/modules.${mod#=} ]; then |
|
|
|
|
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} ) |
|
|
|
|
else |
|
|
|
@ -761,9 +770,9 @@ instmods() {
@@ -761,9 +770,9 @@ instmods() {
|
|
|
|
|
[[ -f $initdir/$1 ]] && { shift; continue; } |
|
|
|
|
# If we are building a host-specific initramfs and this |
|
|
|
|
# module is not already loaded, move on to the next one. |
|
|
|
|
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules && \ |
|
|
|
|
! echo $add_drivers | grep -qe "\<${mod}\>" && { |
|
|
|
|
shift; continue; |
|
|
|
|
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \ |
|
|
|
|
&& ! echo $add_drivers | grep -qe "\<${mod}\>" && { |
|
|
|
|
shift; continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# We use '-d' option in modprobe only if modules prefix path |
|
|
|
|