openwrt-imagebuilder
Skill1 starsChanged 50 days agoMITView on GitHub
OpenWrt ImageBuilder compilation specialist. Calculates exact SquashFS sizing for 16MB SPI flash, manages package manifests, profiles, and sysupgrade integrity.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ark-theme-uiSkill
- js-performance-optimizationSkill
- openwrt-hardware-offloadingSkill
- openwrt-luci-modernSkill
- openwrt-network-firewallSkill
- openwrt-sqm-bufferbloatSkill
- openwrt-storage-failsafeSkill
- openwrt-wifi-meshSkill
- posix-shellSkill
- security-auditorSkill
- systematic-debuggingSkill
- ark-theme-uiSkill
- js-performance-optimizationSkill
- openwrt-hardware-offloadingSkill
- openwrt-imagebuilderSkill
- openwrt-luci-modernSkill
- openwrt-network-firewallSkill
- openwrt-sqm-bufferbloatSkill
- openwrt-storage-failsafeSkill
- openwrt-wifi-meshSkill
- posix-shellSkill
- security-auditorSkill
- systematic-debuggingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 72
No roteador via SSH antes do flash real:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenWrt ImageBuilder & Firmware Engineering (ARK Router)
Objetivo
Orientar a geração, compilação e validação de imagens de firmware OpenWrt personalizadas utilizando o OpenWrt ImageBuilder (em ambiente WSL ou Linux), garantindo conformidade com o orçamento estrito de memória Flash (16 MB SPI Flash).
1. Geometria de Flash por Família de Placa
A geometria de partição varia drasticamente conforme o hardware alvo:
A. Roteadores com Flash SPI-NOR Restrita (16 MB — ex.: Cudy WR3000 v1, D-Link DGL-5500)
- Particionamento:
u-boot+env+factory: ~1 MBkernel: ~3 MB a 4 MBrootfs(SquashFS comprimido): deve ficar entre 8 MB e 10.5 MBrootfs_data(/overlaygravável): DEVE manter > 2.0 MB livres no primeiro boot.
- Tamanho Máximo do Binário Sysupgrade:
- O binário
*-sysupgrade.binNUNCA deve ultrapassar a partição de firmware do DTS (~14.5 MB; no Cudy WR3000 alvo seguro é ~12.5 MB a 13.0 MB).
- O binário
- Atenção a Revisões de Hardware:
- O Cudy WR3000 v1 padrão utiliza SPI-NOR padrão (
filogic / cudy_wr3000-v1). - Lotes ou variantes (ex: WR3000E/WR3000H) podem utilizar chips ou tamanhos de flash distintos; sempre consulte o DTS específico do target.
- O Cudy WR3000 v1 padrão utiliza SPI-NOR padrão (
B. Roteadores com Flash NAND ou eMMC (128 MB a 1 GB+ — ex.: Acer Predator W6x, Filogic 830/880)
- Particionamento:
kernel: 6 MB a 10 MB.rootfs: 30 MB a 60 MB+ em partição UBI/SquashFS.rootfs_data(/overlay): dezenas a centenas de megabytes livres.
- Limites: O binário sysupgrade pode ter 30 MB a 40 MB+ sem risco de esgotar o chip. Módulos opcionais pesados (ZeroTier, AdGuard Home em RAM, Python) podem ser integrados diretamente na imagem.
2. Operação do ImageBuilder (Linha de Comando)
Sintaxe Canônica
make image \
PROFILE="cudy_wr3000-v1" \
PACKAGES="luci luci-ssl \
kmod-mt7981-firmware mt7981-wo-firmware \
-dnsmasq dnsmasq-full \
adguardhome nlbwmon \
-ppp-mod-pppoe ppp-mod-pppoe" \
FILES="files" \
BIN_DIR="bin/targets/mediatek/filogic"Regras de Ouro para o Pacote de Imagem:
- Substituição Limpa de Pacotes:
- Para substituir um pacote padrão, use
-pacote-antigo +pacote-novo(ex:-dnsmasq dnsmasq-fullou-wpad-basic-mbedtls wpad-mbedtls).
- Para substituir um pacote padrão, use
- Inclusão de Configurações Nativas (
FILES="files"):- Arquivos colocados em
files/são incorporados diretamente na partição SquashFS (ROM somente leitura), consumindo zero bytes no/overlay! - Ideal para: temas pré-instalados (
files/www/...), scripts de inicialização (files/etc/uci-defaults/...) e configurações base de rede.
- Arquivos colocados em
- Zero-Waste no
/etc/sysupgrade.conf:- Nunca adicione caminhos em
/usrou/wwwno/etc/sysupgrade.conf. O sysupgrade deve preservar apenas configurações de/etc/configpara manter o/overlaylivre.
- Nunca adicione caminhos em
3. Validação de Integridade e Flashing
- Checagem de Hash SHA-256 Obrigatória:
- Sempre gere e confira a soma de verificação antes de qualquer upload via SCP:
sha256sum openwrt-*-sysupgrade.bin
- Sempre gere e confira a soma de verificação antes de qualquer upload via SCP:
- Teste de Compatibilidade do Sysupgrade (
-T):- No roteador via SSH antes do flash real:
sysupgrade -T /tmp/firmware.bin - O teste verifica a imagem e a configuração de backup sem gravar a flash. Ele não substitui a comparação do SHA-256 com uma fonte confiável, nem demonstra que o novo firmware fará boot ou manterá os serviços funcionando.
- No roteador via SSH antes do flash real:
- Flashing Seguro:
- Preservando configurações:
sysupgrade -v /tmp/firmware.bin - Limpeza de fábrica (Clean Flash):
sysupgrade -v -n /tmp/firmware.bin
- Preservando configurações:
4. Pacote, perfil e espaço livre
- Diferencie arquivos integrados em SquashFS de um
.apk/.ipkinstalado depois do boot; o segundo pode consumir/overlay. - Perfis Lite/Full devem usar limites de instalação calculados do tamanho descompactado, dependências e reserva para UCI. No ARK Router,
scripts/install.shcontém os limites atuais; não aplique esses números a outro pacote sem recalcular. - Um backup de instalação em
/tmpdesaparece no reboot. Copie-o para local persistente quando fizer parte do plano de retorno.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

