openwrt的一些资料

http://blog.chinaunix.net/uid-28396016-id-3590867.html coovachilli无线认证

http://code.commotionwireless.net/projects/commotion/wiki/Virtual-Box 制作vdi

http://blog.csdn.net/manfeel/article/category/1707987 一个关于openwrt的 BLOG

http://blog.csdn.net/jt6562/article/details/23831735 如何将openwrt移植到intel Galileo

http://wiki.openwrt.org/doc/techref/procd procd进程管理

http://wiki.openwrt.org/inbox/procd-init-scripts procd脚本编写 (结尾还有示例)

http://wiki.openwrt.org/doc/techref/hotplug 热插介绍

https://forum.openwrt.org/viewtopic.php?id=49599 openwrt-systemd

https://github.com/aport/openwrt-systemd openwrt-systemd github

https://forum.openwrt.org/viewtopic.php?id=44363 New qos-scripts package (drop in replacement)

http://downloads.openwrt.org/docs/eclipse.pdf eclipse下调试openWRT的应用程序,在此目录下还有其他文档

http://wiki.openwrt.org/doc/start 官方文档首页

http://downloads.openwrt.org/kamikaze/docs/openwrt.html 官方文档

http://wiki.openwrt.org/doc/devel/gdb 调试

http://wiki.openwrt.org/doc/devel/add.new.device 添加新设备

http://wiki.openwrt.org/doc/devel/add.new.platform 添加新平台

http://wiki.openwrt.org/doc/howto/build 官方buildroot文档


http://axlrose.blog.51cto.com/434566/1293640 通过openpctv简单学习opkg安装与生成包的一些过程

http://wiki.openwrt.org/doc/devel/crosscompile 交叉编译

http://wiki.openwrt.org/doc/techref/opkg 包管理器

http://wiki.openwrt.org/zh-cn/doc/recipes/3gdongle 3G配置

http://www.51nb.com/forum/viewthread.php?tid=1034040&pid=15625649&page=1&extra=page%3D1 3G合并带宽

http://blog.csdn.net/sydjm/article/details/8232963 [置顶] [OpenWrt] openwrt的一些琐事

http://blog.csdn.net/openme_openwrt/article/details/7348452  编译OpenWrt - 索引

http://blog.163.com/gl_jiang@126/blog/static/761009722013210918644/ 创建包

http://blog.csdn.net/openme_openwrt/article/category/1123712 openwrt CSDN文章


http://blog.csdn.net/openme_openwrt/article/details/7956120 介绍 OpenWrt中的FEATURES:=broken jffs2


Wiki导航:http://wiki.openwrt.org/doc/start


编译OpenWRT
0早期的openwrt编译文档:http://downloads.openwrt.org/docs/buildroot-documentation.html#about


1工具链:http://wiki.openwrt.org/about/toolchain

2编译准备:http://wiki.openwrt.org/doc/howto/buildroot.exigence

3编译:http://wiki.openwrt.org/doc/howto/build

4添加feeds:http://wiki.openwrt.org/doc/devel/feeds

5Image Builder:http://wiki.openwrt.org/doc/howto/obtain.firmware.generate

6 SDK:http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk

7 Rootfs on External Storage (extroot):

    http://wiki.openwrt.org/doc/howtobuild/extroot.howtobuild

    http://wiki.openwrt.org/doc/howto/extroot

8 wireless router which is connected to either a wired, a wireless or a 3G wireless connection:

    http://wiki.openwrt.org/doc/howtobuild/wireless-router-with-a-3g-dongle

9 How to Build a Single Package

    http://wiki.openwrt.org/doc/howtobuild/single.package


Developing开发


1 Cross Compile:http://wiki.openwrt.org/doc/devel/crosscompile


            外部编译器设置

                 https://forum.openwrt.org/viewtopic.php?id=32330

                 https://forum.openwrt.org/viewtopic.php?id=29804

                 https://forum.openwrt.org/viewtopic.php?id=12436

           内部编译器设置

2 Creating packages:http://wiki.openwrt.org/doc/devel/packages

3 Feeds:http://wiki.openwrt.org/doc/devel/feeds

4 Using Dependencies:http://wiki.openwrt.org/doc/devel/dependencies

5 How To Submit Patches to OpenWrt:

    https://dev.openwrt.org/wiki/SubmittingPatches

6 External Toolchain - Use OpenWrt as External Toolchain

    http://wiki.openwrt.org/doc/howto/external_toolchain

    https://lists.openwrt.org/pipermail/openwrt-devel/2009-February/003774.html

http://blog.csdn.net/openme_openwrt/article/details/8299215  OpenWrt取消strip或者重新设置strip参数的方法

http://andelf.diandian.com/post/2013-05-22/40050677370 添加新设备


http://wiki.openwrt.org/doc/devel/packages  制作包参考文档

4、OpenWrt取消strip的方法

1
make package /foo/ {clean,compile} V=99 STRIP= /bin/true


也就是说如果默认使用strip破坏了你的程序、库,可以使用STRIP=/bin/true来取消strip操作,直接在Makefile中定义也是可以的

1
2
3
4
5
SECTION:=base   在opkg中的段
CATEGORY:=Network   在menuconfig中的分类
DEFAULT := y 在menuconfig中变成默认选中
PKG_RELEASE 类似arch包的尾部子版本,
参考 i2c-gpio-custom , kernel.mk  package-default.mk


PKG_CAT - How to decompress the sources (zcat, bzcat, unzip)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
PKG_NAME - The name of the package, as seen via menuconfig and ipkg
PKG_VERSION - The upstream version number that we're downloading
PKG_RELEASE - The version of this package Makefile
PKG_LICENSE - The license(s) the package is available under, SPDX form.
PKG_LICENSE_FILE- file containing the license text
PKG_BUILD_DIR - Where to compile the package
PKG_SOURCE - The filename of the original sources
PKG_SOURCE_URL - Where to download the sources from (directory)
PKG_MD5SUM - A checksum to validate the download
PKG_CAT - How to decompress the sources (zcat, bzcat, unzip)
PKG_BUILD_DEPENDS - Packages that need to be built before this package, but are not required at runtime. Uses the same syntax as DEPENDS below.
PKG_INSTALL - Setting it to "1" will call the package's original "make install" with prefix set to PKG_INSTALL_DIR
PKG_INSTALL_DIR - Where "make install" copies the compiled files
PKG_FIXUP - ???



1
2
3
4
5
6
7
8
9
10
Adding configuration options
If you would like configure your package installation /compilation in the menuconfig you can do the following: Add MENU:=1 to your package definition like this:
define Package /mjpg-streamer
  SECTION:=multimedia
  CATEGORY:=Multimedia
  TITLE:=MJPG-streamer
  DEPENDS:=@!LINUX_2_4 +libpthread-stubs +jpeg
  URL:=http: //mjpg-streamer .wiki.sourceforge.net/
  MENU:=1
endef

Create a config key in the Makefile:

1
2
3
define Package /mjpg-streamer/config
    source "$(SOURCE)/Config.in"
endef
1
2
3
4
And finally you can check your configuration parameters in your Makefile in the following way: (Note that you can reference to the parameters value with it name prefixed with CONFIG_)
ifeq ($(CONFIG_MJPEG_STREAMER_INPUT_UVC),y)
$(CP) $(PKG_BUILD_DIR) /input_uvc .so $(1) /usr/lib
endif

内核模块 autoload

  AUTOLOAD:=$(call AutoLoad,30,loop)


1
2
3
define Build/InstallDev
    $(INSTALL_DIR) $(STAGING_DIR)/usr/ include /madwifi
endef

http://wiki.openwrt.org/doc/devel/dependencies 依赖关系,必看

1
DEPENDS 中 @GPIO_SUPPORT 会在menuconfig中的depends中出现, 而其他子包+kmod-i2c-core则不会出现在里面,将会被opkg的包依赖引用
1
2
3
4
5
EXTRA_KCONFIG := CONFIG_SPI_GPIO_CUSTOM=m  (spi-gpio-custom 包)
EXTRA_CFLAGS
AUTOLOAD表示会自动加载,放入 /etc/modules .d/
FILES 指定模块名
PKG_BUILD_PARALLEL 并行编译

http://wiki.openwrt.org/doc/devel/feeds 添加自定义的feed的方法使用 src-link 本地link方式

1
2
3
src-link customfeed /home/user/openwrt/project/packages
PKG_FILE_DEPENDS 和 PKG_BUILD_DEPNEDS:=opkg /host
参考 base-files示例



1
PKG_FLAGS := hold 将会在ipk安装的时候hold, 使用例子 kernel的Makefile, 在 package-ipkg.mk中定义


1
2
3
kernel /linux/Makefile :PKG_FLAGS:=hold
libs /toolchain/Makefile :  PKG_FLAGS:=hold essential
utils /busybox/Makefile :PKG_FLAGS:=essential


判断包是否被选中

CONFIG_PACKAGE_包名

