Olinuxino Lime2 (A20 - arm) and Trisquel: Has anyone done it?

12 réponses [Dernière contribution]
nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

For what I can understand, Trisquel on arm devices is somewhat tricky.
I know that there are arm images of trisquel in https://cdimage.trisquel.info/trisquel-images/, but I struggle to find instructions.

Olinuxino Lime2 is a well established device that can be used with free software. If someone have some tips or have successfully installed and booted trisquel please let me know.

ryry
Hors ligne
A rejoint: 03/26/2024

Hi nparafe,

I have successfully setup trisquel on arm (A20) devices, namely the cubieboard 2 and banana pi. I am working on a guide do these at the moment. It should work for the Olinuxino Lime2 to as these are supported by the u-boot images in trisquel.

I'd say its not much different to how to setup parabola on the same devices, but there are some extra steps, currently there is a need to use the fsfla prebuilt kernel images and chrooting in order to setup the system. A (very simplified) order goes something like, format the SD card to ext4, mount it and unpack the trisquel arm rootfs image, then chroot- install u-boot and flash, update, setup the system (adding users and ntp etc) setup the fsfla flash repo and install the kernel and config u-boot/extlinux/dtb. After which it should all boot.

Its sounds more complicated than it really is, There isn't too many commands needed in order to get setup, but there is a sequence. Once you get into it it probably only takes maybe 15-30 mins.

I will make a consented effort to finish documenting my findings, but I sometimes procrastinate but I have half completed it. Sorry.

Hope this helps in some way for now,

Ryan

Avron

I am a translator!

Hors ligne
A rejoint: 08/18/2020

The Olinuxino Lime 2 has a specific problem with ethernet as mentioned at https://wiki.parabola.nu/Computers/A20-OLinuXino-LIME2 for board revisions H to L, which are the revisions available since several years. There is an issue opened at https://labs.parabola.nu/issues/2945 that is still pending for a long time. People somehow told me what to do, but I am not skilled enough to understand what they said, so I never managed. I previously found https://notabug.org/sagaracharya/parabola_openrc_olinuxino_lime2 that I tried long time ago and worked, but at the time I was trying with the version that has an HDD, it was failing repeatedly so I thought there was a hardware problem and gave it up. Now I know that the problem was that the power supply provided by Olimex is not sufficient, one should use at least a 4A power supply.

For Debian bullseye, there is a procedure to fix the problem at https://wiki.debian.org/InstallingDebianOn/Allwinner#Olimex_A20-OLinuXino-LIME2__rev._F_and_newer_and_Debian11.2F_bullseye_kernel which I applied successfully. I have board revision L, note that this page mentions revision F and newer, while the parabola page mentions H and newer, so there is a discrepancy.

I also hope to eventually run Trisquel on these boards.

EDIT: Just installed parabola again on a G2 board, ethernet works fine ! The uboot4extlinux-a20-olinuxino-lime2 package was updated on 2024-02-22, so perhaps it has a u-boot version that makes this work.

nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

> I will make a consented effort to finish documenting my findings
That sounds awesome.

In the meantime, I would appreciate if someone can explain the steps in more detail, especially:
> chroot- install u-boot and flash, update,
> ...install the kernel and config u-boot/extlinux/dtb

del111
Hors ligne
A rejoint: 08/23/2023

> For what I can understand, Trisquel on arm devices is somewhat tricky.

Actually, as an owner of many exotic devices, installing any OS on ARM/RISCV SBCs is somewhat tricky.

> I would appreciate if someone can explain the steps in more detail, especially:

>> chroot- install u-boot and flash, update,
>> ...install the kernel and config u-boot/extlinux/dtb

That's actually many steps meld into two. I usually do it in the order like this: prepare a rootfs using debootstrap; install linux-image-arm64; install u-boot.

U-boot can read/write ext4 filesystems, unlike EFI, so you can just make one ext4 partition.

Basically you need to have another working Trisquel or debian-derivative system, mount your storage device (formatted), then run the debootstrap command (install deboostrap first). e.g. (assuming mounted at /mnt):

debootstrap aramo /mnt http://repo.jing.rocks/trisquel

* the URL should be a Trisquel mirror. This URL is the mirror I host. :) If you don't provide an URL it will default to debian's apt repo.

debootstrap will download and extract packages, thus building a minimal rootfs. When it finishes, it's time to chroot, but we also need some more mounting to work inside the chroot:

mount --bind /dev /mnt/dev
mount -t proc proc /mnt/proc
mount -t sysfs sysfs /mnt/sys
mount -t tmpfs tmpfs /mnt/tmp # optional
chroot /mnt

