据说,Padavan比openwrt稳定...
注:第一次尝试,采用最简单的方法处理 操作系统: Ubuntu 18.04 LTS
一、系统准备 1. 操作系统更新 $ sudo apt update $ sudo apt upgrade |
2. 安装依赖包 $ sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 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 |
二、编译过程 1. 准备目录 $ sudo mkdir /opt/rt-n56u $ sudo chmod 0777 /opt/rt-n56u |
2. 拉取源码: 选择github上的代码 $ git clone --depth=1 https://github.com/hanwckf/rt-n56u.git /opt/rt-n56u |
3. 准备toolchain $ cd /opt/rt-n56u/toolchain-mipsel # 使用脚本下载预编译的工具链: $ sh dl_toolchain.sh |
4. (如何有必要)编辑配置文件(模板)在/opt/rt-n56u/trunk/configs/templates/目录下 Newifi3的配置文件名为NEWIFI3.config 5. 进行编译 $ cd /opt/rt-n56u/trunk # 对于WSL环境,需要使用sudo进行编译,或者使用fakeroot-tcp代替fakeroot $ sudo ./build_firmware_modify NEWIFI3 |
坐等编译完成,时间会比较长,应该跟机器速度强相关。 6. 编译完成,拷出固件 编译好的固件在: /opt/rt-n56u/trunk/images 生成的固件为: NEWIFI3_3.4.3.9-099.trx
注: 有人提醒: 刷机后为避免各类怪异现象,请到 系统管理->配置管理 重置路由器设置 (NVRAM)和 路由器内部存储 (/etc/storage)进行双清
Pavadan的第一次编译过程比较顺利,相比而言,Openwrt的编译过程总是状况不断。 好感度+1!
后记: 用编译后固件刷了NEWIFI3后, 进入后看到的图面如下:
完全没有扩展功能,功能不全,无法使用。
在老毛子Padavan固件编译笔记中发现chongshengB的版本可以选择科学上网插件,看样子有可能可用。 跟着老毛子Padavan固件编译笔记的说明做编译。 注: 在编译过程中报了四次错 1. 报错为没有找到7z 处理:安装7z $sudo apt install p7zip-full |
但是,装完7z后还有报错,如下: make[2]: Entering directory '/opt/rt-n56u/trunk/libs/boost' ( if [ ! -d boost_1_72_0 ]; then \ 7z x -bsp0 boost_1_72_0.7z ; \ patch -d boost_1_72_0 -p1 -i ../build.patch; \ fi )
Error: Incorrect command line patch: **** Can't change to directory boost_1_72_0 : No such file or directory Makefile:14: recipe for target 'extract_test' failed make[2]: *** [extract_test] Error 2 make[2]: Leaving directory '/opt/rt-n56u/trunk/libs/boost' |
a. 查找问题原因: 查找原因,直接执行 7z x -bsp0 boost_1_72_0.7z,报错如下: /tmp$ 7z x -bsp0 /opt/rt-n56u/trunk/libs/boost/boost_1_72_0.7z
Error: Incorrect command line |
显示的错误一致。 如果修改一下,执行 7z x boost_1_72_0.7z /tmp$ 7z x /opt/rt-n56u/trunk/libs/boost/boost_1_72_0.7z |
则能正确执行。 通过Google搜索"7z bsp0 error",可以查到一篇"How to disable the output of 7-Zip?",里面有提到 You can use the -bs command to control where output goes. To stop anything but error output, I would add -bso0 -bsp0. |
即参数-bsp0可以停止除错误输出之外的任何操作, 下一个回复则说到 This is correct, but introduced in 7Zip version 15.01 or after 9.38beta Source: sourceforge.net/p/sevenzip/discussion/45797/thread/8a45fa74 The actual Synology DSM 6.1.x includes 7zip with the version 9.20 and has no such option. |
应该是后来的版本里没有这个选项。 由此可以确定是由于7z版本更新后,不再支持-bsp0选项,而造成的这个错误。 b. 解决问题: 解决方法应该是去掉命令中的-bsp0。 搜索这个命令的位置: $ /opt/rt-n56u/trunk$ grep -r 'bsp0 ' * libs/boost/Makefile: 7z x -bsp0 $(SRC_NAME).7z ; \ |
那就是在文件/opt/rt-n56u/trunk/libs/boost/Makefile里,打开该文件 $ vim /opt/rt-n56u/trunk/libs/boost/Makefile SRC_NAME = boost_1_72_0 THISDIR = $(shell pwd) CFLAGS := -O3 -ffunction-sections -fdata-sections CXXFLAGS := -O3 -ffunction-sections -fdata-sections LDFLAGS := -Wl,--gc-sections Boost_libs := date_time,program_options,system
all: extract_test config_test ( cd $(SRC_NAME); \ ./b2 -d 0 -j $(HOST_NCPU) toolset=gcc-cross link=static variant=release runtime-link=shared install ; \ )
extract_test: ( if [ ! -d $(SRC_NAME) ]; then \ 7z x -bsp0 $(SRC_NAME).7z ; \ patch -d $(SRC_NAME) -p1 -i ../build.patch; \ fi )
config_test: ( if [ -f ./config_done ]; then \ echo "config done"; \ else \ cd $(SRC_NAME); \ ./bootstrap.sh --with-libraries=$(Boost_libs) --prefix=$(STAGEDIR) ; \ echo "using gcc : cross : $(CXX) : <compileflags>\"$(CPUFLAGS)\" <cxxflags>\"$(CXXFLAGS)\" <cflags>\"$(CFLAGS)\" <linkflags>\"$(LDFLAGS)\" ;" >> project-config.jam ; \ touch ../config_done; \ fi )
clean: rm -f config_done
romfs: cp -fP $(STAGEDIR)/lib/libboost_*.so* $(ROMFSDIR)/lib |
修改第15行 ” 7z x -bsp0 $(SRC_NAME).7z ; \”,去掉-bsp0,改为: " 7z x $(SRC_NAME).7z ; \" 已确认完成安装后该问题解决。 2. 没有htop-3.0.2.tar.gz,且在试图下载htop-3.0.2.tar.gz时报错, 报错内容为: HTTP request sent, awaiting response... 403 Forbidden 2022-05-29 11:09:25 ERROR 403: Forbidden. |
帖子C大源码编译到htop时出错里描述了相同的错误,并说明了解决方案,如下: 把htop-3.0.2.tar.gz文件放/opt/rt-n56u/trunk/user/htop下就行了。 已确认该解决方案可行。
3. 在编译到trojan时, 报错如下: CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.7.2 or higher is required. You are running version 3.5.1 |
参考Ubuntu18/16 升级默认apt安装的cmake版本,从CMakedownload下载cmake。 当前cmake版本为3.22.4 /tmp$ wget https://github.com/Kitware/CMake/releases/download/v3.22.4/cmake-3.22.4-linux-x86_64.tar.gz |
注意:上面下载的是linux的可执行版本,而不是源代码包。 解压后,移动到/opt目录下,并做链接(ln)
/tmp$ tar zxvf cmake-3.22.4-linux-x86_64.tar.gz # 查看版本号 /tmp$ ./cmake-3.22.4-linux-x86_64/bin/cmake --version # 新建目录 /tmp$ sudo mkdir /opt/cmake-3.22.4 /tmp$ sudo chmod 0777 /opt/cmake-3.22.4 # 移动 /tmp$ mv cmake-3.22.4-linux-x86_64/* /opt/cmake-3.22.4/ -f # 建立软链接 $ sudo ln -sf /opt/cmake-3.22.4/bin/* /usr/bin/ # 再次查看版本 $ cmake --version |
4. 最后编译完成后报错,说包太大 # Padded Kernel Image Size 1273856 /opt/rt-n56u/trunk/images/zImage.lzma # Original RootFs Size 110628938 /opt/rt-n56u/trunk/romfs # Compressed RootFs Size 43246464 /opt/rt-n56u/trunk/images/ramdisk # Padded Kernel Image + Compressed Rootfs Size 44520320 /opt/rt-n56u/trunk/images/zImage.lzma # !!! Please make sure that Padded Kernel Image + Compressed Rootfs size # can't bigger than 32964544 !!! #=========================================== # 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/NEWIFI3_3.4.3.9-099.trx |
查看images目录,包还是生成了 /opt/rt-n56u/trunk$ ll images/ total 132812 drwxr-xr-x 2 root root 4096 May 30 05:35 ./ drwxrwxr-x 14 jimway jimway 4096 May 30 04:59 ../ -rw-r--r-- 1 root root 44520384 May 30 05:35 NEWIFI3_3.4.3.9-099.trx -rw-r--r-- 1 root root 43246464 May 30 05:35 ramdisk -rwxr-xr-x 1 root root 3692352 May 30 05:35 zImage* -rw-r--r-- 1 root root 44520320 May 30 05:35 zImage.lzma |
多用了12-13M空间,看下怎么能减下来。
综上所述,修改原老毛子Padavan固件编译笔记中的编译操作如下: 一、系统准备 1. 操作系统更新 $ sudo apt update $ sudo apt upgrade |
2. 安装依赖包 $ sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano fakeroot cpio git python-docutils gettext automake autopoint texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget p7zip-full |
二、编译过程 1. 准备目录 $ sudo mkdir /opt/rt-n56u $ sudo chmod 0777 /opt/rt-n56u |
2. 拉取源码: 选择github上的代码 $ git clone --depth=1 https://github.com/chongshengB/rt-n56u.git /opt/rt-n56u |
3. 准备toolchain $ cd /opt/rt-n56u/toolchain-mipsel # 使用脚本下载预编译的工具链: $ sh dl_toolchain.sh |
4. 将前述htop-3.0.2.tar.gz文件拷贝到/opt/rt-n56u/trunk/user/htop目录下 $ cp htop-3.0.2.tar.gz /opt/rt-n56u/trunk/user/htop |
5. 修改libs/boost/Makefile $ vim /opt/rt-n56u/trunk/libs/boost/Makefile |
修改第15行”7z x -bsp0 $(SRC_NAME).7z ; \”,改为: ”7z x $(SRC_NAME).7z ; \” 6. 升级cmake版本
下载新版本cmake(可执行版本) /tmp$ wget https://github.com/Kitware/CMake/releases/download/v3.22.4/cmake-3.22.4-linux-x86_64.tar.gz |
解压后,移动到/opt目录下,并做链接(ln) # 解压 /tmp$ tar zxvf cmake-3.22.4-linux-x86_64.tar.gz # 新建目录 /tmp$ sudo mkdir /opt/cmake-3.22.4 /tmp$ sudo chmod 0777 /opt/cmake-3.22.4 # 移动 /tmp$ mv cmake-3.22.4-linux-x86_64/* /opt/cmake-3.22.4/ -f # 建立软链接 $ sudo ln -sf /opt/cmake-3.22.4/bin/* /usr/bin/ |
|
7. 查看并修改自定义插件,配置文件是/opt/rt-n56u/trunk/build_firmware_modify $ vim /opt/rt-n56u/trunk/build_firmware_modify |
将文件中的插件自定义修改y/n,y是编译,n是不编译。 注意:至少要保留科学上网相关的插件。 8. (可选)编辑配置文件(模板)在/opt/rt-n56u/trunk/configs/templates/目录下 Newifi3的配置文件名为NEWIFI3.config $ vim /opt/rt-n56u/trunk/configs/templates/NEWIFI3.config |
9. 进行编译 $ cd /opt/rt-n56u/trunk # 对于WSL环境,需要使用sudo进行编译,或者使用fakeroot-tcp代替fakeroot $ sudo ./build_firmware_modify NEWIFI3 |
坐等编译完成,时间会比较长,大概与机器速度强相关。 10. 编译完成,拷出固件 编译好的固件在: /opt/rt-n56u/trunk/images 生成的固件为: NEWIFI3_3.4.3.9-099.trx |
编译成功,功能较多,尚未测试。(5.30)
(第一次成功编译后_5.30之前)用编译后固件刷了NEWIFI3后, 进入后看到的图面如下: |
符合预期!
又:
经测试,科学功能不稳定!且功能简单,远不如op上的科学功能强大,而且功能远少于op。
注: 清理代码树并重新开始编译 $ cd /opt/rt-n56u/trunk $ sudo ./clear_tree $ sudo ./build_firmware_modify NEWIFI3 |
|
成功不完全,就是完全不成功! 换:CM520+自制全套OP办科学,NWF3+自制全套PDV做交换+wifi。 2020.5.30记录
...当前NWF3+PDV还能凑合用,先用着 1. 自制...完成 2. CM520+自制测试,NWF3(不刷+不做拨号和DHCP)做WIFI(如失败,NWF3恢复后继续凑合) 如成功 3. 再刷NWF3 希望最终CM520、NWF3都能独立使用。 |
2022.6.1记录: 最后还是成功了的(还未上线测), 看图
|
|
参考列表
Padavan固件编译办法:
第一次编译时参考
hanwckf的Padavan库_Github:
最先支持了7915无线芯片,也就是支持了wifi6的机型比如CR660x和JCG Q20/Q10 Pro
chongshengB的Padavan库_Github:
在hanwckf的基础上增加修改出了7615/7915对kvr的支持
padavanonly的Padavan库 Github:
具有一些别人没有的插件,使用比较方便
immortalwrt的Padavan库 Github:
在一些细节上有优化
Yuclee的Padavan-mini库 Github:
看样子是个精简版本
Padavan各源码融合教程_m0_60027682的博客-程序员秘密:整合多个源代码的功能
老毛子固件使用说明:
有初始化说明
评论