1
ifneq ($(CONFIG_PACKAGE_odhcp6c_ext_s46),0)
1
2
3
4
PKGARCH:=all 脚本之类的使用all
PKG_REV    使用git的值
PKG_RELEASE
PKG_BUILD_PARALLEL:=1 并行构建

PKG_CONFIG_DEPENDS 为配置依赖, 可依赖HOST的,如python包, python/host 编译,但包中必须有支持host的构建功能

PKG_BUILD_DEPENDS -需要预先构建的软件包,但只是在构建本软件包时,而不是运行的时候。它的语法和下面的DEPENDS一样。

BUILD_VARIANT变量灵活运用参考open包示例

参考opkg和ffmpeg可以得出通过包里的VARIANT变量就可以得来BUILD_VARIANT关联



Build/IncludeOverlay 包含 $(TOPDIR)/overlay/*/$(PKG_NAME).mk  可用于覆盖相同包的参数

1
feeds /oldpackages/open/Makefile :  PROVIDES:=open

PROVIDES为opkg提供provide,$(PKG_INFO_DIR)/$(1).provides在 package-ipkg.mk中处理

PKG_SOURCE_VERSION 参考 procd 包,使用git取代码,指定版本号

添加不属于Linux源码包的内核模块。在这种情况下,内核模块放在package/目录,跟通常的软件包是一样的。package/Makefile文件使用KernelPackage/xxx定义代替Package/xxx。

这是package/madwifi/Makefile的例子

PKG_INSTALL:=1 https://dev.openwrt.org/browser/feeds/desktop/apps/recordmydesktop/Makefile


http://blog.csdn.net/yangguanghaozi/article/details/17583303

需要注意的是:因为在SmartBox中依赖了libstdcpp以及libpthread,需要在Makefile中添加

1
2
DEPENDS:=+libstdcpp+libpthread”


package-ipkg.mk

:执行makeV=s时可能会显示错误提示:Packagememwatch is missing dependencies for the followinglibraries:libc.so.6,这个错误是因为SDKOpenWrt-SDK-ramips-for-linux-i686-gcc-4.6-linaro_uClibc-0.9.33.2/stagin_dir/target-mipsel_r2_uClibc-0.9.33.2/pkginfo目录下没有libstdcpp.provides,新建一个,并添加内容

1
2
3
libstdc++.so.6
libstdc++.so.6.0.16
libstdc++.so.6.0.16-gdb.py

添加一个libpthread.provides,内容为:

1
2
3
libgcc_s.so.1
libpthread-0.9.33.2.so
libpthread.so.0



内核模块包中 KCONFIG

通过查看include/target.mk 文件中, 查找 .config.override  .config.target

还有include下几个kernel相关的mk文件中

其中 .config.target为 openwrt根目录下 make menuconfig 得到的CONFIG_KERNEL_XXX得到的

.config.override为 包模块里 KCONFIG= 得到的

用户自定义的为 $(TOPDIR)/env/kernel-config 

最后通过scripts/kconfig.pl 来处理


在package.mk中

可以通过$(TOPDIR)/*/*.mk 来覆盖包

define Build/IncludeOverlay 来替换掉包中的信息

1
2
3
4
5
6
7
FEATURE_xxx   feeds /xorg/gtk2/Makefile
oldpackages /libs/libdirectfb/Makefile
define Feature /DirectFB
TARGET_NAME:=drawing-backend
TARGET_TITLE:=Drawing Backend
NAME:=DirectFB
endif
1
2
3
package-dumpinfo.mk 定义 $(call Feature,DirectFB)
./xorg/xorg/lib/libX11/Makefile:define Feature/libX11
./xorg/xorg/lib/libX11/Makefile:$(eval $(call Feature,libX11))


以Depends方式使用供menuconfig

1
2
3
$ grep FEATURE_ xorg /lib/gtk2/Makefile
  +FEATURE_drawing-backend_DirectFB:directfb \
  +FEATURE_drawing-backend_libX11:libX11 \


以CONFIG_FEATURE_方式使用

1
$( if $(CONFIG_FEATURE_drawing-backend_DirectFB),--with-gdktarget=directfb,)


调试包

1
2
3
4
5
6
TOPDIR=$PWD make -C package/ DUMP=1 V=99
make package/ /clean V=99
make package/ /install V=99
make package/ /prepare V=99
make package/ /compile V=99
make package/ /configure V=99





1
2
TARGET_CFLAGS += -ggdb3
make package /busybox/ {clean,compile} V=99 CONFIG_DEBUG=y
1
2
3
4
gdbserver :9000 /bin/ping example.org
. /scripts/remote-gdb 192.168.1.1:9000 . /build_dir/target- * /busybox- * /busybox
关于stamp在$(STAGING_DIR)下stamp下面 ls -al, 还有一些其他目录,
其他包编译是放在构建包目录下 .built等隐藏文件


1
2
3
4
5
.built
.built_check
.configured
preparedf5837c063b28dd4125539e9d71721a60
.preparedf5837c063b28dd4125539e9d71721a60_check


添加新平台必须要 rm -rf $(TOPDIR)/tmp目录,重新make menuconfig


overlay目录下的

*/$(PKG_NAME).mk 会被调用到 InstallOverlay替换主仓库的


files下的文件为覆盖rootfs根目录下的对应文件


在新工程中添加上游仓库

1
2
3
4
cd $(TOPDIR)
ln -sv env /overlay ./
ln -sv env /files ./
ln -sv env /feed .conf ./
1
2
make package /download 下载包源代码
make download 下载所有需要的源代码
1
2
3
4
@+$(SUBMAKE) tools/download
@+$(SUBMAKE) toolchain/download
@+$(SUBMAKE) package/download
@+$(SUBMAKE) target/download


1
2
查看 ../include/toplevel.mk
make kernel_menuconfig


定制 /etc/opkg.conf

1
2
3
在menuconfig菜单中的位置
        --- Image configuration                                                                                                                     
                 [*]   Version configuration options  --->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
include /version .mk中通过配置 CONFIG_VERSION_REPO来处理更新opkg.conf
在VERSION_SED中,可以查找到%T为替换$(BOARD)参数,还有其他%V等
通过 sed 替换掉 CONFIG_VERSION_REPO中的变量来实现自动替换目标板opkg.conf信息
如意云插件中自动清理内存脚本
#!/bin/sh
tmp1=$( free | grep Mem: | awk '{print $4}' )
tmp2=$( cat /opt/app/FreeD/etc/config | grep freeLow | cut -d '=' -f2)
if [ $tmp1 -lt $tmp2 ]; then
    sync
    sleep 1
    echo 1 > /proc/sys/vm/drop_caches
fi
Targets for 'make'
download 下载源代码
    download all source tarballs (from the selected packages and it's dependencies) at once before starting the build
   
prereq 构建前的准备,预先编译host所需要的工具
    checks if you have all prerequisites installed on the host-system for building the selected packages
   
world 构建所有
    build everything
tools /install toolchain /install  对host工具还有工具链编译
    only build the tools and the toolchain
   
clean 清理包,不会清理工具链
    cleans the packages (NOT the tools and toolchain)
   
distclean 清理一切,慎用!!!
    cleans up everything expect $(TOPDIR)/.config and $(TOPDIR) /dl/
   
package/-{clean,compile} 针对包编译清理等
    rebuild a single package
   
package /index  构建包索引,用于opkg
    updates $(TOPDIR) /bin/packages/Packages
   
V=99 调试使用,还有V=s参数
    turns on debugging
   
make kernel_menuconfig 直接进行内核的menuconfig
    If you want, you can also modify the kernel config for the selected target system. Simply run "make kernel_menuconfig"
    and the build system will unpack the kernel sources ( if necessary), run menuconfig inside of the kernel tree, and then
    copy the kernel config to target /linux/ /config so that it is preserved over "make clean" call.
   
   
   
   
   
使用本地源镜像,用于下载源代码包,如同gentoo的distfiles
echo "http://local.mirror/path/" > scripts /localmirrors
选择xorg /qt4 包里,需要在全局── Global build settings
Symbol: DISPLAY_SUPPORT [=y]
Prompt: Show packages that require graphics support ( local or remote)
在Qt选项中才会出现gui相关的选项
$(TOPDIR) /include/kernel-defaults .mk中
define Kernel /Configure/Default
   将$(TOPDIR)/.config中的 CONFIG_KERNEL_* 存到 $(LINUX_DIR)/.config.target
   通过scrits /metadata .pl kconfig 将$(TMP_DIR)/.packageinfo 和 $(TOPDIR)/.config中的 kconfig 转存到 $(LINUX_DIR)/.config.override
   即modules.mk中的驱动模块包 KCONFIG:= CONFIG_RTC_CLASS=y   CONFIG_RTC_DRV_STMP=m



Hooks/Prepare/Pre += prepare_source_directory 添加HOOKS函数

本文出自 “枪炮与玫瑰的BLOG” 博客,请务必保留此出处http://axlrose.blog.51cto.com/434566/1530954

你可能感兴趣的:(openwrt)