piframe/docs/base.md

3.5 KiB

Base Firmware Setup

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 and flash it to the sd card. There are a lot of guides on how to do this online.
  2. Boot the Ubuntu installation
  3. 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.
  4. Login to the Ubuntu envrionment
  5. Open a terminal
  6. Run sudo -sHu root to elevate your privileges

Prep / install arch linux on micro sd card

Inspiration and Further Reading

Arch Linux Disk Setup

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.


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.


mkdir /mnt/arch
mount -o nodiratime,noatime,compress /dev/sda2 /mnt/arch
mkdir /mnt/arch/boot
mount /dev/sda1 /mnt/arch/boot
cd /mnt/arch
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz
tar -xpf ArchLinuxARM-rpi-4-latest.tar.gz
rm ArchLinuxARM-rpi-4-latest.tar.gz

Tweak Bootstrapped System

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.


cat > /mnt/arch/boot/config.txt <<EOF
# KmN: Borrowed some stuff from majaro
# See /boot/overlays/README for all available options

gpu_mem=512
dtoverlay=miniuart-bt
initramfs initramfs-linux.img followkernel
disable_overscan=1

#enable vc4
dtoverlay=vc4-fkms-v3d
max_framebuffers=1

# you may need to add hdmi settings specific to your lcd display panel
# for example, the below settings are for a 2560x1600 50Hz panel
hdmi_cvt=2560 1600 50 5 0 0 1
hdmi_group=2
hdmi_mode=88
EOF

nano -w /mnt/arch/boot/cmdline.txt
    root=/dev/mmcblk0p2 rootflags=nodiratime,noatime,compress rw rootwait
    remove kgdboc=ttyAMA0,115200 
    

parted /dev/sda
set 1 boot on
set 1 lba on
set 2 lba on
q

Boot Arch Linux

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.