From 89ab0d27c99ce4899829ab45001c0955db1149ab Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Thu, 7 Jan 2021 00:56:11 +0100 Subject: libre: uboot4extlinux-sunxi: lower maintenance costs - We can now do cross builds of u-boot: - We can now more easily work on the package as we don't need an ARM computer for that anymore. - It also enable people already using Parabola on x86 to more easily install, test, or repair u-boot for an ARM computer as users can simply install it on microSD cards without needing to use ARM chroots. - There is now an install script to install u-boot: - It makes things easier for users as it is more similar to grub-install than dd commands. - It also does many checks at the same time to avoid data loss. - The commands to split packages are now shared between all package_ functions. This lower maintenance. - How to add a new board has been made more clear. Comparison with other distributions (for consistency): - u-boot doesn't have anything to handle the installation and update of u-boot binaries if UEFI is not used. - Debian has an u-boot-install-sunxi script which handles way more cases than what I wrote (it even handles GPT and so on and even has a manual), but there seems to be no tools to update u-boot. - Openembedded doesn't seem to have anything special in the u-boot recipe in openembedded-core Signed-off-by: Denis 'GNUtoo' Carikli --- .../generate-uboot4extlinux-sunxi-install-text.sh | 141 +++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 libre/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh (limited to 'libre/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh') diff --git a/libre/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh b/libre/uboot4extlinux-sunxi/generate-uboot4extlinux-sunxi-install-text.sh new file mode 100644 index 000000000..e8c9c29a9 --- /dev/null +++ b/libre/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}) " + + 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 -- cgit v1.2.3