Difference between revisions of "Pinebook Pro Installing Arch Linux ARM"

From PINE64
Jump to navigation Jump to search
m
(change the boot partition size to 512M. 256M is not enough, in fact it fails to upgrade the linux package because fallback initramfs step runs out of space (and the MiB -> MB is because I'm pretty sure that 512M in fdisk uses the MEGA prefix and not the MEBI))
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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.
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 (example Tow-Boot on SPI).
(Should you have Tow-Boot installed on SPI, nvme boot is supported)


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


== Partitioning ==
== Partitioning ==
=== Flashing U-Boot ===
=== Flashing U-Boot ===
{{note|While any U-Boot for the Pinebook Pro can be used, this tutorial uses [https://tow-boot.org Tow-Boot].
{{note|While any build of U-Boot for the Pinebook Pro can be used, this tutorial uses [https://tow-boot.org Tow-Boot]. The process of installing Tow-Boot is different from any other U-Boot build, so large parts of the partitioning section will need to be changed if you want to use something else. If you already have Tow-Boot installed via SPI, you can skip this step. Use '''fdisk''' to create a blank GPT partition table. '''/boot''' will be partition 1, and '''/''' will be partition 2.}}
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.
Download and extract the latest release of Tow-Boot for the Pinebook Pro from https://github.com/Tow-Boot/Tow-Boot/releases.
  <nowiki>$ wget https://github.com/Tow-Boot/Tow-Boot/releases/download/release-2021.10-004/pine64-pinebookPro-2021.10-004.tar.xz</nowiki>
 
  $ 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
  $ tar xf pine64-pinebookPro-2021.10-004.tar.xz


Flash Tow-Boot to <tt>/dev/sdb</tt> (replace this with the device you actually intend to use).
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
  # dd if=pine64-pinebookPro-2021.10-004/shared.disk-image.img of=/dev/sdb bs=1M oflag=direct,sync


Line 20: Line 20:


=== Creating the partitions ===
=== Creating the partitions ===
Use <code>fdisk</code> to add partitions to <tt>/dev/sdb</tt>.
Use <code>fdisk</code> to add partitions to '''/dev/sdb'''.


  # fdisk /dev/sdb
  # fdisk /dev/sdb


Create the <tt>/boot</tt> partition.
Create the '''/boot''' partition.
 
* Type '''n''' to create a new partition.
* Type '''n''' to create a new partition.
* Press enter for partition number two.
* Press enter for partition number two.
* Press enter for the default start sector.
* Press enter for the default start sector.
* Type '''+256M''' to make the new partition 256 MiB.
* Type '''+512M''' to make the new partition 512 MB.
 
Mark the '''/boot''' partition bootable.


Mark the <tt>/boot</tt> partition bootable.
* Type '''x''' to enter expert mode.
* Type '''x''' to enter expert mode.
* Type '''A''' to mark a partition bootable.
* Type '''A''' to mark a partition bootable.
Line 37: Line 39:


Create the root partition.
Create the root partition.
* Type '''n''' to create a new partition.
* Type '''n''' to create a new partition.
* Press enter for partition number three.
* Press enter for partition number three.
Line 43: Line 46:


Write the changes to disk.
Write the changes to disk.
* Type '''w''' to write the changes and exit.
* Type '''w''' to write the changes and exit.


=== Formatting the partitions ===
=== Formatting the partitions ===
Format the <tt>/boot</tt> partition as either FAT32 or ext4.
Format the '''/boot''' partition as a filesystem supported by your U-Boot. ext4 is recommended:
 
FAT32:
# mkfs.fat -F32 /dev/sdb2
ext4:
  # mkfs.ext4 /dev/sdb2
  # mkfs.ext4 /dev/sdb2


Format the root partition as any filesystem supported by Arch Linux ARM. For this example ext4 is used:
Format the root partition as any filesystem supported by Arch Linux ARM. btrfs for example:
  # mkfs.ext4 /dev/sdb3
  # mkfs.btrfs /dev/sdb3


== Installing the root filesystem ==
== Installing the root filesystem ==
Line 82: Line 82:
==== Editing fstab ====
==== Editing fstab ====
Find the partitions' UUIDs with <code>blkid</code>.
Find the partitions' UUIDs with <code>blkid</code>.
  # blkid /dev/sdb2 /dev/sdb3
 
  # blkid /dev/sdb3 /dev/sdb2


Example output:
Example output:
/dev/sdb3: UUID="c1ec9712-5c64-46da-852c-9d665416e8a6" UUID_SUB="90e5b654-6967-471a-9d35-8997488b1ba8" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="885dd863-a550-2d47-89dd-f54fd6744ca5"
  /dev/sdb2: UUID="21bbff3f-b82e-416e-93c8-e6d44c3daf82" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="be571200-1a56-5d4c-9a5b-88a5f36a295e"
  /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 <tt>/mnt/etc/fstab</tt>, substituting the example UUIDs with those you received from <code>blkid</code>.
Add the following lines to '''/mnt/etc/fstab''', substituting the example UUIDs with those you received from <code>blkid</code>.
  UUID=d22c5207-0f87-4fe9-91ce-6d6e0fb9a13e /    ext4 defaults 0 1
 
  UUID=21bbff3f-b82e-416e-93c8-e6d44c3daf82 /boot ext4 defaults 0 2
  UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 /    btrfs defaults 0 1
  UUID=21bbff3f-b82e-416e-93c8-e6d44c3daf82 /boot ext4 defaults 0 2


==== Creating extlinux.conf ====
==== Creating extlinux.conf ====
Create a file <tt>/mnt/boot/extlinux/extlinux.conf</tt> with the following contents, replacing the example UUID with the one for <tt>/dev/sdb3</tt> from <code>blkid</code>.
 
Create a file '''/mnt/boot/extlinux/extlinux.conf''' with the following contents, replacing the example UUID with the one for '''/dev/sdb3''' from <code>blkid</code>.
  DEFAULT arch
  DEFAULT arch
  MENU TITLE Boot Menu
  MENU TITLE Boot Menu
Line 102: Line 106:
  MENU LABEL Arch Linux ARM
  MENU LABEL Arch Linux ARM
  LINUX /Image
  LINUX /Image
INITRD /initramfs-linux.img
FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
APPEND root=UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 rw
LABEL arch-fallback
MENU LABEL Arch Linux ARM with fallback initramfs
LINUX /Image
INITRD /initramfs-linux-fallback.img
  FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
  FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
  APPEND initrd=/initramfs-linux.img root=UUID=d22c5207-0f87-4fe9-91ce-6d6e0fb9a13e rw
  APPEND root=UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 rw


== Booting and finishing setup ==
== Booting and finishing setup ==
Boot into Arch Linux ARM and log in as <tt>root</tt> with password <tt>root</tt>.
Boot into Arch Linux ARM and log in as '''root''' with password '''root'''.


Initialize the pacman keyring.
Initialize the pacman keyring.
  # pacman-key --init
  # pacman-key --init
  # pacman-key --populate archlinuxarm
  # pacman-key --populate archlinuxarm


For security, change the default passwords for root and the default user <tt>alarm</tt>.
For security, change the default passwords for root and the default user '''alarm'''.
 
  # passwd
  # passwd
  # passwd alarm
  # passwd alarm
Line 118: Line 132:
Congratulations, you have now installed Arch Linux ARM on your PineBook Pro!
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
[[Category:Pinebook Pro]]

Latest revision as of 19:19, 25 October 2024

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 (example Tow-Boot on SPI).

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 build of 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 build, so large parts of the partitioning section will need to be changed if you want to use something else. If you already have Tow-Boot installed via SPI, you can skip this step. Use fdisk to create a blank GPT partition table. /boot will be partition 1, and / will be partition 2.

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 +512M to make the new partition 512 MB.

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 a filesystem supported by your U-Boot. ext4 is recommended:

# mkfs.ext4 /dev/sdb2

Format the root partition as any filesystem supported by Arch Linux ARM. btrfs for example:

# mkfs.btrfs /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/sdb3 /dev/sdb2

Example output:

/dev/sdb3: UUID="c1ec9712-5c64-46da-852c-9d665416e8a6" UUID_SUB="90e5b654-6967-471a-9d35-8997488b1ba8" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="885dd863-a550-2d47-89dd-f54fd6744ca5"
/dev/sdb2: UUID="21bbff3f-b82e-416e-93c8-e6d44c3daf82" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="be571200-1a56-5d4c-9a5b-88a5f36a295e"

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

UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 /     btrfs 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
INITRD /initramfs-linux.img
FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
APPEND root=UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 rw

LABEL arch-fallback
MENU LABEL Arch Linux ARM with fallback initramfs
LINUX /Image
INITRD /initramfs-linux-fallback.img
FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
APPEND root=UUID=c1ec9712-5c64-46da-852c-9d665416e8a6 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!