|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This repository contains GitHub Actions workflows for building custom OpenWRT firmware images with additional packages (OpenClash, Passwall, Argon theme). It supports multiple OpenWRT versions and architectures. |
| 8 | + |
| 9 | +## Key Architecture |
| 10 | + |
| 11 | +### Version Compatibility |
| 12 | +- **OpenWRT 24.x**: Uses `opkg` package manager with `.ipk` files |
| 13 | +- **OpenWRT 25.x**: Uses `apk` package manager with `.apk` files |
| 14 | +- Version detection pattern: `[[ "$VERSION" == 24.* ]]` or `[[ "$VERSION" == 25.* ]]` |
| 15 | + |
| 16 | +### Build Pipeline (build_image_all.yml) |
| 17 | +1. **build_openclash** - Builds OpenClash using Docker SDK container |
| 18 | +2. **build_passwall** - Builds Passwall (requires Go installation) |
| 19 | +3. **build_theme_argon** - Builds Argon theme |
| 20 | +4. **build_image** - Combines artifacts and creates final firmware image |
| 21 | + |
| 22 | +Jobs run in parallel where possible; `build_image` depends on all package builds. |
| 23 | + |
| 24 | +### Docker Images Used |
| 25 | +- `openwrt/sdk:{arch}-{version}` - For compiling packages |
| 26 | +- `openwrt/imagebuilder:{arch}-{version}` - For creating firmware images |
| 27 | + |
| 28 | +### Supported Targets |
| 29 | +- **Architectures**: `x86-64`, `rockchip-armv8` |
| 30 | +- **Profiles**: `generic` (x86-64), `friendlyarm_nanopi-r2s` (rockchip-armv8) |
| 31 | + |
| 32 | +## Build Scripts |
| 33 | + |
| 34 | +### build_clash.sh |
| 35 | +Compiles OpenClash inside SDK container. Outputs to `/openclash`. |
| 36 | + |
| 37 | +### build_image.sh |
| 38 | +Creates final firmware image. Key environment variables: |
| 39 | +- `PROFILE` - Device profile name |
| 40 | +- `PACKAGES` - Space-separated package list |
| 41 | +- `ROOTFS_SIZE` / `KERNEL_SIZE` - Partition sizes |
| 42 | +- `ARCH` / `VERSION` - Target architecture and OpenWRT version |
| 43 | + |
| 44 | +For OpenWRT 25.x, uses `ADD_LOCAL_KEY=1` to allow unsigned custom packages. |
| 45 | + |
| 46 | +## Important Patterns |
| 47 | + |
| 48 | +### Package Extension Handling |
| 49 | +```yaml |
| 50 | +if [[ "${{ matrix.version }}" == 24.* ]]; then |
| 51 | + echo "PKG_EXT=ipk" >> $GITHUB_ENV |
| 52 | +else |
| 53 | + echo "PKG_EXT=apk" >> $GITHUB_ENV |
| 54 | +fi |
| 55 | +``` |
| 56 | + |
| 57 | +### Artifact Retention |
| 58 | +- Intermediate packages: 7 days |
| 59 | +- Final firmware images: 30 days |
| 60 | + |
| 61 | +## Workflow Triggers |
| 62 | +- Push to `master` branch |
| 63 | +- Manual dispatch (`workflow_dispatch`) |
| 64 | +- Daily schedule at 21:00 UTC |
0 commit comments