OpenWrt Auto Extroot 项目使用教程

OpenWrt Auto Extroot 项目使用教程

openwrt-auto-extroot Use the OpenWRT ImageBuilder to build a firmware that automatically formats and moves extroot to any (!) inserted storage device 项目地址: https://gitcode.com/gh_mirrors/op/openwrt-auto-extroot

1. 项目目录结构及介绍

openwrt-auto-extroot/
├── build.sh
├── default.nix
├── image-extras/
│   ├── common/
│   │   ├── etc/
│   │   │   └── dropbear/
│   │   │       └── authorized_keys
│   │   └── usr/
│   │       └── lib/
│   │           └── autoprovision/
│   │               ├── autoprovision-functions.sh
│   │               ├── autoprovision-stage2.sh
│   │               └── autoprovision-stage3.py
│   └── ath79/
│       └── etc/
│           └── uci-defaults/
│               └── setLedAttribute
├── LICENSE
├── manifest.scm
└── README.md

目录结构说明

  • build.sh: 构建脚本,用于生成自定义的 OpenWrt 固件。
  • default.nix: Nix 配置文件,用于定义构建环境。
  • image-extras/: 包含自定义脚本和配置文件,用于在固件启动时自动设置 extroot。
    • common/: 通用配置和脚本。
      • etc/dropbear/authorized_keys: SSH 公钥文件,用于远程登录。
      • usr/lib/autoprovision/: 自动配置脚本。
        • autoprovision-functions.sh: 自动配置的通用函数。
        • autoprovision-stage2.sh: 第二阶段自动配置脚本。
        • autoprovision-stage3.py: 第三阶段自动配置脚本(可选)。
    • ath79/: 特定于 ath79 架构的配置。
      • etc/uci-defaults/setLedAttribute: 设置 LED 属性的脚本。
  • LICENSE: 项目许可证文件。
  • manifest.scm: 项目清单文件。
  • README.md: 项目说明文件。

2. 项目启动文件介绍

build.sh

build.sh 是项目的核心启动文件,用于构建自定义的 OpenWrt 固件。该脚本使用 OpenWrt 的 ImageBuilder 工具来生成固件,并在固件启动时自动设置 extroot。

使用方法
./build.sh <architecture> <variant> <device-profile>

例如:

./build.sh ath79 generic tplink_tl-wr1043nd-v1
功能说明
  • 自动格式化并移动 extroot: 在固件启动时,自动格式化并移动 extroot 到插入的存储设备。
  • 多阶段配置: 分为三个阶段进行配置,确保固件在启动后能够自动完成必要的设置。

3. 项目配置文件介绍

image-extras/common/etc/dropbear/authorized_keys

该文件用于存储 SSH 公钥,允许用户通过 SSH 远程登录到路由器。

image-extras/common/usr/lib/autoprovision/autoprovision-functions.sh

包含自动配置的通用函数,用于在固件启动时执行各种配置任务。

image-extras/common/usr/lib/autoprovision/autoprovision-stage2.sh

第二阶段自动配置脚本,主要用于在固件启动后安装必要的 OpenWrt 包。

image-extras/common/usr/lib/autoprovision/autoprovision-stage3.py

可选的第三阶段自动配置脚本,使用 Python 编写,用于执行更复杂的配置任务。

image-extras/ath79/etc/uci-defaults/setLedAttribute

特定于 ath79 架构的配置脚本,用于设置 LED 属性,提供初始设置阶段的进度反馈。

通过以上配置文件和脚本,项目能够在固件启动时自动完成 extroot 的设置和必要的配置任务,简化了用户的操作流程。

openwrt-auto-extroot Use the OpenWRT ImageBuilder to build a firmware that automatically formats and moves extroot to any (!) inserted storage device 项目地址: https://gitcode.com/gh_mirrors/op/openwrt-auto-extroot

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

纪亚钧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值