The ```PiFrame``` uses Arch Linux at its core. This document will outline a way to setup a micro sd card with Arch Linux.
# Please Note
We assume you're going to use the Raspberry Pi itself for setting up an Arch Linux environment. In order to do this properly and safely, you'll need 2 micro sd cards and a USB to micro sd card adapter.
# Setup an Ubuntu SD Card
The first step is to setup a basic Ubuntu boot environment for the Raspberry Pi, we will use this to boot strap (initialize) the Arch Linux micro sd card. This Ubuntu micro sd card can also be used to recover a broken Arch Linux system if necessary.
1. Download Ubuntu from their main [download site](https://ubuntu.com/download/raspberry-pi/thank-you?version=20.04&architecture=arm64+raspi) and flash it to the sd card. There are a lot of guides on how to do this online.
1. Boot the Ubuntu installation
1. Check the ip address with ```ip addr`` and ssh into the environment if desired. This step can be skipped if you have a keyboard/monitor setup.
1. Login to the Ubuntu envrionment
1. Open a terminal
1. Run ```sudo -sHu root``` to elevate your privileges
Run the following commands to prep the Arch Linux micro sd card. Please note the device nodes like ```/dev/sda``` may be different depending on the usb adapter used.
``` sh
parted /dev/sda
mklabel msdos
mkpart
p
[enter]
1
100M
mkpart
p
[enter]
100M
-1
set 1 boot on
set 1 lba on
q
mkfs.fat /dev/sda1
mkfs.btrfs /dev/sda2
```
## Arch Linux Bootstrap
Run the following commands to bootstrap (initialize) a fundamental Arch Linux installation.
``` sh
mkdir /mnt/arch
mount -o nodiratime,noatime,compress /dev/sda2 /mnt/arch
The following commands will tweak the base Arch Linux distro to facilitate the needs of a photo frame as well as tune some of the debugging that's present in the default setup.
``` sh
cat > /mnt/arch/boot/config.txt <<EOF
# KmN: Borrowed some stuff from majaro
# See /boot/overlays/README for all available options
That should do it for the bootstrapping process. You can now shutdown the Ubuntu environment via ```systemctl poweroff```, swap the micro sd cards and boot into the Arch Linux environment.
You should not need the Ubuntu micro sd card at this point unless you need to recover or fix a broken Arch Linux installation.