Code Monkey home page Code Monkey logo

openwrt's Introduction

OpenWrt

一个可以简单自定义 OpenWrt 固件的工具

关于此项目

通常在官方下载的固件会缺少一些软件包,且在初次启动时需要配置拨号账号密码等,官方提供的 Firmware Selector,不能添加自定义软件源,此项目就是为了解决这些问题,目标是简化以减少新系统启动时必须的初始化配置为,达到开机无需配置即可使用

另外项目会将配置持久化,相比 Firmware Selector,无需每次生成固件都需要重新配置

基于

  • 基于 ImageBuilder 构建,几分钟即可构建完成
  • 使用 Docker 运行 ImageBuilder,无需安装额外的软件和依赖

特性

  • 集成常用代理软件及其最佳实践配置,如 openclash, daed, passwall
  • 可配置默认 LAN 口 IP,PPPoE 账号密码,推荐的 IPv6 配置,刷机完成后,无需配置网络
  • 模块化,方便添加和维护

准备

安装 Docker https://docs.docker.com/engine/install/

安装和配置

git clone https://github.com/ekkog/OpenWrt.git
cd OpenWrt

项目配置通过 .env 文件进行,您可以通过修改 .env 文件来配置项目

.env 中可以配置两类变量,一类是 ImageBuilder 的环境变量,一类是项目的环境变量

CONFIG_ 开头的变量是 ImageBuilder 的环境变量,运行时会将这些变量传递给 ImageBuilder,您可以通过 ImageBuilder 的文档来了解这些变量的含义

MODULES 是项目的环境变量,用于配置项目使用的 modules,后面会详细介绍

使用

❯ ./run.sh --help                                                                           
--image: specify imagebuilder docker image, find it in https://hub.docker.com/r/openwrt/imagebuilder/tags or https://hub.docker.com/r/immortalwrt/imagebuilder/tags
--profile: specify profile
--with-pull: pull image before build
--rm-first: remove container before build
--use-mirror: use mirror
-h|--help: print this help

示例

./run.sh --image=immortalwrt/imagebuilder:rockchip-armv8-openwrt-23.05.1 --profile=friendlyarm_nanopi-r2s --rm-first --with-pull --use-mirror=1                                  

modules

本项目所有的特性均通过 modules 进行配置,您可以根据自己的需求,自由选择需要的模块,或者自行添加新的模块

每个 module 都是一个目录,目录名即为 module 名,目录下包含以下文件

packages #一个文本文件,定义本 module 依赖的软件包
files/ #定义本 module 需要的文件,按照 [OpenWrt 的 files](https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#custom_files) 规范,放置到对应的目录下,最后会将所有 module 的 files 合并到一个目录下
post-files.sh #定义本 module 的预处理脚本,会在将当前 module 的 files 合并到最终目录后执行
.env #定义本 module 的环境变量,会将其中的变量的值替换到 files/uci-defaults/ 目录下的文件中

您可以通过在项目根目录下的 .env 中定义 MODULES 变量,来选择需要的 module,例如

MODULES="python -tools"

以减号开头的 module 会被排除,上面的例子中,会增加 python module,并排除 tools module

内置 modules https://github.com/EkkoG/OpenWrt/tree/master/modules

默认使用的 modules 参见 https://github.com/EkkoG/OpenWrt/blob/master/build.sh

更多

请查看 Wiki

致谢

感谢以下项目,使得我的上网体验又有所提升

openwrt's People

Contributors

ekkog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openwrt's Issues

没有 .env文件

你好,我遇到个问题,git下来,在Openwrt文件夹下没有找到 .env文件。是我哪里出问题了吗?--- WSL Ubuntu22.04

运行出错:mkdir: cannot create directory '/home/build/openwrt/bin/targets': Permission denied

ubuntu 18.04 运行出错,请C大指点一下,感谢!

