Step by step Procedure
Following the Arch Linux Raspberry Pi 3 Installation Guide, it is possible to abstract the steps necessary to do this on macOS without any virtualization. It is a matter of understanding what is going on and knowing macOS tools (which are just enough different than GNU tools be be a pain).
A quick look at which filesystems are necessary: mkfs.vfat
is just mkfs.fat
, which can be FAT12, FAT16, or FAT32.
diskutil listFilesystems
-------------------------------------------------------------------------------
PERSONALITY USER VISIBLE NAME
-------------------------------------------------------------------------------
Case-sensitive APFS APFS (Case-sensitive)
(or) APFSX
APFS APFS
(or) APFSI
ExFAT ExFAT
Free Space Freier Speicherplatz
(or) FREE
MS-DOS MS-DOS (FAT)
MS-DOS FAT12 MS-DOS (FAT12)
MS-DOS FAT16 MS-DOS (FAT16)
MS-DOS FAT32 MS-DOS (FAT32)
(or) FAT32
HFS+ Mac OS Extended
Case-sensitive HFS+ Mac OS Extended (Case-sensitive)
(or) HFSX
Case-sensitive Journaled HFS+ Mac OS Extended (Case-sensitive, Journaled)
(or) JHFSX
Journaled HFS+ Mac OS Extended (Journaled)
(or) JHFS+
ZFS ZFS Dataset
Indicates that MS-DOS FAT 32 is supported. But EXT 4 is not.
Install mkfs.ext4 brew install e2fsprogs
. This will not add support to the Disk Utility, but it allow you to make an EXT4 partition. You will also need to mount it to extract the Arch Linux tar to it, so also get yourself brew cask install osxfuse && brew install ext4fuse
.
Acquire the necessary Arch Linux ARM tar.gz here https://archlinuxarm.org/about/downloads
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz.md5
Find SD Card Device Node
diskutil list
...
(internal)
...
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: *64.1 GB disk2
Setup BOOT partition.
Apply FAT 32 Filesystem to my sd card like in step 3 of the guide. The diskutil
help does not make it obvious how to run something like mkfs.vfat
. diskutil partitionDisk -h
is somewhat useful. Unlike on Linux, you do not need to unmount your SD card, because diskutil partitionDisk
will do it automatically.
/dev/node PARTSCHEME FS LABEL SIZE (R=remainder, 100%)
diskutil partitionDisk /dev/disk2 MBR FAT32 BOOT 100M FAT32 ROOT R
(replace disk2 with the device node of your sd card)
macOS will automount the new partition at /Volumes/BOOT
, so skip the mount step.
Setup ROOT partition.
Caveat: I am using EXT 3 instead of EXT 4, the non-journaled variant, because the FUSE implementation does not support writing to journaled EXT yet, and I could not find the no_journal
option mentioned here: https://github.com/gerard/ext4fuse/wiki/Write-Support. As soon as it gets implemented, an EXT 4 write on MacOS will be possible.
$(brew --prefix e2fsprogs)/sbin/mkfs.ext3 /dev/disk2s2
$(brew --prefix ext4fuse)/bin/ext4fuse /dev/disk2s2 /Volumes/ROOT -o allow_other
Extract ArchLinuxARM-rpi-3-latest.tar.gz
directly to the mount point. MacOS is closely related to BSD, so tar
on macOS is bsdtar
.
tar -xpvf ArchLinuxARM-rpi-3-latest.tar.gz -C /Volumes/ROOT
Now we just expanded everything to root, but the boot stuff needs to be on the BOOT partition. Move it over. You could use mv
or be safer with rsync
mv /Volumes/ROOT/boot/* /Volumes/BOOT/
Flush out the kernel buffers to disk.
sync
Unmount and you are good to go. (which probably flushes out the buffers anyway)
# unmountDisk unmounts both ROOT and BOOT
diskutil unmountDisk /Volumes/ROOT