Ключевые слова:linux, module, kernel, (найти похожие документы)
Date: Tue, 08 May 2001 07:07:16 +0400
From: Alexey Presniakov <Alexey.Presniakov@f34.n5027.z2.fidonet.org>
Newsgroups: fido7.ru.linux
Subject: [Linux] Изменение для модуля версии ядра
AU> Есть ли дpугой способ, кpоме замены ядpа, исpользовать имеющийся дpайвеp ???
Знач так. Если он более-менее подходит, то можно готовый модуль немного
обмануть. Эта программка меняет версию ядра для модуля. И они не орут при
загрузке:
=== fixscript starts here ===
#! /bin/bash
#
# THIS VERSION IS OBSOLETE - it works in some cases, so I haven't deleted
# it, but you really want to get the most recent version from
# http://www.test.dclabs.com.au/linmodem/fixscript
#
# To make this file executable: chmod +x fixscript
# This is a very slight edit of the ltfixscript contributed to
# the Linmodems Newslist
# From - Sun Jul 23 04:27:38 2000
# From: "Mark Spieth" <mark at digivation.com.au>
# To: <discuss@linmodems.org>
# Subject: ltmodem symbols and version fixed
# Date: Sun, 23 Jul 2000 12:39:44 +1000
# Organization: Digivation Pty Ltd
echo "Fixscript V1.21"
if [ -z "$1" -o -z "$2" ]; then
cat <<END
This script changes version number tags of binary
kernel modules to match the version of the currently
running kernel. It also renames any symbol that the
current kernel cannot resolve into their equivalent
resolvable symbols.
For inserting binary modules into kernels, the fixed
module can be inserted with:
insmod module
which is used in automated kernel module management,
rather than forcing module loading with:
insmod -f module
which is necessary when kernel and module versions
are not matched.
WARNING! This change is purely cosmetic, and the use
of version matched binaries whenever possible is
strongly advised. It may crash your kernel due to
inconsistencies in data structures between the kernel
as it stands and the headers used to originally compile
the module being fixed. No guarantees are given or implied
under any circumstances.
GNU objcopy version 2.9.5 or later is required;
this is provided as part of the binary utilities
packages such as the Debian binutils.deb
USAGE: fixscript input-file output-file
END
exit 1
fi
MI=/tmp/modinfo
DI=/tmp/depinfo
#new kernel version modinfo section
echo -ne "kernel_version="`uname -r`"\0" > $MI
#build the objcopy command
CMD="objcopy"
#for i in `depmod -e $1 | grep -vE "^$1:"` ; do
depmod -e $1 2>$DI
AWKSTR=\$2
for i in `awk "{print $AWKSTR}" $DI | grep _R` ; do
echo doing $i
i1=`echo $i | awk '{
gsub(/_R[0-9a-fA-F]+/,"");
printf("%s", $1);
}'`
echo "i1=" $i1
echo " trunc=\"$i1\""
searchstr=$i1"_R"
echo "searchstr=" $searchstr
new=`cat /proc/ksyms | grep $searchstr | awk "{print $AWKSTR}"`
echo " new=$new"
CMD="$CMD --redefine-sym=$i=$new"
done
#replace the modinfo section with the new one
CMD="$CMD --remove-section=.modinfo --add-section=.modinfo=$MI"
CMD="$CMD $*"
#run the command
echo "CMD:" $CMD
$CMD
#remove the section file
rm -f $MI
rm -f $DI
=== fixscript ends here ===
Искренне Ваш, Алексей.
[Registered Linux User #157917]
[Teams: Linux, Descent, [BAT] Heavy, AMD, Russian Rock, Орловчане]
... Сигнал к атаке - три зеленых свистка наверх.