自己从源码编译dd-wrt
根据DD-WRT的源码来编译重建DD-WRT是件相当有难度的事情,在这里肯定不是第一次尝试这个工作。你会看到很多奇怪的错误,许多混乱的脚本安装。这,论坛中也没人能作出通过运行程序这种安装充分。在论坛的新闻区远远高于这些新来港,但也很混乱,混淆了。 Brainslayer没有时间做的一切。直到有一天,是DD - WRT的将建立一个没有任何额外的步骤,我已经写了一些脚本,将成立一个对DD - WRT的建设环境。较新的版本可能打破这些脚本的兼容性的DD - WRT的。如果发生这种情况,我不更新它们,请花时间来更新它们如果你肯定你的修改是适当的。 你需要一台Linux机器来编译DD-WRT。它应该工作于安装好了基础开发工具包的机器上。 最低资格(TODO:在有人请完成此列表 - 对/在openwrt先决条件最需要): 若首次,其中大部分要安装/更新: WiP DD-WRT的的源代码是有组织的,象这样: 以下是另一种使用svn释出的源代码树。 第一步是要获取所需的DD - WRT的版本。您可以通过下载或从DD - WRT的下载部分,或使用Subversion签出这一点。 首先,您需要得到subversion,可在http://subversion.tigris.org/ 对于一些Linux发行版,你应该能够使用软件包管理工具得到 subversion 。 安装后,您可以通过从DD-WRT的最新源运行以下命令: --jbrazio 13:05, 17 December 2008 (CET) HTTP method is not working currently. or 这将下载源码到当前的目录,您可以通过更改“目录”。在结束的目录,你想进来走出了“源”。将下载到的一切“DD-WRT的”子目录。 请注意,由于该库包含每个硬件平台的Linux内核版本的源的数繁多,所以需要要很长的时间来下载(大于20G?)。 提取除了内核的源代码的所有源代码,请查看ddwrt_selective_co.sh。 另一种方式来获得源是从[1]下载它。 随后你需要通过使用类似下面的很简单的命令来提取它: --jbrazio 13:07, 17 December 2008 (CET) The download section seems not to contain the source code for v24 and up. 2011-01-18补充一下:toolchain-x86_x64-mipsel-4.1.2.tar.bz2下载地址出现在:http://www.dd-wrt.com/dd-wrtv2/downloads/others/tornado/toolchains/toolchain-x86_x64-mipsel-4.1.2.tar.bz2 你需要mipsl的版本为3.4.6和4.1.0的uClibc。他们可在[[2]]为x86用户。 也有部分在下载PPC版本的[[3]]在MIPS - uClibc的开发工具链3.4.6用于建设的内核和4.1.0 mipsel - uClibc的开发工具链,是建设用户模式程序包使用。无论你是否想解压,下面的脚本都将设立适当的符号链接。 为了编译DD-WRT,你只需: 这两个脚本应保存到ready_ddwrt.sh和ready_ddwrt_root.sh。你可以下载他们[[4]]但是ready_ddwrt.sh缺少最后两节,建立write4和webcomp,所以你最好把刚才的脚本从这个网页复制一下。 注意: $DDROOT/src/linux/brcm可能不存在于你的文件结构(我没有这个想法),所以下面的脚本来解决作出新的子目录$DDROOT/src/linux/brcm ,然后将您的文件夹$DDROOT/src/linux/linux.v2*或简单地改变脚本如下$DDROOT/src/linux/brcm 。 注意: If you are having issues with the first ready_ddwrt.sh script building mksquashfs-lzma and it's giving you some error about "ld: skipping incompatible ./lzma/C/7zip/Compress/LZMA_Lib/liblzma.a when searching for -llzma", then this is likely the result of the CPU tuning done in the CFLAGS in the makefiles. I had to edit src/squashfs-tools/Makefile and src/squashfs-tools/lzma/C/7zip/Compress/LZMA_Lib/makefile removing the following optimizations: I kept the "-funroll-loops" and "-O3" optimizations since those should be non-CPU-specific. By all mean leave any optimizations that apply to your CPU. For a 64-bit CPU, leave -D_FILE_OFFSET_BITS=64, -D_LARGEFILE_SOURCE, and -m64. If you're curious as to what your cpu has, look at the flags listed in /proc/cpuinfo. 这第二个脚本需要以root运行...[edit]需求
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev libc6
[edit]组织架构
src/ source
router/ packages
linux/ kernel
opt/ make/control
[root@ibm ~]$ find DD-WRT -maxdepth 1 -type d
DD-WRT
DD-WRT/redboot
DD-WRT/src
DD-WRT/opt
DD-WRT/tools
DD-WRT/image
DD-WRT/.svn
DD-WRT/.subversion
[root@ibm ~]$
[edit]获取源码
[edit]Subversion
svn co http://svn.dd-wrt.com/DD-WRT .
svn co svn://svn.dd-wrt.com/DD-WRT .
重要
请在svn下载释出源码后做一个简单的检查运作。[root@ibm DD-WRT]$ svn list
.cvsignore
.project
Makefile
image/
opt/
redboot/
src/
tools/
[root@ibm DD-WRT]$
[edit]下载区
tar -jxvf nameoffile.tar.bz
[edit]说明
0. 运行ready_ddwrt.sh 和 ready_ddwrt_root.sh (下面的脚本).
1. 添加4.1.0工具库到您的bin文件夹路径环境变量。即
PATH=$PATH:/home/db90h/toolchains/4.1.0-uclibc/bin
2. 到 DD-WRT/opt 目录运行 ./install.sh. 运行 ./install_* 建立一个特定
你要求重建共享代码的第一个变量。
#!/bin/sh
#
# title: ready_ddwrt.sh
# version: 1.14
# author: Jeremy Collake <jeremy@bitsum.com>
#
# This silly script will prepare a build environment
# for DD-WRT. You must also run ready_ddwrt_root.sh.
#
# RL 11/01/2006: Added line to compile tools/webcomp.c and write4.c
#
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
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
# for CFE building
ln -s $DDROOT/src/linux/brcm/linux.v23 $DDROOT/src/linux/linux
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 fixing alconf's
#echo ................................................................
#cd src/router/pptpd
#aclocal
#cd ../../..
echo ................................................................
echo "re-building some tools"
echo ................................................................
cd $DDROOT
# make bb_mkdep
cd src/router/busybox/scripts
rm bb_mkdep
make bb_mkdep
cd ../../../..
# make jsformat
cd src/router/tools
rm jsformat
make jsformat
cd ../../..
# make mksquashfs-lzma
cd src/squashfs-tools/
rm mksquashfs-lzma
make
cp mksquashfs-lzma ../linux/brcm/linux.v23/scripts/squashfs
cd ../..
# make strip
cd tools
rm ./strip
gcc strip.c -o ./strip
cd ..
# make write3
cd tools
rm ./write3
gcc write3.c -o ./write3
cd ..
# make write4
cd tools
rm ./write4
gcc write4.c -o ./write4
cd ..
# make webcomp
cd tools
rm ./webcomp
gcc -o webcomp -DUEMF -DWEBS -DLINUX webcomp.c
cd ..
echo done
#!/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!