您尚未登录。

楼主 #1 2021-01-21 17:13:09

LinuxGo
会员
注册时间: 2021-01-07
已发帖子: 88
积分: 120

求助:f1c100s vscode下驱动编写 老是编译不过,

按照正点原子的驱动教程 在vscode下写了如下代码

#include <linux/module.h>
static int __init chardevbase_init(void)
{

	return 0;
}
static void __exit chardevbase_exit(void)
{
    ;
}
module_init(chardevbase_init);
module_exit(chardevbase_exit);

在Makefile里写了

KERNELDIR := /home/jonsen/f1c100s/linux
CURRENT_PATH := $(shell pwd)
obj-m := chrdevbase.o

build:kernel_modules

kernel_modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) kernel_modules
Clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) chean

c_cpp_properties.json修改了如下

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/home/jonsen/f1c100s/linux/include",
                "/home/jonsen/f1c100s/linux/arch/arm/include/",
                "/home/jonsen/f1c100s/linux/arch/arm/include/generated/"
            ],
            "defines": [],
            //"compilerPath": "/usr/bin/gcc",
            "compilerPath":"/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

make 后
出现 :
jonsen@ubuntu:~/f1c100s/test_chrdevbase$ make
make -C /home/jonsen/f1c100s/linux M=/home/jonsen/f1c100s/test_chrdevbase kernel_modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
make[1]: *** No rule to make target 'kernel_modules'.  Stop.
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:8: kernel_modules] Error 2
不知怎么处理了,大佬们 帮忙指指路。。。

最近编辑记录 LinuxGo (2021-01-21 17:17:18)

离线

#2 2021-01-21 17:23:33

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

Re: 求助:f1c100s vscode下驱动编写 老是编译不过,

写一个简单的V3s@linux4.13-y 中断驱动
http://whycan.com/t_1261.html
(出处:哇酷开发者社区)

离线

#3 2021-01-21 18:47:36

armstrong
会员
注册时间: 2019-04-10
已发帖子: 287
积分: 196.5

Re: 求助:f1c100s vscode下驱动编写 老是编译不过,

把$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) kernel_modules
改成$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
试试

离线

楼主 #4 2021-01-22 05:54:53

LinuxGo
会员
注册时间: 2021-01-07
已发帖子: 88
积分: 120

Re: 求助:f1c100s vscode下驱动编写 老是编译不过,

改后有变化,错误信息还是有,大佬再看下

jonsen@ubuntu:~/f1c100s/test_chrdevbase$ make
make -C /home/jonsen/f1c100s/linux M=/home/jonsen/f1c100s/test_chrdevbase modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
  CC [M]  /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o
In file included from ./arch/x86/include/asm/barrier.h:5,
                 from ./include/linux/compiler.h:242,
                 from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:
./arch/x86/include/asm/arch_hweight.h:55:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64’
   55 |  asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
      |                                          ^~~~~~~~
./arch/x86/include/asm/alternative.h:133:28: note: in definition of macro ‘ALTINSTR_REPLACEMENT’
  133 |  b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
      |                            ^~~~~~~~
./arch/x86/include/asm/arch_hweight.h:55:7: note: in expansion of macro ‘ALTERNATIVE’
   55 |  asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
      |       ^~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:20:40: error: unknown type name ‘atomic64_t’
   20 | static inline long atomic64_read(const atomic64_t *v)
      |                                        ^~~~~~~~~~
In file included from ./include/linux/kernel.h:10,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: In function ‘atomic64_read’:
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
   22 |  return READ_ONCE((v)->counter);
      |                      ^~
./include/linux/compiler.h:246:17: note: in definition of macro ‘__READ_ONCE’
  246 |  union { typeof(x) __val; char __c[1]; } __u;   \
      |                 ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
   22 |  return READ_ONCE((v)->counter);
      |         ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
   22 |  return READ_ONCE((v)->counter);
      |                      ^~
