Building From Source

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 18:57, 5 August 2006 (edit)
Jcollake (Talk | contribs)
(Requirements)
← Previous diff
Revision as of 19:05, 5 August 2006 (edit) (undo)
Jcollake (Talk | contribs)
(total rewrite - new scripts)
Next diff →
Line 1: Line 1:
-Building DD-WRT from source is quite a daunting task. There isn't much documentation on this process on the official site, although [http://www.cardoe.demon.co.uk/ Peter Cardoe's site] is indeed very helpful. Hopefully expanding on his work will make it an easier process for newbies like me.+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= =Requirements=
-To build DD-WRT, you need a Linux machine. It should work on any reasonably modern machine, as long as you have a compiler installed - note that this may not be strictly necessary but I haven't tried it any other way.+To build DD-WRT, you need a Linux machine. It should work on any reasonably modern machine with basic development tools installed. You'll need GNU Make, ncurses, and several other packages. I'd recommend using the OpenWrt pre-requisites as a guideline for what you need to get it building.
-# The first step is to download the proper source from the [http://www.dd-wrt.com/dd-wrtv2/downloads/index.php?path=sourcecode/ download page] or check it out of the subversion repository at svn://svn.dd-wrt.com/DD-WRT. Should be straightforward.+The first step is to download and extract the proper source from the [http://www.dd-wrt.com/dd-wrtv2/downloads/index.php?path=sourcecode/ download page] or check it out of the subversion repository at svn://svn.dd-wrt.com/DD-WRT. I recommend checking out of the repository since it will be the freshest build.
-# If you downloaded an archive, unpack it into a directory of your choice by running <tt>tar jxvf FILENAME</tt>. Change to the directory that process creates, probably named "DD-WRT" or something similar.+ 
-# Download the appropriate toolchain. This is a set of cross-compile tools. Unpack the toolchain wherever, but one suggestion is <tt>/location?/of?/ddwrtdirectory?/toolchain</tt>.+Download the appropriate toolchain. This is a set of cross-compile development tools and libraries. Unpack the toolchain wherever you desire, the scripts below will set up symlinks appropriately.
-# Make a workspace directory and some folders needed by the build process. The name of the "toolchain" directory must be as shown. You may need to be "root" to create the first directory.+
Here is my work on building DD-WRT. I've created a couple scripts to set up the build environment for you to make life easier on those wanting to create their own builds of DD-WRT. Here is my work on building DD-WRT. I've created a couple scripts to set up the build environment for you to make life easier on those wanting to create their own builds of DD-WRT.
Line 13: Line 12:
After running these scripts, to build DD-WRT you simply need to: After running these scripts, to build DD-WRT you simply need to:
- 1. Add your toolchains bin folder to your path environment variable. + 1. Add your 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, or ./install_WHATEVER.sh to build only a particular variant.+ 2. In DD-WRT/opt run ./install.sh, or ./install_WHATEVER.sh to build only a particular variant (i.e../install_micro.sh).
These instructions are valid as of DD-WRT v23 SP2 beta 08/03/06. These instructions are valid as of DD-WRT v23 SP2 beta 08/03/06.
Line 133: Line 132:
This page is only marginally useful; you do a lot of work and end up with a stock firmware. You may also want to see [[modifying DD-WRT]] ''(todo: fix this link)''. This page is only marginally useful; you do a lot of work and end up with a stock firmware. You may also want to see [[modifying DD-WRT]] ''(todo: fix this link)''.
 +
 +--[[User:Jcollake|Jcollake]] 21:05, 5 Aug 2006 (CEST)
[[Category:English documentation]] [[Category:English documentation]]

Revision as of 19:05, 5 August 2006

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. You'll need GNU Make, ncurses, and several other packages. I'd recommend using the OpenWrt pre-requisites as a guideline for what you need to get it building.

The first step is to download and extract the proper source from the download page or check it out of the subversion repository at svn://svn.dd-wrt.com/DD-WRT. I recommend checking out of the repository since it will be the freshest build.

Download the appropriate toolchain. This is a set of cross-compile development tools and libraries. Unpack the toolchain wherever you desire, the scripts below will set up symlinks appropriately.

Here is my work on building DD-WRT. I've created a couple scripts to set up the build environment for you to make life easier on those wanting to create their own builds of DD-WRT.

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

 1. Add your 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, or ./install_WHATEVER.sh to build only a particular variant (i.e../install_micro.sh).

These instructions are valid as of DD-WRT v23 SP2 beta 08/03/06.

#!/bin/sh
#
# title: ready_ddwrt.sh
# version: 1.0
# 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.
#
MINPARAMS=2
if [ $# -lt "$MINPARAMS" ]
	then
	echo usage:
	echo    ready_ddwrt.sh [ddwrt_base_path] [toolchain_base_path]
	echo
	echo i.e.:
	echo    ready_ddwrt.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 ................................................................
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.0
# 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] [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!

This page is only marginally useful; you do a lot of work and end up with a stock firmware. You may also want to see modifying DD-WRT (todo: fix this link).

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