void-packages/srcpkgs/yaboot/patches/0005-no-unix-block-names.patch
q66 90f5f8ffe1 New package: yaboot-1.3.17
This should replace the yaboot-bin package (which should be dropped
assuming this is found to be working well). This, instead of taking
the binary from Debian, compiles yaboot from source.

The tricky part here is e2fsprogs, or rather, libext2fs. Yaboot
requires a fairly old version of it, and being a strictly ppc32
program, needs that library compiled in a minimal form for ppc32.
In order to achieve that, I abuse the cross-compiler, using the
musl ppc32 cross-compiler as that's universally available on all
crosshosts, as well as all ppc64 (and ppc32 doesn't need it).

The main reason to do this over shipping the binary is that this
will actually work properly on some ppc64 machines, which require
the bundled addnote executable, which can now be compiled properly
for the native architecture.
2019-10-25 23:52:27 +02:00

74 lines
2.4 KiB
Diff

Description: Support persistent device naming symlinks, UUID, and LABEL tags
in addition to openfirmware paths and aliases as traditional Unix block
device names are not persistent anymore.
Last-Update: 2011-08-04
Bug-Debian: http://bugs.debian.org/615602
Bug-Debian: http://bugs.debian.org/580455
Author: Milan Kupcevic <milan@physics.harvard.edu>
Forwarded: http://patchwork.ozlabs.org/patch/108567/
--- a/ybin/yabootconfig
+++ b/ybin/yabootconfig
@@ -27,7 +27,7 @@
PATH="${PATH}:${PATH_PREFIX}/sbin:${PATH_PREFIX}/bin:${PATH_PREFIX}/usr/sbin:${PATH_PREFIX}/usr/bin:${PATH_PREFIX}/usr/local/sbin:${PATH_PREFIX}/usr/local/bin"
fi
PRG="${0##*/}"
-VERSION=1.0.8
+VERSION=1.0.8+debian2
CHROOT=/
## $CONFIG is relative to $CHROOT
CONFIG=etc/yaboot.conf
@@ -732,6 +732,27 @@
INITRDIMGS="\tinitrd=$INITRDIMG\n\tinitrd-size=8192\n"
fi
+## Get a symlink which always points to the correct block device.
+## If it does not exist, give the unix block device name back.
+devsymlink() {
+ [ "$2" != "nobyid" ] && BYID="/dev/disk/by-id/scsi* /dev/disk/by-id/*"
+ for SYMLINK in $BYID /dev/disk/by-uuid/* /dev/disk/by-label/*; do
+ [ "`readlink -f "$SYMLINK"`" = "$1" ] && {
+ echo $SYMLINK
+ return
+ }
+ done
+ echo $1
+}
+
+## Get UUID= or LABEL= for the given unix partition block device.
+## If it could not be determined, give the unix partition block device back.
+uuidlabel() {
+ echo `devsymlink "$1" nobyid` \
+ | sed -e "s,/dev/disk/by-uuid/,UUID=," \
+ -e "s,/dev/disk/by-label/,LABEL=,"
+}
+
## generate global section of yaboot.conf
GLOBAL="## yaboot.conf generated by $PRG $VERSION
##
@@ -739,9 +760,9 @@
${HEADER}##
## For a dual-boot menu, add one or more of:
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n
-boot=${BOOT}${DEVICE:-}
+boot=\"`devsymlink "${BOOT}"`\"${DEVICE:-}
partition=$PARTITION
-root=$ROOT
+root=\"`uuidlabel "${ROOT}"`\"
timeout=30
install=${INSTALL}${OFBOOT:-}\n"
--- a/ybin/ybin
+++ b/ybin/ybin
@@ -1647,6 +1647,12 @@
exit 1
fi
+## also accept quoted symlink names
+for v in boot bsd macos macosx darwin ; do
+ eval $v="\`echo \$$v | tr -d '\"'\`"
+ eval [ -h \"\$$v\" ] \&\& $v="\`readlink -f \$$v\`"
+done
+
## if there is still no config file use the automatic generation to make a
## generic yaboot.conf. do this before the confcheck to avoid wierd errors.
if [ "$bootconf" = /dev/null ] ; then