notro / fbtft_tools

27 stars 17 forks source link

How to add ads7846_device to the kernel tree? #4

Closed ctshh closed 9 years ago

ctshh commented 9 years ago

I am crosscompiling my Raspberry Pi kernel on another, rather much faster, machine. Therefore I'd like to add ads7846_device to my kernel source tree and compile the module together with the other drivers.

I have added ads7846_device.c to drivers/input/touchscreen/, I have added the lines

config TOUCHSCREEN_ADS7846_DEVICE
        tristate "ADS7846 based touchscreens device adder"
        help
          Say Y here if you have a touchscreen interface using the
          ADS7846/TSC2046/AD7873 or ADS7843/AD7843 controller,
          and would actually like to enable the device.

          To compile this driver as a module, choose M here: the
          module will be called ads7846_device.

to drivers/input/touchscreen/Kconfig and the line

obj-$(CONFIG_TOUCHSCREEN_ADS7846_DEVICE)        += ads7846_device.o

to drivers/input/touchscreen/Makefile.

The module, once enabled with make menuconfig is compiled correctly to ads7846_device.o but does not show up within my module-tree.

Any ideas how to correctly add ads7846_device to the kernel source tree so that it gets compiled and the module installed?

ctshh commented 9 years ago

make mrproper and make for the kernel and modules did install ads7846_device - but now ads7846 is gone. Any ideas what I'm doing wrong?

notro commented 9 years ago

No need to put it in the source tree. This is an log extract from my automated build:

cd /home/pi/rpi-firmware/fbtft/workdir/linux && ARCH=arm CROSS_COMPILE=/home/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- make INSTALL_MOD_PATH=/home/pi/rpi-firmware/fbtft/workdir/modules M=/home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device modules modules_install
  LD      /home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device/built-in.o
  CC [M]  /home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device/ads7846_device.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device/ads7846_device.mod.o
  LD [M]  /home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device/ads7846_device.ko
  INSTALL /home/pi/rpi-firmware/fbtft/workdir/fbtft_tools/ads7846_device/ads7846_device.ko
  DEPMOD  3.12.25+

Regarding ads7846, is it enabled in .config (TOUCHSCREEN_ADS7846) ?

ctshh commented 9 years ago

Perfect, thank you. For everyone stumbling across this - check your paths in the above, mine are a little different. Most notably because I followed some other RasPi kernel building instructions my crosscompiler-path is different. ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- make INSTALL_MOD_PATH=~/modules M=/root/fbtft_tools-master/ads7846_device/ads7846_device modules modules_install