首页 > 其他分享 >ERROR: Kernel configuration is invalid.

ERROR: Kernel configuration is invalid.

时间:2023-06-01 18:04:21浏览次数:26  
标签:Kernel mini make module invalid linux home configuration


最简单的linux hello的驱动源程序

//下面是驱动源代码  

#include <linux/init.h>  
#include <linux/module.h>   

static int hello_init(void)  
{  
    printk(KERN_ALERT "Hello, Tekkaman Ninja !\n");  
    return 0;  
}  

static void hello_exit(void)  
{  
    printk(KERN_ALERT "Goodbye, Tekkaman Ninja !\n Love Linux !Love ARM ! Love KeKe !\n");  
}  

module_init(hello_init);  
module_exit(hello_exit);  



MODULE_LICENSE("Dual BSD/GPL");

下面是Makefile

#!/bin/bash
#通知编译器我们要编译模块的哪些源码
#这里是编译itop4412_hello.c这个文件编译成中间文件itop4412_hello.o
obj-m += mini_linux_module.o 

#源码目录变量,这里用户需要根据实际情况选择路径
#作者是将Linux的源码拷贝到目录/home/topeet/android4.0下并解压的
KDIR := /home/iTop4412_Kernel_3.0

#当前目录变量
PWD ?= $(shell pwd)

#make命名默认寻找第一个目标
#make -C就是指调用执行的路径
#$(KDIR)Linux源码目录,作者这里指的是/home/iTop4412_Kernel_3.0
#$(PWD)当前目录变量
#modules要执行的操作
all:
    make -C $(KDIR) M=$(PWD) modules

#make clean执行的操作是删除后缀为o的文件
clean:
    rm -rf *.o

执行make出现错误

make -C /home/kernel/iTop4412_Kernel_3.0 M=/mnt/code/01qudong/mini_linux_module modules
make[1]: Entering directory '/home/kernel/iTop4412_Kernel_3.0'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump /home/kernel/iTop4412_Kernel_3.0/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /mnt/code/01qudong/mini_linux_module/mini_linux_module.o
cc1: fatal error: include/generated/autoconf.h: No such file or directory
compilation terminated.
scripts/Makefile.build:311: recipe for target '/mnt/code/01qudong/mini_linux_module/mini_linux_module.o' failed
make[2]: *** [/mnt/code/01qudong/mini_linux_module/mini_linux_module.o] Error 1
Makefile:1368: recipe for target '_module_/mnt/code/01qudong/mini_linux_module' failed
make[1]: *** [_module_/mnt/code/01qudong/mini_linux_module] Error 2
make[1]: Leaving directory '/home/kernel/iTop4412_Kernel_3.0'
Makefile:18: recipe for target 'all' failed
make: *** [all] Error 2

或者是

