Ubuntu x64 编译 Padavan 过程&教程

Ubuntu x64 编译 Padavan 记录

  近 3 个通宵尝试用 Mac OS X 进行编译,1 个通宵解决交叉编译工具链 toolchain 问题,后两个通宵执着于固件编译,随后放弃。解决了 Linux Kernel,在 uClibc 那里我知道我没法继续了。实在受不了,中途居然还因为 Mac 上文件不区分大小写少文件。装 Genymotion 的时候正好有 VBox,顺手下载了 Ubuntu Desktop 16 装上,吐血。下文为编译过程…

先更新系统是有必要的

sudo apt-get update
sudo apt-get upgrade

安装必需的组件

首先是 git

sudo apt-get install git

其他组件(mc 可选,我并没有安装)

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

交叉编译工具链

建议在 /opt 目录下操作
移动到 /opt 目录,cd /opt
获取源码:sudo git clone https://bitbucket.org/padavan/rt-n56u.git
下载近 900M,耐心等待…联通 50M 表示下载速度还可以,约 1-4M/s

编译:

cd toolchain-mipsel
sudo ./clean_sources
sudo ./build_toolchain

耐心等待约 5-10 分钟…无视掉中途无数的警告

修改固件配置

只写出了简单的配置,详细请浏览国内“恩山论坛”和 Google 爬坑

换个位置 cd ../trunk
/opt/rt-n56u/trunk/configs/templates 目录下复制一份适配的配置文件到 /opt/rt-n56u/trunk
删除 trunk 内的 .config 文件并重命名刚刚复制的配置文件为 .config

操作如下:

sudo rm -f .config
cd /opt/rt-n56u/trunk/configs/templates
# xxx.config 为你需要的配置文件
sudo cp ./xxx.config ../../.config
# 返回 trunk 目录修改 .config 文件
cd ../../

可用 vim | nano 等命令行编辑器修改内容

由于我使用的 Ubuntu 桌面版,有图形编辑器,所以就用 gedit

sudo gedit .config

配置好需要的功能,编辑完成后 Ctrl + S 保存即可
先清理一下 sudo ./clear_tree

编译固件

【同样涉及交叉编译,所以耐心等待约 8 - 20 分钟】

sudo ./build_firmware

完成后提示如下:

#===========================================
# Pack final image and write headers
# For No padded,need write kernel size in image header 
# to correct mount partition in mtd drivers address
img file: /opt/rt-n56u/trunk/images/XX-XXXXX_version.trx
Product ID:   XX-XXXXX
Created:      Wed Dec 28 05:26:51 2016
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    5223551 Bytes = 5101.12 kB = 4.98 MB
Load Address: 0x80000000
Entry Point:  0x802705A0
Kernel Size:  0x00104460
Kernel Ver.:  3.4
FS Ver.:      3.9
make[2]: Leaving directory '/opt/rt-n56u/trunk/vendors/Ralink/MT7620'
make[1]: Leaving directory '/opt/rt-n56u/trunk/vendors'

获取固件

/opt/rt-n56u/trunk/images 目录下得到 *.trx 文件
如果路由器已有 U-Bootbreed 这等神器,刷入他…完毕

相关文章

文章浏览阅读2.3k次,点赞4次,收藏22次。最近安装了CARLA预...
文章浏览阅读6.3k次,点赞5次,收藏15次。在清华镜像中下载U...
文章浏览阅读5k次。linux环境, python3.7.问题描述: 安装...
文章浏览阅读4.2k次,点赞4次,收藏17次。要安装这个 standa...
文章浏览阅读894次,点赞51次,收藏31次。在安卓使用vscode主...