Wondering if anyone out there has tried building the Morse Micro OpenWRT image on MacOS? Is there a specific Docker image I should use to build this?
Well, if you’re really crazy, you can build it natively:
https://openwrt.org/docs/guide-developer/toolchain/buildroot.exigence.macosx
But yes, simplest will be to just use the current debian image (e.g. debian:stable or debian:bookworm) and then follow the instructions in the README. Since this is not really OSX, just a docker image running in a Linux VM, it should work just as well as on Linux.
To actually answer your question: I haven’t tried it.
Thanks James, definitely not crazy enough to try and built it natively!
I’ll give this a go and will let you know how I go.
Below are the steps I took to build the MM OpenWRT image on my Mac - putting it here for future reference in case anyone else wants to do the same.
After installing Docker on MacOS, I ran the following inside a Terminal window:
docker pull debian:stable
docker run -it debian:stable /bin/bash
Then I ran the following commands inside the Docker Terminal to clone the MM OpenWRT repo:
cd ~
apt-get update
apt-get install git# Looks like ssl verification has to be disabled on Mac docker images
git config --global http.sslVerify false
git clone git@github.com:MorseMicro/openwrt.gitcd openwrt
git branch # to confirm I’m on mm/v23.05.3
Then followed the instructions inside README.md:
# Note that it didn’t find gcc-multilib, so I took that out; I had to add wget and file
apt-get install build-essential clang flex g++ gawk git gettext libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev swig wget file# Building the image for MM6108-EKH-01
# Piping output to build.log as I was getting some errors…
./scripts/morse_setup.sh -i -b ekh01 2>&1 | tee build.log
make -j 1 V=s 2>&1 | tee build.log
The build has been running for a few hours now, looking promising
@michael You’ve neatly evaded two of the issues I’ve been working through.
- gcc-multilib
This is not available on aarch64, but since you’re targeting the EKH01, you aren’t cross-compiling, so that’s not a problem. - Case-sensitivity
OpenWRT has to be built on a case sensitive filesystem. You don’t have any mounts, so the underlying case-insensitive APFS isn’t exposed to the container.
I have been experimenting with the OpenWRT sdk docker container (which is amd64) and mounting an APFSX volume. It was off to a good start, but it’s crashy and needs lots of RAM.
If you want to have source code for Linux based OS (required for Linux kernel itself), I would highly recommend creating a separate volume on your Mac that is case sensitive. Apple volumes are very intelligent and unlike traditional partitions in Linux/Windows don’t use space by default.
I would also mount that volume into the Docker container or use a Docker named volume to store the source code and build in there. This has the advantage that if you need to change the container in some way you likely wouldn’t need a full rebuild of OpenWRT.
That’s the approach I’ve been taking, but the container linux kernel keeps crashing. Are you building in an aarch64 or amd64 container? This machine only has 8GB of RAM, which probably doesn’t help.
chiming in here as well.
I initially started with writing a nix flake for building openwrt for morse micro, but that became quite a headache after a day because the openwrt build scripts are so “impure” in nix terms.
then I attempted wrapping it in a docker file and running it in an x86_64 docker image with Mac os’ emulation for x86, but this made the builds terribly slow (~2-3 hours until failure), the reasons for which is not super clear to me still.
but this seems to be the relevant failure:
2025-04-04 23:20:21 /bin/bash: line 13: 46123 Illegal instruction
next I switched to using an arm64 ubuntu image, which to be honest, I’m not sure how I was able to get as far as I did, because as @Zandr mentioned there’s no gcc-multilib
now I’m getting an error about fakeroot dying.
2025-04-05 02:04:48 libfakeroot: read: Connection reset by peer
2025-04-05 02:04:48 /openwrt/staging_dir/host/bin/fakeroot: line 1: kill: (32887) - No such process
2025-04-05 02:04:48 make[3]: *** [Makefile:66: /openwrt/bin/targets/ramips/mt76x8/packages/kmod-trelay_5.15.167-2_mipsel_24kc.ipk] Error 1
2025-04-05 02:04:48 make[3]: Leaving directory '/openwrt/package/kernel/trelay'
which seems similar enough as this bug mentioned here: Openwrt 22.03 kernel module kmod-mac80211 build fails · Issue #9860 · openwrt/openwrt · GitHub
Either way, would appreciate some suggestions as for what the most convenient way to build this on a Mac is? or even what some good version tags of mm openwrt I can try in case I’m running into upstream bugs.
I’ve run into this illegal instruction error before when using x86_64/amd64 docker containers on the Apple M series chips. This was caused by having the Rosetta option enabled in Docker. You can try turning off Rosetta when using the Apple Virtualization framework in the settings for Docker Desktop if using that.
I have found that the VirtioFS can give noticeable speed-ups if using bind mounts, but is prone to crashing. gRPC Fuse is more reliable, but slower.