0
votes

I am using Ubuntu 16.0.4 LTS running linux kernel 4.4.0 series. I made some changes to the i2c-ocores code and eeprom driver and built the whole kernel afresh. Then I installed the newly built kernel.

I used the following steps to build the kernel:

1. sudo apt-get source linux-image-$(uname -r)
2. Applied my changes to i2c-ocores and eeprom driver
3. sudo chmod a+x debian/scripts/*
4. sudo chmod a+x debian/scripts/misc/*
5. sudo fakeroot debian/rules clean
6. sudo fakeroot debian/rules editconfigs
   a. Checked all the options for i2c driver
7. sudo fakeroot debian/rules binary-headers binary-generic skipabi=true skipmodule=true 
8. Installed all the .deb packages created by the build.

After installing new kernel, I rebooted the machine and inserted i2c-ocores and eeprom drivers and they worked fine. But after like four or five reboots, my insertion for these drivers fails. I am using modprobe to insert the modules.

Like for i2c-ocores, I get the following errors:

Aug 18 11:08:14 manik kernel: [  214.831678] i2c_ocores: disagrees about version of symbol i2c_new_device
Aug 18 11:08:14 manik kernel: [  214.831682] i2c_ocores: Unknown symbol i2c_new_device (err -22)
Aug 18 11:08:14 manik kernel: [  214.831700] i2c_ocores: disagrees about version of symbol i2c_del_adapter
Aug 18 11:08:14 manik kernel: [  214.831701] i2c_ocores: Unknown symbol i2c_del_adapter (err -22)
Aug 18 11:08:14 manik kernel: [  214.831708] i2c_ocores: disagrees about version of symbol i2c_add_adapter
Aug 18 11:08:14 manik kernel: [  214.831709] i2c_ocores: Unknown symbol i2c_add_adapter (err -22)

does anyone have any idea what is happening here ? Am I doing something wrong ?

1
You don't need to recompile entire kernel in the first place.0andriy
@AndyShevchenko - How would I build just those modules separately in this ubuntu setup ?Monku
@AndyShevchenko I don't think the issue is with the way I am building the modules since I am building the whole kernel itself.Monku
It's unclear why you do that, why you rebooted machine so often. All those in usual case is not needed, esp. when you build module for the running kernel.0andriy
Regarding to a modular build there are a lot of articles and examples. Google it or create a new question with your Makefile, source module directory layout, etc.0andriy

1 Answers

0
votes

There really isn't enough information in the question to give a definite answer, but I believe I might know the problem.

You are rebuilding an Ubuntu kernel, but not changing the version number. As a result, you are, effectively, overwriting the kernel that came with the system. Somewhere in the process, it is possible that you are getting a mismatch between the kernel you are using and the modules you are trying to load (i.e. - you are getting the vanilla kernel and your custom modules or vice-versa). When that happens, the errors you are seeing might come up.

My best advice for you is to change the appended revision of the kernel to something that contains your name before building. At the very least, that will allow you to see which versions are involved by simply running uname -r.

A few asides:

  • People offered you to build just the modules. That won't work for two reasons. First, you are replacing existing modules, which means you run the risk that exactly what I think happened would happen. More to the point, however, you say you change the kernel's config. You cannot do that when you build just the modules out of tree.
  • You are running sudo fakeroot. sudo is a tool that makes your commands run as root. fakeroot is a command that fakes the root environment when the real one isn't available. It makes no sense to run both. As far as I can tell, your best bet is to build with fakeroot and install with sudo.