git clone https://github.com/espressif/esp-idf -b v5.1 --depth=1 --recursive
cd esp-idf
./install.sh
source export.sh
# You're in the root of your project
mkdir components
cd components
git clone https://github.com/espressif/arduino-esp32 -b esp-idf-v5.1-libs --depth=1 --recursive arduino
git clone https://github.com/espressif/esp-protocols --depth=1
# Arduino would complain missing `mdns`
ln -s esp-protocols/components/mdns .
cd ..
vim sdkconfig
# change CONFIG_FREERTOS_HZ to 1000
idf.py build