Development

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:13, 7 August 2006 (edit)
Jcollake (Talk | contribs)
(Instructions)
← Previous diff
Revision as of 19:38, 8 August 2006 (edit) (undo)
AlReece45 (Talk | contribs)
(Instructions)
Next diff →
Line 23: Line 23:
</pre> </pre>
 +==Source Retrivial==
 +
 +The first step is to retrieve the desired DD-WRT version. You can do this by either downloading from the DD-WRT downloads section, or by checking out using Subversion.
 +
 +===Subversion===
 +
 +First you'll need to get subversion, available at http://subversion.tigris.org/
 +For some Linux distributions, you should be able to get subversion using the package manager tool.
 +
 +After installing, you can get the latest source from DD-WRT by running the following command:
 +
 +<pre>svn co svn://svn.dd-wrt.com/DD-WRT .</pre>
 +
 +That will download the source into the current directory, you could change the directory by changing the "." at the end to the directory you would like the source in. Leaving out the "." will download everything to a "DD-WRT" sub-directory.
 +
 +===Download Section===
 +
 +Another way to get the source is to download it from the [http://www.dd-wrt.com/dd-wrtv2/downloads.php Downloads Section].
 +Afterwards you need to extract it which is done simply by using a command like:
 +<pre>tar -jxvf nameoffile.tar.bz</pre>
 +
==Instructions== ==Instructions==
-The first step is to check out the desired revisoin from subversion repository at svn://svn.dd-wrt.com/DD-WRT. Starting with DD-WRT v23 SP2, the svn revision number should be indicated in the DD-WRT version string. Then you'll want to download the 3.4.6 and 4.1.0 mipsl uclibc toolchains. The mips-uclibc 3.4.6 toolchain is used for building the kernel and the 4.1.0 mipsel-uclibc toolchain is used for building the user-mode packages. Unpack the toolchains wherever you desire, the scripts below will set up symlinks appropriately.+ 
 +You'll need the 3.4.6 and 4.1.0 mipsl uclibc toolchains. The mips-uclibc 3.4.6 toolchain is used for building the kernel and the 4.1.0 mipsel-uclibc toolchain is used for building the user-mode packages. Unpack the toolchains wherever you desire, the scripts below will set up symlinks appropriately.
'''After''' running these scripts below, to build DD-WRT you simply need to: '''After''' running these scripts below, to build DD-WRT you simply need to:

Revision as of 19:38, 8 August 2006

Contents

Building DD-WRT from Source

Building DD-WRT from source is not that difficult, but don't expect the build system to be as well maintained as OpenWrt. Brainslayer has not the time to do everything. Until the day comes that DD-WRT will build without any extra steps, I've written some scripts that will set up a build environment for DD-WRT. Newer builds of DD-WRT may break compatibility with these scripts. If this happens and I don't update them, please take the time to update them if you are sure your changes are appropriate.

Requirements

To build DD-WRT, you need a Linux machine. It should work on any reasonably modern machine with basic development tools installed.

Pre-requisites (todo: someone please finish this list -- most/all of the openwrt pre-requisites are required):

  • Automake v1.9.4
  • GNU Make v?
  • GCC/G++ v4
  • ncurses v?

Organization

WiP DD-WRT's source is organized like so:

src/            source
  router/       packages 
  linux/        kernel
opt/            make/control

Source Retrivial

The first step is to retrieve the desired DD-WRT version. You can do this by either downloading from the DD-WRT downloads section, or by checking out using Subversion.

Subversion

First you'll need to get subversion, available at http://subversion.tigris.org/ For some Linux distributions, you should be able to get subversion using the package manager tool.

After installing, you can get the latest source from DD-WRT by running the following command:

svn co svn://svn.dd-wrt.com/DD-WRT .

That will download the source into the current directory, you could change the directory by changing the "." at the end to the directory you would like the source in. Leaving out the "." will download everything to a "DD-WRT" sub-directory.

Download Section

Another way to get the source is to download it from the Downloads Section. Afterwards you need to extract it which is done simply by using a command like:

tar -jxvf nameoffile.tar.bz

Instructions

You'll need the 3.4.6 and 4.1.0 mipsl uclibc toolchains. The mips-uclibc 3.4.6 toolchain is used for building the kernel and the 4.1.0 mipsel-uclibc toolchain is used for building the user-mode packages. Unpack the toolchains wherever you desire, the scripts below will set up symlinks appropriately.

After running these scripts below, to build DD-WRT you simply need to:

 1. Add the 4.1.0 toolchains bin folder to your path environment variable. i.e. PATH=$PATH:/home/db90h/toolchains/4.1.0-uclibc
 2. In DD-WRT/opt run ./install.sh. Running ./install_* to build a particular variant requires you rebuild shared code first.

These two scripts should be saved to ready_ddwrt.sh and ready_ddwrt_root.sh. You can download them [here]. These work as of DD-WRT v23 SP2 beta 08/03/06.

#!/bin/sh
#
# title: ready_ddwrt.sh
# version: 1.1
# author: Jeremy Collake <jeremy@bitsum.com> aka db90h
#
# This silly script will prepare a build environment
# for DD-WRT. You must also run ready_ddwrt_root.sh.
#
# The toolchains path isn't actually used in this script.
#
MINPARAMS=1
if [ $# -lt "$MINPARAMS" ]
	then
	echo usage:
	echo    ready_ddwrt.sh [ddwrt_base_path]
	echo
	echo i.e.:
	echo    ready_ddwrt.sh /home/db90h/DD-WRT /home/db90h/4.1.0-ucliblc
	echo
	exit 1
fi  

ME=`whoami`
DDROOT=$1

echo I am $ME
echo DD-WRT is at $DDROOT

echo ................................................................
echo creating some symlinks
echo ................................................................
rm $DDROOT/src/linux/brcm/linux.v23/include/asm
ln -s $DDROOT/src/linux/brcm/linux.v23/include/asm-mips $DDROOT/src/linux/brcm/linux.v23/include/asm
echo done

echo ................................................................
echo adjusting some attributes
echo ................................................................
chmod +x $DDROOT/src/router/iptables/extensions/.dccp-test 
chmod +x $DDROOT/src/router/iptables/extensions/.layer7-test
echo done

echo ................................................................
echo re-building some tools
echo ................................................................
cd $DDROOT
# make bb_mkdep
cd src/router/busybox/scripts 
rm bb_mkdep
make bb_mkdep 
# make jsformat
cd ../../../.. 
cd src/router/tools 
rm jsformat
make jsformat 
cd ../../..
cd src/squashfs-tools/
rm mksquashfs-lzma
make 
cp mksquashfs-lzma ../linux/brcm/linux.v23/scripts/squashfs
cd ../..
echo done

This second script needs to be run as root ...

#!/bin/sh
#
# title: ready_ddwrt_root.sh
# version: 1.1
# author: Jeremy Collake <jeremy@bitsum.com> aka db90h
#
# This silly script will prepare a build environment
# for DD-WRT. You must also run ready_ddwrt.sh.
#
MINPARAMS=2
if [ $# -lt "$MINPARAMS" ]
	then
	echo 
	echo This script needs root access.
	echo
	echo usage:
	echo    ready_ddwrt_root.sh [ddwrt_base_path] [3.4.6_toolchain_base_path]
	echo
	echo i.e.:
	echo    ready_ddwrt_root.sh /home/db90h/DD-WRT /home/db90h/3.4.6-ucliblc-0.9.28
	echo
	exit 1
fi  

ME=`whoami`
DDROOT=$1
TCHAIN=$2

echo I am $ME
echo DD-WRT is at $DDROOT
echo mipsl-uclibc-x toolchain is at $TCHAIN

echo ................................................................
echo creating some symlinks
echo ................................................................
# duh, this will already be here
mkdir -p /opt
rm /opt/3.3.6
ln -s $TCHAIN /opt/3.3.6
rm /GruppenLW
ln -s $DDROOT/image /GruppenLW

echo All done!

--Jcollake 21:05, 5 Aug 2006 (CEST)

Modifying DD-WRT

Work in progress DD-WRT is easily reconfigured. In the /src/router folder you'll find .config* files for each type of distribution. Use 'make menuconfig' to edit the appropriate configuration files. The /src/router/busybox folder contains .config* files for its configuration. Just edit them in a similar way.

Change micro configuration: WARNING: Before and after doing this you need to copy and restore the "Internal Options" section of the .config files. These options don't seem to be in #the Config template.

cd DD-WRT/src/router
cp .config .config_micro
make menuconfig
cp .config_micro .config

Change micro Busybox configuration:

cd DD-WRT/src/router/busybox
cp .config .config_micro
make menuconfig
cp .config_micro .config

Change micro kernel configuration:

cd DD-WRT/src/router/busybox
cp .config .config_micro
make menuconfig
cp .config_micro .config

--Jcollake 20:11, 6 Aug 2006 (CEST)