./include/linux/compiler.h:248:22: note: in definition of macro ‘__READ_ONCE’
  248 |   __read_once_size(&(x), __u.__c, sizeof(x));  \
      |                      ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
   22 |  return READ_ONCE((v)->counter);
      |         ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
   22 |  return READ_ONCE((v)->counter);
      |                      ^~
./include/linux/compiler.h:248:42: note: in definition of macro ‘__READ_ONCE’
  248 |   __read_once_size(&(x), __u.__c, sizeof(x));  \
      |                                          ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
   22 |  return READ_ONCE((v)->counter);
      |         ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
   22 |  return READ_ONCE((v)->counter);
      |                      ^~
./include/linux/compiler.h:250:30: note: in definition of macro ‘__READ_ONCE’
  250 |   __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
      |                              ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
   22 |  return READ_ONCE((v)->counter);
      |         ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
   22 |  return READ_ONCE((v)->counter);
      |                      ^~
./include/linux/compiler.h:250:50: note: in definition of macro ‘__READ_ONCE’
  250 |   __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
      |                                                  ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
   22 |  return READ_ONCE((v)->counter);
      |         ^~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:32:33: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   32 | static inline void atomic64_set(atomic64_t *v, long i)
      |                                 ^~~~~~~~~~
      |                                 atomic_t
./arch/x86/include/asm/atomic64_64.h:44:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   44 | static __always_inline void atomic64_add(long i, atomic64_t *v)
      |                                                  ^~~~~~~~~~
      |                                                  atomic_t
./arch/x86/include/asm/atomic64_64.h:58:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   58 | static inline void atomic64_sub(long i, atomic64_t *v)
      |                                         ^~~~~~~~~~
      |                                         atomic_t
./arch/x86/include/asm/atomic64_64.h:74:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   74 | static inline bool atomic64_sub_and_test(long i, atomic64_t *v)
      |                                                  ^~~~~~~~~~
      |                                                  atomic_t
./arch/x86/include/asm/atomic64_64.h:85:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   85 | static __always_inline void atomic64_inc(atomic64_t *v)
      |                                          ^~~~~~~~~~
      |                                          atomic_t
./arch/x86/include/asm/atomic64_64.h:98:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
   98 | static __always_inline void atomic64_dec(atomic64_t *v)
      |                                          ^~~~~~~~~~
      |                                          atomic_t
./arch/x86/include/asm/atomic64_64.h:113:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  113 | static inline bool atomic64_dec_and_test(atomic64_t *v)
      |                                          ^~~~~~~~~~
      |                                          atomic_t
./arch/x86/include/asm/atomic64_64.h:126:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  126 | static inline bool atomic64_inc_and_test(atomic64_t *v)
      |                                          ^~~~~~~~~~
      |                                          atomic_t
./arch/x86/include/asm/atomic64_64.h:140:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  140 | static inline bool atomic64_add_negative(long i, atomic64_t *v)
      |                                                  ^~~~~~~~~~
      |                                                  atomic_t
./arch/x86/include/asm/atomic64_64.h:152:57: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  152 | static __always_inline long atomic64_add_return(long i, atomic64_t *v)
      |                                                         ^~~~~~~~~~
      |                                                         atomic_t
./arch/x86/include/asm/atomic64_64.h:157:48: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  157 | static inline long atomic64_sub_return(long i, atomic64_t *v)
      |                                                ^~~~~~~~~~
      |                                                atomic_t
./arch/x86/include/asm/atomic64_64.h:162:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  162 | static inline long atomic64_fetch_add(long i, atomic64_t *v)
      |                                               ^~~~~~~~~~
      |                                               atomic_t
./arch/x86/include/asm/atomic64_64.h:167:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  167 | static inline long atomic64_fetch_sub(long i, atomic64_t *v)
      |                                               ^~~~~~~~~~
      |                                               atomic_t
./arch/x86/include/asm/atomic64_64.h:175:37: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  175 | static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
      |                                     ^~~~~~~~~~
      |                                     atomic_t
./arch/x86/include/asm/atomic64_64.h:181:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  181 | static __always_inline bool atomic64_try_cmpxchg(atomic64_t *v, s64 *old, long new)
      |                                                  ^~~~~~~~~~
      |                                                  atomic_t
