Group: Hardware/FSDG distributions/Trisquel

From LibrePlanet
Jump to: navigation, search
(How to install Trisquel 10 (etiona) on 32bit ARM SBCs: Add support for doing the installation with Guix and unify Parabola/Trisquel with Guix.)
(Trisquel versions: Add Trisquel 11)
Line 8: Line 8:
 
! Kernel version
 
! Kernel version
 
! Comments
 
! Comments
 +
|-
 +
| Trisquel 11 (aramo)
 +
| {{yes}}
 +
|
 +
|
 
|-
 
|-
 
| Trisquel 10 (nabia)
 
| Trisquel 10 (nabia)

Revision as of 21:27, 3 April 2024

Trisquel versions

Version Can be debootstrapped Based on Kernel version Comments
Trisquel 11 (aramo) Yes
Trisquel 10 (nabia) Yes Ubuntu 20.04 LTS (Focal Fossa)
  • 5.4
  • 5.13 (though linux-image-generic-hwe-20.04)

Installing

How to install Trisquel 10 (etiona) on 32bit ARM SBCs

This tutorial has been tested on Parabola x86_64, but it should work on Trisquel too as they both have similar qemu-user-static packages.

Distribution Package Binary
Guix qemu:static /gnu/store/*-qemu-*-static/bin/qemu-arm
Parabola qemu-user-static /usr/bin/qemu-arm-static
Trisquel 11.0 (aramo) qemu-user-static /usr/bin/qemu-arm-static

You can then start installing Trisquel on an ARM computer (from an x86 computer with Guix, Parabola or Trisquel) with the following commands:

# qemu-img create -f raw storage.img 2G
# fdisk storage.img # create 1 partition
# udisksctl loop-setup -f storage.img
# mkdir rootfs
# mkfs.ext4 -O ^metadata_csum -O ^64bit /dev/loop0p1
# mount /dev/loop0p1 rootfs
# mkdir -p rootfs/usr/bin
# debootstrap --foreign --arch armhf etiona rootfs

Then if you use Parabola or Trisquel, you need to run the following commands:

# cp /usr/bin/qemu-arm-static rootfs/usr/bin
# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# export TERM=xterm-color
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /debootstrap/debootstrap --second-stage

If you use Guix instead (either as system distribution or on top of another distribution) you can use the following commands instead:

$ guix package -i qemu:static
$ sudo cp $(guix package -I | awk '{if($1=="qemu" && $3=="static"){print $4}}')/bin/qemu-arm rootfs/usr/bin/qemu-arm-static
# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# export TERM=xterm-color
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# sed 's#/gnu/store/.*/bin/sh#/bin/sh#g' -i /debootstrap/debootstrap
# sed 's#/gnu/store/.*/bin/dpkg#/usr/bin/dpkg#g' -i /debootstrap/debootstrap
# /debootstrap/debootstrap --second-stage

You then need to create the extlinux.conf file in /boot/extlinux/extlinux.conf with the following content:

menu title Welcome to U-Boot with Extlinux support!

timeout 10

label Trisquel GNU/Linux-libre, linux-libre kernel
        kernel /boot/vmlinuz
        append loglevel=8 root=/dev/mmcblk0p1 rw
        fdtdir /boot/dtb/
        initrd /boot/initrd.img

Set the first partition to be bootable (needed to be able to boot):

# sfdisk /dev/loop0 -A 1

Then you need to install a kernel:

# for d in proc dev dev/pts sys ; do mount -o bind /$d rootfs/$d ; done
# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# source /etc/environment
# apt remove flash-kernel
# apt install linux-image-generic

You then need to write a script in /etc/kernel/postinst.d/zz-generate-dtb-link to generate a symlink from /lib/firmware/<<your-kernel-version>>/device-tree/ to /boot/dtb, so for instance from /lib/firmware/5.4.0-96-generic/device-tree/ to /boot/dtb. I've an incomplete script here:

#!/bin/sh
set -e

version="$1"

ln -sf /lib/firmware/${version}/device-tree/ /boot/dtb

The caveat of this script is that it has not been tested with multiple kernel versions installed, so during apt upgrade, it may or may not make the /boot/dtb link point to the wrong kernel. So that needs to be tested.

With only one kernel installed it should not be a problem.

In addition to that you will also need to make the symlink yourself the first time, before booting the image, like that:

# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# source /etc/environment
# ln -sf /lib/firmware/<your-kernel-version>/device-tree/ /boot/dtb

You will need to replace the <your-kenrel-version> with your kenrel version, for instance:

# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# source /etc/environment
# ln -sf /lib/firmware/5.4.0-96-generic/device-tree/ /boot/dtb

You will then need to install a bootloader, here's an example for the lime 1 A20:

# LANG=C.UTF-8 chroot rootfs /usr/bin/qemu-arm-static /bin/bash
# source /etc/environment
# apt update
# apt install u-boot-sunxi
# cat /usr/share/doc/u-boot-sunxi/README.Debian
# dd conv=fsync,notrunc if=/usr/lib/u-boot/A20-OLinuXino-Lime/u of=/dev/loop0 bs=1024 seek=8

You can then unmount and copy to a microSD:

# umount rootfs/dev/pts rootfs/dev rootfs/proc rootfs/sys rootfs/
# ddrescue /dev/loop0 /dev/sdZ # copy to a microSD

Failed installation With Trisquel 10 (nabia)

  • Devices with an Allwiner SOCs: missing devicetree.
  • Devices with OMAP3 SOC: the package instructions / README use dd but u-boot.img is probably expected on a fat partition. And u-boot determine that due to some bug. See Parabola patches for more details. Tested with a beagleboard (probably one of the latest revisions) and MLO complained about not finding u-boot.img
  • On a Pandaboard, it booted the kernel, dtb and initramfs fine, but then the kernel hangs (there are too much backtraces to see where the issue comes from).
  • The TBS2910 is also supported by upstream u-boot but there I coudn't test since u-boot-img 2019.07+dfsg-1ubuntu6 doesn't have an image for it. Maybe support for DISTRO_BOOT was added upstream after that u-boot version.

References