scripts/ directory contains shell scripts, Perl scripts, and Python scripts used by the OpenWrt build system for package management, image generation, source downloading, and development utilities.
Feed Management
scripts/feeds
The primary tool for managing OpenWrt package feeds (external package repositories).feeds.conf (or feeds.conf.default if feeds.conf doesn’t exist):
Configuration Utilities
scripts/diffconfig.sh
Generates a minimal diff of the current.config against the default configuration. The output contains only the options that differ from defaults and can be used to reproduce the configuration on a clean tree.
.config changes frequently with new packages.
scripts/getver.sh
Outputs the current OpenWrt version string derived from git tags.Code Quality
scripts/checkpatch.pl
A port of the Linux kernel’scheckpatch.pl script. Checks patch files or source files for coding style issues.
Image Generation
scripts/json_overview_image_info.py
Generates theprofiles.json file from device metadata. Called automatically by the image build step.
scripts/json_add_image_info.py
Adds individual image entries toprofiles.json as images are built. Called per-device during make target/install.
scripts/gen_image_generic.sh
Generic image generation helper script used by target image Makefiles. Handles common image assembly steps.scripts/ubinize-image.sh
Creates UBI (Unsorted Block Images) from rootfs and kernel for NAND flash targets.Package and Source Management
scripts/download.pl
The package source downloader. Downloads source archives and verifies their integrity against expected hashes.scripts/metadata.pm
Perl library providing functions to parse and manipulate OpenWrt package metadata. Used byscripts/feeds and other tools.
scripts/ipkg-build
Builds.ipk package archives from a staged install directory.
BuildPackage infrastructure; not typically invoked directly.
scripts/ipkg-make-index.sh
Generates aPackages index file from a directory of .ipk files, used when creating a package repository.
Kernel Utilities
scripts/patch-kernel.sh
Applies a series of patches to the Linux kernel source. Called automatically during the kernel prepare step.scripts/kconfig.pl
Merges multiple Kconfig fragment files into a single configuration. Used to combine generic and target-specific kernel configs.scripts/kernel_bump.sh
Helper script for updating the kernel version in a target Makefile and managing kernel patches across version bumps.Toolchain
scripts/ext-toolchain.sh
Configures OpenWrt to use an external (pre-built) cross-toolchain instead of building its own.scripts/check-toolchain-clean.sh
Verifies that the toolchain was built in a clean environment without host library contamination.Testing
scripts/qemustart
Launches a QEMU virtual machine to test OpenWrt x86 or ARM images without physical hardware.scripts/remote-gdb
Helper script for attaching GDB to a remote OpenWrt process over the network for debugging.Miscellaneous
scripts/get_source_date_epoch.sh
Returns theSOURCE_DATE_EPOCH (UNIX timestamp) for reproducible builds, derived from the most recent git commit timestamp.