Giter Site home page Giter Site logo

arch-linux-arm-clockworkpi-a06's Introduction

[UNMAINTAINED] Arch Linux ARM for the ClockworkPi DevTerm A06

Author: Cole Smith

License: LGPL-2.1

Introduction

This document will walk you through installing Arch Linux ARM on the DevTerm A06. At the time of writing, only Armbian is supported on the DevTerm.

We will create a root file system based on the rock64 architecture (rk3328). This will include patching our bootloader and kernel with the patches provided by ClockworkPi. Technically, the DevTerm A06's architecture is based on the rk3399.

Quickstart

Pre-built root filesystem(s) are provided in the Releases tab. Skip to the Prepare the SD Card section if using a pre-built image. Replace arch-linux-clockworkpi-a06-root-fs.tar.xz with your downloaded file name in the guide steps.

NOTE: Please note the following defaults for the release filesystem:

  • Root password: root
  • Timezone: US/Eastern
  • Locale: en_US UTF8
  • Hostname: devterm

Setup

This guide assumes you are already using Arch Linux. Some package names or procedures may differ depending on your distribution.

In order to build the root filesystem, we will set up the following:

  1. aarch64 chroot environment + necessary configuration
  2. arm-none-eabi-gcc build tools from ARM
  3. Linux kernel
  4. U-Boot bootloader
  5. Additional packages for the A06

Setting up Chroot Environment

We will start by creating an ARM chroot environment to build our root filesystem using this guide.

  1. Install the required packages
$ yay -S base-devel binfmt-qemu-static qemu-user-static arch-install-scripts

# systemctl restart systemd-binfmt.service
  1. Verify that an aarch64 executable exists in
$ ls /proc/sys/fs/binfmt_misc
  1. Download the base root FS to use. We will use the aarch64 tarball from Arch Linux ARM
$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
  1. Create the mount point and extract the files as root (not via sudo)
$ sudo su
# mkdir root 

# bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root
# mount --bind root root

NOTE: It's very important that this root folder is owned by root. Otherwise, you will get unsafe path transition errors in the final build.

  1. Chroot into the newly created environment
# arch-chroot root
  1. Inside the chroot, populate and init the pacman keyring
# pacman-key --init
# pacman-key --populate archlinuxarm
  1. Finally, update the packages
# pacman -Syu

Configuring The Root Filesystem

We will start with lightly configuring our system before compiling the packages.

For this section, all commands will be run inside the chroot.

  1. Install some useful tools
# pacman -S base-devel git vim wget ranger sudo man networkmanager
  1. Enable networkmanager and dhcpcd for networking on first boot
# systemctl enable NetworkManager dhcpcd
  1. Set the Locale by editing /etc/locale.gen and uncommenting your required locales.
  2. Run
# locale-gen
  1. Set fstab
# echo 'LABEL=ROOT_ARCH    /    ext4    defaults    0    0' >> /etc/fstab
  1. Set the time using timedatectl. To list supported timezones: timedatectl list-timezones
# timedatectl set-timezone "US/Eastern"
# timedatectl set-ntp true

NOTE: This may affect the timezone of your system outside the chroot, if so, you may reset your host system timezone after finishing the root tarball.

  1. Set the system clock
# hwclock --systohc
  1. Set the hostname to whatever you like
# echo 'devterm' > /etc/hostname
  1. Add the following to /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
        Identifier "DSI-1"
        Option "Rotate" "right"
EndSection
  1. Assign the root password
# passwd

Switch to the alarm user

  1. We can avoid working with the root account by granting alarm, the default Arch Linux ARM user, sudo privileges.
# EDITOR=/usr/bin/vim visudo
  1. And add the corresponding line for alarm after the one for root
alarm ALL=(ALL) ALL
  1. Switch to the alarm user
# su alarm

$ cd

NOTE: The default password for the alarm user is alarm

Acquiring GCC Build Tools

U-Boot depends on the arm-none-eabi-gcc executable to be built, and since this program is not available in the Arch Linux ARM repositories, we will download it directly from ARM's website .

  1. Download the binaries
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-arm-none-eabi.tar.xz
  1. Extract the binaries to another directory
