Notes:
- This method does not use premade filesystem images. It uses, more or less, the same method as the official ArchLinux Wiki.
- You MUST execute these procedures from a machine with an aarch64 Arch installation that can mount the SD card for the Raspberry Pi 5b filesystem (usually via a USB SD card reader).
- You must be root to execute these procedures. [code]su -[/code]
- You must have 'arch-install-scripts' and 'dosfstools' installed.
- This guide creates a f2fs filesystem for the root partition, thus you must also have 'f2fs-tools' installed as well. You can substitute ext4 (or maybe even btrfs, I haven't tested.).
- This guide uses the raspberry pi kernel 'linux-rpi' as opposed to the generic mainline kernel 'linux-aarch64'. I don't believe the mainline kernel has all the Raspberry Pi 5b enablement bits in it yet (though I could be wrong... I haven't tested it.)
Procedures:
1. Plug SD card into a machine running aarch64 Arch Linux Arm. (Usually via a USB SD card reader)
2. [code]fdisk /dev/sdx[/code] Where sdx is the SD card you will be writing to.
a. Type 'p' to verify this actually is the SD card you intend to write to! (We will be repartitioning/formatting this device, wiping everything from it.)
b. Type 'g' to create a new gpt partition table on the card.
c. Type 'n' to create a new partition.
d. Press 'Enter' to accept the partition number 1.
e. Type in the first sector the partition should start on. (I usually choose '65536' which represents 32MiB which is the largest sized write block I have heard an SD card use to date. Aligning to write blocks is supposed to be the most efficient way to partition a SD or eMMC.)
f. Type '+256M' for it to make the partition 256MiB in size.
g. Type 't' to set the partition type.
h. Type 'Enter' to accept the target partition 1.
i. Type '1' to set the partition type to 'EFI System'
j. Type 'n' to create a new partition
k. Type 'Enter' to accept the partition number 2.
l. Type 'Enter' to accept the default first sector the partition will start on.
m. Type 'Enter' to accept the default last sector.
n. Type 'w' to write the changes to the card.
3. Now we need to format our new partitions.
a. [code]mkfs.vfat -n BOOT -F32 /dev/sdx1[/code] To format the boot partition. Replace '/dev/sdx1' with the first partition of your SD card.
b. [code]mkfs.f2fs -l ROOT -O extra_attr,inode_checksum,sb_checksum,compression /dev/sdx2[/code] To format the root partition as f2fs. You may change the filesystem to any other filesystem type supported by the raspberry pi kernel. Replace '/dev/sdx2' with the second partition of your SD card.
c. [code]mkdir root[/code] To create the mount point for the new root partition we will be installing Arch to.
d. [code]mount -o compress_algorithm=zstd:1,compress_chksum,atgc,gc_merge,lazytime /dev/sdx2 root[/code] to mount the root partition.
e. [code]chattr -R +c root[/code] To enable compression on the root filesystem. (Note: F2FS will still allocate the uncompressed size for each file, so files won't appear smaller. This is purely for bandwidth savings and lowering write cycles.)
f. [code]mkdir root/boot[/code] To create the mount point for the boot partition.
g. [code]mount /dev/sdx1 root/boot[/code] To mount the boot partition.
4. Now the fun part, we get to install Arch to the root filesystem and the bootloader and kernel to the boot filesystem.
a. [code]pacstrap -K root base linux-rpi linux-firmware raspberrypi-bootloader firmware-raspberrypi archlinuxarm-keyring f2fs-tools dosfstools iwd openssh[/code] To install the necessary packages to boot Arch. 'iwd' is for WiFi, you may substitute this with your desired WiFi setup utility. I access my Raspberry Pi remotely, so I use 'openssh', you can omit it if you don't need ssh. Feel free to add any other packages you think you'll need.
b. [code]echo 'LABEL=BOOT /boot vfat defaults 0 0' >> root/etc/fstab[/code] To mount the boot partition on startup.
c. [code]echo 'LABEL=ROOT / f2fs defaults,compress_algorithm=zstd:1,compress_chksum,atgc,gc_merge,lazytime 0 0'[/code] To remount the root partition with the desired settings at bootup. You may also skip this and instead place the mount options in the kernel command line (root/boot/cmdline.text) as 'rootflags=<mount-options-go-here>'.
d. [code]arch-chroot root[/code] To chroot into the new installation.
5. I'm going to be lazy and just say follow the instructions from the official Arch Linux Wiki. Start at "3.3 Time", disregard "3.6 Initramfs" and stop after "3.7 Root Password":make_clickable_callback(MAGIC_URL_FULL, '
', 'https://wiki.archlinux.org/title/Installation_guide#Time', '', ' class="postlink"')
6. [code]exit[/code] To leave the chroot.
7. [code]sync && umount root/boot && umount root[/code] To unmount the SD card.
8. Plug the SD card into your shiny new Raspberry Pi 5. Plug in the HDMI, keyboard/mouse, and power. (If you dont want to plug in a monitor/keyboard/mouse, let me know if you want me to do a How-To to have the raspberry pi automatically connect to your WiFi so you can access it via SSH.)
9. Follow the instructions for setting up your user and the software environment from:make_clickable_callback(MAGIC_URL_FULL, '
', 'https://wiki.archlinux.org/title/General_recommendations', '', ' class="postlink"')