Errors when configuring kernel to enalbe Hidraw

I‘m trying to install a driver for a touch sreen wihch needs to enable Hidraw.
and I did the following steps:

cd /usr/src/linux-headers-3.10.40-ga7da876
make menuconfig
make

then I got mistakes like this:
make[1]: *** No rule to make target init/main.o', needed by init/built-in.o’. Stop.
make: *** [init] Error 2

I’ve tried to erase the old .config and after the make menuconfig there was a new one,so I think the configuration is a success.

How can I solve this?

Any information would be greatly appreciated!

also I’ve tried make clean / make mrproper / make distclean before make
and the get mistakes like this:

scripts/Makefile.clean:17: /usr/src/linux-headers-3.10.40-ga7da876/drivers/infiniband/hw/amso1100/Makefile: 没有那个文件或目录(no such file or directory
make[3]: *** 没有规则可以创建目标“/usr/src/linux-headers-3.10.40-ga7da876/drivers/infiniband/hw/amso1100/Makefile”。 停止。
make[2]: *** [drivers/infiniband/hw/amso1100] 错误 2 (error 2)
make[1]: *** [drivers/infiniband] 错误 2
make: *** [_clean_drivers] 错误 2

I made some translation,hope the Chinese won’t be too confused to understand…

/home/yao/下载/2017-09-29 15_01_01屏幕截图.png

Headers alone are not enough. When building an “external” (out-of-tree) module it is usually because you have a source for a driver which is from a third party and not distributed with the kernel source. You would cd into that source and perform the correct commands. The headers would be referenced by this external module, but are not the actual driver source.

Kernel source on R21.5 is here:
https://developer.nvidia.com/linux-tegra-r215

“hidraw” is in the kernel source, so you’d build the kernel from kernel source by normal methods (you need to download kernel source and build from this). This would include a starting config matching your running system (such as from “/proc/config.gz”…sometimes tegra210_defconfig will work, sometimes not), then setting CONFIG_LOCALVERSION to match the suffix of “uname -r”. After this you can make menuconfig and build as expected.

thank you for your reply!

I’ve downloaded the R21.5 Kernel sources, and place it under /usr/src.

What should I do to set the CONFIG_LOCALVERSION?

The suffix of the current kernel is 3.10.40-ga7da876

The kernel source version would be “3.10.40”. So the suffix is the remainder…set CONFIG_LOCALVERSION to “-ga7da876” (don’t forget the hyphen). Then when this kernel boots verify that “uname -r” still matches “3.10.40-ga7da876” (if you had a different kernel source version the prefix would then break even though the suffix would match).

I do the following steps,and achive my goal.

zcat /proc/config.gz > .config

then do

make menuconfig

, modify the configuration,and CONFIG_LOCALVERSION,save and exit.

make -j4 zIamge
make modules
make modules_install

then copy the new zImage to replace the one in /boot,and reboot.

and now hidraw devices can be found under /dev.

Making change in a new kernel source did help solve the problem,thanks a lot!@linuxdev