I have taken your fixes and updated my script.
This script downloads all of the source and applies the necessary
fixed to build the latest binary. This is currently: Firmware 2.1.9 (7)
If this script is run in a new subdirectory it creates it’s own environment
to build the binary. This allows you to have multiple build trees with
their own build root.
I have attached my script. I use Ubuntu 20.04 for development.