Building From Source

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 17:17, 4 August 2006 (edit)
Jcollake (Talk | contribs)
(Requirements)
← Previous diff
Revision as of 18:57, 5 August 2006 (edit) (undo)
Jcollake (Talk | contribs)
(Requirements)
Next diff →
Line 8: Line 8:
# 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 tools. Unpack the toolchain wherever, but one suggestion is <tt>/location?/of?/ddwrtdirectory?/toolchain</tt>.
# 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. # 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.
-## <tt>mkdir -p /home/dev/workspace /home/backup/mikrotik</tt>+ 
-## <tt>ln -s ~yourusername/image /GruppenLW</tt>+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.
-## <tt>ln -s /location/of/ddwrtdirectory /home/dev/workspace/DD-WRT</tt>+ 
-# Link /opt/3.3.6 (warning: this step may not be accurate, but something like this ..)+After running these scripts, to build DD-WRT you simply need to:
-## <tt>mkdir /opt</tt>+ 
-## <tt>ln -s /opt/3.3.6 /location/of/ddwrtdirectory/DD-WRT/toolchains</tt>+ 1. Add your toolchains bin folder to your path environment variable.
-# Need this symlink as of 08/01/06 (or somewhere around there)+ 2. In DD-WRT/opt run ./install.sh, or ./install_WHATEVER.sh to build only a particular variant.
-## <tt>ln -s src/linux/brcm/linux.v23/include/asm-mips src/linux/brcm/linux.v23/include/asm</tt>+ 
-# Next we change some permissions:+These instructions are valid as of DD-WRT v23 SP2 beta 08/03/06.
-## <tt>chmod +x src/router/iptables/extensions/.dccp-test</tt>+ 
-## <tt>chmod +x src/router/iptables/extensions/.layer7-test</tt>+<pre>
-## <tt>chmod +wxxx src/router/samba</tt>+#!/bin/sh
-# rebuild some tools that may not be compatible with your linux install (especially if you're not using x64) **+#
-## <tt>cd src/router/busybox/scripts</tt>+# title: ready_ddwrt.sh
-## <tt>rm bb_mkdep</tt>+# version: 1.0
-## <tt>make bb_mkdep</tt>+# author: Jeremy Collake <jeremy@bitsum.com> aka db90h
-## <tt>cd ../../../..</tt>+#
-## <tt>cd src/router/tools</tt>+# This silly script will prepare a build environment
-## <tt>rm jsformat</tt>+# for DD-WRT. You must also run ready_ddwrt_root.sh.
-## <tt>make jsformat</tt>+#
-## <tt>cd ../../..</tt>+MINPARAMS=2
-# Set the toolchain bin folder to your PATH environment.+if [ $# -lt "$MINPARAMS" ]
-# Run <tt>opt/install.sh</tt> to build all DD-WRT renditions (long process) or <tt>opt/install_*.sh</tt> to build a specific version, i.e. <tt>opt/install_micro.sh</tt>.+ 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
 +</pre>
 + 
 +This second script needs to be run as root ...
 + 
 +<pre>
 +#!/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!
 +</pre>
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)''.
[[Category:English documentation]] [[Category:English documentation]]

Revision as of 18:57, 5 August 2006

Building DD-WRT from source is quite a daunting task. There isn't much documentation on this process on the official site, although Peter Cardoe's site is indeed very helpful. Hopefully expanding on his work will make it an easier process for newbies like me.

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.

  1. The first step is to download the proper source from the download page or check it out of the subversion repository at svn://svn.dd-wrt.com/DD-WRT. Should be straightforward.
  2. If you downloaded an archive, unpack it into a directory of your choice by running tar jxvf FILENAME. Change to the directory that process creates, probably named "DD-WRT" or something similar.
  3. Download the appropriate toolchain. This is a set of cross-compile tools. Unpack the toolchain wherever, but one suggestion is /location?/of?/ddwrtdirectory?/toolchain.
  4. 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.

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

 1. Add your toolchains bin folder to your path environment variable. 
 2. In DD-WRT/opt run ./install.sh, or ./install_WHATEVER.sh to build only a particular variant.

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).