0

We want to integrate a light sensor driver with Ubuntu's kernel. Please advise how can we do it.

The light sensor code given in opt3001.c here.

Eliah Kagan
  • 119,640

1 Answers1

0

It seems this is the mainline upstream kernel, so please have a look at MainlineBuilds, you can probably find the kernel suiting your needs here.

On ubuntu 16.04 , the default kernel (4.4) is too old for compiling this driver. But you can install a more recent kernel HWE using this command : sudo apt-get install --install-recommends linux-generic-hwe-16.04.

Manual compiling, tested on 16.04 with kernel 4.10.0-35-generic

mkdir opt3001 && cd opt3001
wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/iio/light/opt3001.c
echo 'obj-$(CONFIG_OPT3001)     += opt3001.o' > Makefile
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules

Some packages may be necessary (build-essential, linux-headers-$(uname -r), ...).

And you may have a look at this answer if you have troubles with secure boot (insmod: ERROR: could not insert module opt3001.ko: Required key not available).

pim
  • 3,350