Skip to content

Instantly share code, notes, and snippets.

@peternguyen93
Last active May 8, 2023 20:14
Show Gist options
  • Save peternguyen93/b613facf5b2bdbce7200c022fda65909 to your computer and use it in GitHub Desktop.
Save peternguyen93/b613facf5b2bdbce7200c022fda65909 to your computer and use it in GitHub Desktop.
Install ArchLinux ARM64 UEFI boot on Apple Silicon Virtualization.framework

Install ArchLinux UEFI on M1 Virtualization.framework

1. Preparation

  • ISO gentoo aarch64 installation
  • tart a command line to create and run Virtual Machine in command line.

2. Setup

  • Create virtual machine with tart and boot into Gentoo Linux
tart create —linux archlinux
tart run --disk ./install-arm64-minimal-20221218T221711Z.iso archlinux
  • SSH into Gentoo
passwd root # change root password
/etc/init.d/sshd start # start ssh
ssh root@<ip> # ssh to gentoo environment
  • Partition disk
fdisk /dev/vda

Command (m for help): g
Created a new GPT disklabel (GUID: 56905986-F7A8-4848-8F81-CBE765CE8154).

Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-97656216, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-97656216, default 97656216): +512M

Created a new partition 1 of type 'Linux filesystem' and of size 512 MiB.

Command (m for help): t
Selected partition 1
Partition type or alias (type L to list all): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.

Command (m for help): n
Partition number (2-128, default 2):
First sector (1050624-97656216, default 1050624):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-97656216, default 97656216):

Created a new partition 2 of type 'Linux filesystem' and of size 46.1 GiB.

Command (m for help): w

# format disk
mkfs.vfat -F 32 /dev/vda1
mkfs.ext4 /dev/vda2
  • Install Archlinux AArch64 base system.
mount /dev/vda2 /mnt/gentoo
cd /mnt/gentoo/
wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
tar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C ./
mv boot ./boot_tmp
mkdir ./boot
mount /dev/vda1 ./boot
cp -r ./boot_tmp/* ./boot/
  • Chrooting
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
mount --bind /run /mnt/gentoo/run
mount --make-slave /mnt/gentoo/run
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"
  • Install UEFI boot
pacman-key --init
pacman-key --populate archlinuxarm
mkdir --parent /run/systemd/resolve/
echo 'nameserver 8.8.8.8' > /run/systemd/resolve/resolv.conf
pacman -Syu
pacman -S efibootmgr grub
grub-install --target=arm64-efi --efi-directory=/boot --bootloader-id=ArchLinux
# Edit /etc/default/grub and add “console==ttyAMA0” to /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
  • Update /etc/fstab Adding these lines to fstab to automatically mount /boot when system is booting
/dev/vda1      	/boot     	vfat      	defaults,rw	0 2
/dev/vda2	/         	ext4      	rw,relatime	0 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment