Difference between revisions of "Quartz64 Installing Arch Linux ARM"

From PINE64
Jump to navigation Jump to search
(work in progress installation instructions for Arch Linux ARM on Quartz64)
 
Tag: Manual revert
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{note|This page is a work in progress. It's not a tutorial you can follow yet. Wait for the 5.16 kernel release.}}
Commands to be run as a normal user are prefixed with <code>$</code>, commands to be run as root are prefixed with <code>#</code>. We assume your target device is <tt>/dev/sdX</tt>, adjust accordingly.


Commands to be run as a normal user are prefixed with <code>$</code>, commands to be run as root are prefixed with <code>#</code>. We assume your target device is <tt>/dev/sdb</tt>, adjust accordingly.
== Partitioning The Block Device ==
 
Here we assume your block device is <tt>/dev/sdX</tt>, adjust as needed.
 
Create a new partition table:
 
# parted -s /dev/sdX mklabel gpt
 
Create the partitions for loader and u-boot:
# parted -s /dev/sdX mkpart loader 64s 8MiB
# parted -s /dev/sdX mkpart uboot 8MiB 16MiB
 
Create the partition for u-boot's environment:
 
# parted -s /dev/sdX mkpart env 16MiB 32MiB
 
Create the "efi" boot partition and mark it as bootable:
 
# parted -s /dev/sdX mkpart efi fat32 32MiB 544MiB
# parted -s /dev/sdX set 4 boot on
 
Create the root partition:


== Partitioning The Block Device ==
# parted -s /dev/sdX mkpart root ext4 544MiB 100%
 
=== Creating The File Systems ===
 
Now create the file systems for boot and root:


'''TODO'''
# mkfs.vfat -n "efi" /dev/sdX4
# mkfs.ext4 -L "rootfs" /dev/sdX5


== Fetching and Flashing U-Boot ==
== Fetching and Flashing U-Boot ==


'''TODO'''
For this we'll use the precompiled idblock and u-boot from pgwipeout's CI.
 
Go to https://gitlab.com/pgwipeout/quartz64_ci/-/pipelines and click the three dots, download the merge-job artifacts.
 
Unzip them:
 
$ unzip artifacts.zip
 
Flash idblock.bin and uboot.img:
 
# dd if=artifacts/idblock.bin of=/dev/sdX1
# dd if=artifacts/uboot.img of=/dev/sdX2


== Fetching The Root File System Tarball ==
== Fetching The Root File System Tarball ==


Fetch the root filesystem tarball over HTTPS from the de3 mirror, the autoselect mirror is broken and will sometimes feed you mirrors with broken HTTPS, and you can't get the GPG keys to verify the tarball anywhere.
Fetch the root filesystem tarball and the PGP signature
 
<nowiki>$ wget -N http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz{,.sig}</nowiki>


$ wget https://de3.mirror.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz{,.md5}
Fetch the gpg keys:


Verify that the file survived the transfer (i.e. the connection didn't get interrupted prematurely). This provides no security against maliciously modified tarballs, just aborted transfers:
<nowiki>$ curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x68b3537f39a313b3e574d06777193f152bdbe6a6' | gpg --import=-</nowiki>


  $ md5sum -c ArchLinuxARM-aarch64-latest.tar.gz.md5
Compare the key ID provided in the above command with the one listed here: https://archlinuxarm.org/about/package-signing (Take good note of the domain and HTTPS)
 
Verify the tarball's authenticity
 
  $ gpg --verify ArchLinuxARM-aarch64-latest.tar.gz.sig
 
{{note|Do not skip verifying the authenticity. This is important. It also protects you from prematurely aborted transfers giving you a corrupt archive.}}


== Installing The Root File System ==
== Installing The Root File System ==


{{note|Don't prefix the bsdtar command with <code>sudo</code>, run it from an interactive root shell as done here with <code>sudo -i</code>. At least the ALARM instructions claim this matters}}
# mount /dev/sdX5 /mnt/alarm-root
 
  # mkdir /mnt/alarm-root/boot
$ sudo -i
  # mount /dev/sdX4 /mnt/alarm-root/boot
  # mount /dev/sdb5 /mnt/alarm-root
  # mount /dev/sdb4 /mnt/alarm-root/boot
  # bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt/alarm-root
  # bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt/alarm-root


Line 38: Line 82:
In <tt>/mnt/alarm-root/etc/fstab</tt>, put the lines
In <tt>/mnt/alarm-root/etc/fstab</tt>, put the lines


  PARTUUID=''root-uuid-here''  /      ext4    defaults        0      0
  PARTUUID=''root-uuid-here''  /      ext4    defaults        0      1
  PARTUUID=''boot-uuid-here''  /boot  vfat    defaults        0      1
  PARTUUID=''boot-uuid-here''  /boot  vfat    defaults        0      2


with your UUIDs in place of the placeholder.
with your UUIDs in place of the placeholder.
Line 51: Line 95:
  prompt 0
  prompt 0
  timeout 50
  timeout 50
 
  label l0
  label l0
  menu label Boot Arch Kernel SDMMC
  menu label Boot Arch Kernel
  linux /Image
  linux /Image
  fdt /dtbs/rockchip/rk3566-quartz64-a.dtb
  fdt /dtbs/rockchip/rk3566-quartz64-a.dtb
  append initrd=/initramfs-linux.img earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 root=/dev/mmcblk0p5 rw rootwait
  append initrd=/initramfs-linux.img earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 root=LABEL=rootfs rw rootwait
 
==== For Model B ====
 
Kernel 5.18 and 5.19 do not yet have the Quartz64 Model B device tree, however, you can add it manually to your install and adjust <tt>extlinux.conf</tt>:
 
Download it from here: https://overviewer.org/~pillow/up/5f1fabef1b/rk3566-quartz64-b.dtb (this is just linux-next with sd card speed changed to <tt>sd-uhs-sdr50</tt>)
 
Copy it to <tt>/mnt/alarm-root/boot/dtbs/rockchip/rk3566-quartz64-b.dtb</tt>


For eMMC instead of SD, replace <code>/dev/mmcblk0p5</code> with <code>/dev/mmcblk1p5</code>.
Then adjust your <tt>/mnt/alarm-root/boot/extlinux/extlinux.conf</tt>'s <tt>fdt</tt> line as follows:


For a different type of Quartz64 device (e.g. Model B) replace the <tt>fdt</tt> line with the appropriate <tt>/boot</tt>-relative path to the device tree.
  fdt /dtbs/rockchip/rk3566-quartz64-'''b'''.dtb
 
=== Finishing Up ===


Once done, unmount the partitions:
Once done, unmount the partitions:
 
  # umount /mnt/alarm-root/boot
  # umount /mnt/alarm-root/boot
  # umount /mnt/alarm-root
  # umount /mnt/alarm-root
== Booting And Finishing Setup ==
Hook up your UART dongle to your Quartz64, open a serial terminal at 1.5mbauds. Install the SD card or eMMC module inside the Quartz64, and plug in the power.
Once you hit a login shell, log in as <code>root</code> with password <code>root</code> and run:
# pacman-key --init
# pacman-key --populate archlinuxarm
You are now ready to use Arch Linux ARM! Either delete or rename (and move the homedir of) the <code>alarm</code> user, and you're all set. Don't forget to install things like <code>sudo</code> and setting up sudo groups and such.
[[Category:Quartz64]] [[Category:Guide]] [[Category:Quartz64 Guides]]

Revision as of 14:32, 6 August 2022

Commands to be run as a normal user are prefixed with $, commands to be run as root are prefixed with #. We assume your target device is /dev/sdX, adjust accordingly.

Partitioning The Block Device

Here we assume your block device is /dev/sdX, adjust as needed.

Create a new partition table:

# parted -s /dev/sdX mklabel gpt

Create the partitions for loader and u-boot:

# parted -s /dev/sdX mkpart loader 64s 8MiB
# parted -s /dev/sdX mkpart uboot 8MiB 16MiB

Create the partition for u-boot's environment:

# parted -s /dev/sdX mkpart env 16MiB 32MiB

Create the "efi" boot partition and mark it as bootable:

# parted -s /dev/sdX mkpart efi fat32 32MiB 544MiB
# parted -s /dev/sdX set 4 boot on

Create the root partition:

# parted -s /dev/sdX mkpart root ext4 544MiB 100%

Creating The File Systems

Now create the file systems for boot and root:

# mkfs.vfat -n "efi" /dev/sdX4
# mkfs.ext4 -L "rootfs" /dev/sdX5

Fetching and Flashing U-Boot

For this we'll use the precompiled idblock and u-boot from pgwipeout's CI.

Go to https://gitlab.com/pgwipeout/quartz64_ci/-/pipelines and click the three dots, download the merge-job artifacts.

Unzip them:

$ unzip artifacts.zip

Flash idblock.bin and uboot.img:

# dd if=artifacts/idblock.bin of=/dev/sdX1
# dd if=artifacts/uboot.img of=/dev/sdX2

Fetching The Root File System Tarball

Fetch the root filesystem tarball and the PGP signature

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

Fetch the gpg keys:

$ curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x68b3537f39a313b3e574d06777193f152bdbe6a6' | gpg --import=-

Compare the key ID provided in the above command with the one listed here: https://archlinuxarm.org/about/package-signing (Take good note of the domain and HTTPS)

Verify the tarball's authenticity

$ gpg --verify ArchLinuxARM-aarch64-latest.tar.gz.sig
Do not skip verifying the authenticity. This is important. It also protects you from prematurely aborted transfers giving you a corrupt archive.

Installing The Root File System

# mount /dev/sdX5 /mnt/alarm-root
# mkdir /mnt/alarm-root/boot
# mount /dev/sdX4 /mnt/alarm-root/boot
# bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt/alarm-root

Editing fstab

Find your partition UUIDs for both partitions using lsblk:

$ lsblk -o NAME,SIZE,MOUNTPOINTS,PARTUUID

In /mnt/alarm-root/etc/fstab, put the lines

PARTUUID=root-uuid-here  /       ext4    defaults        0       1
PARTUUID=boot-uuid-here  /boot   vfat    defaults        0       2

with your UUIDs in place of the placeholder.

Writing extlinux.conf

Create a /mnt/alarm-root/boot/extlinux/extlinux.conf with these contents:

default l0
menu title Quartz64 Boot Menu
prompt 0
timeout 50

label l0
menu label Boot Arch Kernel
linux /Image
fdt /dtbs/rockchip/rk3566-quartz64-a.dtb
append initrd=/initramfs-linux.img earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 root=LABEL=rootfs rw rootwait

For Model B

Kernel 5.18 and 5.19 do not yet have the Quartz64 Model B device tree, however, you can add it manually to your install and adjust extlinux.conf:

Download it from here: https://overviewer.org/~pillow/up/5f1fabef1b/rk3566-quartz64-b.dtb (this is just linux-next with sd card speed changed to sd-uhs-sdr50)

Copy it to /mnt/alarm-root/boot/dtbs/rockchip/rk3566-quartz64-b.dtb

Then adjust your /mnt/alarm-root/boot/extlinux/extlinux.conf's fdt line as follows:

 fdt /dtbs/rockchip/rk3566-quartz64-b.dtb

Finishing Up

Once done, unmount the partitions:

# umount /mnt/alarm-root/boot
# umount /mnt/alarm-root

Booting And Finishing Setup

Hook up your UART dongle to your Quartz64, open a serial terminal at 1.5mbauds. Install the SD card or eMMC module inside the Quartz64, and plug in the power.

Once you hit a login shell, log in as root with password root and run:

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

You are now ready to use Arch Linux ARM! Either delete or rename (and move the homedir of) the alarm user, and you're all set. Don't forget to install things like sudo and setting up sudo groups and such.