./arch/x86/include/asm/atomic64_64.h:186:34: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  186 | static inline long atomic64_xchg(atomic64_t *v, long new)
      |                                  ^~~~~~~~~~
      |                                  atomic_t
./arch/x86/include/asm/atomic64_64.h:200:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  200 | static inline bool atomic64_add_unless(atomic64_t *v, long a, long u)
      |                                        ^~~~~~~~~~
      |                                        atomic_t
./arch/x86/include/asm/atomic64_64.h:219:45: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  219 | static inline long atomic64_dec_if_positive(atomic64_t *v)
      |                                             ^~~~~~~~~~
      |                                             atomic_t
./arch/x86/include/asm/atomic64_64.h:230:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  230 | static inline void atomic64_and(long i, atomic64_t *v)
      |                                         ^~~~~~~~~~
      |                                         atomic_t
./arch/x86/include/asm/atomic64_64.h:238:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  238 | static inline long atomic64_fetch_and(long i, atomic64_t *v)
      |                                               ^~~~~~~~~~
      |                                               atomic_t
./arch/x86/include/asm/atomic64_64.h:247:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  247 | static inline void atomic64_or(long i, atomic64_t *v)
      |                                        ^~~~~~~~~~
      |                                        atomic_t
./arch/x86/include/asm/atomic64_64.h:255:46: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  255 | static inline long atomic64_fetch_or(long i, atomic64_t *v)
      |                                              ^~~~~~~~~~
      |                                              atomic_t
./arch/x86/include/asm/atomic64_64.h:264:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  264 | static inline void atomic64_xor(long i, atomic64_t *v)
      |                                         ^~~~~~~~~~
      |                                         atomic_t
./arch/x86/include/asm/atomic64_64.h:272:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
  272 | static inline long atomic64_fetch_xor(long i, atomic64_t *v)
      |                                               ^~~~~~~~~~
      |                                               atomic_t
In file included from ./include/linux/atomic.h:660,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:21:18: error: conflicting types for ‘atomic64_read’
   21 | extern long long atomic64_read(const atomic64_t *v);
      |                  ^~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:20:20: note: previous definition of ‘atomic64_read’ was here
   20 | static inline long atomic64_read(const atomic64_t *v)
      |                    ^~~~~~~~~~~~~
In file included from ./include/linux/atomic.h:660,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:59: warning: "atomic64_inc_return" redefined
   59 | #define atomic64_inc_return(v)  atomic64_add_return(1LL, (v))
      | 
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:172: note: this is the location of the previous definition
  172 | #define atomic64_inc_return(v)  (atomic64_add_return(1, (v)))
      | 
In file included from ./include/linux/atomic.h:660,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:63: warning: "atomic64_dec_return" redefined
   63 | #define atomic64_dec_return(v)  atomic64_sub_return(1LL, (v))
      | 
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:173: note: this is the location of the previous definition
  173 | #define atomic64_dec_return(v)  (atomic64_sub_return(1, (v)))
      | 
In file included from ./include/linux/atomic.h:660,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:65: warning: "atomic64_inc_not_zero" redefined
   65 | #define atomic64_inc_not_zero(v)  atomic64_add_unless((v), 1LL, 0LL)
      | 
