佐须之男的博客

技术需要沉淀,成长需要痛苦,成功需要坚持,敬仰需要奉献

X86 32位 DD-WRT 系统编译教程

    13年-14年之间,因工作需要,琢磨了一段时间x86版本的dd-wrt,这几天有网友问起如何编译x86版本的dd-wrt,故写此文。时隔久远,难免有偏差和遗漏,所以很多细节需要读者自己琢磨和研究。

    首先dd-wrt并非是一套100%开源的系统,当然这并非指责,而是这些缺失的代码恰恰是编译过程中的难点。我采用的代码版本是141116,下面是我编译时候整理的文档。当时是参考了好几份文档整理而出,所以很多时候需要读者自己进行分析,由于当时编译并没有做完整的记录,只记录了参考的教程。

 Description:

If you would like to build your own version of DD-WRT for Netgear's R7000 Router here are the basic steps.
Prerequisites

A 32-bit Linux machine (I use Fedora 14)
DD-WRT source code of R7000 Download Size:760578127 bytes (725.34MB)
Toolchain to compile DD-WRT source code (Use the same toolchain that is used for compiling the stock source code).
Compilation should be done as root user.

Steps1. 
Toolchain ftp://ftp.dd-wrt.com/toolchains/toolchains.tar.xz 

/xfs/toolchains/staging_dir_i386.4.2.1 

Create a directory path for toolchain.

mkdir -p /projects/hnd/tools/linux/ 

apt-get install libpcre3 libpcre3-dev gawk cmake libssl libssl-dev texinfo libpcap-dev liblzo2-dev rcs

sudo ln -s /usr/lib/x86_64-linux-gnu/libcloog-ppl.so.1.0.1 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libcloog-ppl.so.1.0.1 /usr/lib/libppl.so.9

cp /home/forgotfun/project/dd-wrt-master/src/linux/universal/linux-3.14/arch/mips/configs/bcm47xx_defconfig /home/forgotfun/project/dd-wrt-master/src/linux/universal/linux-3.14/arch/mips/defconfig-bcm947xx

edit rules/all.mk and comment madwifi*.mk 

edit .config must set CONFIG_MSSID=y, else it will include the worn file


2. Copy toolchain to that directory.

cp hndtools-arm-linux-2.6.36-uclibc-4.5.3.tar.bz2 /projects/hnd/tools/linux/

3. Decompress toolchain.

cd /projects/hnd/tools/linux/
tar -jxvf hndtools-arm-linux-2.6.36-uclibc-4.5.3.tar.bz2

4. Comment out the definition

"typedef float float_t;" in the file "hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-brcm-linux-uclibcgnueabi/sysroot/usr/include/bits/mathdef.h"

5. Export toolchain path.

export PATH=/projects/hnd/tools/linux/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/:$PATH

6. Decompress DD-WRT source code.

tar -zxvf dd-wrt_R7000_2-Sep-2013.tgz

7. Select configuration file.

cd dd-wrt/src/router
cp .config_R7000 .config

8. Compile the source code.

make -f Makefile.brcm_arm configure clean all install

On successful compilation, DD-WRT firmware of Negear R7000 will be created.

Filename: "dd-wrt.v24-K26_R7000.chk"
Path: "dd-wrt/src/router/arm-uclib







Here is what I do:

######################## Ubuntu x64 13.10 #############################################################
sudo apt-get update
sudo apt-get install -y g++ flex bison zlib1g-dev automake automake1.4 automake1.7 automake1.9 subversion libncurses5-dev dia git-core texinfo libtool autopoint libppl0.12-dev mc gitk build-essential ccache gperf libcurl4-openssl-dev libcrypt-openssl* texlive flip cvs gawk libtomcrypt-dev libtommath-dev libcloog-ppl1 sharutils libpcap-dev iftop uml-utilities gir1.2-gtksource-3.0 libiconv-hook-dev python-dev cmake libreadline6-dev
sudo apt-get install -y libstdc++5 #old version that some OS's might need?
sudo apt-get install -y lib32z1 lib32ncurses5 lib32bz2-1.0 (Former ia32-libs)

cd /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libcloog-ppl.so.1.0.1 libcloog.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libppl.so.12.0.0 libppl.so.9
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so libcrypto.so.1.0.0

sudo ln -s /usr/lib/x86_64-linux-gnu/libcloog-ppl.so.1.0.1 libcloog.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libppl.so.13.0.0 libppl.so.9
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so libcrypto.so.1.0.0

# Install iconv char support
mkdir iconv
cd iconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
tar -xvzf libiconv-1.11.tar.gz
cd libiconv-1.11
./configure --prefix=/usr/local/libiconv
make
sudo make install
cd /home/$USER

# Install tooolchains:
cd /home/$USER
mkdir dd-wrt
cd dd-wrt
mkdir toolchains
cd toolchains
wget https://secure.dd-wrt.com/dd-wrtv2/downloads/others/sourcecode/toolchains/current-toolchains.tar.bz2
tar -jxvf current-toolchains.tar.bz2
cd ..

# Checkout source code [23764]
svn co svn://svn.dd-wrt.com/DD-WRT

#Fix missing drivers
cd ~/dd-wrt/DD-WRT/src/router
mkdir private
Udpak private.tar.bz2 til private
# git clone git://gitorious.org/wive-rtnl-ralink-rt305x-routers-firmware/wive-rtnl-ralink-rt305x-routers-firmware.git
cd private
mkdir ath9k-rules

# Make env
export TOOLCHAIN=/home/$USER/dd-wrt/toolchains/toolchain-mipsel_r2_gcc-4.7-linaro_uClibc-0.9.33.2
export PATH=$TOOLCHAIN/bin:$PATH
echo $PATH
cp ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.10/arch/mips/configs/bcm47xx_defconfig ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.10/arch/mips/defconfig-bcm947xx

cd ~/dd-wrt/DD-WRT/opt
echo "#define BUILD_DATE \"$(date +%D)\"" > build.h


cd ~/dd-wrt/DD-WRT/src/router/libutils
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h

cd ~/dd-wrt/DD-WRT/src/router/httpd/visuals
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h

cd ~/dd-wrt/DD-WRT/src/router/httpd
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h

# Configure
cd ~/dd-wrt/DD-WRT/src/router/tools
rm jsformat
make jsformat
cd ~/dd-wrt/DD-WRT/src/squashfs-tools/lzma/C/7zip/Compress/LZMA_Alone
mv makefile makefile.disabled
mv makefile.gcc makefile
make
cp -vf lzma ~/dd-wrt/DD-WRT/opt/loader-0.02/
mv makefile makefile.gcc
mv makefile.disabled makefile
cd ~/dd-wrt/DD-WRT/src/squashfs-tools
rm mksquashfs-lzma
sudo make
cp mksquashfs-lzma ../linux/universal/linux-3.10/scripts/squashfs
cd ~/dd-wrt/DD-WRT/tools/
rm ./strip
gcc strip.c -o ./strip
rm ./write3
gcc write3.c -o ./write3
rm ./write4
gcc write4.c -o ./write4
rm ./webcomp
gcc -o webcomp -DUEMF -DWEBS -DLINUX webcomp.c
cd ~/dd-wrt/DD-WRT/opt/tools/
gcc -o trx trx.c

cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K3x/.config_mini.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
# In .config
# uncomment CONFIG_SPUTNIK_APD=y
#in "~/dd-wrt/DD-WRT/src/router/rules/all.mk" uncomment mmc-ixp4xx.mk strace.mk oled.mk atm.mk $(TOP)/private/ath9k-rules/ath9k.mk

make -f Makefile.brcm3x configure

#build
make -f Makefile.brcm3x clean all install





Okay, I went back to K26.
I have tried Debian 7 also, but its nearly the same, but more complicated.

And here is what I do in Ubuntu:

