Build OpenWrt for Xiaomi AX3600

Update March 26th, 2022 - Strong recommendation to use Robimarko's prebuild images instead of rolling your own.

Build Infrastructure - CXP11 - Ubuntu 20.04 - https://www.hetzner.com/cloud

Prepare the vanilla Ubuntu 20.04 as root:

apt-get update
apt-get upgrade -v
apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools python3-dev rsync subversion swig time xsltproc zlib1g-dev

Create and become build user:

useradd -m build
su - build
bash

Prepare building the image, in menuconfig go into LuCI and select your desired deployment:

git clone https://github.com/robimarko/openwrt.git
cd openwrt
ls
git pull
git branch -a
git tag
git checkout ipq807x-5.15
./scripts/feeds update -a
./scripts/feeds install -a
echo 'CONFIG_TARGET_ipq807x=y' > .config
echo 'CONFIG_TARGET_ipq807x_generic=y' >> .config
echo 'CONFIG_TARGET_ipq807x_generic_DEVICE_xiaomi_ax3600=y' >> .config
echo 'CONFIG_HAS_SUBTARGETS=y' >> .config
echo 'CONFIG_TARGET_BOARD="ipq807x"' >> .config
echo 'CONFIG_TARGET_SUBTARGET="generic"' >> .config
echo 'CONFIG_TARGET_PROFILE="DEVICE_xiaomi_ax3600"' >> .config
echo 'CONFIG_TARGET_ARCH_PACKAGES="aarch64_cortex-a53"' >> .config
echo 'CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -mcpu=cortex-a53"' >> .config
echo 'CONFIG_TARGET_ROOTFS_INITRAMFS=y' >> .config
echo 'CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD=y' >> .config
echo 'CONFIG_TARGET_ROOTFS_SQUASHFS=y' >> .config
echo 'CONFIG_TARGET_SQUASHFS_BLOCK_SIZE=256' >> .config
echo 'CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP=y' >> .config
echo 'CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mcpu=cortex-a53"' >> .config
echo 'CONFIG_TARGET_SUFFIX="musl"' >> .config
echo "CONFIG_PACKAGE_nss-firmware-ipq8074=y" >> .config
echo "CONFIG_PACKAGE_kmod-qca-nss-dp=y" >> .config
make menuconfig

Below is the build command I ran because I had some challenges earlier, probably works perfectly as make -j $(nproc) defconfig download clean world

make kernel_menuconfig
make -j1 V=sc defconfig download clean world 
#assign 4 rx interrupts to each cores
echo 8 > /proc/irq/50/smp_affinity
echo 4 > /proc/irq/51/smp_affinity
echo 2 > /proc/irq/52/smp_affinity
echo 1 > /proc/irq/53/smp_affinity

#assign 3 tcl completions to 3 CPUs
echo 4 > /proc/irq/73/smp_affinity
echo 2 > /proc/irq/74/smp_affinity
echo 1 > /proc/irq/75/smp_affinity

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

build log 20220122