In file included from ./arch/x86/include/asm/atomic.h:276,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/jump_label.h:186,
                 from ./arch/x86/include/asm/string_64.h:6,
                 from ./arch/x86/include/asm/string.h:5,
                 from ./include/linux/string.h:19,
                 from ./arch/x86/include/asm/page_32.h:35,
                 from ./arch/x86/include/asm/page.h:14,
                 from ./arch/x86/include/asm/thread_info.h:12,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:210: note: this is the location of the previous definition
  210 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:21: warning: "PUD_SHIFT" redefined
   21 | #define PUD_SHIFT P4D_SHIFT
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:56: note: this is the location of the previous definition
   56 | #define PUD_SHIFT 30
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:22: warning: "PTRS_PER_PUD" redefined
   22 | #define PTRS_PER_PUD 1
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:57: note: this is the location of the previous definition
   57 | #define PTRS_PER_PUD 512
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:23: warning: "PUD_SIZE" redefined
   23 | #define PUD_SIZE   (1UL << PUD_SHIFT)
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:73: note: this is the location of the previous definition
   73 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:24: warning: "PUD_MASK" redefined
   24 | #define PUD_MASK   (~(PUD_SIZE-1))
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:74: note: this is the location of the previous definition
   74 | #define PUD_MASK (~(PUD_SIZE - 1))
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:20: warning: "PMD_SHIFT" redefined
   20 | #define PMD_SHIFT PUD_SHIFT
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:63: note: this is the location of the previous definition
   63 | #define PMD_SHIFT 21
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:21: warning: "PTRS_PER_PMD" redefined
   21 | #define PTRS_PER_PMD 1
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:64: note: this is the location of the previous definition
   64 | #define PTRS_PER_PMD 512
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:22: warning: "PMD_SIZE" redefined
   22 | #define PMD_SIZE   (1UL << PMD_SHIFT)
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:71: note: this is the location of the previous definition
   71 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:23: warning: "PMD_MASK" redefined
   23 | #define PMD_MASK   (~(PMD_SIZE-1))
      | 
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
                 from ./arch/x86/include/asm/processor.h:19,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:72: note: this is the location of the previous definition
   72 | #define PMD_MASK (~(PMD_SIZE - 1))
      | 
In file included from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/processor.h:180: warning: "cache_line_size" redefined
  180 | #define cache_line_size() (boot_cpu_data.x86_cache_alignment)
      | 
In file included from ./include/linux/printk.h:9,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/cache.h:79: note: this is the location of the previous definition
   79 | #define cache_line_size() L1_CACHE_BYTES
      | 
In file included from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/processor.h: In function ‘load_cr3’:
./arch/x86/include/asm/processor.h:253:12: error: implicit declaration of function ‘__sme_pa’ [-Werror=implicit-function-declaration]
  253 |  write_cr3(__sme_pa(pgdir));
      |            ^~~~~~~~
In file included from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/thread_info.h: At top level:
./include/linux/thread_info.h:96:19: error: redefinition of ‘arch_within_stack_frames’
   96 | static inline int arch_within_stack_frames(const void * const stack,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/thread_info.h:171:19: note: previous definition of ‘arch_within_stack_frames’ was here
  171 | static inline int arch_within_stack_frames(const void * const stack,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/elf.h:5,
                 from ./include/linux/module.h:15,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: In function ‘elf_common_init’:
./arch/x86/include/asm/elf.h:180:3: error: ‘struct thread_struct’ has no member named ‘fsbase’
  180 |  t->fsbase = t->gsbase = 0;
      |   ^~
./arch/x86/include/asm/elf.h:180:15: error: ‘struct thread_struct’ has no member named ‘gsbase’
  180 |  t->fsbase = t->gsbase = 0;
      |               ^~
In file included from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: In function ‘mmap_is_ia32’:
./include/linux/thread_info.h:91:22: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration]
   91 |  test_ti_thread_flag(current_thread_info(), flag)
      |                      ^~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
  306 |   test_thread_flag(TIF_ADDR32));
      |   ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:91:22: warning: passing argument 1 of ‘test_ti_thread_flag’ makes pointer from integer without a cast [-Wint-conversion]
   91 |  test_ti_thread_flag(current_thread_info(), flag)
      |                      ^~~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      int
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
  306 |   test_thread_flag(TIF_ADDR32));
      |   ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:77:59: note: expected ‘struct thread_info *’ but argument is of type ‘int’
   77 | static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
      |                                       ~~~~~~~~~~~~~~~~~~~~^~
In file included from ./include/linux/cache.h:6,
                 from ./include/linux/printk.h:9,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: At top level:
