Pinebook Pro Installing Arch Linux ARM

From PINE64
Revision as of 21:40, 18 September 2022 by WoC (talk | contribs)
Jump to navigation Jump to search

These instructions can be followed to install Arch Linux ARM on an SD Card, USB Flash Drive, eMMC, or even NVMe if your U-Boot supports it.

Commands to be run as a normal user are prefixed with $, commands to be run as root (or with sudo) are prefixed with #. The target device is assumed to be /dev/sdb, adjust accordingly.

Partitioning

Flashing U-Boot

While any U-Boot for the Pinebook Pro can be used, this tutorial uses Tow-Boot. The process of installing Tow-Boot is different from any other U-Boot, so large parts of the partitioning section will need to be changed if you want to use something else.

Download and extract the latest release of Tow-Boot for the Pinebook Pro from https://github.com/Tow-Boot/Tow-Boot/releases.

$ wget https://github.com/Tow-Boot/Tow-Boot/releases/download/release-2021.10-004/pine64-pinebookPro-2021.10-004.tar.xz
$ tar xf pine64-pinebookPro-2021.10-004.tar.xz

Flash Tow-Boot to /dev/sdb (replace this with the device you actually intend to use).

# dd if=pine64-pinebookPro-2021.10-004/shared.disk-image.img of=/dev/sdb bs=1M oflag=direct,sync

This creates the partition table for the device, with the first partition serving to protect Tow-Boot. Do not move or write to this partition.

Creating the partitions

Use fdisk to add partitions to /dev/sdb.

# fdisk /dev/sdb

Create the /boot partition.

  • Type n to create a new partition.
  • Press enter for partition number two.
  • Press enter for the default start sector.
  • Type +256M to make the new partition 256 MiB.

Mark the /boot partition bootable.

  • Type x to enter expert mode.
  • Type A to mark a partition bootable.
  • Type 2 to select partition two.
  • Type r to exit expert mode.

Create the root partition.

  • Type n to create a new partition.
  • Press enter for partition number three.
  • Press enter for the default start sector.
  • Press enter to fill the rest of the device.

Write the changes to disk.

  • Type w to write the changes and exit.

Formatting the partitions

Format the /boot partition as either FAT32 or ext4.

FAT32:

# mkfs.fat -F32 /dev/sdb2

ext4:

# mkfs.ext4 /dev/sdb2

Format the root partition as any filesystem supported by Arch Linux ARM. For this example ext4 is used:

# mkfs.ext4 /dev/sdb3

Installing the root filesystem

Mounting the partitions

# mount /dev/sdb3 /mnt
# mkdir /mnt/boot
# mount /dev/sdb2 /mnt/boot

Downloading and verifying the rootfs tarball

Download the tarball and its PGP signature.

$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz{,.sig}

Import the Arch Linux ARM signing key.

$ gpg --keyserver keyserver.ubuntu.com --recv-keys 68B3537F39A313B3E574D06777193F152BDBE6A6

Verify the tarball's authenticity.

$ gpg --verify ArchLinuxARM-aarch64-latest.tar.gz.sig

Verifying the authenticity of the tarball protects you in two ways:

  1. Makes sure the tarball came directly from Arch Linux ARM and was not tampered with
  2. Prevents you from using a corrupt tarball (for example from an interrupted download)

Extracting and configuring the root filesystem

Extracting the root filesystem

# bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt

Editing fstab

Find the partitions' UUIDs with blkid.

# blkid /dev/sdb2 /dev/sdb3

Example output:

/dev/sdb2: UUID="21bbff3f-b82e-416e-93c8-e6d44c3daf82" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="be571200-1a56-5d4c-9a5b-88a5f36a295e"
/dev/sdb3: UUID="d22c5207-0f87-4fe9-91ce-6d6e0fb9a13e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="1d3603f4-bcd4-3c41-8d6d-23e65b405e5a"

Add the following lines to /mnt/etc/fstab, substituting the example UUIDs with those you received from blkid.

UUID=d22c5207-0f87-4fe9-91ce-6d6e0fb9a13e /     ext4 defaults 0 1
UUID=21bbff3f-b82e-416e-93c8-e6d44c3daf82 /boot ext4 defaults 0 2

Creating extlinux.conf

Create a file /mnt/boot/extlinux/extlinux.conf with the following contents, replacing the example UUID with the one for /dev/sdb3 from blkid.

default arch
menu title Boot Menu
prompt 0
timeout 50

label arch
menu label Arch Linux ARM
linux /Image
fdt /dtbs/rockchip/rk3399-pinebook-pro.dtb
append initrd=/initramfs-linux.img root=UUID=d22c5207-0f87-4fe9-91ce-6d6e0fb9a13e rw

Booting and finishing setup

Boot into Arch Linux ARM and log in as root with password root.

Initialize the pacman keyring.

# pacman-key --init
# pacman-key --populate archlinuxarm

For security, change the default passwords for root and the default user alarm.

# passwd
# passwd alarm

Congratulations, you have now installed Arch Linux ARM on your Pinebook Pro!

Note that: Should you have tow-boot installed on the spi, you can simply skip the tow-boot step and partition #1 would be your /boot and #2 / (rootfs) Also note that the pacman-key will take a very long time, make sure to use the command sync to ensure it is ready for you to reboot, before you reboot