padavan 源码编译

玩机教程 > Router (193) 2025-01-09 10:50:19

 

如何为路由器 RT-N14U/N56U/N65U/N11P/AC51U/AC54U/AC1200HP/N56UB1独立编译固件

Instructions for independently build firmware for your router from source in Ubuntu 16.04 LTS i386.

  1. 在你的电脑安装Oracle VirtualBox 或者Vmware虚拟软件
  2. 下载 Ubuntu 16.04 LTS i386/amd64 (例如从这个镜像下载,ubuntu mirror).
  3. 创建新的虚拟机,并从步骤2安装Ubuntu到它。VirtualBox可以使用iso镜像作为虚拟机的驱动器。

    如果你打算使用带有GUI的Ubuntu,你必须为虚拟机预留至少1.5Gb的RAM(建议4Gb)。当您选择较小大小的RAM时,您可能会在创建固件映像时收到错误。
     
  4. 启动虚拟机并打开终端或者使用shell工具连接
     
  5. 登录系统后安装git工具

    sudo apt-get update -y
    sudo apt-get install git -y
  6. 进入“/opt”目录,运行git命令创建git仓库本地副本:

    cd /opt
    sudo git clone https://bitbucket.org/padavan/rt-n56u.git
    

    这将复制所有源代码,创建一个本地git存储库。目录/opt/rt-n56u将是git存储库的根目录。 提示:必须在/opt/rt-n56u目录编译

  7. 阅读/opt/rt-n56u/readme.eng.txt文档 并  安装其中列出的所有必需软件包

    sudo apt-get update -y
    sudo apt-get install autoconf automake autopoint bison build-essential flex gawk gettext git gperf libtool pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev texinfo python-docutils -y
    

    MC (midnight commander)不需要构建固件,但它将帮助您浏览目录,复制或编辑文件。

  8. 转到包含工具链源(交叉编译器和构建工具)的目录并构建它:

    cd /opt/rt-n56u/toolchain-mipsel
    sudo ./clean_sources
    sudo ./build_toolchain
    

    The result will be collected the target of toolchain /opt/rt-n56u/toolchain-mipsel/toolchain-3.4.x

    If you plan to build the firmware with the kernel 3.0, you must build the appropriate version of tolchain:

    cd /opt/rt-n56u/toolchain-mipsel
    sudo ./clean_sources
    sudo ./build_toolchain_3.0.x
    

    The result will be collected the target of toolchain /opt/rt-n56u/toolchain-mipsel/toolchain-3.0.x

    In the future, you will need these commands only if the toolchain will be updated.

  9. 现在进入带有源代码的目录:

    cd /opt/rt-n56u/trunk
    

    and edit file /opt/rt-n56u/trunk/.config to fit your needs.

    Edit path to toolchain (if you need it):

    CONFIG_TOOLCHAIN_DIR=/opt/rt-n56u/toolchain-mipsel
    

    To build the firmware, for example, for router RT-N65U uncomment (remove the simbol #) the line:

    CONFIG_FIRMWARE_PRODUCT_ID="RT-N65U"
    

    and comment the line:

    #CONFIG_FIRMWARE_PRODUCT_ID="RT-N56U"
    

    Save the file after edit.



    以上操作可使用下面替代,直接复制配置文件到  /opt/rt-n56u/trunk

    cd /opt/rt-n56u/trunk
    cp configs/templates/MI-R3G.confg  .config
  10. Clear source tree (every time before a new build)

    sudo ./clear_tree
    
  11. Build the firmware:

    sudo ./build_firmware
    

    Created custom firmware file will be in the directory ./path_to_your_dir/rt-n56u/trunk/images. If you want to save the firmware that you created earlier - copy it to another location, because the command clear_tree overwrites the directory images.

  12. When repository updated a local source tree must be updated with command:

    sudo git pull
    
  13. If you made ​​any changes to the local repository, when you upgrade tree some files could not be copied. In this case, you must give the command:

    sudo git stash
    sudo git pull
    
  14. If toolchain sources (cross-compiler and tools for building) is changed you must re-build it:

    cd /opt/rt-n56u/toolchain-mipsel
    sudo ./clean_sources  
    sudo ./clean_toolchain  
    sudo ./build_toolchain

     

     

     

     

    来源padavan / rt-n56u / wiki / EN / HowToMakeFirmware — Bitbucket

     

     

     

    其他版本说明

    https://github.com/hanwckf/rt-n56u.git

    H大的编译交叉环境和编译固件Ubuntu不要自己加sudo,否则可能报错

    # Debian/Ubuntu
    sudo apt update
    sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano \
    	fakeroot kmod cpio git python3-docutils gettext automake autopoint \
    	texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \
    	libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin
    
    # Archlinux/Manjaro
    sudo pacman -Syu --needed git base-devel cmake gperf ncurses libmpc \
            gmp python-docutils vim rpcsvc-proto fakeroot cpio help2man
    
    # Alpine
    sudo apk add make gcc g++ cpio curl wget nano xxd kmod \
    	pkgconfig rpcgen fakeroot ncurses bash patch \
    	bsd-compat-headers python2 python3 zlib-dev \
    	automake gettext gettext-dev autoconf bison \
    	flex coreutils cmake git libtool gawk sudo
    
    # CentOS 7
    sudo yum update
    sudo yum groupinstall "Development Tools"
    sudo yum install ncurses-* flex byacc bison zlib-* texinfo gmp-* mpfr-* gettext \
    	libtool* libmpc-* gettext-* python-docutils nano help2man fakeroot
    
    # CentOS 8
    sudo yum update
    sudo yum groupinstall "Development Tools"
    sudo yum install ncurses-* flex byacc bison zlib-* gmp-* mpfr-* gettext \
    	libtool* libmpc-* gettext-* nano fakeroot
    
    # CentOS 8不能直接通过yum安装texinfo,help2man,python-docutils。请去官网下载发行的安装包编译安装
    # 以texinfo为例
    # cd /usr/local/src
    # sudo wget http://ftp.gnu.org/gnu/texinfo/texinfo-6.7.tar.gz
    # sudo tar zxvf texinfo-6.7.tar.gz
    # cd texinfo-6.7
    # sudo ./configure
    # sudo make
    # sudo make install
    • 准备工具链
    cd /opt/rt-n56u/toolchain-mipsel
    
    # (推荐)使用脚本下载预编译的工具链:
    sh dl_toolchain.sh
    
    # 或者,也可以从源码编译工具链,这需要一些时间:
    ./clean_toolchain
    ./build_toolchain
    


    开始编译

    cd /opt/rt-n56u/trunk
    # 对于WSL环境,建议使用sudo进行编译,或者使用fakeroot-tcp代替fakeroot
    fakeroot ./build_firmware_modify PSG1218
    # 脚本第一个参数为路由型号,在trunk/configs/templates/中
    # 编译好的固件在trunk/images里
    # 首次编译完成后,如果需要再次编译其它固件,需要执行清理脚本:
    ./clear_tree

     

    ---


评论
User Image
提示:请评论与当前内容相关的回复,广告、推广或无关内容将被删除。

相关文章
如何为路由器 RT-N14U/N56U/N65U/N11P/AC51U/AC54U/AC1200HP/N56UB1独立编译固件Instructions for
READMEWelcome to the rt-n56u projectThis project aims to improve the rt-n56u and
首先来张小米路由器3G照片正楼,Padavan约等于华硕梅林远房亲戚也就是联发科版本
挂载部分内存当硬盘用 # mount -t tmpfs -o size=50M tmpfs /opt/说明:50M是挂载的大小,/opt/挂载的是目录,这里op
前言随着项目升级,目前存在一些项目是jdk8的一些是jdk17的,让Jenkins 使用主机编译环境成为了问题。故此使用docker环境来编译项目,分离各个版本
预安装的软件包追加部分luci-i18n-base-zh-cn lsblk cfdisk block-mount luci-i18n-ttyd-zh-cn l
某些情况,我们需要对jar进行反编译修改部分代码,通过源码编译太麻烦就直接通过javassist工具对具体的方法进行修改。下面是一些简单javassist使用说明。一 引入javassist M...
transmission修改密码,写这篇博客主要是小米路由器刷了padavan固件。固件中transmission需要修改默认密码遇到的问题。以下为修改transmission密码具体步骤
OpenWRT云编译CUDY TR3000 V1官方编译https://firmware-selector.openwrt.org/https://firmwa
一、CMake介绍CMake是一个被广泛使用的、开源免费并且完全跨平台的构建工具,可以用简单的语句来描述所有平台的安装(编译过程)。它能够输出各种各样的make
Spring Boot编译如何更改默认JDK版本?,spring boot,java
Docker Nodejs 18.20.4 环境编译vue项目 sudo docker run --rm --name node18c -v /your/pro
环境基于openwrt/ImmortalWrt 官方在线编译器编译原因挂载自动挂载外部设备使用的默认字符集是iocharset=iso8859-1通过命令mou
国内编译某些GitHub偶有访问不到仓库的情况,需要使用魔法。目前情况是主机已经魔法了,让虚拟机能用上。以Windows 11环境为例,配置魔法软件打开允许局域网连接。