#Ubuntu x64 13.10
#VMware Player
#4 cpu 2048 mb ram
#Display 1024*768
#
sudo apt-get update
sudo apt-get install -y g++ flex bison zlib1g-dev automake automake1.4 automake1.7 automake1.9 automake1.10 automake1.11 subversion libncurses5-dev dia git-core texinfo
sudo apt-get install -y libtool autopoint libppl0.12-dev mc gitk build-essential ccache gperf libcurl4-openssl-dev libcrypt-openssl* texlive flip cvs gawk libtomcrypt-dev
sudo apt-get install -y libtommath-dev sharutils libpcap-dev iftop uml-utilities gir1.2-gtksource-3.0 libiconv-hook-dev python-dev cmake libreadline6-dev sqlite3
sudo apt-get install -y libsqlite3-dev doxygen lib32z1 lib32ncurses5 lib32bz2-1.0 libcloog-ppl1 g++-4.7 gcc-4.7 gcc-multilib intltool libbz2-dev libgc-dev libglib2.0-dev
sudo apt-get install -y lib32z-dev libffi-dev libgdbm-dev shtool tk-dev libxml2-dev attr libattr1-dev libacl1-dev libusb-dev pcsc-tools libblkid-dev libreadline-dev
sudo apt-get install -y python-all libpopt-dev libcups2-dev python-dnspython docbook-xsl gengetopt xsltproc liblz-dev liblz4-dev libid3tag0-dev libavutil-dev libavcodec-dev
dloosudo apt-get install -y libavformat-dev libjpeg-dev libexif-dev libvorbis-dev libflac-dev libgtk2.0-dev libfreeradius-dev libidzebra-2.0-dev lib32ncurses5-dev librpcsecgss-dev
sudo apt-get install -y libmatrixssl-dev libfuse-dev ntfs-3g-dev libssl0.9.8 libsslcommon2-dev
#old version that some OS's might need?
sudo apt-get install -y libstdc++5

# Install tooolchains:
cd /home/$USER
mkdir dd-wrt
cd dd-wrt
mkdir toolchains
cd toolchains
wget https://secure.dd-wrt.com/dd-wrtv2/downloads/others/sourcecode/toolchains/current-toolchains.tar.bz2
tar -jxvf current-toolchains.tar.bz2
cd ..

# Checkout source code [23906]
svn co svn://svn.dd-wrt.com/DD-WRT

#Fix missing stuff
cd /home/$USER/dd-wrt/DD-WRT/src/router
mkdir private
cd private
mkdir ath9k-rules
Udpak private.tar.bz2 til private
# git clone git://gitorious.org/wive-rtnl-ralink-rt305x-routers-firmware/wive-rtnl-ralink-rt305x-routers-firmware.git
tar -jxvf private.tar.bz2
mkdir madwifi
mv ~/dd-wrt/DD-WRT/src/router/madwifi/Makefile ~/dd-wrt/DD-WRT/src/router/madwifi/Makefile.org
cp ~/dd-wrt/DD-WRT/src/router/madwifi/patches/2.6/Makefile ~/dd-wrt/DD-WRT/src/router/madwifi/Makefile
cp ~/dd-wrt/DD-WRT/src/router/madwifi/patches/2.6/Kconfig ~/dd-wrt/DD-WRT/src/router/madwifi/Kconfig
cp ~/dd-wrt/DD-WRT/src/router/madwifi/patches/install.sh ~/dd-wrt/DD-WRT/src/router/madwifi/install.sh
sudo ln -s ~/dd-wrt/DD-WRT/src/router/private/madwifi /xfs/madwifi_nm
ln -s ~/dd-wrt/DD-WRT/opt/sstrip ~/dd-wrt/DD-WRT/src/router/sstrip
cp ~/dd-wrt/DD-WRT/src/linux/brcm/linux-2.6.23/arch/mips/defconfig-bcm947xx-slimrtr ~/dd-wrt/DD-WRT/src/linux/brcm/linux-2.6.23/arch/mips/defconfig-bcm947xx
cp ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.10/arch/mips/configs/bcm47xx_defconfig ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.10/arch/mips/defconfig-bcm947xx
cp ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.12/arch/mips/configs/bcm47xx_defconfig ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.12/arch/mips/defconfig-bcm947xx
cp ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.13/arch/mips/configs/bcm47xx_defconfig ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.13/arch/mips/defconfig-bcm947xx
cp ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.14/arch/mips/configs/bcm47xx_defconfig ~/dd-wrt/DD-WRT/src/linux/universal/linux-3.14/arch/mips/defconfig-bcm947xx
sudo ln -s /usr/lib/x86_64-linux-gnu/libcloog-ppl.so.1.0.1 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libppl.so.12.0.0 /usr/lib/libppl.so.9
sudo mkdir /xfs
sudo ln -s /home/$USER/dd-wrt/toolchains /xfs/toolchains
sudo ln -s /home/$USER/dd-wrt/toolchains/toolchain-mipsel_gcc4.1.2 /opt/4.1.2
sudo mkdir -p /usr/local/share/xsl
sudo ln -s /usr/share/xml/docbook/stylesheet/docbook-xsl /usr/local/share/xsl/docbook

# Configure once
# Do not run the commented commands, they wil ruin the web interface
cd ~/dd-wrt/DD-WRT/src/router/tools
rm jsformat
make jsformat
cd ~/dd-wrt/DD-WRT/src/squashfs-tools/lzma/C/7zip/Compress/LZMA_Alone
mv makefile makefile.disabled
mv makefile.gcc makefile
make
cp lzma ~/dd-wrt/DD-WRT/src/router/netgear/
cp -vf lzma ~/dd-wrt/DD-WRT/opt/loader-0.02/
mv makefile makefile.gcc
mv makefile.disabled makefile
cd ~/dd-wrt/DD-WRT/src/squashfs-tools
rm -f mksquashfs-lzma
sudo make
cp mksquashfs-lzma ../linux/universal/linux-3.10/scripts/squashfs
cp mksquashfs-lzma ../linux/universal/linux-3.12/scripts/squashfs
cp mksquashfs-lzma ../linux/universal/linux-3.13/scripts/squashfs
cp mksquashfs-lzma ../linux/universal/linux-3.14/scripts/squashfs
cp mksquashfs-lzma ../linux/brcm/linux-2.6.23/scripts/squashfs
cd ~/dd-wrt/DD-WRT/tools/
#
#in ~/dd-wrt/DD-WRT/tools/strip.c replace
#printf("len %d\n",strlen(printbuffer));
#with
#printf("len %zd\n",strlen(printbuffer));

rm strip
gcc-4.7 -o strip strip.c
#rm write3
#gcc-4.7 -o write3 write3.c
rm write4
gcc-4.7 -o write4 write4.c
#rm ./webcomp
#gcc-4.7 -o webcomp -DUEMF -DWEBS -DLINUX webcomp.c
cd ~/dd-wrt/DD-WRT/opt/tools/
#in ~/dd-wrt/DD-WRT/opt/tools/trx.c replace
# fprintf(stderr, "WARNING: current length exceeds -b %d offset\n",n);
#with
# fprintf(stderr, "WARNING: current length exceeds -b %zd offset\n",n);
gcc-4.7 -o trx trx.c
cd ~/dd-wrt/DD-WRT/opt/asus
make clean all
rm -f asustrx-rt66u
cc -o asustrx-rt66u asustrx-rt66u.c
cd ~/dd-wrt/DD-WRT/src/router/minidlna/libexif-0.6.19/doc
doxygen -u
cd ~/dd-wrt/DD-WRT/src/router
#in Makefile.brcm3x replace:
#../../opt/asus/asustrx-rt66u -p RT-AC66U -v 3.0.0.1 -m 32000000 -o $(ARCH)-uclibc/dd-wrt.v24-K3_RT-AC66U.trx $(ARCH)-uclibc/lzma_vmlinuz -a 1024 $(ARCH)-uclibc/rootfs.squashfs
#with:
#../../opt/asus/asustrx-rt66u -p RT-AC66U -v 3.0.0.1 -m 32000000 -o $(ARCH)-uclibc/dd-wrt.v24-K3_RT-AC66U.trx $(ARCH)-uclibc/lzma_vmlinuz $(ARCH)-uclibc/rootfs.squashfs
#And comment:
# cd $(ARCH)-uclibc && ../tools/bufenc/makefw.sh dd-wrt.v24-K3-nandboot

