Linux
Virtualized compilation of the Raspberry Pi Linux Kernel on macOS through Ubuntu using OrbStack.
insert prose here
Compiling Linux Kernel
- Install OrbStack
brew install --cask orbstack
-
Create a case-sensitive APFS filesystem volume to store the Linux source code
- Open Disk Utility
- Choose root disk (APPLE SSD .... Media)
- Click "partition" on top right
- Create a reasonably sized APFS case-sensitive partition (around 20 GB)
- Allow system to repartition (may take a few minutes)
-
Open OrbStack and create a new Ubuntu instance under "Linux > Machines"
-
orb
to start the hypervisor. Stay in the Ubuntu environment for next steps. -
Clone Linux source code to the new case-sensitive partition
sudo apt install -y git bc bison flex libssl-dev make libc6-dev libncurses5-dev crossbuild-essential-armhf crossbuild-essential-arm64
cd /Volumes/<PARTITION NAME>
git clone https://github.com/murexrobotics/mrxOS
- Make config files
cd mrxOS
KERNEL=kernel8
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
- Make modifications to the kernel (if modifications are needed)
make menuconfig
- Compile the kernel
make -j<NUMBER_OF_THREADS> ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
# Example for M3 Max:
make -j14 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
unsure, but the number of threads can be found with the htop
command and seeing how many "bars" appear at the top
Depending on system performance, the build process should take 15 minutes to an hour.
note: actual flashing onto an RPi has not been tested
Next steps & external references
- https://www.jeffgeerling.com/blog/2020/cross-compiling-raspberry-pi-os-linux-kernel-on-macos (opens in a new tab)
- https://www.raspberrypi.com/documentation/computers/linux_kernel.html (opens in a new tab)
arm64 Virtualized Linux (macOS Apple Silicon)
- Install UTM
brew install --cask UTM
-
Download the latest Linux arm64 Desktop Image (opens in a new tab)
-
Open UTM and follow these instructions (opens in a new tab)
- Pay special attention to this (opens in a new tab)
-
Best settings;
- Display Card:
virtio-ramfb-gl (GPU Supported)
- Network:
Shared Network + Intel Gigabit e100
- Display Card: