Taylorbyte.com

Documentation Wiki

Compiling packages and kernel modules in OpenWrt

Compiling a package

Prepair directories for svn downlod, then download the appropriate svn for your release

mkdir ~/openwrt
cd ~/openwrt

To download trunk svn

svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk

To download a release svn

svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment
cd attitude_adjustment/

Update feeds

./scripts/feeds update -a

Install package feed

./scripts/feeds install nginx
ls feeds/packages/net/nginx/

edit package/feeds/packages/nginx/Makefile and add

ADDITIONAL_MODULES += --with-http_realip_module

Compile

make defconfig
make prereq
make -j 8

ipk packages are created automatically in

./bin/[target]/packages/

Example nginx package is found here

./bin/ar71xx/packages/nginx_1.2.2-1_ar71xx.ipk

Extra commands

Locate the binary

find . -name '*package*'

To check binary size

ls -alh ./build_dir/target-mips_r2_uClibc-0.9.33.2/nginx-1.2.2/ipkg-ar71xx/nginx/usr/sbin/nginx
cp ./build_dir/target-mips_r2_uClibc-0.9.33.2/nginx-1.2.2/ipkg-ar71xx/nginx/usr/sbin/nginx ~/

To recompile a single package after make has been run atleast once

make package/nginx/{clean,compile,install} -j 8

To force compile a single package add variable DEVELOPER=1 to beginning of the line, ususally the compile will fail anyway.

DEVELOPER=1 make package/nginx/{clean,compile,install} -j 8 V=99

To see a more verbose output add V=99 to the line, for example

make package/nginx/{clean,compile,install} -j 8 V=99

Compiling a kernel module

Prepair directories for svn downlod, then download the appropriate svn for your release

mkdir ~/openwrt
cd ~/openwrt

To download trunk svn

svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk

To download a release svn

svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment
cd attitude_adjustment/

Update feeds

./scripts/feeds update -a

kmod-sched with drr support

edit package/kernel/modules/netsupport.mk and add the next line after CONFIG_NET_SCH_TEQL \

CONFIG_NET_SCH_DRR \

Configure make menuconfig

touch package/kernel/Makefile
make menuconfig

Select kmod-sched, exit and save

Kernel modules  --->  Network Support  --->  <M> kmod-sched

Compile

make defconfig
make prereq
make -j 8

Gather modules

mkdir modules
find . -name "*.ko" ! -wholename "./modules/*" -prune -exec cp {} modules \;

Extra commands

Locate the module

find . -name '*module*'

Or to locate all modules

find . -name '*.ko'