openwrt--内核编译及生成

0:重要文件

在下面的目录中包含了编译过程中调用的makefile.很重要的。

[root@localhost /openwrt/openwrt/trunk/include]$ls
autotools.mk      device_table.txt.bak  kernel-build.mk     Makefile             package-dumpinfo.mk  quilt.mk  site                uclibc++.mk
cmake.mk          download.mk           kernel-defaults.mk  netfilter.mk         package-ipkg.mk      rules.mk  subdir.mk           unpack.mk
debug.mk          host-build.mk         kernel.mk           nls.mk               package.mk           scan.mk   target.mk      verbose.mk
depends.mk        host.mk               kernel-version.mk   package-bin.mk       prereq-build.mk      scons.mk  toolchain-build.mk  version.mk
device_table.txt  image.mk              ltqtapi.mk   


1:内核编译:

现在了最新的open的trunk之后, /openwrt/openwrt/trunk中的makefile是总的编译开始,其中有如下内容:

 include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1)
  _SINGLE=export MAKEFLAGS=$(space);
  override OPENWRT_BUILD=1
  export OPENWRT_BUILD
  GREP_OPTIONS=
  export GREP_OPTIONS
  include $(TOPDIR)/include/debug.mk
  include $(TOPDIR)/include/depends.mk
  include $(TOPDIR)/include/toplevel.mk
else
  include rules.mk
  include $(INCLUDE_DIR)/depends.mk
  include $(INCLUDE_DIR)/subdir.mk
  include target/Makefile
  include package/Makefile
  include tools/Makefile
  include toolchain/Makefile

其中在此处关注的是文件   include target/Makefile  

其中首先看看

$(curdir)/builddirs:=linux sdk imagebuilder toolchain
$(curdir)/builddirs-default:=linux 可以看到在此目录下面有:/openwrt/openwrt/trunk/target/linux中的makefile 

include $(INCLUDE_DIR)/target.mk
export TARGET_BUILD=1
prereq clean download prepare compile install menuconfig nconfig oldconfig update refresh: FORCE
@+$(NO_TRACE_MAKE) -C $(BOARD) $@

其中NO_TRACE_MAKE 就是在顶层通过make menuconfig时配置的目标是什么,此处选择是ar71xx。

因此在看看ar71xx中的makefile是怎么定义的。

include $(TOPDIR)/rules.mk
ARCH:=mips  当前的CPU是MIPS
BOARD:=ar71xx 板子类型
BOARDNAME:=Atheros AR7xxx/AR9xxx
FEATURES:=mips16
CPU_TYPE=34kc
SUBTARGETS:=generic nand mikrotik
LINUX_VERSION:=3.10.36  内核版本
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += \
        kmod-gpio-button-hotplug swconfig  kmod-ath9k wpad-mini uboot-envtools 必须编译的模块
$(eval $(call BuildTarget)) 需要实际执行的目标。

下面来看看BuildTarget的定义:












  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

家有工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值