Windows10建立Ubuntu子系统编译Openwrt的全过程

发布于 / 运维 / 0 条评论

0x00 建立Ubuntu子系统

Windows 10,打开设置,更新与安全,开发者选项,打开开发人员模式。(建议用Windows专业版。在家庭版和教育版上有一定的概率遇到一些奇奇怪怪的问题)

打开Powershell(管理员)输入命令

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

或者在控制面板,程序,程序和功能,启用或关闭Windows功能里面找到 适用于Linux 的 Windows 子系统,勾选上,确定

image.png

然后重启电脑。

打开应用商店,搜索Ubuntu,下载Ubuntu系统,并设置用户名密码。之后,在cmd中输入ubuntu,你的电脑应该可以成功运行起一个Ubuntu来。

0x01 下载Openwrt源码

首先在Ubuntu中安装git

apt install git

然后从下面任选一个git源进行git clone

https://github.com/openwrt/openwrt.git
https://git.openwrt.org/openwrt/openwrt.git
https://gitee.com/harvey520/openwrt.git

gitee是国内镜像,应该是最快的。

git clone的代码建议不要放在其他硬盘,默认放在C:\Users\用户名\AppData\Local\Microsoft\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc目录下。

如果一定放在其他硬盘,需要修改大小写敏感。方法是:在windows系统找到你clone下的代码文件夹,打开Powershell(管理员),执行:

cd 存放openwrt的目录
fsutil file setCaseSensitiveInfo openwrt enable

这一步是为了将openwrt文件夹改为大小写敏感文件夹,以免后续编译报错。

0x02 编译

进入Ubuntu内,进入openwrt文件夹内,执行:

sudo apt update
sudo apt install make subversion libssl-dev ncurses-dev gcc g++ unzip 
./scripts/feeds update -a 
./scripts/feeds install -a 
make menuconfig -j1 V=99

如果feeds update时提示无法解析域名,百度一个在线DNS服务,查一下git.openwrt.org的A记录并添加到/etc/hosts内即可。

如果提示缺少依赖,按照要求安装即可。如果没有意外,可以看到OpenWrt Configuration界面了

image.png

使用

make -j5 V=99

即可开始编译

转载原创文章请注明,转载自: 斐斐のBlog » Windows10建立Ubuntu子系统编译Openwrt的全过程
目前还没有评论,快来抢沙发吧~