[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#728535: which size increment to expect



Geert Stappers <stappers@stappers.nl> writes:
> Op 2013-11-17 om 11:15 schreef Geert Stappers:
>> Op 2013-11-17 om 10:55 schreef Geert Stappers:
>> > 
>> > Edit on the kernel module source file, to add USB ID.
>> > 
>> > Executed `fakeroot debian/rules binary-arh
>> > Produced a same size .ko, but it should be bigger due the extra USB ID
>> 
>> Is it correct to expect an increase in size of the .ko with a few bytes?
>> 
>> Or is size increment in steps of 256 of 1024 bytes?
>> 
>
> Answer on my question:
>
> Yes, adding in .c source a line with VendorID and ProductID
> does increase the .ko module. In my case 120 bytes. 
> So no increment in steps of 256 or 1024 bytes.
>
>
> $ filtered ls -l  output
> -rw-r--r-- 1 root     root      23144 Nov 15 20:55 /lib/modules/3.11-1-amd64/kernel/drivers/media/usb/gspca/gspca_sunplus.ko
> -rw-r--r-- 1 stappers stappers  23264 Nov 17 14:40 /home/stappers/src/linux/linux-3.11.5-goed/debian/linux-image-3.11-1-amd64/lib/modules/3.11-1-amd64/kernel/drivers/media/usb/gspca/gspca_sunplus.ko


If I understand you correctly, you want to build a modified version of
gspca_sunplus.ko for your Debian 3.11-1-amd64 kernel?

You do not need to rebuild the whole kernel to do that.  You can build
your modified driver like it was an out-of-tree module:

 apt-get install linux-headers-3.11-1-amd64
 make -C /lib/modules/3.11-1-amd64/build SUBDIRS=/home/stappers/src/linux/linux-3.11.5-goed/drivers/media/usb/gspca gspca_sunplus.ko
 rmmod gspca_sunplus
 insmod /home/stappers/src/linux/linux-3.11.5-goed/drivers/media/usb/gspca/gspca_sunplus.ko

(this module is probably much bigger than the original due to debug
symbols not being stripped)

Now, if that worked then you might want to install it in place of the
original gspca_sunplus.ko module.  The easiest way to do that is

 mkdir /lib/modules/3.11-1-amd64/updates
 cp /home/stappers/src/linux/linux-3.11.5-goed/drivers/media/usb/gspca/gspca_sunplus.ko /lib/modules/3.11-1-amd64/updates
 depmod -a

It will now override the other gspca_sunplus.ko module for this kernel
version, even if you upgrade the kernel.  But if the kernel ABI changes,
then you will have to repeat the procedure for the new version.  That's
of course a feature...

And please: If you do stuff like this, and it works, then do report your
success back to the upstream maintainer! They will usually want to add
the new device IDs to the driver. Such changes are normally backported
to stable kernels, and appearing in Debian kernels a few weeks later.
So by doing that, you ensure that you won't have to keep on rebuilding
the driver forever.

Note: The above procedure should never be necessary for any end user
unless their quest is to test a new device ID before sending the patch
upstream.


Bjørn


Reply to: