Just copy from openwrt official site.
I used to use port but brew looks better now.
First, install brew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It is broken when I install it, need to set privilege for some folders, you can call “brew doctor” to get instruction then fix it or search google 🙂
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz gnu-time
note: in my macbook, I find getopt do not support –long. Looks like default it will find the getopt from MacOS (/usr/bin) but not the one from brew.
add this line to your ~/.profile, so system will search and use gnu-getopt first.(this path will be different if version of getopt changed)
export PATH="/usr/local/Cellar/gnu-getopt/1.1.6/bin:$PATH"
Then make a virtual disk by disk-utils, must be case sensitive disk, size around 20GB.
Clone openwrt latest version from github to the new disk.
git clone https://github.com/openwrt/openwrt.git
Then make menuconfig, everything will work.
If you want install mt7628.ko into the firmware, follow the tutorial at https://github.com/vonger/vocore2