Move base firmware bootstrap from notes to proper markdown document

This commit is contained in:
KemoNine 2020-07-31 23:32:08 +00:00
parent 4d8e9f8af4
commit a826a7ec60
3 changed files with 122 additions and 0 deletions

View file

@ -8,6 +8,16 @@ This is very much a Work In Progress project. Early prototype builds (see [notes
Additional tuning, documentation and integrations will be added to the repo over time.
# IMPORTANT CONSIDERATIONS
## SSL Support
The PiFrame project does **NOT** use SSL for anything unless it's a default setting for a given service. We have optimized the project to be managed via a trusted LAN and/or VPN solution (for multiple frames).
Use acme.sh + vhosts + nginx if you really want SSL. There is plenty of great information online how to set up acme.sh + nginx + vhosts + SSL if you want to go this route.
We will not discuss, entertain or bother debating our decision regarding SSL. It's an additional layer of complexity and not strictly required for the purposes of this project.
# Licensing
Unless otherwise stated all source code is licensed under the [Apache 2 License](LICENSE-APACHE-2.0.txt).

5
docs/README.md Normal file
View file

@ -0,0 +1,5 @@
# General Documentation
This folder contains a bunch of general information on how to get the base of a PiFrame deployed.
* [Base Firmware](base.md)

107
docs/base.md Normal file
View file

@ -0,0 +1,107 @@
# 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](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
# Prep / install arch linux on micro sd card
## Inspiration and Further Reading
- [https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4#installation](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4#installation)
- [https://github.com/phortx/Raspberry-Pi-Setup-Guide](https://github.com/phortx/Raspberry-Pi-Setup-Guide)
## 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.
``` 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.vat /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
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 fram 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
gpu_mem=512
dtoverlay=miniuart-bt
initramfs initramfs-linux.img followkernel
disable_overscan=1
#enable vc4
dtoverlay=vc4-fkms-v3d
max_framebuffers=1
EOF
nano -w /mnt/arch/boot/cmdline.txt
root=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
```
## 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.