summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2021-08-24 08:41:05 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2021-08-24 08:41:05 +0200
commit3904318da2a7aa5487cbeb4e7aa4de48734e837f (patch)
treed5ba28b3661166019822fb957ac21776a73e55a4
parentcb30d26ffdae399a6cf0616707a5361f5cf3bab5 (diff)
downloadalpine-conf-3904318da2a7aa5487cbeb4e7aa4de48734e837f.zip
setup-disk: Add preliminary support for u-boot based boards
Currently, this bootloader is not set automatically and needs to be set manually using the BOOTLOADER environment variable, e.g.: BOOTLOADER=u-boot setup-disk -m sys /dev/sda Furthermore, it relies on the update-u-boot script to install the bootloader based on the automatically determined defaults.
-rw-r--r--setup-disk.in26
1 files changed, 26 insertions, 0 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 656b5bc..34c359d 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -348,6 +348,30 @@ setup_syslinux() {
extlinux $extlinux_raidopt --install "$mnt"/boot
}
+# setup u-boot bootloader
+setup_uboot() {
+ local mnt="$1" root="$2" modules="$3" kernel_opts="$4"
+ local parameters="root=$root modules=$modules $kernel_opts"
+
+ mkdir -p "$mnt"/boot/extlinux
+ cat > "$mnt/boot/extlinux/extlinux.conf" <<- EOF
+ menu title Alpine Linux
+ timeout 50
+ default $KERNEL_FLAVOR
+
+ label $KERNEL_FLAVOR
+ menu label Linux $KERNEL_FLAVOR
+ kernel /vmlinuz-$KERNEL_FLAVOR
+ initrd /initramfs-$KERNEL_FLAVOR
+ fdtdir /dtbs-$KERNEL_FLAVOR
+ append $parameters
+ EOF
+
+ # Rely on update-u-boot to automatically determine the
+ # board, imagedir, etc. this may not work in all cases.
+ update-u-boot
+}
+
rpi_gen_config() {
cat <<-EOF
# do not modify this file as it will be overwritten on upgrade.
@@ -556,6 +580,7 @@ install_mounted_root() {
syslinux) setup_syslinux "$mnt" "$root" "$modules" "$kernel_opts" "$bootdev" ;;
zipl) setup_zipl "$mnt" "$root" "$modules" "$kernel_opts" ;;
raspberrypi-bootloader) setup_raspberrypi_bootloader "$mnt" "$root" "$modules" "$kernel_opts" ;;
+ u-boot) setup_uboot "$mnt" "$root" "$modules" "$kernel_opts" ;;
*) die "Bootloader \"$BOOTLOADER\" not supported!" ;;
esac
@@ -1311,6 +1336,7 @@ fi
if [ -d "$1" ]; then
# install to given mounted root
[ "$BOOTLOADER" = "syslinux" ] && apk add --quiet syslinux
+ [ "$BOOTLOADER" = "u-boot" ] && apk add --quiet u-boot
install_mounted_root "${1%/}" \
&& echo "You might need fix the MBR to be able to boot" >&2
exit $?