#in "~/dd-wrt/DD-WRT/src/router/rules/all.mk" comment mmc-ixp4xx.mk strace.mk oled.mk atm.mk $(TOP)/private/ath9k-rules/ath9k.mk

# in "~/dd-wrt/DD-WRT/src/linux/universal/linux-3.10/drivers/net/wireless/Kconfig" comment out the following lines:
# in "~/dd-wrt/DD-WRT/src/linux/universal/linux-3.12/drivers/net/wireless/Kconfig" comment out the following lines:
# in "~/dd-wrt/DD-WRT/src/linux/universal/linux-3.13/drivers/net/wireless/Kconfig" comment out the following lines:
# in "~/dd-wrt/DD-WRT/src/linux/universal/linux-3.14/drivers/net/wireless/Kconfig" comment out the following lines:
# if RALINK_DEVICE
# source "drivers/net/wireless/rt3352/rt2860v2_ap/Kconfig"
# source "drivers/net/wireless/rt3352/rt2860v2_sta/Kconfig"
# endif
# if SOC_MT7620_OPENWRT
# source "drivers/net/wireless/rt7620/rt2860v2_ap/Kconfig"
# source "drivers/net/wireless/rt7620/rt2860v2_sta/Kconfig"
# source "drivers/net/wireless/rt5592/Kconfig"
# endif

#in "~/dd-wrt/DD-WRT/src/router/rules/nocat.mk" replace
# cd glib && ./config.sh "$(CC)" "$(COPTS) $(MIPS16_OPT)" ac_cv_host=$(ARCH)-uclibc-linux --target=$(ARCH)-linux --host=$(ARCH)
#with:
# cd $(TOP)/glib && ./config.sh "$(CC)" "$(COPTS) $(MIPS16_OPT)" ac_cv_host=$(ARCH)-uclibc-linux --target=$(ARCH)-linux --host=$(ARCH)

#Linux:
cd ~/dd-wrt/DD-WRT/src/linux/brcm/linux-2.6.23
cp .config_std .config

# Fix a bug
cp ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.org
cp ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.custom
#Delete the following 3 sections from ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.custom because
#they are already defined in ~/dd-wrt/toolchains/toolchain-mipsel_r2_gcc-4.7-linaro_uClibc-0.9.33.2/include/linux/if_link
# and gives error in iproute2 with stop of make

