使用win10 wsl中的Debian编译lean 的 lede

安装Debian发行版

启用windows 适用于linux 的 windows子系统

安装Debian

参考p3terx的文章把debian装到非系统盘上:
https://p3terx.com/archives/compiling-openwrt-with-wsl.html

配置环境与编译openwrt

设置编译环境

安装编译过程需要的工具

更换debian源(当前debian版本为stretch)

sudo nano /etc/apt/sources.list

在文件最开头添加以下内容

deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

令行输入 sudo apt-get update

然后输入 sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3.5 python2.7 unzip zlib1g-dev lib32gcc1 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

取消WSL PATH 与windows PATH关联

#在Debian中修改/etc/wsl.conf
sudo nano /etc/wsl.conf
#加入内容
[interop]
appendWindowsPath=false
[automount]
enable=false
#管理员身份cmd运行以下命令重启wsl
net stop LxssManager 
net start LxssManager
#结果看不到windows的环境变量了
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

在wsl使用win10的proxy

#示例
export http_proxy=socks5://127.0.0.1:10800
export https_proxy=socks5://127.0.0.1:10800

开始编译工作

#为了避开wsl与windows文件系统的一些兼容性问题
#在Debian用户目录下,如/home/you_name执行下面的操作

git clone https://github.com/coolsnowwolf/lede.git
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j8 download V=s 	#下载dl库
make -j1 V=s 	        #(-j 后面是线程数。第一次编译推荐用单线程)即可开始编译固件了

非常感谢lean大的代码

参考:

http://www.win10.uk/article/11785.html

https://blog.csdn.net/notMine/article/details/103302371

https://github.com/coolsnowwolf/lede

https://p3terx.com/archives/compiling-openwrt-with-wsl.html

posted @ 2020-04-27 13:17  BeeFlow  阅读(814)  评论(0编辑  收藏  举报