Note that if you are bootstraping a foreign architecture, e.g., your amd64 laptop to your arm64 SBC, you likely need the qemu-user-static package, so that you can run arm64 binaries (via qemu) on your amd64 laptop.

Once you are inside the chroot, there are a few things to do:
1. set root passwd.
2. set localtime.
3. set hostname.
4. adjust "/etc/apt/sources.list", like adding aramo-updates and aramo-security
5. set locales to generate in "/etc/locale.gen". You likely need to install the locales package first.
6. setup /etc/fstab
7. (maybe) setup networking. or not.
8. do you need other software? I always need bash-completion.

Then we can install a kernel. "linux-image-arm64" should just work.

If Trisquel doesn't come with a u-boot-* package for your board, you will need to compile u-boot yourself. This is board specific and you should consult u-boot manual for instructions. The u-boot binary will need to be "flashed" to somewhere (SD card, emmc, SPI falsh?), and it's also board specific, consult u-boot manual or your board manual.

U-boot's "standard boot" supports multiple ways of telling it where to find your kernel image, it searches e.g. /boot/extlinux/extlinux.conf, /boot/boot.scr, and this part is kind of hard to explain...FIXME

You might also want to add a hook for initramfs to copy dtb from /usr/lib/linux-image-$KERNELVERSION-arm64 to /boot/dtb/, then use the u-boot-tool to mkimage to convert initrd.img to uInitrd (a gzipped format that u-boot recognizes). Again the setup is kind of complex. From what I observed, different (non-free) distros targeting different boards do it in many different ways...FIXME: introduce an easy way as an example.

If things go well, you will see that when you compile u-boot, no non-free blobs are needed, and it should just work with linux-libre. That's how you know your board doesn't need non-free blobs. (Some rockchip boards unfortunately require u-boot to be compiled with a non-free blob inserted, but still work with linux-libre)

nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

Inspired by ryry and del111 I searched for more information and found a website that installs debian using the proposed method: https://www.irif.fr/en/users/letouzey/lime2

So I tried installing trisquel following the instruction, changing the command of dedbootstrap to use aramo and trisquel mirror.

The problem I had was that flash-kernel installation gave an error:

---
Setting up flash-kernel (3.104ubuntu9) ...

Creating config file /etc/default/flash-kernel with new version
grep: /proc/cpuinfo: No such file or directory
flash-kernel: deferring update (trigger activated)
Setting up ssh (1:8.9p1-3+11.0trisquel2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1+11.0trisquel1) ...
Processing triggers for initramfs-tools (0.140ubuntu13) ...
Processing triggers for flash-kernel (3.104ubuntu9) ...
grep: /proc/cpuinfo: No such file or directory
Can't find /boot/vmlinuz- (see /tmp/flash-kernel-no-kernel-error.log)
dpkg: error processing package flash-kernel (--configure):
installed flash-kernel package post-installation script subprocess returned err
or exit status 1
Errors were encountered while processing:
flash-kernel
E: Sub-process /usr/bin/dpkg returned an error code (1)
---

I continued the installation and right after kernel install (linux-image-generic) again I got complains about flash-kernel:
---
Processing triggers for flash-kernel (3.104ubuntu9) ...
Unsupported platform '"Olimex A20-OLinuXino-LIME2"'.
dpkg: error processing package flash-kernel (--configure):
installed flash-kernel package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.15.0-58-generic (5.15.0-58.64+11.0trisquel13) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-58-generic
W: Couldn't identify type of root file system for fsck hook
flash-kernel: deferring update (trigger activated)
/etc/kernel/postinst.d/zz-flash-kernel:
flash-kernel: deferring update (trigger activated)
Errors were encountered while processing:
flash-kernel
E: Sub-process /usr/bin/dpkg returned an error code (1
---

Inserting the sdcard (and a USB Serial Cable to get the output) *didn't* booted.

After that I used the debian's u-boot as suggested by avron from https://wiki.debian.org/InstallingDebianOn/Allwinner#Olimex_A20-OLinuXino-LIME2__rev._F_and_newer_and_Debian11.2F_bullseye_kernel but that didn't work either.

Is the flash-kernel the no-go in this situtation?

ryry
Hors ligne
A rejoint: 03/26/2024

Hi nparafe,

I'd say it depends on how flash kernel failed, but either way the stock trisquel kernel doesn't have sunxi enabled, so doesn't boot. In order to get things working (or at least to the next stage) you will likley need to use the FSFLA's freesh repo using this guide here https://www.fsfla.org/ikiwiki/selibre/linux-libre/freesh.en.html. The current lts (6.6) kernel has sunxi enabled at build time, which is what I am using to power my trisquel arm devices kernelwise.

After that, I had to remove flash kernel and the trisquel kernel packages (the trisquel kernel package depends on flash kernel) as it always errored due to the path not being correct for finding a dtb, this I copied manually to a directory i created inside /boot as /boot/dtb then pointed to it in the extlinux.conf file. The init image it creates should be the default and symlinked automatically as long as you have installed the kernel from fsfla freesh and then removed the stock one.

Hope this helps/makes sense

Ryan :)

nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

So you propose to install the kernel and the flash-kernel from the aramo repos, then install linux-libre and remove them?

> I copied manually to a directory i created inside /boot as /boot/dtb
from where?

> then pointed to it in the extlinux.conf file
Can you provide more details?

I am willing to try things and report back my results, If I have some guidance.

ryry
Hors ligne
A rejoint: 03/26/2024

> So you propose to install the kernel and the flash-kernel from the aramo repos, then install linux-libre and remove them?

The stock linux-image-5.15.* comes installed already inside the trisquel arm tarball, so you are only removing it or setting a hold via apt and not installing and then removing it.

> from where?

Once you have installed the fsfla kernel, it will place them in a directory inside /usr/lib for the kernel version installed for example 6.6.39-gnu which i believe is the current lts version so something like /usr/lib/linux-image-6.6.* but you can just ls -l /usr/lib and it will list the directory somewhere in the list.

I created a directory inside /boot as extlinux (so /boot/extlinux) and then created a text file in that directory as extlinux.conf. Then in extlinux.conf I put something like the following,

PROMPT 1
TIMEOUT 50
DEFAULT linux-libre

LABEL linux-libre
KERNEL /boot/vmlinuz
FDTDIR /boot/dtb
INITRD /boot/initrd.img
APPEND root=/dev/mmcblk0p1 rootfstype=ext4 rw video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 console=ttymxc0,115200n8 console=tty1 consoleblank=0

These seem sufficient defaults for booting the cubieboard and banana pi, both A20 sunxi. When the kernel gets installed it should symlink the current version to its relevant vmlinuz and initrd image so no need to change them unless you need/want to boot a specific kernel version.

Hope this helps a little more.

nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

1. Install necessary packages:
$apt-get install binfmt-support qemu-user-static

2. Prepare sdcard:
cfdisk /dev/sdb

$fdisk -l /dev/sdb
Disk /dev/sdb: 7,49 GiB, 8044675072 bytes, 15712256 sectors
Disk model: R5U880FlashMedia
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5452574f

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 501759 499712 244M 83 Linu
/dev/sdb2 501760 15712255 15210496 7,3G 83 Linu

3. Refresh the partition table and format these new partitions:
$partprobe /dev/sdb
$mkfs.ext3 /dev/sdb1
$mkfs.ext4 /dev/sdb2

4.Mount these partitions:
$mount /dev/sdb2 /mnt
$mkdir /mnt/boot
$mount /dev/sdb1 /mnt/boot

5.Debootstrap, part 1
$debootstrap --arch=armhf --foreign aramo /mnt https://mirror.librelabucm.org/trisquel/

6. Debootstrap, part 2
$export DEBIAN_FRONTEND=noninteractive
$export DEBCONF_NONINTERACTIVE_SEEN=true
$export LC_ALL=C
$cp /usr/bin/qemu-arm-static /mnt/usr/bin
$chroot /mnt /debootstrap/debootstrap --second-stage
$chroot /mnt dpkg --configure -a

7. Install linux-libre
$chroot /mnt

$wget https://linux-libre.fsfla.org/pub/linux-libre/freesh/pool/main/f/freesh-archive-keyring/freesh-archive-keyring_1.1_all.deb

$dpkg -i freesh-archive-keyring_1.1_all.deb

$apt install linux-libre-lts

$exit

8. Set root password and hostname

$chroot /mnt passwd

$nano /mnt/etc/hostname

9. Network

$nano /mnt/etc/network/interfaces

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
iface eth0 inet6 auto

10. edit /mnt/etc/fstab

$nano /mnt/etc/fstab

/dev/mmcblk0p2 / ext4 defaults 0 1
/dev/mmcblk0p1 /boot ext3 defaults 0 2
proc /proc proc defaults 0 0

11. o avoid errors during the final build of the initrd (?):

$mknod /mnt/dev/mmcblk0 b 179 0
$mknod /mnt/dev/mmcblk0p1 b 179 1
$mknod /mnt/dev/mmcblk0p2 b 179 2

