ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
5.8k stars 1.87k forks source link

编译内核模块遇到的问题 #771

Closed shutup closed 1 year ago

shutup commented 1 year ago

Standard chat template, no routine, no chat. 标准聊天模板,无套路不聊天。

Device Information | 设备信息

Armbian Version | 系统版本

Describe the bug | 问题描述 Describe the problem in detail and attach screenshots if necessary. 详细描述问题,并在必要时附上屏幕截图。

最近在学习驱动开发,打算在n1上实践一下,于是使用了您发布的系统镜像为基础,在编译内核模块代码时,提示出错

make CC=clang-14
make -C /lib/modules/5.15.80-flippy-79+o/build ARCH=arm64 M=/home/shutup/develop/driver/hello modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.80-flippy-79+o'
  CC [M]  /home/shutup/develop/driver/hello/hello.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:289: /home/shutup/develop/driver/hello/hello.o] Error 126
make[2]: *** Deleting file '/home/shutup/develop/driver/hello/hello.o'
make[1]: *** [Makefile:1902: /home/shutup/develop/driver/hello] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.80-flippy-79+o'
make: *** [Makefile:6: kernel_modules] Error 2

于是我在/lib/modules/5.15.80-flippy-79+o/build,执行下面的命令,发现缺少文件

sudo make modules_prepare
[sudo] password for shutup:
  SYNC    include/config/auto.conf.cmd
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
can't find file Kconfig
make[2]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1
make[1]: *** [Makefile:621: syncconfig] Error 2
make: *** [Makefile:741: include/config/auto.conf.cmd] Error 2
make: *** [include/config/auto.conf.cmd] Deleting file 'include/generated/autoconf.h'

我现在很疑惑,是您那边需要提供这个文件吗?

ophub commented 1 year ago

在armbian里编译内核方法:

https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel#run-under-armbian-system