root@debian:~/ciel# ./run.sh amd64_21
Pulling imagebuilder_x86_64_21_02 (openwrtorg/imagebuilder:x86-64-21.02-SNAPSHOT)...
x86-64-21.02-SNAPSHOT: Pulling from openwrtorg/imagebuilder
1cfaf5c6f756: Pull complete
70e66b8a8157: Pull complete
bd6b7cd9a867: Pull complete
eb26ff370e39: Pull complete
5e043e6b2ccf: Pull complete
abea2a23e8a6: Pull complete
Digest: sha256:dbc4463293bb593687c7e236048bc2799789eb22a7c6026c0b40759249c554fe
Status: Downloaded newer image for openwrtorg/imagebuilder:x86-64-21.02-SNAPSHOT
Creating imagebuilder_x86_64_21_02 ... done
Attaching to imagebuilder_x86_64_21_02
imagebuilder_x86_64_21_02 | cd5844109a8e9dda
imagebuilder_x86_64_21_02 | Generate local signing keys...
imagebuilder_x86_64_21_02 | Generate local certificate...
imagebuilder_x86_64_21_02 | Checking 'working-make'... ok.
imagebuilder_x86_64_21_02 | Checking 'case-sensitive-fs'... ok.
imagebuilder_x86_64_21_02 | Checking 'proper-umask'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl-data-dumper'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl-findbin'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl-file-copy'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl-file-compare'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl-thread-queue'... ok.
imagebuilder_x86_64_21_02 | Checking 'tar'... ok.
imagebuilder_x86_64_21_02 | Checking 'find'... ok.
imagebuilder_x86_64_21_02 | Checking 'bash'... ok.
imagebuilder_x86_64_21_02 | Checking 'xargs'... ok.
imagebuilder_x86_64_21_02 | Checking 'patch'... ok.
imagebuilder_x86_64_21_02 | Checking 'diff'... ok.
imagebuilder_x86_64_21_02 | Checking 'cp'... ok.
imagebuilder_x86_64_21_02 | Checking 'seq'... ok.
imagebuilder_x86_64_21_02 | Checking 'awk'... ok.
imagebuilder_x86_64_21_02 | Checking 'grep'... ok.
imagebuilder_x86_64_21_02 | Checking 'egrep'... ok.
imagebuilder_x86_64_21_02 | Checking 'getopt'... ok.
imagebuilder_x86_64_21_02 | Checking 'stat'... ok.
imagebuilder_x86_64_21_02 | Checking 'unzip'... ok.
imagebuilder_x86_64_21_02 | Checking 'bzip2'... ok.
imagebuilder_x86_64_21_02 | Checking 'wget'... ok.
imagebuilder_x86_64_21_02 | Checking 'perl'... ok.
imagebuilder_x86_64_21_02 | Checking 'python2-cleanup'... ok.
imagebuilder_x86_64_21_02 | Checking 'python'... ok.
imagebuilder_x86_64_21_02 | Checking 'python3'... ok.
imagebuilder_x86_64_21_02 | Checking 'python3-distutils'... ok.
imagebuilder_x86_64_21_02 | Checking 'git'... ok.
imagebuilder_x86_64_21_02 | Checking 'file'... ok.
imagebuilder_x86_64_21_02 | Checking 'rsync'... ok.
imagebuilder_x86_64_21_02 | Checking 'which'... ok.
imagebuilder_x86_64_21_02 | Checking 'ldconfig-stub'... ok.
imagebuilder_x86_64_21_02 | Building images for x86 - Generic x86/64
imagebuilder_x86_64_21_02 | Packages: luci luci-compat dnsmasq-full luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn wget curl vim-full luci-app-clash overture clash luci-app-jd-dailybonus node luci-app-dnsfilter luci-app-zerotier luci-app-autoreboot luci-app-passwall luci-app-wrtbwmon luci-app-ssr-plus luci-theme-argon base-files busybox ca-bundle dropbear e2fsprogs firewall fstools ip6tables iptables kernel kmod-bnx2 kmod-button-hotplug kmod-e1000 kmod-e1000e kmod-forcedeth kmod-igb kmod-ipt-offload kmod-ixgbe kmod-r8169 libc libgcc libustream-wolfssl logd mkf2fs mtd netifd odhcp6c odhcpd-ipv6only opkg partx-utils ppp ppp-mod-pppoe procd uci uclient-fetch urandom-seed urngd
imagebuilder_x86_64_21_02 |
imagebuilder_x86_64_21_02 | mkdir: cannot create directory '/home/build/openwrt/bin/targets': Permission denied
imagebuilder_x86_64_21_02 | make[1]: *** [Makefile:120: _call_image] Error 1
imagebuilder_x86_64_21_02 | make: *** [Makefile:240: image] Error 2
imagebuilder_x86_64_21_02 exited with code 2
Going to remove imagebuilder_x86_64_21_02
Removing imagebuilder_x86_64_21_02 ... done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.