Build Guide
# Download and update the sources git clone https://git.openwrt.org/openwrt/openwrt.git cd openwrt git pull # Select a specific code revision git branch -a git tag git checkout v22.03.0 # Update the feeds ./scripts/feeds update -a ./scripts/feeds install -a # Optionally pull in a buildinfo for your build. Here is the buildbot config for v22.03.0 wget https://downloads.openwrt.org/releases/22.03.0/targets/ramips/mt7621/config.buildinfo -O .config # Configure the firmware image, which may be based on the buildinfo make menuconfig # And optionally the kernel (note that changing the kernel in such a way that a different one is produced will change the vermagic, which will make it incompatible with official opkg kmods) make -j $(nproc) kernel_menuconfig # Build the firmware image make -j $(nproc) defconfig download clean world
Buildinfo and .config
When choosing what buildinfo you wish to use, you must consider what you want to end up with at the output. Merely taking the buildinfo file for a version and notr making any changes might be desirable if you wish to go through the logn build procedure of the OpenWRT official buildbot, but usually is not. Often, you'll want to make adjustments or even merge multiple buildinfo files together to achieve the desired result.
An example of a common scenario in which you may wish to merge multiple buildinfo files together is when building a fresh snapshot image based on the master branch of the OpenWRT GIT. Your final .config file will vary heavily based on what your desired result from the build is and what you wish to use the build for. Here is an example .config which was based on both a snapshot buildinfo and a v22.03.0 buildinfo specifically for the ramips MT7621 platform of devices:
CONFIG_TARGET_ramips=y CONFIG_TARGET_ramips_mt7621=y CONFIG_TARGET_MULTI_PROFILE=y CONFIG_ALL_KMODS=y CONFIG_ALL_NONSHARED=y CONFIG_DEVEL=y CONFIG_TARGET_PER_DEVICE_ROOTFS=y CONFIG_BPF_TOOLCHAIN_BUILD_LLVM=y # CONFIG_BPF_TOOLCHAIN_NONE is not set CONFIG_COLLECT_KERNEL_DEBUG=y CONFIG_HAS_BPF_TOOLCHAIN=y CONFIG_KERNEL_BUILD_DOMAIN="buildhost" CONFIG_KERNEL_BUILD_USER="builder" CONFIG_MAKE_TOOLCHAIN=y CONFIG_REPRODUCIBLE_DEBUG_INFO=y CONFIG_USE_LLVM_BUILD=y CONFIG_PACKAGE_cgi-io=y CONFIG_PACKAGE_libbpf=m CONFIG_PACKAGE_libelf=m CONFIG_PACKAGE_libiwinfo-lua=y CONFIG_PACKAGE_liblua=y CONFIG_PACKAGE_liblucihttp=y CONFIG_PACKAGE_liblucihttp-lua=y CONFIG_PACKAGE_libubus-lua=y CONFIG_PACKAGE_lua=y CONFIG_PACKAGE_luci=y CONFIG_PACKAGE_luci-app-firewall=y CONFIG_PACKAGE_luci-app-opkg=y CONFIG_PACKAGE_luci-base=y CONFIG_PACKAGE_luci-lib-base=y CONFIG_PACKAGE_luci-lib-ip=y CONFIG_PACKAGE_luci-lib-jsonc=y CONFIG_PACKAGE_luci-lib-nixio=y CONFIG_PACKAGE_luci-mod-admin-full=y CONFIG_PACKAGE_luci-mod-network=y CONFIG_PACKAGE_luci-mod-status=y CONFIG_PACKAGE_luci-mod-system=y CONFIG_PACKAGE_luci-proto-ipv6=y CONFIG_PACKAGE_luci-proto-ppp=y CONFIG_PACKAGE_luci-ssl=y CONFIG_PACKAGE_luci-theme-bootstrap=y CONFIG_PACKAGE_px5g-wolfssl=y CONFIG_PACKAGE_qosify=m CONFIG_PACKAGE_rpcd=y CONFIG_PACKAGE_rpcd-mod-file=y CONFIG_PACKAGE_rpcd-mod-iwinfo=y CONFIG_PACKAGE_rpcd-mod-luci=y CONFIG_PACKAGE_rpcd-mod-rrdns=y CONFIG_PACKAGE_tc-full=m CONFIG_PACKAGE_tc-mod-iptables=m CONFIG_PACKAGE_uhttpd=y CONFIG_PACKAGE_uhttpd-mod-ubus=y CONFIG_PACKAGE_zlib=m
- The file was initially based on the snapshot buildinfo, will all of the
CONFIG_TARGET_DEVICE_ramips_mt7621_*
,CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt7621_*
andCONFIG_PACKAGE_*
lines completely removed. - All lines starting with
CONFIG_IB
,CONFIG_SDK
,CONFIG_AUTOREMOVE
andCONFIG_BUILDBOT
were also removed - All
CONFIG_PACKAGE_*
lines from the v22.03.0 buildinfo were then inserted so that the packageset from that release is included by default in output build images