E8820S 路由器使用
Hz 2022-06-19 Sunday
E8820S 路由器安装及使用。常用功能配置。
1. 编译固件
1.1 准备编译环境
# 配置GIT代理
git config --global http.proxy socks5://代理地址
git config --global https.proxy socks5://代理地址
# 配置命令行代理
export http_proxy=socks5://代理地址
export https_proxy=socks5://代理地址
# 配置APT代理
sudo apt -o Acquire::socks::proxy="socks5://代理地址" install xxx
# 以下使用http代理
git config --global http.proxy http://代理地址
git config --global https.proxy https://代理地址
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1.2 参考编译手册
零基础编译openwrt看这一篇就够了 (opens new window) 手册 (opens new window)
2. 安装
2.1 准备Bread环境
按住复位键,打开电源,5秒后松开。访问 (opens new window) 进入 刷机界面。
2.2 刷入 initramfs-kernel.bin
选择 名为xxx-initramfs-kernel.bin 的固件,重启进入openwrt。
这时,文件系统均为 tmpfs,无法保存配置。
2.3 刷入 squashfs-sysupgrade.bin
在 Openwrt中选择 名为xxx-squashfs-sysupgrade.bin 的固件,保留配置升级。 再重启,文件系统就正常了。
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 4.8M 4.8M 0 100% /rom
tmpfs 123.1M 1.2M 121.9M 1% /tmp
/dev/ubi0_1 100.5M 60.0K 95.7M 0% /overlay
overlayfs:/overlay 100.5M 60.0K 95.7M 0% /
tmpfs 512.0K 0 512.0K 0% /dev
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
3. 刷入Bread
4. 自定义服务
4.1 编写服务
新建一个文件, /etc/init.d/xxxx,并在里面写入以下内容
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
STOP=10
start_service() {
procd_open_instance
# 执行用户
procd_set_param user root
# 启动参数
procd_set_param command /bin/sh -c "命令行,可以带参数"
# PID 文件,服务停止后自动清理
procd_set_param pidfile /var/run/PID文件.pid
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
4.2 启动服务
service xxxx enable
service xxxx start
1
2
2