#Section1:
#struct rtnl_link_stats
#{
# __u32 rx_packets; /* total packets received */
# __u32 tx_packets; /* total packets transmitted */
# __u32 rx_bytes; /* total bytes received */
# __u32 tx_bytes; /* total bytes transmitted */
# __u32 rx_errors; /* bad packets received */
# __u32 tx_errors; /* packet transmit problems */
# __u32 rx_dropped; /* no space in linux buffers */
# __u32 tx_dropped; /* no space available in linux */
# __u32 multicast; /* multicast packets received */
# __u32 collisions;
#
# /* detailed rx_errors: */
# __u32 rx_length_errors;
# __u32 rx_over_errors; /* receiver ring buff overflow */
# __u32 rx_crc_errors; /* recved pkt with crc error */
# __u32 rx_frame_errors; /* recv'd frame alignment error */
# __u32 rx_fifo_errors; /* recv'r fifo overrun */
# __u32 rx_missed_errors; /* receiver missed packet */
#
# /* detailed tx_errors */
# __u32 tx_aborted_errors;
# __u32 tx_carrier_errors;
# __u32 tx_fifo_errors;
# __u32 tx_heartbeat_errors;
# __u32 tx_window_errors;
#
# /* for cslip etc */
# __u32 rx_compressed;
# __u32 tx_compressed;
#};
#
#/* The struct should be in sync with struct ifmap */
#struct rtnl_link_ifmap
#{
# __u64 mem_start;
# __u64 mem_end;
# __u64 base_addr;
# __u16 irq;
# __u8 dma;
# __u8 port;
#};
#
#enum
#{
# IFLA_UNSPEC,
# IFLA_ADDRESS,
# IFLA_BROADCAST,
# IFLA_IFNAME,
# IFLA_MTU,
# IFLA_LINK,
# IFLA_QDISC,
# IFLA_STATS,
# IFLA_COST,
##define IFLA_COST IFLA_COST
# IFLA_PRIORITY,
##define IFLA_PRIORITY IFLA_PRIORITY
# IFLA_MASTER,
##define IFLA_MASTER IFLA_MASTER
# IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
##define IFLA_WIRELESS IFLA_WIRELESS
# IFLA_PROTINFO, /* Protocol specific information for a link */
##define IFLA_PROTINFO IFLA_PROTINFO
# IFLA_TXQLEN,
##define IFLA_TXQLEN IFLA_TXQLEN
# IFLA_MAP,
##define IFLA_MAP IFLA_MAP
# IFLA_WEIGHT,
##define IFLA_WEIGHT IFLA_WEIGHT
# __IFLA_MAX
#};
#
#
#Section2:
#
#
#/* Subtype attributes for IFLA_PROTINFO */
#enum
#{
# IFLA_INET6_UNSPEC,
# IFLA_INET6_FLAGS, /* link flags */
# IFLA_INET6_CONF, /* sysctl parameters */
# IFLA_INET6_STATS, /* statistics */
# IFLA_INET6_MCAST, /* MC things. What of them? */
# IFLA_INET6_CACHEINFO, /* time values and max reasm size */
# __IFLA_INET6_MAX
#};
#
#
#Section3:
#
#
#struct ifla_cacheinfo
#{
# __u32 max_reasm_len;
# __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
# __u32 reachable_time;
# __u32 retrans_time;
#};
#

#
# Backup from here
#

# NOT in first run
rm ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h
cp ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.custom ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h
#cp ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.org ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h

#in ~/dd-wrt/DD-WRT/src/linux/brcm/linux-2.6.23/drivers/net/wireless/Kconfig comment source "drivers/net/wireless/madwifi/Kconfig"

#Fix problem with asterisk
sudo ln -s /home/$USER/dd-wrt/DD-WRT/src/router/minidlna/sqlite-3.6.22/.libs/libsqlite3.so.0.8.6 /home/$USER/dd-wrt/DD-WRT/src/router/asterisk/main/libsqlite3.so
sudo ln -s /home/$USER/dd-wrt/DD-WRT/src/router/minidlna/sqlite-3.6.22/.libs/libsqlite3.a /home/$USER/dd-wrt/DD-WRT/src/router/asterisk/main/libsqlite3.a
#in ~/dd-wrt/DD-WRT/src/router/asterisk/main/Makefile comment
#ifneq ($(LDCONFIG),)
# $(LDCONFIG) $(LDCONFIG_FLAGS) .
#endif
#
#and
#
#ifneq ($(LDCONFIG),)
# $(LDCONFIG) $(LDCONFIG_FLAGS) "$(DESTDIR)$(ASTLIBDIR)/"
#endif
#
#and
#
#ifneq ($(LDCONFIG),)
# $(LDCONFIG) $(LDCONFIG_FLAGS) "$(DESTDIR)$(ASTLIBDIR)/"
#endif

#Fix problem with openssl not getting -lssl
#in ~/dd-wrt/DD-WRT/src/router/rules/openssl.mk comment
# $(MAKE) -C openssl clean

# Make env
export TOOLCHAIN=/home/$USER/dd-wrt/toolchains/toolchain-mipsel_r2_gcc-4.7-linaro_uClibc-0.9.33.2
export PATH=$TOOLCHAIN/bin:$PATH

#Update source
cd ~/dd-wrt/DD-WRT
svn up
cd ~/dd-wrt/DD-WRT/opt
echo "#define BUILD_DATE \"$(date +%D)\"" > build.h

