summaryrefslogtreecommitdiff
path: root/libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-23 23:40:35 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-24 00:54:32 +0200
commit26258c970a5de46a243ffccd74a30ecdaed85b9c (patch)
treec5520924fb822771235f31a299569794cfd8f69c /libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh
parent88462e5cc21168872df53543d9607335bb4ba625 (diff)
downloadabslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.tar.gz
abslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.tar.bz2
abslibre-26258c970a5de46a243ffccd74a30ecdaed85b9c.zip
move WIP u-boot modifications in libre-testing
I asked bill-auger to push his modifications so he uploaded the packages to libre-testing and the PKGBUILD modifications to abslibre. Since the pakcages have been uploaded to libre-testing it's better to move them here. While the code is not ready yet, it enables users to test the new u-boot which fixes the Ethernet PHY. From linux-sunxi we have[1]: Proper fix for rev. F and newer is to apply trace length compensation at the PHY. This is done by default (also for rev. H and newer despite commit message mentioning only realtek not Micrel) since mainline linux v5.15 and since mainline u-boot v2022.04; [1]https://linux-sunxi.org/Olimex_A20-OLinuXino-Lime2#calibrate_at_PHY That page also has more background on the issue being fixed here (basically making all the various Lime 2 A20 revisions (which have different Ethernet PHY) work with the same u-boot binary / package. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh')
-rw-r--r--libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh141
1 files changed, 141 insertions, 0 deletions
diff --git a/libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh b/libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh
new file mode 100644
index 000000000..e8c9c29a9
--- /dev/null
+++ b/libre-testing/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2020 Denis 'GNUtoo' Carikli
+
+line_length=81
+
+printchar()
+{
+ char="$1"
+ nr_chars="$2"
+
+ if [ -z "${nr_chars}" ] ; then
+ echo -n "${char}"
+ else
+ i=0
+ while [ $i -lt ${nr_chars} ] ; do
+ echo -n "${char}"
+ i=$(expr $i + 1)
+ done
+ fi
+}
+
+print_separation_line()
+{
+ echo -n "+"
+ printchar "-" $(expr ${line_length} - 2)
+ echo "+"
+}
+
+strlen()
+{
+ echo $(expr $(echo "$1" | wc -c) - 1)
+}
+
+print_header()
+{
+ pkgname="$1"
+
+ # ${line_length}
+ # - '| '
+ # - ${pkgname}
+ # - ' '
+ # - 'installation instructions:'
+ # - ' |'
+ extra_spaces=$(expr ${line_length} - 2 - $(strlen "${pkgname}") - 1)
+ extra_spaces=$(expr ${extra_spaces} - \
+ $(strlen "installation instructions:") - 2)
+
+ print_separation_line
+ echo -n "| "
+ echo -n "${pkgname} installation instructions:"
+ printchar " " "${extra_spaces}"
+ echo " |"
+ print_separation_line
+}
+
+print_line()
+{
+ line="$1"
+
+ # ${line_length} - '| ' - ${line} - ' |'
+ extra_spaces=$(expr ${line_length} - 2 - $(strlen "${line}") - 2)
+ echo -n '| '
+ echo -n "${line}"
+ printchar " " "${extra_spaces}"
+ echo ' |'
+}
+
+print_text()
+{
+ for line in "$@" ; do
+ print_line "${line}"
+ done
+}
+
+print_introduction()
+{
+ print_text \
+ "To boot with u-boot you will need to do two things:" \
+ "- First you will need to install u-boot to the storage device (like" \
+ " a microSD) you will be booting from. You can consult the Parabola" \
+ " installation instructions to know which storage devices are" \
+ " supported." \
+ "- Then you will need to read and potentially modify the" \
+ " /boot/extlinux/extlinux.conf configuration file to tell u-boot" \
+ " from which kernel to boot, and various other settings related to" \
+ " booting (like LVM or disk encryption settings)."
+}
+
+print_uboot_install_instructions()
+{
+ pkgname="$1"
+ install_script="$2"
+
+ print_text \
+ "To install or upgrade u-boot you can use similar commands:" \
+ " cd $(dirname ${script})" \
+ " sudo ./$(basename ${script}) <path/to/block-device>"
+
+ print_line ""
+
+ print_text \
+ "For instance if the microSD you (will) boot from is available at" \
+ "/dev/mmcblk0 you can use the following commands:" \
+ " cd $(dirname ${script})" \
+ " sudo ./$(basename ${script}) /dev/mmcblk0"
+
+ print_line ""
+
+ print_text \
+ "Instead if the microSD is available at /dev/sdb you can use the" \
+ "following commands:" \
+ " cd $(dirname ${script})" \
+ " sudo ./$(basename ${script}) /dev/sdb"
+}
+
+print_extlinux_config_remainder()
+{
+ pkgbase="$1"
+
+ print_text \
+ "When this is done you'll need to create and/or modify the" \
+ "/boot/extlinux/extlinux.conf configuration file."
+ print_line ""
+
+ print_text \
+ "There is an example file for that at" \
+ "/usr/lib/u-boot/${pkgbase}/extlinux.conf"
+}
+
+pkgname="$1"
+pkgbase="$2"
+script="$3"
+
+print_header "${pkgname}"
+print_introduction
+print_line " "
+print_uboot_install_instructions "${pkgname}" "${script}"
+print_line " "
+print_extlinux_config_remainder "${pkgbase}"
+print_separation_line