制作斐讯N1的OpenWRT镜像

1.编译OpenWRT镜像

参考
https://github.com/coolsnowwolf/lede

中文:如何编译自己需要的 OpenWrt 固件

注意:
1. 不要用 root 用户 git 和编译!!!
2. 国内用户编译前最好准备好梯子
3. 默认登陆IP 192.168.1.1, 密码 password

编译命令如下:

1. 首先装好 Ubuntu 64bit,推荐  Ubuntu  14 LTS x64

2. 命令行输入 sudo apt-get update ,然后输入
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint

3. git clone https://github.com/coolsnowwolf/lede命令下载好源代码,然后 cd lede 进入目录

4. ./scripts/feeds update -a 
   ./scripts/feeds install -a
   make menuconfig 

5. 最后选好你要的路由,输入 make -j1 V=s 

2.make menuconfig 设备选择

Target System (QEMU ARM Virtual Machine)  --->
Subtarget (ARMv8 multiplatform)  --->
LuCI  --->Applications  --->选择自己需要的APP
其他默认

编译成功之后在lede/bin/targets/armvirt/64目录下openwrt-armvirt-64-root.ext4.gz
或者直接用OpenWRT官方镜像https://downloads.openwrt.org/releases/18.06.2/targets/armvirt/64/openwrt-18.06.2-armvirt-64-default-rootfs.tar.gz

3.制作斐讯N1的OpenWRT镜像

镜像母版使用Armbian_5.60_Aml-s9xxx_Debian_stretch_default_4.18.7_20180922.img

//解包原版镜像
tar xvf openwrt-armvirt-64-rootfs.tar.gz -C openwrt
//挂载母版镜像
losetup -P -f --show Armbian_5.60_Aml-s9xxx_Debian_stretch_default_4.18.7_20180922.img
mount /dev/loop0p2 /armbian
//删除OpenWRT中firmware modules
rm -rf openwrt/lib/firmware
rm -rf openwrt/lib/modules
//替换armbian
mv armbian/lib/modules openwrt/lib/
mv armbian/lib/firmware openwrt/lib/
mv armbian/etc/modprobe.d openwrt/etc/
mv armbian/etc/fstab openwrt/etc/
//切换到openwrt/lib/modules/4.18.7-aml-s9xxx
cd openwrt/lib/modules/4.18.7-aml-s9xxx
//创建link-ko.sh
nano link-ko.sh
//内容为:
for x in `find -name *.ko`
do
    ln -s $x .
done
//给予link-ko.sh运行权限
chmod +x link-ko.sh
//运行link-ko.sh
./link-ko.sh
//回到openwrt目录
cd openwrt
//编辑openwrt/etc/init.d/boot
nano openwrt/etc/init.d/boot
//内容是在第38行也就是“/sbin/kmodloader”之前,增加以下内容:
ulimit -n 51200
//清空armbian
rm -rf armbian/*
//把openwrt目录下所有剪切到armbian
mv openwrt/* armbian/
//新建boot目录
mkdir armbian/boot
//同步
sync
//卸载media和openwrt目录
umount armbian
losetup -d /dev/loop0

Armbian_5.60_Aml-s9xxx_Debian_stretch_default_4.18.7_20180922.img已被修改为openwrt系统
写入U盘,插入N1盒子,插电,启动成功,电脑直接接入盒子lan口,进入管理界面设置成辅助网关即可。

echo  0xDEADBEEF > /etc/config/google_fu_mode

你可能感兴趣的:(制作斐讯N1的OpenWRT镜像)