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.
This commit is contained in:
q66 2019-10-24 23:41:02 +02:00 committed by Juan RP
parent c8097960ca
commit 90f5f8ffe1
11 changed files with 816 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/second/fs_xfs.c
+++ b/second/fs_xfs.c
@@ -661,8 +661,6 @@
startpos = xfs_file->pos;
endpos = xfs_file->pos + len;
- if (endpos > xfs_file->len)
- endpos = xfs_file->len;
endofprev = (xfs_fileoff_t)-1;
init_extents ();
while (len > 0 && (xad = next_extent ())) {

View File

@ -0,0 +1,11 @@
--- a/COPYING
+++ b/COPYING
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@ -0,0 +1,110 @@
This is different from what Debian does. It does several things required only
for us. We disable usage of native CFLAGS for the yaboot binary itself as that
is loaded by OF (and is 32-bit). We keep CFLAGS intact for the userland part.
Additionally, we fix various paths, and make sure a 32-bit crosscompiler is
used for yaboot itself, in order to ensure linkage against correct libgcc and
so on, which is required. We alter the flags for that too (must be synchronized
with the flags used for e2fsprogs, see the template).
Also do not strip the binaries upon install, xbps-src will take care of that.
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,8 @@ VERSION = 1.3.17
DEBUG = 0
# make install vars
ROOT =
-PREFIX = usr/local
-MANDIR = man
+PREFIX = usr
+MANDIR = share/man
# command used to get root (needed for tarball creation)
GETROOT = fakeroot
@@ -32,14 +32,17 @@ LD := $(CROSS)ld
AS := $(CROSS)as
OBJCOPY := $(CROSS)objcopy
+# The compiler to use for yaboot itself
+YBCC = $(CC)
+
# The flags for the yaboot binary.
#
-YBCFLAGS = -Os -m32 $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
+YBCFLAGS = -Os -m32 -nostdinc -Wall -isystem `$(YBCC) -m32 -print-file-name=include` -fsigned-char
YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\""
YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG)
YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE)
YBCFLAGS += -DKERNELADDR=$(KERNELADDR)
-YBCFLAGS += -Werror -fdiagnostics-show-option
+YBCFLAGS += -fgnu89-inline -fno-builtin-malloc -fno-stack-protector -no-pie
YBCFLAGS += -I ./include
YBCFLAGS += -fno-strict-aliasing
@@ -69,12 +72,12 @@ LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux
# Libraries
#
-LLIBS = -lext2fs
+LLIBS = ./libext2fs.a ./libcom_err.a
# For compiling userland utils
#
UCFLAGS = -Os $(CFLAGS) -Wall -I/usr/include
-UCFLAGS += -Werror -fdiagnostics-show-option
+UCFLAGS += -fdiagnostics-show-option
# For compiling build-tools that run on the host.
#
@@ -103,7 +106,7 @@ OBJS += second/fs_reiserfs.o
endif
# compilation
-lgcc = `$(CC) -m32 -print-libgcc-file-name`
+lgcc = `$(YBCC) -m32 -print-libgcc-file-name`
all: yaboot addnote mkofboot
@@ -125,10 +128,10 @@ mkofboot:
fi
%.o: %.c
- $(CC) $(YBCFLAGS) -c -o $@ $<
+ $(YBCC) $(YBCFLAGS) -c -o $@ $<
%.o: %.S
- $(CC) $(YBCFLAGS) -D__ASSEMBLY__ -c -o $@ $<
+ $(YBCC) $(YBCFLAGS) -D__ASSEMBLY__ -c -o $@ $<
dep:
makedepend -Iinclude *.c lib/*.c util/*.c gui/*.c
@@ -181,9 +184,9 @@ strip: all
strip util/addnote
strip --remove-section=.comment --remove-section=.note util/addnote
-install: all strip
+install: all
install -d -o root -g root -m 0755 ${ROOT}/etc/
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/sbin/
+ install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/bin/
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
@@ -191,11 +194,11 @@ install: all strip
install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
- install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
- install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
- install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
- rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
- ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
+ install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/bin/ofpath
+ install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/bin/ybin
+ install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/bin/yabootconfig
+ rm -f ${ROOT}/${PREFIX}/bin/mkofboot
+ ln -s ybin ${ROOT}/${PREFIX}/bin/mkofboot
@gzip -9 man/*.[58]
install -o root -g root -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
install -o root -g root -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz

View File

@ -0,0 +1,324 @@
Description: Get scsi, sata, and firewire drive info from sysfs
as legacy /proc/scsi interface does not exist anymore.
Added support for pata-macio on 2011-08-04.
Last-Update: 2011-08-04
Bug-Debian: http://bugs.debian.org/608384
Bug-Debian: http://bugs.debian.org/572869
Bug-Debian: http://bugs.debian.org/377097
Bug-Debian: http://bugs.debian.org/342833
Bug-Debian: http://bugs.debian.org/289201
Author: Milan Kupcevic <milan@physics.harvard.edu>
Forwarded: http://patchwork.ozlabs.org/patch/108566/
--- a/ybin/ofpath
+++ b/ybin/ofpath
@@ -3,6 +3,9 @@
###############################################################################
##
## ofpath: determine OpenFirmware path from unix device node
+##
+## Copyright (C) 2010, 2011 Milan Kupcevic
+##
## Copyright (C) 2000, 2001, 2002, 2003 Ethan Benson
##
## Portions based on show_of_path.sh:
@@ -27,7 +30,7 @@
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
PRG="${0##*/}"
-VERSION=1.0.7
+VERSION=1.0.7+debian2
DEBUG=0
export LC_COLLATE=C
@@ -36,9 +39,10 @@
{
echo \
"$PRG $VERSION
-Written by Ethan Benson
+Written by Ethan Benson, portions rewritten by Milan Kupcevic
Portions based on show_of_path.sh written by Olaf Hering
+Copyright (C) 2010, 2011 Milan Kupcevic
Copyright (C) 2000, 2001, 2002, 2003 Ethan Benson
Portions Copyright (C) 2000 Olaf Hering
This is free software; see the source for copying conditions. There is NO
@@ -181,158 +185,125 @@
return 0
}
+# read OpenFirmware device path from its corresponding devspec
+find_of_path()
+{
+ [ -z "$1" ] && return
+ [ -f "$1/devspec" ] && {
+ OF_PATH="`cat $1/devspec`"
+ SYS_PATH="$1"
+ return
+ }
+ find_of_path "${1%/*}"
+}
+
## this finds information we need on both newworld and oldworld macs.
## mainly what scsi host a disk is attached to.
scsiinfo()
{
- ## see if system has scsi at all
- if [ ! -f /proc/scsi/scsi ] ; then
- local kver="$(uname -r)"
- case "$kver" in
- 2.5.*|2.6.*)
- if [ -d /sys/bus/scsi/devices -a \
- -n "$(ls /sys/bus/scsi/devices 2>/dev/null)" ] ; then
- echo 1>&2 "$PRG: /proc/scsi/scsi does not exist"
- echo 1>&2 "$PRG: Make sure you compiled your kernel with CONFIG_SCSI_PROC_FS=y"
- return 1
- fi
- ;;
- esac
- echo 1>&2 "$PRG: /dev/$DEVNODE: Device not configured"
- return 1
- fi
-
- ## first we have to figure out the SCSI ID, have to do that
- ## anyway [to] find the attached scsi disks = "Direct-Access" and
- ## stop at sda=1 sdb=2 or whatever count in 3 lines steps
-
- ## get last letter of device node, ie sda -> a
- SUBNODE=${DEVNODE##*sd}
-
- ## turn SUBNODE above into a number starting at 1, ie a -> 1
- SUBDEV="$(smalltr $SUBNODE)"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: SUBNODE=$SUBNODE SUBDEV=$SUBDEV"
-
- DEVCOUNT=0
-
- ## copy scsi file into a variable removing "Attached Devices"
- ## which is the first line. this avoids a lot of
- ## [incmopatible] crap later, and improves readability.
-
- ## find number of lines once and recycle that number, to save
- ## some time (linecount is a bit slow). subtract one line
- ## to scrap Attached Devices:
-
- SCSILINES="$(($(linecount /proc/scsi/scsi) - 1))"
-
- if [ "$SUBDEV" -gt "$(cat /proc/scsi/scsi | grep Direct-Access | linecount)" ] ; then
- echo 1>&2 "$PRG: /dev/$DEVNODE: Device not configured"
- return 1
- fi
-
- PROCSCSI="$(cat /proc/scsi/scsi | tail -n $SCSILINES)"
-
- for i in $(smallseq $(($SCSILINES / 3))) ; do
-
- ## put every scsi device into one single line
- DEVINFO="$(echo "$PROCSCSI" | head -n $(($i * 3)) | tail -n 3)"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVINFO=$DEVINFO"
-
- ## cut the type field, expect "Direct-Access" later.
- DEVTYPE="$(v=$(echo ${DEVINFO##*Type: }) ; echo ${v%% *})"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVTYPE=$DEVTYPE"
-
- ## get the device id.
- DEVID="$(v=$(echo ${DEVINFO##*Id: }) ; n=$(echo ${v%% *}) ; echo ${n#*0})"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVID=$DEVID"
-
- ## get the scsi host id.
- DEVHOST="$(v=$(echo ${DEVINFO##*Host: scsi}) ; echo ${v%% *})"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVHOST=$DEVHOST"
-
- if [ "$DEVTYPE" = "Direct-Access" ] || [ "$DEVTYPE" = "Direct-Access-RBC" ] ; then
- DEVCOUNT="$(($DEVCOUNT + 1))"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVCOUNT=$DEVCOUNT"
- if [ "$SUBDEV" = "$DEVCOUNT" ] ; then
- DEVICE_HOST=$DEVHOST
- DEVICE_ID=$DEVID
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVICE_HOST=$DEVICE_HOST"
- break
- fi
- fi
- done
-
- ## figure out what the scsi driver is, it is /proc/scsi/dirname.
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVICE_HOST=$DEVICE_HOST"
- SCSI_DRIVER="$(x=`ls /proc/scsi/*/$DEVICE_HOST 2>/dev/null | cat` ; y=`echo ${x##*proc/scsi/}` ; echo ${y%%/*})"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: SCSI_DRIVER=$SCSI_DRIVER"
-
- ## figure out which host we found.
- SCSI_HOSTNUMBER="$(v=`ls /proc/scsi/$SCSI_DRIVER/* 2>/dev/null | cat | grep -n "$DEVICE_HOST\>"` ; echo ${v%%:*})"
- [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: SCSI_HOSTNUMBER=$SCSI_HOSTNUMBER"
+ SYS_DEVICE="`readlink -f /sys/block/$DEVNODE/device`"
+ [ -e "$SYS_DEVICE" ] && {
+
+ SCSI_DEVICE=${SYS_DEVICE##*/}
+ HOST_ID=${SCSI_DEVICE%%:*}
+ BUS_ID=`T=${SCSI_DEVICE#*:}; echo ${T%%:*}`
+ DEVICE_ID=`T=${SCSI_DEVICE#*:*:}; echo ${T%%:*}`
+ LUN_ID=${SCSI_DEVICE##*:}
+
+ OF_PATH=;find_of_path "$SYS_DEVICE"
+
+ SCSI_DRIVER=`cat /sys/class/scsi_host/host$HOST_ID/proc_name 2>/dev/null`
+
+ SCSI_NAME=`cat /proc/device-tree$OF_PATH/name 2>/dev/null`
+
+ IEEE1394_ID=`cat /sys/block/$DEVNODE/device/ieee1394_id 2>/dev/null`
+ IEEE1394_ID=${IEEE1394_ID%%:*}
+
+ PLUG_ID=$(ls -dv $SYS_PATH/host* 2>/dev/null | grep -n "/host$HOST_ID$")
+ PLUG_ID=$((${PLUG_ID%%:*}-1))
+
+ PART=${PARTITION:+:$PARTITION}
+
+ [ "$LUN_ID" != "0" ] && LUNX=`printf ",%x" $LUN_ID`
+
+ [ "$DEBUG" = "1" ] && {
+ echo SYS_DEVICE=$SYS_DEVICE
+ echo SCSI_DEVICE=$SCSI_DEVICE
+ echo HOST_ID=$HOST_ID
+ echo BUS_ID=$BUS_ID
+ echo DEVICE_ID=$DEVICE_ID
+ echo LUN_ID=$LUN_ID
+ echo PLUG_ID=$PLUG_ID
+ echo IEEE1394_ID=$IEEE1394_ID
+ echo SCSI_NAME=$SCSI_NAME
+ echo SCSI_DRIVER=$SCSI_DRIVER
+ echo SYS_PATH=$SYS_PATH
+ echo OF_PATH=$OF_PATH
+ echo PART=$PART
+ echo LUNX=$LUNX
+ }
+
+ SCSI_DRIVER=${SCSI_DRIVER:?}
+
+ [ -z "$OF_PATH" ] && {
+ echo 1>&2 "Cannot find $DEVNODE among OpenFirmware registered devices"
+
+ exit 1
+ }
+
return 0
+ }
+
+ echo 1>&2 "Link /sys/block/$DEVNODE/device does not exist"
+
+ exit 1
}
-## generic function that can find OF device paths for scsi devices,
+## add OF device node to the host OF path,
## must be run after scsiinfo().
scsi_ofpath()
{
- case "$SCSI_DRIVER" in
- aic7xxx)
- HOST_LIST="$(for i in `find /proc/device-tree -name compatible` ; do
- lgrep "$i" "^ADPT" "^pci900[45]" "^pciclass,01000" ; done)"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION"
- ;;
- sym53c8xx)
- HOST_LIST="$(for i in `find /proc/device-tree -name compatible` ; do
- lgrep "$i" "^Symbios" "^pci1000" "^pciclass,01000" ; done)"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION"
- ;;
- mesh)
- HOST_LIST="$(for i in `find /proc/device-tree -name compatible` ; do
- lgrep "$i" "mesh" ; done)"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION"
- ;;
- ata_k2|sata_svw)
- #Not all G5 device trees have a compatible "k2-sata" node
- #per channel use parent
- HOST_LIST="$(for i in `find /proc/device-tree -name compatible ` ; do
- lgrep "$i" "k2-s-ata" ; done | sort)"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- K2_DEVICE_ID=0
- while [ "$DEVICE_PATH" = "" ] ; do
- SCSI_HOSTNUMBER=`expr $SCSI_HOSTNUMBER - 1`
- let "K2_DEVICE_ID += 1"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- done
- echo "${DEVICE_PATH##*device-tree}/k2-sata@$K2_DEVICE_ID/disk@0:$PARTITION"
- ;;
- usb-storage)
- HOST_LIST="$(for i in `find /proc/device-tree -name name | grep usb` ; do
- lgrep "$i" "disk" ; done)"
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- echo "${DEVICE_PATH##*device-tree}:$PARTITION"
- ;;
- sbp2|"")
- # sbp-2 driver may not have a dir in /proc/scsi
- HOST_LIST="$(for i in `find /proc/device-tree -name name` ; do
- lgrep "$i" "sbp-2" ; done)"
- if [ "$SCSI_HOSTNUMBER" = "" ] ; then
- SCSI_HOSTNUMBER=1
- fi
- DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
- echo "${DEVICE_PATH##*device-tree}/disk@0:$PARTITION"
- ;;
- *)
- echo 1>&2 "$PRG: Driver: $SCSI_DRIVER is not supported"
- return 1
- ;;
+ if [ -d "/proc/device-tree$OF_PATH/sas" ] ; then
+
+ SAS_ID=$(( ($BUS_ID << 16) | ($DEVICE_ID << 8) | $LUN_ID))
+ printf "%s/sas/disk@%x%s\n" $OF_PATH $SAS_ID $LUNX$PART
+
+ elif [ -d "/proc/device-tree$OF_PATH/scsi@`printf %x $BUS_ID`" ] ; then
+
+ printf "%s/scsi@%x/@%x%s\n" $OF_PATH $BUS_ID $DEVICE_ID $LUNX$PART
+
+ else
+
+ case "$SCSI_DRIVER-$SCSI_NAME" in
+ aic7xxx-*|sym53c8xx-*|mesh-*|*-scsi)
+ printf "%s/@%x%s\n" $OF_PATH $DEVICE_ID $LUNX$PART
+ ;;
+ sata_sil-*|sata_vsc-*)
+ printf "%s/@%x%s\n" $OF_PATH $(($PLUG_ID * 2)) $PART
+ ;;
+ sata_svw-*|*-pci-ata)
+ printf "%s/@%x/@%x%s\n" $OF_PATH $PLUG_ID $DEVICE_ID $PART
+ ;;
+ pata_macio-*)
+ printf "%s/@%x%s\n" $OF_PATH $DEVICE_ID $PART
+ ;;
+ sbp2-*)
+ IEEE1394_ID=${IEEE1394_ID:?}
+ printf "%s/node@%s/sbp-2/@%x%s\n" $OF_PATH $IEEE1394_ID $DEVICE_ID $PART
+ ;;
+ ipr-obsidian)
+ printf "%s/@%x,%x%s\n" $OF_PATH $BUS_ID $DEVICE_ID $LUNX$PART
+ ;;
+ *)
+ echo 1>&2 "${PRG}: ${SCSI_NAME} (${SCSI_DRIVER}) is not supported"
+ return 1
+ ;;
esac
- return 0
+
+ fi
+
+ return 0
}
ide_ofpath()
@@ -432,11 +403,11 @@
case "$DEVNODE" in
hda|hdc|hde|hdg|hdi|hdk|hdm|hdo)
- echo "${DEVSPEC}${MASTER}:$PARTITION"
+ echo "${DEVSPEC}${MASTER}${PARTITION:+:${PARTITION}}"
return 0
;;
hdb|hdd|hdf|hdh|hdj|hdl|hdn|hdp)
- echo "${DEVSPEC}${SLAVE}:$PARTITION"
+ echo "${DEVSPEC}${SLAVE}${PARTITION:+:${PARTITION}}"
return 0
;;
*)

View File

@ -0,0 +1,74 @@
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

View File

@ -0,0 +1,74 @@
Description: Support for YDL PowerStation
Bug-Debian: http://bugs.debian.org/603894
Author: Milan Kupcevic <milan@physics.harvard.edu>
Forwarded: http://patchwork.ozlabs.org/patch/111893/
--- a/ybin/ofpath
+++ b/ybin/ofpath
@@ -30,7 +30,7 @@
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
PRG="${0##*/}"
-VERSION=1.0.7+debian2
+VERSION=1.0.7+debian3
DEBUG=0
export LC_COLLATE=C
@@ -899,6 +899,8 @@
SUBARCH=OldWorld
elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then
SUBARCH=CHRP
+elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Maple') ; then
+ SUBARCH=Maple
elif (cat /proc/cpuinfo 2>/dev/null | grep ^machine | grep -q 'CHRP Pegasos') ; then
SUBARCH=Pegasos
else
@@ -930,7 +932,7 @@
OldWorld)
oldworld || exit 1
;;
- CHRP)
+ CHRP|Maple)
chrp || exit 1
;;
esac
--- a/ybin/ybin
+++ b/ybin/ybin
@@ -77,6 +77,8 @@
fstype=raw
elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then
fstype=raw
+elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Maple') ; then
+ fstype=raw
else
fstype=hfs
fi
@@ -514,6 +516,8 @@
## IBM hardware does not need nvram update AFAICT
nonvram=1
ADDNOTE=yes
+ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Maple') ; then
+ true
else
#echo 1>&2 "$PRG: Warning: Unknown archetecture, $boot may not be bootable on this machine"
[ "$nonvram" = 0 ] && echo 1>&2 "$PRG: Warning: Unknown architecture, nvram will not be updated"
@@ -1157,6 +1161,20 @@
return 1
fi
sync ; sync
+
+ ## update the boot-device variable in OF nvram.
+ if [ "$nonvram" = 0 ] ; then
+ chrp_ofboot=${ofboot%%:*}
+ [ "$VERBOSE" = 1 ] && echo "$PRG: Updating OpenFirmware boot-device variable in nvram..."
+ [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: boot-device=${chrp_ofboot}"
+ nvsetenv boot-device "${chrp_ofboot}"
+ if [ $? != 0 ] ; then
+ echo 1>&2 "$PRG: An error occured while updating nvram, we'll ignore it"
+ fi
+ else
+ echo 1>&2 "$PRG: Warning: You must manually configure OpenFirmware to boot."
+ fi
+
[ "$VERBOSE" = 1 ] && echo "$PRG: Installation successful"
return 0
}

