# N1
# 系统还原
# 准备工作
WEBPAD大的2.2线刷包 传送门 (opens new window)
USB_Burning_Tool 刷机工具 传送门 (opens new window)
USB对公线一条
# 开始刷机
- 先把USB对公线链接到电脑USB口与N1的第二个口(靠HDMI口),N1不要通电
- 打开USB_Burning_Tool,导入固件WEBPAD大的2.2的线刷包,验证通过后,出现开始字样
- 勾选擦除FLASH,不要勾选擦除bootloader,USB_Burning_Tool点击开始运行刷机,3秒钟内速度让N1通电
- USB_Burning_Tool开始正常识别N1线刷模式,刷机开始
- 烧录完成后,拔电重启,N1恢复了原来的样子,可以正常ADB连接
# 刷入系统
设置盒子从U盘启动
.\adb.exe connect 192.168.10.186
.\adb.exe shell reboot update
# OpenWRT
# 橙子 OpenWrt
制作XQ7大神的Armbian系统 U盘镜像,并将Armbian写入到eMMC中
/boot/create-mbr-linux.sh
./install.sh
通过文件传输软件,将OpenWRT镜像文件上传到盒子root目录
完成后,创建一个emmc2文件夹
mkdir /emmc2
将eMMC其中一个分区(Armbian所在的分区)挂载到新创建的emmc2文件夹
mount /dev/mmcblk1p2 /emmc2
删除Armbian的所有文件
rm -rf /emmc2/*
挂载我们的OpenWRT镜像
losetup -P -f --show 2019.05.26-openwrt-on-phicomm-n1-bycheng.img
挂载到指定文件夹
mount /dev/loop0p2 /media
将OpenWRT的所有文件拷贝到Armbian文件夹
cp -R /media/* /emmc2
卸载挂载
umount /media
losetup -d /dev/loop0
umount /emmc2
重启盒子,先拔盒子电源,然后取下U盘,再插入电源
# gd772 OpenWrt
# flippy OpenWrt
查看流控(rx/tx):dmesg | grep dwmac
写入 emmc:/root/inst-to-emmc.sh
docker 数据目录:/mnt/mmcblk1p3/docker
旁路由防火墙:iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
# Armbian
- N1首个支持FullCone Nat的Armbian系统 (opens new window)
- 斐讯N1 – 完美刷机Armbian教程 (opens new window)
- 小狮子N1学习个人笔记 (opens new window)
刷入系统
/boot/create-mbr-linux.sh
/root/install.sh
$ cat /etc/cron.d/armbian-truncate-logs
*/15 * * * * root /usr/lib/armbian/armbian-truncate-logs
在 /usr/lib/armbian/armbian-ramlog syncToDisk 函数 头部返回即可避免将日志 rsync 到 emmc
syncToDisk () {
# no sync to protect emmc
return 0
isSafe
echo -e "\n\n$(date): Syncing logs from $LOG_TYPE to storage\n" | $LOG_OUTPUT
if [ "$USE_RSYNC" = true ]; then
rsync -aXWv --exclude armbian-ramlog.log --links $RAM_LOG $HDD_LOG 2>&1 | $LOG_OUTPUT
else
cp -rfup $RAM_LOG -T $HDD_LOG 2>&1 | $LOG_OUTPUT
fi
sync
}
armbian做了一个systemd服务:/lib/systemd/system/armbian-ramlog.service,它开机会创建zram盘,然后从emmc的/var/log.hdd中load数据到zram的/var/log路径下,完成开机初始化。
换源
sed -i s@/httpredir.debian.org/@/mirrors.ustc.edu.cn/@g /etc/apt/sources.list
sed -i s@/security.debian.org/@/mirrors.ustc.edu.cn/debian-security/@g /etc/apt/sources.list
sed -i s@apt.armbian.com@mirrors.tuna.tsinghua.edu.cn/armbian@g /etc/apt/sources.list.d/armbian.list
openwrt
- 在Docker 中运行 OpenWrt 旁路网关 (opens new window)
- Docker版Openwrt更新方法 (opens new window)
- Docker Openwrt r20.04.08 (opens new window)
ifconfig eth1 promisc # 设置混杂模式
ifconfig eth1 -promisc # 取消混杂模式
ip link set eth0 promisc on # 设置混杂模式
ip link set eth0 promisc off # 取消混杂模式
# 拉取openwrt
docker pull unifreq/openwrt-aarch64:r20.04.08
# 创建macvlan网络
docker network create -d macvlan --subnet 192.168.11.0/24 --gateway 192.168.11.1 -o parent=eth0 -o macvlan_mode=bridge macnet
# 查看已创建网络
docker network ls
#
docker run --name OpenWrt --restart always -d --network macnet --privileged unifreq/openwrt-aarch64:r20.04.08 /sbin/init
# 其他镜像
docker pull kanshudj/n1-openwrtgateway:latest
# 修改管理地址
$ vi /etc/config/network
option ipaddr '192.168.2.3'
option netmask '255.255.255.0'
option gateway '192.168.2.1'
option dns '114.114.114.114 223.5.5.5 180.76.76.76 8.8.4.4'
$ /etc/init.d/network restart
# 永久开启混杂模式
$ vi /etc/network/interfaces
auto eth0
iface eth0 inet manual
up ip link set eth0 promisc on
auto macvlan
iface macvlan inet static
address 192.168.12.104→修改成你需要的
netmask 255.255.255.0
gateway 192.168.12.1→需改成你的主路由ip或192.168.12.5(旁路由的ip)
dns-nameservers 192.168.12.1→需改成你的主路由ip或12.5或再加1个公共dns比如114
pre-up ip link add macvlan link eth0 type macvlan mode bridge
post-down ip link del macvlan link eth0 type macvlan mode bridge
$ systemctl restart networking
固定IP
给N1设置一个固定IP只需
armbian-config
network
eth0
ip
static
Edit /etc/network/interfaces and change from:
iface eth0 inet dhcp
to - for example:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
auto lo
auto ens33 #开机自动连接网络
iface lo inet loopback
allow-hotplug ens33
iface ens33inet static #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.2.22 #设置ip地址
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.2.2 #设置网关
#network 192.168.2.0
#broadcast 192.168.2.255
auto lo
auto eth0 #开机自动连接网络
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.1.233 #设置ip地址
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.1.1 #设置网关