felipe.o.gutierrez
Posts: 6
Joined: Tue Aug 07, 2018 8:36 am

Update RPi and the kernel modules

Tue Oct 23, 2018 11:20 am

Hi, I am using i2ctools to simulate sensors on Raspberry Pi. After enable i2c protocol on the RPi I use the commands below to get information from the kernel and install a module.

Code: Select all

sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) clean
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install
after this I can read and write on the i2c port:

Code: Select all

sudo modprobe -r i2c_stub
sudo insmod i2c-stub.ko chip_addr=0x20
sudo i2cset -y 3 0x20 0x00 0x01
sudo i2cget -y 3 0x20 0x00
Turns out that I updated and upgraded my RPi and also installed gcc 6 in order to implement these i2c function in C++. And the commands above are not working anymore. I will be specific about that. uname -r returns "4.14.77-v7+" and the directory build is only on the previous version of the OS. I already rebooted the system, did rpi-update, apt-get update, apt-get upgrade, but the directory of the latest version of the kernel module does not have the build directory. How do I update the kernel in order to create this directory?
Thanks

Code: Select all

[email protected]:~/i2c-tests# uname -r
4.14.77-v7+
[email protected]:~/i2c-tests# ls -l /lib/modules/4.14.77+/
total 1964
drwxr-xr-x 11 root root   4096 Oct 23 10:33 kernel
-rw-r--r--  1 root root 506145 Oct 23 10:33 modules.alias
-rw-r--r--  1 root root 524638 Oct 23 10:33 modules.alias.bin
-rw-r--r--  1 root root  10927 Oct 23 10:33 modules.builtin
-rw-r--r--  1 root root  11915 Oct 23 10:33 modules.builtin.bin
-rw-r--r--  1 root root 152939 Oct 23 10:33 modules.dep
-rw-r--r--  1 root root 220322 Oct 23 10:33 modules.dep.bin
-rw-r--r--  1 root root    302 Oct 23 10:33 modules.devname
-rw-r--r--  1 root root  58565 Oct 23 10:33 modules.order
-rw-r--r--  1 root root    352 Oct 23 10:33 modules.softdep
-rw-r--r--  1 root root 222434 Oct 23 10:33 modules.symbols
-rw-r--r--  1 root root 273499 Oct 23 10:33 modules.symbols.bin
[email protected]:~/i2c-tests# ls -l /lib/modules/4.9.35-v7+/
total 1852
lrwxrwxrwx  1 root root     33 Jul  3  2017 build -> /usr/src/linux-headers-4.9.35-v7+
drwxr-xr-x  2 root root   4096 Oct 19 15:43 extra
drwxr-xr-x 11 root root   4096 Jun 23  2017 kernel
-rw-r--r--  1 root root 478139 Jul  3  2017 modules.alias
-rw-r--r--  1 root root 492852 Jul  3  2017 modules.alias.bin
-rw-r--r--  1 root root   4778 Jul  3  2017 modules.builtin
-rw-r--r--  1 root root   6290 Jul  3  2017 modules.builtin.bin
-rw-r--r--  1 root root 153132 Jul  3  2017 modules.dep
-rw-r--r--  1 root root 222028 Jul  3  2017 modules.dep.bin
-rw-r--r--  1 root root    302 Jul  3  2017 modules.devname
-rw-r--r--  1 root root  61224 Jul  3  2017 modules.order
-rw-r--r--  1 root root     55 Jul  3  2017 modules.softdep
-rw-r--r--  1 root root 198792 Jul  3  2017 modules.symbols
-rw-r--r--  1 root root 245292 Jul  3  2017 modules.symbols.bin

User avatar
bensimmo
Posts: 3317
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Update RPi and the kernel modules

Tue Oct 23, 2018 11:25 am

Don't rpi-update.
That's a testing kernel.
Unless you are needing something from it.

Solve your problems or not, I don't know.

felipe.o.gutierrez
Posts: 6
Joined: Tue Aug 07, 2018 8:36 am

Re: Update RPi and the kernel modules

Wed Oct 24, 2018 7:34 am

I solved by reverting back to the previous kernel (https://www.raspberrypi.org/documentati ... pdating.md)

Return to “Advanced users”