$ mkdir gcc 
$ tar -xJf gcc-arm-10.3-2021.07-aarch64-arm-none-eabi.tar.xz -C gcc
  1. Add the toolchain to your PATH
$ cd gcc/gcc-arm-10.3-2021.07-aarch64-arm-none-eabi/bin
$ export PATH=$PATH:$(pwd)
$ cd

Compiling The Packages

This repository contains pre-configured and patched Arch Linux packages for the DevTerm A06. The Linux kernel and U-Boot are based off the rock64 variants, already available in Arch Linux ARM, with patches provided by ClockWorkPi.

You can find these patches from ClockworkPi here.

Download This Repository

  1. Inside the alarm home folder of your aarch64 chroot environment, clone this repository
$ git clone https://github.com/css459/arch-linux-arm-clockworkpi-a06.git
$ cd arch-linux-arm-clockworkpi-a06

Compiling The Linux Kernel

  1. Build the package. This can take a long time!! Especially since we are emulating an aarch64 architecture. The package build tool makepkg, supports a flag called MAKEFLAGS. Below, we will append MAKEFLAGS="-j$(nproc)" to the makepkg command to instruct the compiler to use one worker for each core.
$ cd linux-clockworkpi-a06 
$ MAKEFLAGS="-j$(nproc)" makepkg -si 
$ cd ..

Compiling U-Boot

  1. Build the package, similar to above.
$ cd uboot-clockworkpi-a06 
$ MAKEFLAGS="-j$(nproc)" makepkg -si 
$ cd ..

NOTE: DO NOT INSTALL THE BOOTLOADER TO THE DISK WHEN ASKED AFTER THIS STEP. We will do this ourselves when we prepare the SD card.

Compiling Additional Packages

For each additional package directory in this repository

$ cd <package directory> 
$ MAKEFLAGS="-j$(nproc)" makepkg -si 
$ cd ..

Exit the chroot

  1. Exit alarm
$ exit
  1. Exit root
# exit

Unmount The Root Filesystem

 # umonut root

Tar The Root Filesystem

We are now ready to package up the root filesystem into a compressed tarball.

 # cd root
 # tar cpJf ../arch-linux-clockworkpi-a06-root-fs.tar.xz .
 # cd ..

Change ownership of the tarball and exit the root account

 # chown <user>:<user> arch-linux-clockworkpi-a06-root-fs.tar.xz
 # exit

You now have a root filesystem tarball to bootstrap the SD card!

Prepare the SD Card

We will now put our prepared filesystem onto the SD card. We will follow Arch Linux ARM's guide for the rock64, but use our tarball in place of theirs.

  1. Zero the beginning of the SD card
# dd if=/dev/zero of=/dev/sdX bs=1M count=32
  1. Start fdisk to partition the SD card
# fdisk /dev/sdX
  1. Inside fdisk,

    1. Type o. This will clear out any partitions on the drive
    2. Type p to list partitions. There should be no partitions left
    3. Type n, then p for primary, 1 for the first partition on the drive, 32768 for the first sector
    4. Press ENTER to accept the default last sector
    5. Write the partition table and exit by typing w
  2. Create the ext4 filesystem without a Journal

# mkfs.ext4 -L ROOT_ARCH -O ^has_journal /dev/sdX1

NOTE: Disabling the journal is helpful for simple flash devices like SD Cards to reduce successive writes. In rare cases, your filesystem may become corrupted, which may arise as a boot loop. Running fsck -y /dev/sdX1 on an external system can fix this issue.

  1. Mount the filesystem
# mount /dev/sdX1 /mnt
  1. Install the root filesystem (as root not via sudo)
# sudo su
# bsdtar -xpf arch-linux-clockworkpi-a06-root-fs.tar.xz -C /mnt
# exit
  1. Install the bootloader to the SD card
# cd /mnt/boot
# dd if=idbloader.img of=/dev/sdX seek=64 conv=notrunc,fsync
# dd if=u-boot.itb of=/dev/sdX seek=16384 conv=notrunc,fsync
  1. Unmount and eject the SD card
# cd
# umount /mnt
# eject /dev/sdX

Done!

The SD card is now ready to be booted by the DevTerm! Good luck!

Next Steps

You will want to set up Wi-Fi on first boot. You can do so by using NetworkManager.