make[1]: Entering directory `/home/xduser/study/driver/src/linux-2.6.22'    

      ERROR: Kernel configuration is invalid.    
      include/linux/autoconf.h or include/config/auto.conf are missing.    
       Run 'make oldconfig && make prepare' on kernel src to fix it.    
  WARNING: Symbol version dump /home/xduser/study/driver/src/linux-2.6.22'/Module.symvers is missing; modules will have no dependencies and modversions.

原因是内核没有编译,先处理内核 编译
简单说一说内核编译
1、先make distclean,然后确认主Makefile的设置
(1)主要是检查交叉编译工具链有没有设置对。CROSS_COMPILE ?= /usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-
(2)确认ARCH = arm。主要目的是为了编译时能找到arch/arm目录。
2、make x210ii_qt_defconfig
最后出现configuration written to .config,就证明我们的操作是正确的。
如果没有得到.config文件,不能进入下一步。实测发现没有.config也可以make menuconfig,但是这样做出来的内核编译和烧写运行应该是有问题的。
3、make menuconfig
(1)可能出现的错误1:ncurses库没装
错误信息:
* Unable to find the ncurses libraries or the
* required header files.
* ‘make menuconfig’ requires the ncurses libraries.


* Install ncurses (ncurses-devel) and try again.
解决方案:apt-get install libncurses5-dev
(2)可能出现的错误2:屏幕太小
错误信息:
Your display is too small to run Menuconfig!
It must be at least 19 lines by 80 columns.
解决方案:全屏,或者是把字体调小。

总结:
(1)这里会弹出配置界面。
(2)make menuconfig是第二步配置。
(3)因为此内核是九鼎已经移植过的,因此这里的配置可以不做,直接退出即可。
4、make
编译完成后得到的内核镜像不在源码树的根目录下,而是在arch/arm/boot这个目录下。
得到的镜像名是zImage。


标签:Kernel,mini,make,module,invalid,linux,home,configuration
From: https://blog.51cto.com/u_16147764/6397231

相关文章

  • /proc/sys/kernel/sysrq /proc/sysrq-trigger----强制重启/触发器
    LINUX远程强制重启/proc/sys/kernel/sysrq/proc/sysrq-trigger----触发器ttp://blog.csdn.net/beckdon/article/details/41313713http://blog.csdn.net/chinaclock/article/details/50499530http://www.cnblogs.com/justin-y-lin/p/5424555.htmlhttps://www.cnblogs.com/yang......
  • [SprigMVC/SpringBoot] JSON序列化专题之日期序列化问题:接口报Jackson框架错误“Inva
    0序言今日工作中遇到的一个bug。各位看官且听我娓娓道来。1问题描述请求接口时,service层返回到controller层的数据结构为List<Map<Strig,Object>>,而Map中存在一个key=date,valuetype=java.time.LocalDate的Entry,且日志报如下错误:InvalidDefinitionException:Java8date......
  • Google Pixel 4 Android13 刷入Magisk + KernelSU 双root环境
    本文所有教程及源码、软件仅为技术研究。不涉及计算机信息系统功能的删除、修改、增加、干扰,更不会影响计算机信息系统的正常运行。不得将代码用于非法用途,如侵立删!GooglePixel4Android13刷入Magisk+KernelSU双root环境环境win10Pixel4Android13下载官方rom包......
  • java同步mysql的数据到PostgreSQL时报错ERROR: invalid byte sequence for encoding "
    最近,同事在做一个功能,通过java程序将mysql中的一张表的数据同步到pgsql中,在同步过程中,插入到pgsql中出现了如下错误:`###Errorupdatingdatabase.Cause:org.postgresql.util.PSQLException:ERROR:invalidbytesequenceforencoding"UTF8":0x00在位置:unnamedportalpa......
  • Invalid prop: type check failed for prop “value”. Expected String, Number, got
    记录一个报错问题,之前别的同事写的代码,还看了半天有点无语!!下拉选择部门,联动动态赋值责任人下拉列表警告,导致选择责任人的时候无法正确赋值undefined。究其原因是封装的表单formItem项中传入了下拉选项的映射字段,如下: 而在选择部门的时候又已经把动态数据遍历处理成了标准的la......
  • docker evel=error msg="error reading the kernel parameter net.ipv4.vs.expire_nod
    我使用的是dockerswarm-#报错evel=errormsg="errorreadingthekernelparameternet.ipv4.vs.expire_nodest_conn"error="open/proc/sys/net/ipv4/vs/expire_nodest_conn:nosuchfileordirectory"-#查看是否开启ip_vslsmod|grepip_vs==============......
  • 【.NET源码解读】Configuration组件及自动更新
    Configuration组件是.NET中一个核心的、非常重要的组件。它提供了一种方便的机制,用于从配置文件、环境变量、命令行参数等各种数据源中读取和配置应用程序,以满足不同环境下应用程序的需求。在本篇文章中,将会介绍Configuration的基本用法,并通过源码探究.NET中Configuration的实现......
  • org.springframework.security.authentication.InternalAuthenticationServiceExcepti
    添加如下配置即可1.在pom.xml添加<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.3.6.RELEA......
  • RockyLinux9.2升级 kernel6.X 内核
    RockyLinux9.2升级内核......
  • npm install ERR_INVALID_URL错误
    我在terminal中设置了proxy后,开启proxyon后,执行npminstall包错误: 把proxyoff后,错误又没有了,不知道是啥问题。下面的文章可能有作用:https://weekendprojects.dev/posts/how-to-fix-npm-err_invalid_url/#:~:text=The%20%E2%80%9CNPM%20ERR_INVALID_URL%E2%80%9D%20error%20occ......