update prepare openwrt script

This commit is contained in:
2026-05-31 03:43:40 +00:00
parent 759a0da17c
commit 819b2ab371
2 changed files with 260 additions and 75 deletions

View File

@@ -8,9 +8,10 @@ This repository contains shell scripts that streamline preparing, configuring, a
- Installs required build dependencies via apt on Ubuntu 22.04/24.04/26.04 and Debian 12/13+.
- Handles x86_64 and ARM64 differences (Python/distutils, multilib notes, Go on ARM64).
- prepare-openwrt.sh
- Clones or updates the OpenWrt source repo.
- Clones or updates the OpenWrt source repo in the top-level `openwrt/` root.
- Lets you select Stable, Beta, or Snapshot versions interactively.
- Normalizes folder layout if run from an “openwrt-build-helper” directory.
- Uses the script location as the source of truth, so running it from another current working directory is supported.
- On first run from a helper checkout, relocates that checkout to `openwrt/helper/`.
- Updates feeds and runs make defconfig.
- add-external-repos.sh
- Clones or updates additional package repositories into package/.
@@ -44,27 +45,28 @@ This repository contains shell scripts that streamline preparing, configuring, a
- Run: ./prepare-openwrt.sh
- Choose Stable, Beta, or Snapshot.
- The script:
- Clones/updates the OpenWrt repo into ./openwrt (or uses the current repo if youre already inside it).
- Reuses or creates the top-level OpenWrt root at `./openwrt`.
- Moves this helper checkout to `./openwrt/helper` on first run.
- Updates/install feeds and runs make defconfig.
3) Add optional external packages
- From the OpenWrt root:
- ../add-external-repos.sh
- ./helper/add-external-repos.sh
- This pulls extra LuCI packages into package/.
4) Import a device config.buildinfo (optional but convenient)
- From the OpenWrt root:
- ../download-config.sh
- ./helper/download-config.sh
- Pick a device, and the script writes .config and runs make defconfig.
5) Enable additional packages from a list (optional)
- Create a file packages.txt containing package names (whitespace or newlines).
- From the OpenWrt root:
- ../add-openwrt-packages.sh packages.txt
- ./helper/add-openwrt-packages.sh packages.txt
6) Configure Go bootstrap path (if needed)
- From the OpenWrt root:
- ../update-go-path.sh
- ./helper/update-go-path.sh
- This sets CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT to the latest /usr/lib/go-X.XX/ found.
- You can override it manually in .config if necessary.
@@ -73,7 +75,7 @@ This repository contains shell scripts that streamline preparing, configuring, a
- ./scripts/feeds update telephony
- ./scripts/feeds install -a
- Then run:
- ../apply-dahdi-patches.sh
- ./helper/config_24.10.4/apply-dahdi-patches.sh
- Build the package:
- make package/feeds/telephony/dahdi-linux/{clean,prepare} V=s
- make package/feeds/telephony/dahdi-linux/compile V=s
@@ -86,8 +88,9 @@ This repository contains shell scripts that streamline preparing, configuring, a
## Script usage notes and tips
- Run locations:
- prepare-openwrt-env.sh, prepare-openwrt.sh: from anywhere (they manage/enter ./openwrt).
- All others: run from inside the OpenWrt source root unless otherwise indicated.
- `prepare-openwrt.sh`: resolves paths from the script location, not your current shell directory.
- `prepare-openwrt-env.sh`: can be run before the first normalization from the fresh helper checkout.
- All other helper scripts: run them from inside the OpenWrt source root as `./helper/...` unless otherwise indicated.
- Feeds:
- If a package cant be found, ensure feeds are updated/installed:
- ./scripts/feeds update -a && ./scripts/feeds install -a
@@ -113,10 +116,12 @@ This repository contains shell scripts that streamline preparing, configuring, a
- make clean; make -j$(nproc) download world
## Directory behavior
- If you run prepare-openwrt.sh from inside a directory named openwrt-build-helper, it will:
- Move your helper files to openwrt/helper/
- Rename the top-level folder to openwrt/
- Continue setup within openwrt/
- If you start from a freshly cloned helper checkout at `<parent>/<origin_folder>`, `prepare-openwrt.sh` will:
- Reuse or create `<parent>/openwrt/` as the OpenWrt source root.
- Move the entire helper checkout, including its `.git`, to `<parent>/openwrt/helper/`.
- Initialize or update the OpenWrt source tree directly in `<parent>/openwrt/`.
- If you later rerun `openwrt/helper/prepare-openwrt.sh`, it reuses the parent `openwrt/` directory and does not move directories again.
- If the script is already located in a real OpenWrt source root, it treats that directory as the source root and does not relocate it just because the directory name is `openwrt`.
## Security and safety
- Scripts use set -e to stop on errors.