研究了半天官方wiki上的文档,最后却找到这个一键脚本。手动试了一下,丝般顺滑,成功编译出RT-AC88U的梅林固件384.15版本。也可以编译其他路由器型号的固件。
不过这个脚本比较暴力,上来就把/bin/sh给干掉了,适合在做好vmware快照的情况下运行,或者在docker中使用,或者自己改一下把删除/bin/sh的代码去掉。
另外,去掉尾部与自己的路由器型号无关的脚本。
### Install fresh Ubuntu 18.04 LTS (Bionic Beaver)
ubuntu-18.04.-desktop-amd64.iso
sudo apt-get update && sudo apt-get -y dist-upgrade && sudo rm -f /bin/sh && sudo ln -sf bash /bin/sh && sudo reboot
sudo apt-get update && sudo apt-get -y install git build-essential linux-headers-$(uname -r)
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get -y install libtool-bin cmake libproxy-dev uuid-dev liblzo2-dev autoconf automake bash bison bzip2 diffutils file flex m4 g++ gawk groff-base libncurses5-dev libtool libslang2 make patch perl pkg-config shtool subversion tar texinfo zlib1g zlib1g-dev git gettext libexpat1-dev libssl-dev cvs gperf unzip python libxml-parser-perl gcc-multilib gconf-editor libxml2-dev g++-multilib gitk libncurses5 mtd-utils libncurses5-dev libvorbis-dev git autopoint autogen sed build-essential intltool libelf1 libglib2.-dev xutils-dev lib32z1-dev lib32stdc++ xsltproc gtk-doc-tools libelf-dev:i386 libelf1:i386 libltdl-dev
sudo apt-get -y install lzip patchelf
cd
if [ ! -d am-toolchains ]; then
git clone https://github.com/RMerl/am-toolchains
fi
sudo mkdir -p /opt ; sudo rm -rf /opt/toolchains ; sudo ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains ; sudo rm -f /opt/brcm-arm ; sudo ln -s ~/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.-uclibc-4.5. /opt/brcm-arm ; sudo rm -f /opt/brcm ; sudo ln -s ~/am-toolchains/brcm-mips-sdk/tools/brcm /opt/brcm
cd
if [ ! -d asuswrt-merlin.ng ]; then
git clone https://github.com/RMerl/asuswrt-merlin.ng
cd asuswrt-merlin.ng
git checkout mainline
else
cd asuswrt-merlin.ng
git checkout mainline
git pull
fi
cd
rm -rf asuswrt-merlin.ng-build
#rsync -aq asuswrt-merlin.ng/ asuswrt-merlin.ng-build --exclude .git
cp -a asuswrt-merlin.ng/ asuswrt-merlin.ng-build
rm -rf ~/asuswrt-merlin.ng-build/release/src-rt-.02hnd/bcmdrivers/broadcom/net/wl/impl51/main/src/toolchains
ln -s ~/am-toolchains/brcm-arm-hnd ~/asuswrt-merlin.ng-build/release/src-rt-.02hnd/bcmdrivers/broadcom/net/wl/impl51/main/src/toolchains
rm -rf ~/asuswrt-merlin.ng-build/release/src-rt-.x./toolchains
ln -s ~/am-toolchains/brcm-arm-sdk ~/asuswrt-merlin.ng-build/release/src-rt-.x./toolchains
export LD_LIBRARY_PATH=/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
echo $PATH | grep -qF /opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
echo $PATH | grep -qF /opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-.02hnd
make rt-ac86u
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-.x.
make rt-ac56u
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-.x.
make rt-ac68u
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-.x.
make rt-ac87u
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-7.14..x/src
make rt-ac88u
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-7.14..x/src
make rt-ac3100
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-7.14..x/src
make rt-ac5300
export LD_LIBRARY_PATH=
export TOOLCHAIN_BASE=
echo $PATH | grep -qF /opt/brcm-arm/bin || export PATH=$PATH:/opt/brcm-arm/bin
echo $PATH | grep -qF /opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin || export PATH=$PATH:/opt/brcm-arm/arm-brcm-linux-uclibcgnueabi/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-.x.main/src
make rt-ac3200
脚本来源:https://www.snbforums.com/threads/merlinwrt-compile-instructions.47984/page-3
手机扫一扫
移动阅读更方便
你可能感兴趣的文章