I want to compile one of linux kernel source files (/net/rds/recv.c)for this, call gcc like below : gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)  cc1 -E -quiet -nostdinc -v -imultiarch x86_64-linux-gnu-iprefix ../lib/gcc/x86_64-linux-gnu/5/ -D __attribute__(x)= -D __restrict= -D __extension__=-D __asm__= -D __asm__(x)=-D __const= -D __inline__=-D __inline= -D __volatile__=-D __builtin_va_list=int-D __KERNEL__ -isystem /lib/modules/4.7.0-rc1+/build/-isystem /home/username/Desktop/linux/include/-isystem /home/username/Desktop/linux/usr/include/-isystem /home/username/workspace/Repositories/4.7.0-rc1+- headers/linux/arch/x86/include/ -isystem /home/username/workspace/Repositories/4.7.0-rc1+-headers/linux/arch/x86/include/uapi/-isystem /home/username/workspace/Repositories/4.7.0-rc1+- headers/linux/arch/x86/include/generated/ -isystem /home/username/workspace/Repositories/4.7.0-rc1+- headers/linux/arch/x86/include/generated/uapi/-isystem /usr/lib/gcc/x86_64-linux-gnu/5/include/-isystem /usr/include/ home/myfolder/linux/net/rds/recv.c -mtune=generic -march=x86-64 -std=c99 - fstack-protector-strong -Wformat -Wformat-securitybut gcc return me error : /home/username/linux/include/linux/jiffies.h:40:3: error: #error Invalid  value of HZ. # error Invalid value of HZ./home/username/linux/include/linux/jiffies.h:257:31: error: division by zero    in #if #if !((((NSEC_PER_SEC << 2) / TICK_NSEC) << (SEC_JIFFIE_SC - 2)) &   0x80000000)                           ^/home/username/linux/include/linux/jiffies.h:293:42: error: division by zero   in #if#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)                                      ^ /home/username/linux/include/linux/jiffies.h:366:20: error: division by   zero in   #if   #if !(USEC_PER_SEC % HZ) /home/username/linux/include/linux/mm_types.h:163:45: error: missing binary   operator before token (  #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS...how can I solve this errors. thanks very much for your help.
compile one file of linux kernel
linux kernel;gcc
try withmake net/rds/recv.oBut you should realize that you need a configured kernel in order to compile files. The kernel configuration setup which architecture is it used, which main features are to be included (e.g. multi-core/multi-processor), etc. Many of the kernel header needs such information to generate the correct wrappers around common functions.Note: the make command will give you (if you are in verbose mode V=1) the parameters that you need to add to compile that file (e.g. which directory to include).