OpenWRT-developing guider

一、openwrt's build system

1.1 有关介绍

openwrt build system包含一系列Makefile和patches,用来生成嵌入式系统的cross-compiling toolchain,rootfile system。

交叉编译工具链包括:
(1)编译器(gcc之类)
(2)二进制工具(汇编器、链接器等,binutils)
(3)C标准库(glibc,uClibc等)

1.2 Build sequence(建立序列)

(1)tools – automake, autoconf, sed, cmake
(2)toolchain/binutils – as, ld, …
(3)toolchain/gcc – gcc, g++, cpp, …
(4)target/linux – kernel modules
(5)package – core and feed packages
(6)target/linux – kernel image
(7)target/linux/image – firmware image file generation

1.3 Usage(使用)

(1)updating feeds
./scripts/feeds update -a
(2)在make menuconfig菜单中显示所有package
具体某个package
./scripts/feeds install
所有的package
./scripts/feeds install -a

image配置
通常步骤:
(1)make menuconfig 配置target system、subtarget、target profile等
(2)make defconfig
(3)make menuconfig,修改package的设置
(4)scripts/diffconfig.sh >mydiffconfig将配置设置保存到mydiffconfig文件
(5)make V=s编译openwrt

Make tips
make V=s 2>&1 | tee build.log | grep -i error
The above saves a full verbose copy of the build output (with stdout piped to stderr) in /openwrt/trunk/build.log and only shows errors on the screen.

ionice -c 3 nice -n 20 make -j 2 V=s CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 | tee build.log | egrep -i '(warn|error)'
The above saves a full verbose copy of the build output (with stdout piped to stderr) in build.log and outputs only warnings and errors while building using only background resources on a dual core CPU.

IGNORE_ERRORS=1 make
If you are building everything (not just packages enough to make a flashable image) and build stops on a package you don't care about you can skip failed packages by using IGNORE_ERRORS=1

make V=s ; echo -e '\a'
设置结束声音警报

make clean
清楚/bin和/build_dir目录里面的内容,并不清楚toolchain和除在.config选择之外的architectures/targets

make dirclean
清除/bin,/build_dir,/staging_dir,/toolchain,/logs

make distclean
清除编译过程中产生的所有文件,包括下载的源代码。慎用

你可能感兴趣的:(OpenWRT-developing guider)