Skip to content

Commit

Permalink
New package: yaboot-1.3.17
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
q66 committed Oct 24, 2019
1 parent f102034 commit 5d175b5
Show file tree
Hide file tree
Showing 11 changed files with 819 additions and 0 deletions.
11 changes: 11 additions & 0 deletions srcpkgs/yaboot/patches/0001-xfs-support.patch
Original file line number Diff line number Diff line change
@@ -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 ())) {
11 changes: 11 additions & 0 deletions srcpkgs/yaboot/patches/0002-new-fsf-address.patch
Original file line number Diff line number Diff line change
@@ -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.

110 changes: 110 additions & 0 deletions srcpkgs/yaboot/patches/0003-build-system.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5d175b5

Please sign in to comment.