2026/6/19 17:01:19
网站建设
项目流程
购物分享网站流量排名,建域名做网站,wordpress去除分类链接,网站开发就业岗位文章目录1、Linux内核裁剪1.1、使用make menuconfig情况下的工作流1.1.1、加载开发板默认配置1.1.2、添加自己的模块选项到make menuconfig菜单1.1.3、在make menuconfig勾选刚添加的选项1.1.4、把修改后的.config保存成新的xxx_defconfig1.1.5、编译1.2、不使用make menuconfi…文章目录1、Linux内核裁剪1.1、使用make menuconfig情况下的工作流1.1.1、加载开发板默认配置1.1.2、添加自己的模块选项到make menuconfig菜单1.1.3、在make menuconfig勾选刚添加的选项1.1.4、把修改后的.config保存成新的xxx_defconfig1.1.5、编译1.2、不使用make menuconfig情况下的工作流2、总结1、Linux内核裁剪目标不使用make menuconfig增加/减少Linux内核编译输出的模块搞清楚Kconfig、.config、xxx_defconfig和Makefile之间的关系1.1、使用make menuconfig情况下的工作流1.1.1、加载开发板默认配置将 arch/arm/configs/100ask_imx6ull_defconfig复制到 Linux项目的根目录下并重命名为为.config$make100ask_imx6ull_defconfig1.1.2、添加自己的模块选项到make menuconfig菜单如果要在100ask_imx6ull_defconfig的配置基础上添加自己的配置可以在相应的目录下编写驱动程序例如在drivers/input/misc/下编写100ask_adxl345-spi.c在drivers/input/misc/下找到Kconfig文件并修改... config INPUT_ADXL34X tristateAnalog Devices ADXL34x Three-Axis Digital Accelerometerdefault nhelpSay Y hereifyou have a Accelerometer interface using the ADXL345/6 controller, and your board-specific initialization code includes thatinits table of devices. This driver can use either I2C or SPI communication to the ADXL345/6 controller. Select the appropriate methodforyour system. If unsure, say N(but its safe to sayY). To compile this driver as a module, choose M here: the module will be called adxl34x.... config INPUT_ADXL34x_MOD tristate100ask SPI bus connectiondepends on INPUT_ADXL34XSPI default mhelpSay Y hereifyou have ADXL345/6 hooked to a SPI bus. To compile this driver as a module, choose M here: the module will be called 100ask_adxl34x-spi....1.1.3、在make menuconfig勾选刚添加的选项在make menuconfig的GUI界面勾选编译选项后会修改.config的编译配置$makemenuconfig被make menuconfig修改后的.config文件如下...CONFIG_INPUT_ADXL34Xy...CONFIG_INPUT_ADXL34x_MODm...这些变量名都会在编译时被读取到Kconfig同级目录的Makefile中例如drivers/input/misc/的Makefile如下所示... obj-$(CONFIG_INPUT_ADXL34X)adxl34x.o... obj-$(CONFIG_INPUT_ADXL34x_MOD)100ask_adxl345-spi.o...1.1.4、把修改后的.config保存成新的xxx_defconfig这里的xxx_defconfig 100ask_imx6ull_defconfig$makesavedefconfig $mvdefconfig arch/arm/configs/my_name_defconfig1.1.5、编译# 如果obj-m, 则即可makemodules# 如果obj-y, 则即可makezImage1.2、不使用make menuconfig情况下的工作流在1.1.3章节中直接手工修改.config文件即可2、总结xxx_defconfig文件用于记录配置好的编译配置.config内核当前的编译配置存在于内核的顶层目录在make xxx_defconfig后出现从 arch/…/configs/xxx_defconfig 生成 .configmake menuconfig修改.config手动编辑 .config 可替代 menuconfigKconfig定义make menuconfig的菜单项Kconfig同级目录的Makefile读取.config中的CONFIG_XXX变量来决定编译行为通过 obj- $ (CONFIG_XXX) 响应配置