./arch/x86/include/asm/cache.h:8:25: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function); did you mean ‘CONFIG_ARM_L1_CACHE_SHIFT’?
    8 | #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/cache.h:9:30: note: in expansion of macro ‘L1_CACHE_SHIFT’
    9 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
      |                              ^~~~~~~~~~~~~~
./include/linux/cache.h:13:25: note: in expansion of macro ‘L1_CACHE_BYTES’
   13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES
      |                         ^~~~~~~~~~~~~~
./include/linux/cache.h:35:58: note: in expansion of macro ‘SMP_CACHE_BYTES’
   35 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
      |                                                          ^~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:381:3: note: in expansion of macro ‘____cacheline_aligned’
  381 | } ____cacheline_aligned;
      |   ^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/module.h:24,
                 from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/module.h:67:2: error: #error unknown processor family
   67 | #error unknown processor family
      |  ^~~~~
In file included from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/module.h:131:6: warning: ‘init_module’ specifies less restrictive attribute than its target ‘chardevbase_init’: ‘cold’ [-Wmissing-attributes]
  131 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:15:1: note: in expansion of macro ‘module_init’
   15 | module_init(chardevbase_init);
      | ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:3:19: note: ‘init_module’ target declared here
    3 | static int __init chardevbase_init(void)
      |                   ^~~~~~~~~~~~~~~~
In file included from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/module.h:137:7: warning: ‘cleanup_module’ specifies less restrictive attribute than its target ‘chardevbase_exit’: ‘cold’ [-Wmissing-attributes]
  137 |  void cleanup_module(void) __attribute__((alias(#exitfn)));
      |       ^~~~~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:17:1: note: in expansion of macro ‘module_exit’
   17 | module_exit(chardevbase_exit);
      | ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:9:20: note: ‘cleanup_module’ target declared here
    9 | static void __exit chardevbase_exit(void)
      |                    ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:323: /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o] Error 1
make[1]: *** [Makefile:1508: _module_/home/jonsen/f1c100s/test_chrdevbase] Error 2
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:8: kernel_modules] Error 2
armstrong 说:

把$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) kernel_modules
改成$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
试试

离线

#5 2021-01-22 15:13:51

心情复杂
会员
注册时间: 2019-12-15
已发帖子: 37
积分: 30

Re: 求助:f1c100s vscode下驱动编写 老是编译不过,

ARCH=arm
#当前目录
CUR_DIR = $(shell pwd)
#源码目录
KERNEL_DIR = /home/jonsen/f1c100s/linux
#交叉编译工具链
CROSS_COMPILE = arm-linux-gnueabihf-
#模块名字
MODULE_NAME = chrdevbase

ifeq ($(KERNELRELEASE),)
all:
    make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(CUR_DIR) modules   
clean:
    #清除模块
    make -C $(KERNEL_DIR) M=$(CUR_DIR) clean
else
    obj-m+=$(MODULE_NAME).o

endif

试试这个

离线

楼主 #6 2021-01-22 16:04:36

LinuxGo
会员
注册时间: 2021-01-07
已发帖子: 88
积分: 120

Re: 求助:f1c100s vscode下驱动编写 老是编译不过,

感谢大佬,
目前写成了,顺利编译

KERNELDIR := /home/jonsen/f1c100s/linux/
CURRENT_PATH := $(shell pwd)
CROSS_COMPILE:= /home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-
ARCH = arm
obj-m := chardevbase.o

build: kernel_modules

kernel_modules:
	$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
心情复杂 说:

ARCH=arm
#当前目录
CUR_DIR = $(shell pwd)
#源码目录
KERNEL_DIR = /home/jonsen/f1c100s/linux
#交叉编译工具链
CROSS_COMPILE = arm-linux-gnueabihf-
#模块名字
MODULE_NAME = chrdevbase

ifeq ($(KERNELRELEASE),)
all:
    make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(CUR_DIR) modules   
clean:
    #清除模块
    make -C $(KERNEL_DIR) M=$(CUR_DIR) clean
else
    obj-m+=$(MODULE_NAME).o

endif

试试这个

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn