使用系统ubuntu20.04

系统设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 修改/etc/sudoers
root@ubuntu:~# grep %sudo /etc/sudoers
%sudo ALL=(ALL:ALL) NOPASSWD: ALL

# 创建普通用户openwrt
root@ubuntu:~# useradd -m -s /bin/bash -G sudo openwrt
root@ubuntu:~# su -l openwrt
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

openwrt@ubuntu:~$ sudo -l
Matching Defaults entries for openwrt on ubuntu:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User openwrt may run the following commands on ubuntu:
(ALL : ALL) NOPASSWD: ALL

# 安装依赖
sudo apt-get -y install build-essential asciidoc binutils bzip2 curl gawk gettext git libncurses5-dev libz-dev patch python3.5 python2.7 unzip zlib1g-dev lib32gcc-s1 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 device-tree-compiler g++-multilib antlr3 gperf genisoimage

# 网络环境检测
openwrt@ubuntu:~$ curl -I -L google.com >/dev/null && echo ok
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- 0 219 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
ok

源码获取

git clone -b openwrt-22.03 https://github.com/openwrt/openwrt.git

文件path/feeds.conf.default追加

1
2
3
src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
src-git passwall2 https://github.com/xiaorouji/openwrt-passwall2.git;main

argon主题

1
2
cd path/package
git clone https://github.com/jerrykuku/luci-theme-argon.git

更新

1
2
./scripts/feeds update -a 
./scripts/feeds install -a

编译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 配置
make menuconfig

# 预下载
nohup make -j`nproc` download V=s &

# 首次编译
nohup make -j1 V=s &

# 文件生成路径path/bin/targets/
openwrt@debian:~/openwrt-22.03.5/bin/targets/x86/64$ ls
config.buildinfo openwrt-22.03.5-x86-64-generic-ext4-rootfs.img.gz profiles.json
feeds.buildinfo openwrt-22.03.5-x86-64-generic-kernel.bin sha256sums
openwrt-22.03.5-x86-64-generic-ext4-combined-efi.img.gz openwrt-22.03.5-x86-64-generic.manifest version.buildinfo
openwrt-22.03.5-x86-64-generic-ext4-combined.img.gz packages