驅動程式 - Linux Device Driver(LDD) - 解決Fatal error: asm/rwonce.h file not found問題



參考資訊:
https://lore.kernel.org/lkml/CAK7LNAQ8h7zxhfndBqYRWXkaWVynH7GpBvDPLcVMZ1VEyUUX7A@mail.gmail.com/T/

問題如下:

In file included from samples/bpf/xdp_adjust_tail_kern.c:15:
In file included from ./include/linux/in.h:19:
In file included from ./include/uapi/linux/in.h:24:
In file included from ./include/linux/socket.h:8:
In file included from ./include/linux/uio.h:8:
In file included from ./include/linux/kernel.h:8:
In file included from ./include/linux/linkage.h:7:
In file included from ./include/linux/export.h:43:
./include/linux/compiler.h:248:10: fatal error: 'asm/rwonce.h' file not found
#include <asm/rwonce.h>
         ^~~~~~~~~~~~~~
1 error generated.
^Cmake[1]: *** [samples/bpf/Makefile:315: samples/bpf/xdp_adjust_tail_kern.o] Interrupt

解法如下:

$ vim tools/bpf/Makefile +11
    CFLAGS += -Wall -O2 -I$(srctree)/usr/include