Looking at the file sizes of the new compiled driver and the current one I can see they differ greatly.
Doing “strip -d” helps to reduce the size of the new one, but now the old is 2KB greater, and still can’t insert the new one.
So, what additional steps do I need to do to compile a driver with unmodified sources and get an identical file than the one installed?
Cymerio wrote:
> My final goal is to change a few lines of a kernel driver, recompile it
> and insert into the running kernel.
>
> However I’m stuck at the simple task of recompiling a kernel driver
> without modification. The resulting file is not identical to the
> provided binary.
>
> The steps I’ve done so far:
>
> - Install kernel-sources, making sure the version matchs the running
> kernel. GCC also matches the version of /proc/version.
> - make oldconfig or make cloneconfig
> - make path/to/the/driver.ko
You need to do a full ‘make’, which has two parts. Your last step only does the
first part.
Hi
Not sure what module your trying to compile, but I need to patch the
toshiba_acpi module for bluetooth, here are the commands I run;
make clean
make oldconfig
make prepare
make scripts
cp /usr/src/linux-obj/i386/default/Module.symvers /usr/src/linux/
cd drivers/acpi
make -C /usr/src/linux SUBDIRS=$PWD modules
cp /usr/src/linux/drivers/acpi/toshiba_acpi.ko /lib/modules/`uname
-r`/kernel/drivers/acpi rmmod toshiba_acpi; modprobe toshiba_acpi
–
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.18-0.2-default
up 20:59, 2 users, load average: 0.14, 0.14, 0.18
GPU GeForce 6600 TE/6200 TE - Driver Version: 177.82
Thanks! I tried your commands and I can insert the module without errors. That was really fast.
However, the original and new driver’s file sizes are not identical.
After I run “strip -d” on the new file, the old (current) file size is still ~1KB over the new.
I don’t why the file sizes vary, when the sources are identical. Probably I should study the SPEC file of the OpenSuSE kernel to know that.
FYI: The module I’m trying to compile is “rtl8187.ko”, one of the wireless drivers, but all modules should compile the same way, shouldn’t they?
After some investigation I found that adding “CONFIG_DEBUG_INFO=y -k” to all the make commands (including oldconfig, prepare, etc) improves the result.
Additionally I added also “CONFIG_DEBUG_SECTION_MISMATCH=y” to the last make, and run “strip -d” to the resulting module.
Now files are almost identical. They differ a little in the header and a little over the middle.
Probably I can’t get any closer than that.