Using an external toolchain reduce build time when starting with a cleaned-up source tree. Useful when using an automated build system like Hudson/Tinderbox.
Just do the same as everytime you (re)compile OpenWrt. Checkout openwrt repo, set your options in .config and build the whole thing. Only difference you have to select Package the OpenWrt-based Toolchain in the main view of make menuconfig
Alternatively you can download precompiled toolchain from openwrt download page by searching for the correct toolchain for your target. For example if you need precompiled toolchain for openwrt 22.03.0 for target ipq806x/generic this is the link to use.
./scripts/ext-toolchain.sh \
--toolchain TOOLCHAIN_FILE_LOCATION \
--config TARGET_NAME (example ipq806x/generic)
make menuconfig and run make to compile your image
If you want to update a .config to use an external toolchain you can use the --overwrite-config. For example:
./scripts/ext-toolchain.sh \
--toolchain TOOLCHAIN_FILE_LOCATION \
--overwrite-config
--config TARGET_NAME (example ipq806x/generic)