5

如何在WSL下交叉编译openwrt - 云中双月

 1 year ago
source link: https://www.cnblogs.com/Johness/p/compile-openwrt-under-wsl.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何在WSL下交叉编译openwrt

  首先我们需要准备一个大小写敏感的文件夹。

  

372875-20230208153454982-305713083.png

  然后拉取代码,并且执行代码的先决条件脚本。

  

372875-20230208153534435-2089497598.png

  注意,如果过程中某项条件不符,你可能要临时修复。

  假如下图的组件判定失败(即出现ok=>fail)

  

372875-20230208153647424-599905019.png

  那么你就需要执行sudo apt install -y python3-distutils来修复。

  然后执行make menuconfig。

  

372875-20230208153827193-815117507.png

  menuconfig需要选择处理器参数(前三项)。

  

372875-20230208154121090-1740877592.gif

  这些参数在openwrt官网可以找到,我们以小米AX6000为例

  

372875-20230208154338157-254555819.png

  然后就是通过make编译,编译大概会分为两个阶段,一是先通过本机的gcc编译出来一个交叉编译工具链;然后再通过交叉编译的工具链编译目标处理器的openwrt系统固件

  不过我们在make之前,还得把编译过程中的资源下载路径优化一下,加速编译过程。

  (主要是把中科大的镜像地址放到最前面)

  

372875-20230208154828864-2114509457.png

  然后make [-j10] V=sc进行编译(加-j多核编译更快)

  

372875-20230208154942732-909541089.png

  当然了,我并没有等到固件编译完成。而是等到交叉编译链生成后就迫不及待地上机测试了!

  

372875-20230208172759981-558881494.png

  (出现Toolchan successfully patched.字样就代表交叉编译链生成完毕了!)

  

372875-20230208172347069-1062931370.png

  (注意,使用openwrt的交叉编译链时,要提供STAGING_DIR的环境变量)

  

372875-20230208172418830-16377362.png

  最后修改时间2023-02-08 17:24:56


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK