How to use the SDK for toolchains only in my openwrt git clone

I have a git clone of openwrt I use to build my own image. I saw this forum post that shows the SDK can be used as a toolchain and got to thinking how I can use the SDK inside my openwrt git clone so I don't have to always rebuild my toolchain.

I thought that each time I go to build my git repo, I would first download the daily sdk tar and make a new dir that is a mix of my git repo and the sdk but that did not work.

I tried to delete the toolchain I always seem to be rebuilding and copy the tar file into my openwrt repo but my builds always error out. What am I doing wrong?

# first copy my gitrepo
cp -a ~/git/openwrt ~/builds/openwrt

# delete outdated toolchain
rm -rf ~/builds/openwrt/build_dir
rm -rf ~/builds/openwrt/staging_dir

# put the fresh toolchain in the dir
cd ~

tar Jxf openwrt-sdk-ipq806x-generic_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz
rsync -a ~/openwrt-sdk-ipq806x-generic_gcc-8.4.0_musl_eabi.Linux-x86_64/ ~/build/openwrt

# use my config and build
cp ~/config/my.config ~/build/openwrt/.config
cd ~/build/openwrt
./scripts/feeds update -a && ./scripts/feeds install -a

make clean
make defconfig
make -j5
1 Like