12. I suspect this is what ryry proposed:
$cp /mnt/usr/lib/linux-image-6.6.40-gnu/* /mnt/boot/dtb

$mkdir /mnt/boot/extlinux

$nano /mnt/boot/extlinux/extlinux.conf

PROMPT 1
TIMEOUT 50
DEFAULT linux-libre

LABEL linux-libre
KERNEL /boot/vmlinuz
FDTDIR /boot/dtb
INITRD /boot/initrd.img
APPEND root=/dev/mmcblk0p1 rootfstype=ext4 rw video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 console=ttymxc0,115200n8 console=tty1 consoleblank=0

13. Install the u-boot loader which I created using the instructions at https://wiki.debian.org/InstallingDebianOn/Allwinner#Olimex_A20-OLinuXino-LIME2__rev._F_and_newer_and_Debian11.2F_bullseye_kernel:

14.Install the u-boot loader which I created using the instrucrtions at https://wiki.debian.org/InstallingDebianOn/Allwinner#Olimex_A20-OLinuXino-LIME2__rev._F_and_newer_and_Debian11.2F_bullseye_kernel :

dd if=u-boot-sunxi-with-spl.bin of=/dev/$sdcard bs=1024 seek=8

nparafe

I am a member!

Hors ligne
A rejoint: 10/20/2020

Results:

Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
1: linux-libre
Enter choice:

ethernet@1c50000 Waiting for PHY auto negotiation t
o complete......... TIMEOUT !
Could not initialize PHY ethernet@1c50000
The remote end did not respond in time.Config file
not found

After some tries it stays in this state.

So the Kernel now boots, which is a progress but still no boot.
Any ideas?

ryry
Hors ligne
A rejoint: 03/26/2024

It looks like it isn't finding the initrd or vmlinuz in order to boot.

I can suggest two things, the first which I had a similar issue with was using UUID in fstab instead of /dev/sdx this is more reliable, seemingly when using multiple partions to and may be the issue. Also change the APPEND root=UUID=PUTYOURUUIDFORYOURBOOTPARTIONHERE rw (in your extlinux.conf) and replace that text before rw with your filesystem (not the boot partition) partion UUID.

Secondly, I can only say that on one device I put everything in one ext4 partition and on the cubieboard 2 (where I boot from a HDD) I used ext4 on the sd card (with the boot directory on it) and everything else on the HDD which was formatted to ext4 also. So that may help if as it appears you have made a separate /boot directory (ext3) and the rest of the filesystem in the ext4 partition.

Glad it progressing, I had to play around with some settings until It worked and I did have a few moments of going round in cicrles till I released the problem. So hopefully this helps to :)

Ryan

del111
Hors ligne
A rejoint: 08/23/2023

Hi,

I want to point out some things that were not done correctly in your steps of installation.

> 3. Refresh the partition table and format these new partitions:

Like Ryan and I said, since u-boot supports booting from an ext4 partition, there is no need to make a separate partition for /boot.

> 5.Debootstrap, part 1
> $debootstrap --arch=armhf --foreign aramo /mnt https://mirror.librelabucm.org/trisquel/

There is no need for "--foreign". You only need to install the trisquel package "qemu-user-static", and the second step of debootstrap won't be needed.

> 7. Install linux-libre
> $chroot /mnt

Unfortunately, since you didn't mount /dev, /sys, /proc, initramfs-tool will likely fail. The kernel would simply not boot, no matter what version you install. I did provide instructions for mounting a working chroot:

mount --bind /dev /mnt/dev
mount -t proc proc /mnt/proc
mount -t sysfs sysfs /mnt/sys
mount -t tmpfs tmpfs /mnt/tmp # optional
chroot /mnt

Then you can try installing any version of kernel. It should just work.

> 12. I suspect this is what ryry proposed:
> $cp /mnt/usr/lib/linux-image-6.6.40-gnu/* /mnt/boot/dtb

Yes! You could write a hook under /etc/kernel/postinst.d/ so that the dtbs gets copied on every kernel update.

On extlinux.conf:
> KERNEL /boot/vmlinuz
> INITRD /boot/initrd.img

On trisquel it's more customary to use /vmlinuz and /initrd.img, instead of /boot/vmlinuz and /boot/initrd.img, since /vmlinuz is a symlink to the actual kernel image like /boot/vmlinuz-6.6.40-arm64, but should check if these two files actually exist under /boot or /.

About the kernel parameters:

Like Ryan said, it's better to use partition UUID instead of /dev/sdx... you can check UUID using "blkid".
Also, "rootfstype=ext4" should not be needed. It's also perfectly fine to use "ro" instead of "rw" on kernel parameters. The init system (systemd) will remount the root partition in rw anyway.

> So the Kernel now boots, which is a progress but still no boot.

That's actually only the u-boot output. Linux is not booted yet.