cd ~/dd-wrt/DD-WRT/src/router/libutils
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h
cd ~/dd-wrt/DD-WRT/src/router/httpd/visuals
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h
cd ~/dd-wrt/DD-WRT/src/router/httpd
echo -n '#define SVN_REVISION "' > revision.h
svnversion -n . >> revision.h
echo '"' >> revision.h

# If I dont start with the small ones first time, ncurses etc. will fail
# Sometimes the make should be run twice the first time to succeed
#mini
cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K26/.config_mini.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
# K26 Sputnik do not compile : all .config
grep -v CONFIG_SPUTNIK .config > .config.new
mv .config{.new,}
make -f Makefile.brcm26 configure
make -f Makefile.brcm26 clean all install
cd mipsel-uclibc
REV=`svn info |grep Revision | cut -f 2 -d ' '`
export TYPE=mini
cp dd-wrt.v24-K26_e2000.bin ~/dd-wrt/DD-WRT/image/dd-wrt.v24-${REV}_NEWD-2_K2.6_${TYPE}-e2000.bin

#std
cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K26/.config_std.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
# K26 Sputnik do not compile : all .config
grep -v CONFIG_SPUTNIK .config > .config.new
mv .config{.new,}
# K26 Kaid do not compile : std, mega and giga .config
grep -v CONFIG_KAID .config > .config.new
mv .config{.new,}
make -f Makefile.brcm26 configure
make -f Makefile.brcm26 clean all install
cd mipsel-uclibc
REV=`svn info |grep Revision | cut -f 2 -d ' '`
export TYPE=std
cp dd-wrt.v24-K26_e2000.bin ~/dd-wrt/DD-WRT/image/dd-wrt.v24-${REV}_NEWD-2_K2.6_${TYPE}-e2000.bin

# Build for e2000
cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K26/.config_big.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
echo CONFIG_NMBD=y >> .config
# K26 Save flash
grep -v CONFIG_WIFIDOG .config > .config.new
mv .config{.new,}
grep -v CONFIG_CHILLILOCAL .config > .config.new
mv .config{.new,}
grep -v CONFIG_NOCAT .config > .config.new
mv .config{.new,}
grep -v CONFIG_HOTSPOT .config > .config.new
mv .config{.new,}
grep -v CONFIG_OPENSER .config > .config.new
mv .config{.new,}
grep -v CONFIG_MILKFISH .config > .config.new
mv .config{.new,}
grep -v CONFIG_CHILLISPOT .config > .config.new
mv .config{.new,}
# K26 Sputnik do not compile : all .config
grep -v CONFIG_SPUTNIK .config > .config.new
mv .config{.new,}
make -f Makefile.brcm26 configure
make -f Makefile.brcm26 clean all install
cd mipsel-uclibc
REV=`svn info |grep Revision | cut -f 2 -d ' '`
export TYPE=bigc
cp dd-wrt.v24-K26_e2000.bin ~/dd-wrt/DD-WRT/image/dd-wrt.v24-${REV}_NEWD-2_K2.6_${TYPE}-e2000.bin

#mega
cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K26/.config_mega.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
# K26 Sputnik do not compile : all .config
grep -v CONFIG_SPUTNIK .config > .config.new
mv .config{.new,}
# K26 Kaid do not compile : std, mega and giga .config
grep -v CONFIG_KAID .config > .config.new
mv .config{.new,}
make -f Makefile.brcm26 configure
make -f Makefile.brcm26 clean all install
cd mipsel-uclibc
REV=`svn info |grep Revision | cut -f 2 -d ' '`
export TYPE=mega
cp dd-wrt.v24-K26_e2000.bin ~/dd-wrt/DD-WRT/image/dd-wrt.v24-${REV}_NEWD-2_K2.6_${TYPE}-e2000.bin