View File

@ -0,0 +1,20 @@
Description: correct ofpath discovery on newer kernels
Author: Milan Kupcevic <milan@physics.harvard.edu>
Bug-Debian: http://bugs.debian.org/784387
Forwarded: no
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/ybin/ofpath
+++ b/ybin/ofpath
@@ -220,7 +220,10 @@
IEEE1394_ID=`cat /sys/block/$DEVNODE/device/ieee1394_id 2>/dev/null`
IEEE1394_ID=${IEEE1394_ID%%:*}
- PLUG_ID=$(ls -dv $SYS_PATH/host* 2>/dev/null | grep -n "/host$HOST_ID$")
+ PLUG_ID=$(ls -dv $SYS_PATH/*/host* 2>/dev/null | grep -n "/host$HOST_ID$")
+ [ -z "$PLUG_ID" ] && {
+ PLUG_ID=$(ls -dv $SYS_PATH/host* 2>/dev/null | grep -n "/host$HOST_ID$")
+ }
PLUG_ID=$((${PLUG_ID%%:*}-1))
PART=${PARTITION:+:$PARTITION}

View File

@ -0,0 +1,44 @@
Description: support cell platform
Origin: other, https://launchpad.net/ubuntu/+source/yaboot
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/ybin/ofpath
+++ b/ybin/ofpath
@@ -906,6 +906,8 @@
SUBARCH=Maple
elif (cat /proc/cpuinfo 2>/dev/null | grep ^machine | grep -q 'CHRP Pegasos') ; then
SUBARCH=Pegasos
+elif (cat /proc/cpuinfo 2>/dev/null | grep ^platform | grep -q 'Cell') ; then
+ SUBARCH=Cell
else
echo 1>&2 "$PRG: This machine is not yet supported"
exit 1
@@ -929,7 +931,7 @@
## use appropriate search for right sub arch.
case "$SUBARCH" in
# Pegasos OF seems to be NewWorld-ish enough to cope with this.
- NewWorld|Pegasos)
+ NewWorld|Pegasos|Cell)
newworld || exit 1
;;
OldWorld)
--- a/ybin/ybin
+++ b/ybin/ybin
@@ -79,6 +79,8 @@
fstype=raw
elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Maple') ; then
fstype=raw
+elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Cell') ; then
+ fstype=raw
else
fstype=hfs
fi
@@ -518,6 +520,8 @@
ADDNOTE=yes
elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Maple') ; then
true
+ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'Cell') ; then
+ nonvram=1
else
#echo 1>&2 "$PRG: Warning: Unknown archetecture, $boot may not be bootable on this machine"
[ "$nonvram" = 0 ] && echo 1>&2 "$PRG: Warning: Unknown architecture, nvram will not be updated"

View File

@ -0,0 +1,16 @@
Description: correct spelling/typo
Author: Milan Kupcevic <milan@physics.harvard.edu>
Forwarded: no
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/second/prom.c
+++ b/second/prom.c
@@ -216,7 +216,7 @@
else if (!strcmp(tmp, "network"))
return FILE_DEVICE_NET;
else {
- prom_printf("Unkown device type <%s>\n", tmp);
+ prom_printf("Unknown device type <%s>\n", tmp);
return FILE_ERR_BADDEV;
}
}

View File

@ -0,0 +1,20 @@
Description: let it probe for other filesystems
Not having a partition does not constitute a bad device.
Author: Milan Kupcevic <milan@debian.org>
Bug-Debian: http://bugs.debian.org/819549
Forwarded: no
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/second/fs_swap.c
+++ b/second/fs_swap.c
@@ -60,8 +60,8 @@
DEBUG_OPEN;
if (file->device_kind != FILE_DEVICE_BLOCK || part == NULL) {
- DEBUG_LEAVE(FILE_ERR_BADDEV);
- return FILE_ERR_BADDEV;
+ DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
+ return FILE_ERR_BAD_FSYS;
}
/* We assume that device is "short" and is correctly NULL terminsated */

112
srcpkgs/yaboot/template Normal file
View File

@ -0,0 +1,112 @@
# Template file for 'yaboot'
pkgname=yaboot
version=1.3.17
revision=1
archs="ppc*"
build_style=gnu-makefile
hostmakedepends="autoconf automake"
depends="powerpc-utils hfsutils"
short_desc="Bootloader for PowerMac and IBM CHRP computers"
maintainer="q66 <daniel@octaforge.org>"
license="GPL-2.0-or-later"
homepage="https://wiki.debian.org/YaBoot"
_e2fsprogs_ver="1.41.14"
distfiles="https://cdimage.debian.org/cdimage/cd-sources/yaboot_${version}.orig.tar.gz
http://ftp.be.debian.org/pub/linux/kernel/people/tytso/e2fsprogs/e2fsprogs-${_e2fsprogs_ver}.tar.gz"
checksum="2fb738d8fd48b94ab2534a4fdf63738ad02c1a30f4b2add91f837baff8fa2aa1
3f8ac1fedd7c4bec480afcbe4acabdd4ac59ec0446a0fd50c8975cd0aad7b176"
patch_args="-Np1"
# Don't want stripped yaboot bits to leak into -dbg
nostrip_files=yaboot
# This is a safe choice available on all cross-hosts and ppc64 itself
# We need to compile yaboot binary itself, as well as e2fsprogs libraries,
# using a 32-bit ppc compiler; 64-bit with -m32 won't do because of libgcc etc.
case "$XBPS_TARGET_MACHINE" in
ppc64*) _need_cross=powerpc-linux-musl ;;
esac
if [ -n "$_need_cross" ]; then
hostmakedepends+=" cross-${_need_cross}"
fi
# No testsuite provided
do_check() {
:
}
post_patch() {
# Add support for DESTDIR in order to not leak files
sed -i 's/^ROOT =/ROOT = $(DESTDIR)/' Makefile
# Ensure safe cleanup
mv ${XBPS_BUILDDIR}/e2fsprogs-${_e2fsprogs_ver} .
}
# This builds e2fsprogs libraries, needed by yaboot for ext* support
# We need to build this using the potential 32-bit cross compiler, with
# specific minimal flags, so we can't just makedepend on it...
_build_e2fsprogs() {
pushd e2fsprogs-${_e2fsprogs_ver}
# Update config.sub and config.guess to recognize modern/musl hosts
cp /usr/share/automake-*/config.* config
if [ ! -f Makefile ]; then
# Regenerate autotools
autoreconf -isf
# Explicitly disable things we definitely don't need
local _args="--disable-testio-debug --disable-debugfs --disable-tls"
local _ecc="$CC" _ear="$AR"
if [ -n "$_need_cross" -o -n "$CROSS_BUILD" ]; then
# using a crosscompiler, set up configure/compiler for that
_args+=" --host=${_need_cross:-$XBPS_CROSS_TRIPLET}"
_ecc="${_need_cross:-$XBPS_CROSS_TRIPLET}-gcc"
_ear="${_need_cross:-$XBPS_CROSS_TRIPLET}-ar"
fi
# We need to keep flags synchronized with yaboot itself
local _ecflags="-Os -fno-stack-protector -no-pie"
_ecflags+=" -fgnu89-inline -fno-builtin-malloc -DNDEBUG"
CFLAGS="$_ecflags" CC="$_ecc" AR="$_ear" ./configure ${_args}
fi
# Avoid building the whole thing, build only the two libs we need
cd lib/et
make ${makejobs}
cd ../ext2fs
make ${makejobs}
cd ..
cp libcom_err.a libext2fs.a ${wrksrc}
popd
}
pre_build() {
# Add toolchain prefix when cross-compiling; for userland tools
# always, for yaboot itself when cross-compiling to ppc32
if [ "$CROSS_BUILD" ]; then
sed -i "s/^CROSS =/CROSS = ${XBPS_CROSS_TRIPLET}-/" Makefile
fi
# When using a separate cross-compiler (ppc64 target), override YBCC
if [ -n "$_need_cross" ]; then
sed -i "s/^YBCC =.*/YBCC = ${_need_cross}-gcc/" Makefile
fi
# These are needed by yaboot core
_build_e2fsprogs
}
post_install() {
# Yaboot is nostrip_files so do it manually (and ignore -dbg)
if [ -n "$_need_cross" ]; then
${_need_cross}-strip --remove-section=.comment \
${DESTDIR}/usr/lib/yaboot/yaboot
else
$STRIP --remove-section=.comment ${DESTDIR}/usr/lib/yaboot/yaboot
fi
}