openwrt配置内核驱动_openWRT最小内核/应用模块的添加++++config.in/Kbuild调用树(先后顺序)...

本文详细介绍了如何在openWRT环境中添加内核驱动和应用模块,包括从获取源码到编译的步骤。首先,通过安装必要的编译工具,然后更新并安装feeds。接着,通过`make menuconfig`进行配置,新建模块目录,编写Makefile和config.in。对于内核模块,还需在相应配置文件中添加菜单项。最后,遵循特定的Kconfig和config.in调用顺序进行编译。
摘要由CSDN通过智能技术生成

openWRT编译初体验:

sudo apt-get update

sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev

svn co svn://svn.openwrt.org/openwrt/branches/backfire

./scripts/feeds update -a

./scripts/feeds install -a

make menuconfig

make V=s(若想清除重新编译则make distclean)

openWRT添加最小驱动模块、最小应用模块:

1.添加内核模块

进入openWRT/package目录下,新建模块目录mkdir example----->

cd example; touch Makefile;touch config.in ;mkdir src(makefile中PKG_NAME:=example;define KernelPackage/example;

$(eval $(call KernelPackage,example))语句是将该内核模块编译进系统的,必加)----->

cd src; touch makefile----->

在openWRT/tmp/.config-package.in中添加一个一级菜单并在菜单中包source "package/example/config.in"

make package/example/compile编译该模块即可。

如:

menu "Ralink Properties"

menu "Applications"

config PACKAGE_ated

tristate "ated.......................................................... ATE Daemon"

default y if DEFAULT_ated

default m if ALL

select PACKAGE_libc

select PACKAGE_librt if USE_EGLIBC

select PACKAGE_libpthread if USE_EGLIBC

help

ATE Daemon

endmenu

menu "Drivers"

menuconfig PACKAGE_kmod-rt2860v2

tristate "kmod-rt2860v2............................... Ralink MT7620 wifi AP driver"

default y if DEFAULT_kmod-rt2860v2

default y if (CONFIG_TARGET_ramips_mt7620n || CONFIG_TARGET_ramips_mt7620a)

select PACKAGE_maccalc

select PACKAGE_wireless-tools

depends on TARGET_ramips_mt7620a

help

This package contains a driver for MT7620

source "package/ralink/drivers/mt7620/config.in"

endmenu

endmenu

2.添加用户态工具或最小应用模块

进入openWRT/package目录下,新建模块目录mkdir example2----->

cd example2; touch Makefile;touch config.in ;mkdir src(makefile中PKG_NAME:=example2;define Package/example2;

$(eval $(call Package,example2))语句是将该内核模块编译进系统的,必加)----->

cd src; touch makefile----->

在openWRT/tmp/.config-package.in中添加一个一级菜单并在菜单中包source "package/example/config.in"

make package/example/compile编译该模块即可。

注:应用模块的新加菜单一般放在一级菜单Base system下,应用菜单作为二级或三级菜单。

openWRT各Kconfig或config.in的调用顺序:

顶层config.in:mainmenu "OpenWrt Configuration"

source "target/Config.in"

source "config/Config-images.in"

source "config/Config-build.in"

source "config/Config-devel.in"

source "toolchain/Config.in"

source "target/imagebuilder/Config.in"

source "target/sdk/Config.in"

source "target/toolchain/Config.in"

source "tmp/.config-package.in"

1.1source "target/Config.in":实现了类似内核中ARCH=arm及make SMDKxxx_defconfig的功能。

source "tmp/.config-target.in"

# Kernel/Hardware features

config GPIO_SUPPORT

config

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值