# Build for e3200
cd ~/dd-wrt/DD-WRT/src/router
cp ./configs/broadcom_K26/.config_giga.v24-K26 .config
echo CONFIG_NVRAM_60K=y >> .config
# K26 Sputnik do not compile : all .config
grep -v CONFIG_SPUTNIK .config > .config.new
mv .config{.new,}
# K26 Kaid do not compile : std, mega and giga .config
grep -v CONFIG_KAID .config > .config.new
mv .config{.new,}
# K26 Save flash : giga .config
grep -v CONFIG_MC .config > .config.new
mv .config{.new,}
make -f Makefile.brcm26 configure
make -f Makefile.brcm26 clean all install
cd mipsel-uclibc
REV=`svn info |grep Revision | cut -f 2 -d ' '`
export TYPE=gigac
cp dd-wrt.v24-K26_e3200.bin ~/dd-wrt/DD-WRT/image/dd-wrt.v24-${REV}_NEWD-2_K2.6_${TYPE}-e3200.bin
cd ..

################ TIPS ####################
#Log results to files
#(make -f Makefile.brcm26 configure | tee /home/$USER/dd-wrt/stdoutconf.log) 3>&1 1>&2 2>&3 | tee /home/$USER/dd-wrt/stderrconf.log
#make -f Makefile.brcm26 configure 2>&1 | tee /home/$USER/dd-wrt/stdoutconf.log
#
#(make -f Makefile.brcm26 clean all install | tee /home/$USER/dd-wrt/stdoutbuild.log) 3>&1 1>&2 2>&3 | tee /home/$USER/dd-wrt/stderrbuild.log
#make -f Makefile.brcm26 clean all install 2>&1 | tee /home/$USER/dd-wrt/stdoutbuild.log

#more info in config.log files
#replace -wl, with -wl,--verbose=99, in relevant Makefile

#Fix minidlna compile
#cd ~/dd-wrt/DD-WRT/src/router/minidlna/libid3tag-0.15.0b
#aclocal
#or
from router dir
rm -fr minidlna
svn export svn://svn.dd-wrt.com/DD-WRT//src/router/minidlna
#make -f Makefile.brcm26 minidlna-configure

#Fix radvd compile
cd ~/dd-wrt/DD-WRT/src/router/radvd
aclocal-1.7
cd ..

#Test openssl configure
make -f Makefile.brcm26 openssl-configure

#Fix usb_modeswitch compile
cd /home/keld/dd-wrt/DD-WRT/src/router/usb_modeswitch/libusb-compat/libusb
mv -f .deps/libusb_la-core.Plo .deps/libusb_la-core.Tpo
# if error aclocal-1.11: couldn't open directory 'm4'
rm -fr usb_modeswitch
svn export svn://svn.dd-wrt.com/DD-WRT//src/router/usb_modeswitch
cd ~/dd-wrt/DD-WRT/src/router/usb_modeswitch/libusb-compat
aclocal-1.11 -I m4 --install
cd ~/dd-wrt/DD-WRT/src/router/usb_modeswitch/libusb
aclocal-1.11 -I m4 --install
cd ~/dd-wrt/DD-WRT/src/router/usb_modeswitch
make clean
cd ..
make -f Makefile.brcm26 usb_modeswitch-configure

Hit CTRL+h to show hidden files
|
Export partial:
rm ~/dd-wrt/DD-WRT/src/router/iproute2/include/linux/rtnetlink.h
svn export svn://svn.dd-wrt.com/DD-WRT//src/router/iproute2/include/linux/rtnetlink.h
#or from router dir
cd ~/dd-wrt/DD-WRT/src/router
rm -fr ~/dd-wrt/DD-WRT/src/router/openssl
svn export svn://svn.dd-wrt.com/DD-WRT//src/router/openssl

svn diff

#The best way to "start" clean, go to src/router and
make -f Makefile.brcm26 clean
make -f Makefile.brcm26 distclean




小广告时间:需要x86 DD-WRT编译环境的可以联系我(有偿拷贝,非诚勿扰),另外本人可提供路由器相关(ddwrt,openwrt,tomato等)的开发和咨询咨询服务。

« 上一篇 下一篇 »

© 2016 佐须之男版权所有 | 业务合作 181-1435-4589 (陆工)