Step1:在Windows 10或者11的应用商店里面,搜索UBUNTU并安装,我安装的是18.04版本;
Step 2:在Windows开始菜单中,找到Ubuntu并打开,在命令行中进行升级:
sudo apt update
sudo apt install build-essential ccache ecj fastjar file g++ gawk \ gettext git java-propose-classpath libelf-dev libncurses5-dev \ libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ python3-distutils python3-setuptools python3-dev rsync subversion \ swig time xsltproc zlib1g-dev
Step 3:下载源码
git clone https://github.com/openwrt/openwrt.git
如果速度慢,先下载压缩包,再解压 wget -c https://github.com/openwrt/openwrt/archive/refs/heads/main.zip unzip main.zip cd openwrt-main/ git init git add . git remote add origin https://github.com/openwrt/openwrt.git git remote update git pull
若遇到问题:configure: error: you should not run configure as root
解决办法:切换到root用户执行:export set FORCE_UNSAFE_CONFIGURE=1
若遇到问题:fatal: unable to access ‘https://github.com/openwrt/openwrt.git/‘: gnutls_handshake() failed: The TLS connection was non-properly terminated. error: Could not fetch origin
解决办法,在命令行执行: git config –global –unset https.https://github.com.proxy && git config –global –unset http.https://github.com.proxy
Step 4:切换分支 //查看所有分支 git branch -a //可以利用tag切换 git tag git checkout v23.05.0 也可以直接利用分支名 sudo git checkout remotes/origin/openwrt-18.06
Step 5:编译前准备 sudo ./scripts/feeds update -a && ./scripts/feeds install -a
Step 6:build
make j=1
//如果OPENWRT WEB页面打不开,如何升级固件?
运行make,编译之后把生成的固件,利用winscp或者运行命令拷贝到机器:scp openwrt-ramips-xxx-squashfs-sysupgrade.bin [email protected]:/tmp/,使用sysupgrade命令升级sysupgrade /tmp/openwrt-ramips-xxx-squashfs-sysupgrade.bin