Check out the post-install suggestions from Arch Linux for further configuration.

Troubleshooting

If you run into issues where you see no screen output or the DevTerm will not boot, please check the debugging output via UART:

  1. Connect a micro-USB cable to the UART port on the inside of your DevTerm, near where the printer ribbon cable is connected
  2. Connect the other end to your Linux system, you should now see a new device: /dev/ttyUSB0
  3. Monitor the connection with sudo stty -F /dev/ttyUSB0 1500000 && sudo cat /dev/ttyUSB0
  4. Power on your DevTerm and monitor for errors

Acknowledgements

Very special thanks to Max Fierke (@maxfierke) from the CPI Discord, and the Manjaro team for their help in debugging and kernel patching. The Linux kernel and u-boot ports in this repository uses their carefully designed patches, and modified PKGBUILDs. This Arch Linux port would not be possible without their hard work, and I make no claims or credit to it.

Manjaro DevTerm A06 Linux Kernel

Manjaro DevTerm A06 U-Boot

arch-linux-arm-clockworkpi-a06's People

Contributors

css459 avatar lonewsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

yatli

arch-linux-arm-clockworkpi-a06's Issues

Mali GPU Support

GPU acceleration currently does not work even with the proper midgard drivers installed. The GPU appears in lshw and its frequency can be changed successfully using the Gearbox application (verified via device files). However, glxinfo -B (via mesa-utils and mesa-demos) reports that the Device is llvmpipe and Accelerated: no

RISC-V version

I recognise that this is for the A06 and not the R01 core, but I was wondering whether there’s any plan to extend this to a RISC-V release of Arch for the DevTerm?

LUKS

Great stuff, I use it with Gnome, it's up to date and working fine (used it for an hour).
I'd like to use LUKS for full disk encryption, when I look at the installation steps I think I can make the root partition encrypted but I wonder if it will boot if I do this, maybe you can give me a pointer how to set this up.

Audio is working but no headphones/speakers switch

Audio is working out-of-the-box but is playing on both speakers and headphones. No Auto-Mute option on alsa sound card. No difference between pulseaudio and pipewire.

Output of aplay -l
**** List of PLAYBACK Hardware Devices **** card 0: rockchipes8388c [rockchip,es8388-codec], device 0: ff880000.i2s-es8328-hifi-analog es8328-hifi-analog-0 [ff880000.i2s-es8328-hifi-analog es8328-hifi-analog-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: hdmisound [hdmi-sound], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [ff8a0000.i2s-i2s-hifi i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0

Is it kernel-related?

Root password doesn't seem to be "root" in release 1.1

Hi, thanks a lot for putting this together. I just installed the latest rootfs release, which was super quick and easy -- I was booted up before I knew it!

I had a trouble using the root default password 'root', or any obvious alternative on the console (or later with su). I was able to log in as alarm user (password: alarm) and set the root pw with sudo though -- so not sure if the default pw made it in the build :)

Seeking Maintainers!

Hello Everyone,

First of all, I want to thank you for supporting this project by submitting bug reports and by using it on your DevTerm! I hope it’s been useful for installing our favorite OS.

I also want to apologize for the lack of responses and progress. Lots of things have come up in my personal life that meant I have little time to devote to actually using my DevTerm, on top of stating a new job.

While I hope to get around to fixing things one day, I feel that is a vague commitment.

Which is why I am seeking maintainers to help keep this project alive! If you are interested, leave a comment here or drop me an email at: cole.s.smith1 (at gmail). Thank you again everyone who has installed this project and has found it useful.

— Cole

dhcpcd interferes with NetworkManager

I had an issue connecting to my Wi-Fi where the connection would constantly cycle between connected and disconnected, with device (wlan0): failure to start DHCPv6: failed to start client: Address already in use appearing repeatedly in the output for journalctl -u NetworkManager right before the connection would disconnect.

Running sudo systemctl disable --now dhcpcd fixed it.

Headphone mic (TRRS) not working

Microphone input via 3-point jack (TRRS) not woking on Arch.

Alsa seems to detect the input, some config is applied and device is showing up on pipewire. But no audio input is detected.

I think it is related to the forked alsa ucm profile (the one from Manjaro repos). Don't know if it works on CPI OS.

Will add more documenation and investigate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.