如何自己本地编译 OpenWrt ?

目录

感觉不如直接下载,然后用转换工具把 img 搞成 vmfs,见linux - VMware安装OpenWrt,工具下载链接https://www.starwindsoftware.com/tmplink/starwindconverter.exe。 关于系统 LEAN 的不行,还是 ImmortalWrt 更好!还可直接下载 vmfs,注意系统日志等级它默认的 debug 可不行。 关于上网控制插件,注意会和广告过滤 ACC 加速等冲突,有舍有得啊,openwrt上网时间控制为什么设置后无效-OPENWRT专版-恩山无线论坛 (right.com.cn)。 老老实实用 clash for windows 了,OpenWrt 很不稳定啊,github 时好时坏。

🤔为老古董编译 Openwrt-Old【失败】

为家里的老古董 Mercury MW316R 编译 Openwrt。

这么弱的路由,别折腾了,不如花钱买时间!

Untitled

lib/fseterr.c:77:3: error: #error “Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib.”

Untitled

cd /root/openwrt-old/build_dir/host/bison-3.0.4
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h

编译

make menuconfig
make -j1 V=s

Untitled

老版本,实在编译不动了,时间别浪费了……

🤗为 VMware 虚拟机编译 Openwrt

哭泣,编译完,发现想要的软件包没选上,后期直接换用 LEAN 的配置来编译 注意,OpenClash 好像就是要自己手动安装!!!

参考:[OpenWrt Wiki] Toolchain

系统:Debian 11 (bullseye)

换用 非 root 用户,先安装 sudo 软件,再/etc/sudoers 添加。

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

# Download and update the sources
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git pull
 
# Select a specific code revision
git branch -a
git tag
git checkout v22.03.3
 
# Update the feeds
./scripts/feeds update -a
./scripts/feeds install -a
 
# Configure the firmware image and the kernel
make menuconfig
make -j $(nproc) kernel_menuconfig
 
# Build the firmware image
make -j $(nproc) V=s defconfig download clean world

关于编译的配置,请看 https://github.com/haiibo/OpenWrt【后期直接换 Lean 的仓库,不用官方】:

git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

# 下载 dl 库、编译固件
make download -j8
make V=s -j1

Untitled

别改太大,否则:

Untitled

编译产物

基于 LEAN 的编译(自己编译的linux6.1,真的不好用):

openwrt-x86-64-generic-squashfs-combined-efi.vmdk

使用方法,见我写的另一篇关于 Openwrt 旁路由的文章。

  • combined-ext4.img.gz(rootfs工作区存储格式为ext4。)
  • combined-squashfs.img.gz(squashfs相当于可以恢复出厂设置的固件,如果使用中配置错误,可直接恢复默认设置。)
  • generic-rootfs.tar.gz(rootfs的镜像,不带引导,可自行定义用grub或者syslinux来引导。)
  • rootfs-ext4.img.gz(rootfs的镜像,不带引导,可自行定义用grub或者syslinux来引导,需要存储区是ext4。)
  • rootfs-squashfs.img.gz(rootfs的镜像,不带引导,可自行定义用grub或者syslinux来引导,如果使用中配置错误,可直接恢复默认设置。)

fatal error: closing dependency file .deps/parseopt.Tpo: No space left on device

Untitled

解决:

https://github.com/coolsnowwolf/lede/issues/1454

有说,kernel分区空间不够了,编译配置里进入Target Images菜单,把kernel默认16M改成32M,成功编译,老树莓派可用

但我这里,确实空间不够了

Untitled

linux 扩容,除了 Vmware 调整之外,还要进系统扩容,想想 Windows 磁盘管理和 Ubuntu 的磁盘管理?

Untitled

实际上才用了 20GB。

fdisk /dev/sda 命令进行分区,依次输入 m、n、p、默认回车、默认回车、w 命令。

Untitled

输入 lsblk 命令查看新加的硬盘分区状况。

Untitled

之后要安装 LVM 工具,(Linux Logical Volume Manager):apt install lvm2

然后 vgdisplay vgextend 等命令,发现都没用!!!

最后 centos7根目录扩容(根目录在sda3 vgdisplay为空) - 知乎 (zhihu.com) 成功:

把所有的删了重建,从头到尾只用到 fdisk /dev/sda,不停 d,最后 n

Untitled

之后,参考 如何无损扩展 Debian 硬盘分区 - azhuge233’s

注意分区是好了,但是还没在 df 中显现,需要 apt install cloud-utils

然后:resize2fs /dev/sda1(这一步很关键

Untitled

Untitled

修改 /etc/default/grub 文件之后: update-grub

But that file is already provided by package * dnsmasq

Untitled

参考:openwrt 编译 出现dnsmasq 错误_dnsmasq-full_liu1250836704的博客-CSDN博客

进入到 Base system  —>  菜单找到dnsmasq 选项将其去掉

Untitled

成功

Untitled

参考文章

标签 :
comments powered by Disqus

相关文章

BlockSuite 一款 Block Style 的编辑器,仅仅是编辑器!

先说结论 我的博客不太适合用 BlockSuite 作为编辑器,因为: 不知道如何渲染,我可以编辑,但是如何展示给匿名用户看? SEO 不太明确,也想着转成 HTML 来做,但是成本太高? 其他博主的调研:https://blog.nineya.

阅读更多

JWT 的应用场景思考

JWT 的应用场景思考 简述 JWT JWT,全称 JSON Web Token。是一种开放标准,用于在各方之间安全传递信息,它是以 Base64 编码 json 对象的 token 。基于 token 的权限验证,与传统的 Session 认证完全不同,它不需要服务端保持 Session 记录,连用户状态都不

阅读更多

beancount-gs 一款 self-hosted 复式记账程序,简化你的记账方式!

本程序将部署在 macOS 上,不使用 Docker(mac 上的 Docker 太卡了) 动机 我利用 beancount 来记账已经有一段时间了,但有些痛点问题困扰着我: 没有 web 界面,fava 真的只能用来展示和分析且不好理解,需要有一个方便记账的界面 text

阅读更多