summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2018-06-22 09:31:53 +0200
committerAndreas Grapentin <andreas@grapentin.org>2018-06-22 09:31:53 +0200
commita5fd90dcce72f58af61880857d7ab0f2e44e9874 (patch)
tree727048402665b287675825a6d95a81fd356a18ab
parent56ec7e46cbdd2f7319574710d3ce3d38b9338108 (diff)
rebootstrapped powerpc64le toolchain with multilib, and added grub
-rw-r--r--README112
-rw-r--r--config/config.powerpc64le.sh11
-rw-r--r--src/blacklist.txt2
-rw-r--r--src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in1
-rw-r--r--src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in4
-rw-r--r--src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in4
-rw-r--r--src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in8
-rw-r--r--src/stage2/patches/generic/binutils.patch35
-rw-r--r--src/stage2/patches/generic/gcc.patch26
-rw-r--r--src/stage2/patches/generic/glibc.patch24
-rw-r--r--src/stage2/patches/powerpc64le/binutils.patch27
-rw-r--r--src/stage3/patches/generic/binutils.patch31
-rw-r--r--src/stage3/patches/generic/gcc.patch26
-rw-r--r--src/stage3/patches/generic/glibc.patch39
-rw-r--r--src/stage3/patches/powerpc64le/binutils.patch13
-rwxr-xr-xsrc/stage3/stage3.sh2
-rw-r--r--src/stage4/patches/generic/binutils.patch31
-rw-r--r--src/stage4/patches/generic/gcc.patch26
-rw-r--r--src/stage4/patches/generic/glibc.patch30
-rw-r--r--src/stage4/patches/generic/grub.patch58
-rw-r--r--src/stage4/patches/powerpc64le/binutils.patch13
-rw-r--r--src/stage4/stage4.sh2
22 files changed, 344 insertions, 181 deletions
diff --git a/README b/README
index 5d71f89..1eb860e 100644
--- a/README
+++ b/README
@@ -1,20 +1,17 @@
-parabola-riscv64-bootstrap
-==========================
+parabola-riscv64-bootstrap ==========================
- “Don't cry because it's over, smile because it happened.”
- ― Dr. Seuss
+ “Don't cry because it's over, smile because it happened.” ― Dr. Seuss
-1. Introduction
----------------
+1. Introduction ---------------
This project is an attempt to bootstrap a self-contained parabola
GNU/Linux-libre system for the following architectures:
- - riscv64 (HiFive)
- - riscv32 (PULP)
- - sparc (OpenSparc)
- - powerpc64le (TalosII)
+ - riscv64 (HiFive) (complete)
+ - riscv32 (PULP) (blocked)
+ - sparc (OpenSparc) (planned)
+ - powerpc64le (TalosII) (multilib complete)
The scripts are created with the goal to be as architecture agnostic as
possible, to make future porting efforts easier.
@@ -22,8 +19,7 @@ possible, to make future porting efforts easier.
The build process is split into four stages, the rationale of which is outlined
in section 2 below.
-To initiate a complete build of all stages, run:
- $> sudo ./create [CARCH]
+To initiate a complete build of all stages, run: $> sudo ./create [CARCH]
The builds can be configured to keep going if the build of a single package
fails, by creating the file `build/.KEEP_GOING`. Otherwise, the build will stop
@@ -35,23 +31,23 @@ will be overwritten by the next package.
The complete console output of a package build process can be found in the
corresponding .MAKEPKGLOG file in the build directory of that package.
-1.1. System Requirements
-------------------------
+Target platform configuration is persisted in the config/config.$CARCH.sh
+files.
+
+1.1. System Requirements ------------------------
The scripts require, among probably other things, to be running on a fairly
-POSIX-conforming GNU/Linux system, and in particulary need the following tools
+POSIX-conforming GNU/Linux system, and in particular need the following tools
to be present and functional:
- * decently up-to-date GNU build toolchain (gcc, glibc, binutils)
- * most of the things in base-devel
- * pacman, makepkg
+ * decently up-to-date GNU build toolchain (gcc, glibc, binutils) most of the
+ * things in base-devel pacman, makepkg
I have tried to make the script smart enough to check for required bits and
pieces where needed, and to report when anything is missing ahead of time, but
some requirements may be missing.
-1.2. A note to the reader
--------------------------
+1.2. A note to the reader -------------------------
The scripts assume to be running on a parabola GNU/Linux-libre system, and may
fail in subtle and unexpected ways otherwise. They also may fail in subtle and
@@ -65,43 +61,44 @@ Also, if you found this project useful, and want to chat about anything, you
can email me at <andreas@grapentin.org>, or find me as <oaken-source> in
#parabola and others on irc.freenode.org.
-1.3. Current state of the project
----------------------------------
+1.3. Current state of the project ---------------------------------
All four stages of the riscv64 bootstrap are complete, and efforts to add
additional architectures has begun. A pointer where to find future development
-efforts for the parabola RISC-V port will be added here in due time.
+efforts for the parabola ports will be added here in due time.
-2. Build Stages
----------------
+2. Build Stages ---------------
The following subsections outline the reasoning behind the separate bootstrap
stages. More details about *how* things are done may be gathered from reading
the inline comments of the respective scripts.
From Stage 2 onwards, the scripts use DEPTREEs to determine what packages need
-to be built. these files are located in the build/stageX/ directories and can
-give an insight into what packages are going to be built next and what
+to be built. these files are located in the build/$CARCH/stage$X/ directories
+and can give an insight into what packages are going to be built next and what
dependencies are still missing.
Since risc-v is a fairly new ISA, some packages were packaged with config.sub
and config.guess files that are too old to recognize the target triplet. This
requires config.sub and config.guess files to be refreshed with newer versions
from upstream. This is done automatically for stage 2 and onwards, if
-REGEN_CONFIG_FRAGMENTS is set to yes (the default) in create.sh or the
-environment.
+REGEN_CONFIG_FRAGMENTS is set to yes (the default) in the architecture config
+file.
Packages with the `any' architecture are reused from upstream arch for this
bootstrap, since they should work for any architecture and do not need to be
-re-(or cross-)compiled.
+re-(or cross-)compiled. This assumption is not always true, but it is a
+reasonable approximation.
Additionally, all checkdepends are ignored, and the check() phase of the builds
-is skipped for sanity reasons.
+is skipped for sanity reasons, since the tests are likely to fail for benign
+reasons in a cross-arch makepkg chroot.
Note that the stages use upstream arch and parabola PKGBUILDs and attempt to
apply custom patches to resolve unbuildable or missing dependencies, and fix
-risc-v specific build issues. Look for these patches in src/stageX/patches and
-be prepared to fix and adapt them for future porting efforts.
+architecture specific build issues. Look for these patches in
+src/stage$X/patches/* and be prepared to fix and adapt them for future porting
+efforts.
2.1. Stage 1
------------
@@ -148,7 +145,8 @@ sysroot of the compiler available to builds in the chroot and vice-versa, the
To build the packages, the DEPTREE is traversed and packages are cross-compiled
using upstream PKGBUILDs and custom patches, and the compiled packages are
-installed into the chroot immediately.
+installed into the chroot immediately. For this stage, the patches are
+mandatory for each built package.
Note that this process is a bit fragile and dependent on arbitrary
particularities of the host system, and thus might fail for subtle reasons,
@@ -162,8 +160,9 @@ Stage 3 uses the cross-compiled makepkg chroot created in Stage 2 to natively
recompile the base-devel group of packages. This stage requires to build more
packages, since a reduced set of make-time dependencies need to be present in
the makepkg chroot, as well as runtime dependencies. Additionally, running the
-cross-compiled native compiler instead of the cross compiler takes longer. As a
-result, stage 3 is expected to takes much longer than stage 2.
+cross-compiled native compiler instead of the cross compiler takes longer,
+since user-mode emulation needs to be applied. As a result, stage 3 is expected
+to takes much longer than stage 2.
However, since now the process is isolated from the host systems installed
packages, since everything is built cleanly in a chroot, the process is much
@@ -172,16 +171,17 @@ more stable and less prone to hard to diagnose problems with the host system.
The scripts create a clean librechroot from the cross-compiled packages
produced in stage 2. A modified libremakepkg script is created to perform
config fragment regeneration and to skip the check() phase, and then packages
-are built in order.
+are built in order of the DEPTREE.
-Since no cross-compilation is needed from stage 3 onwards, fewer packages need
-patching, and the patches are typically smaller and apply less pressure. As a
+Since no cross-compilation is needed from stage 3 onwards, the patches are no
+longer required for each package. Fewer packages need patching, and the patches
+are typically smaller and apply less pressure to the build recipes. As a
consequence, the patches probably need less maintenance in the future, and less
work to adapt to a different architecture.
Note that the cross-compiled packages from stage 3 can be a bit derpy at times,
hence the stage 3 build scripts prioritize building bash and make natively, to
-avoid some very weird known issues down the line.
+avoid some known issues down the line.
2.4. Stage 4
------------
@@ -193,17 +193,20 @@ and the packages of the base group are added to the DEPTREE.
Stage 4 relies entirely on the packages natively compiled in stage 3, and no
cross-compiled packages are present in the build chroot at any time. This
results in reliable builds and reproducible build failures. However, since the
-number of packages to be built in stage 4 is close to 750, expect the builds to
-take a long time (days / weeks, not including work required to fix broken
-patches and builds).
+number of packages to be built in stage 4 is again much larger, expect the
+builds to take a long time (days / weeks, not including work required to fix
+broken patches and builds).
The result of stage 4 is a repository of packages that should allow to
-bootstrap and boot a risc-v virtual machine, with the packages required to
-build the entirety of the arch / parabola package repository. At this point, I
-consider the bootstrap process done.
+bootstrap and boot a virtual machine of the bootstrapped architecture, with the
+packages required to build the entirety of the arch / parabola package
+repository. At this point, the port becomes self-hosting and I consider the
+bootstrap process done. Note that a bootloader is missing from the bootstrap
+process, but this can easily be built manually after stage4 using the
+bootstrapped makepkg chroot.
-3. Final Words
-==============
+3. Acknowledgements
+===================
I would like to thank the awesome abaumann from the archlinux32 project for
pointers on how to bootstrap a PKGBUILD based system for a new architecture,
@@ -226,3 +229,16 @@ much work it really is to get a port like this off the ground. I could not have
made it this far without your work.
― Andreas Grapentin, 2018-04-18
+
+------------------------------------------------------------------------------
+
+After finishing the risc-v bootstrap, I didn't expect to revisit this
+repository so soon. Now, after bootstrapping parabola for powerpc64le, I was
+very pleased with how well the scripts held up to the new architecture and how
+easily everything came together, despite a couple of bumps in the road.
+
+I realize again that this would not have been possible without the people
+listed above - abaumann from archlinux32 and the fedora crew (including, of
+course, the amazing people working on ppc64le fedora). Thank you.
+
+ ― Andreas Grapentin, 2018-06-22
diff --git a/config/config.powerpc64le.sh b/config/config.powerpc64le.sh
index 01af547..6a118d8 100644
--- a/config/config.powerpc64le.sh
+++ b/config/config.powerpc64le.sh
@@ -34,13 +34,14 @@ export PLATFORM_CFLAGS=()
# flags added to the gcc PKGBUILD configure call
export GCC_CONFIG_FLAGS=(
"--with-cpu=power8"
- "--with-long-double-128")
+ "--with-long-double-128"
+ "--enable-targets=powerpcle-linux")
# multilib configuration, uncomment if applicable
-#export MULTILIB=enable
-#export CARCH32=""
-#export CHOST32=""
-#export PLATFORM32_CFLAGS=()
+export MULTILIB=enable
+export CARCH32="powerpcle"
+export CHOST32="$CARCH32-unknown-linux-gnu"
+export PLATFORM32_CFLAGS=("-m32")
# configure build directories
export TOPBUILDDIR="$startdir/build/$CARCH"
diff --git a/src/blacklist.txt b/src/blacklist.txt
index a4521ea..2742336 100644
--- a/src/blacklist.txt
+++ b/src/blacklist.txt
@@ -20,8 +20,6 @@ jre8-openjdk-headless:build broken
jdk9-openjdk:build broken
jre9-openjdk:build broken
jre9-openjdk-headless:build broken
-lib32-gcc-libs:no multilib
-lib32-glibc:no multilib
libreoffice-fresh:depends on java-environment
libreoffice-still:depends on java-environment
libunwind:no port exists
diff --git a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
index 23333f3..9e08603 100644
--- a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
@@ -27,7 +27,6 @@ build() {
./configure --target=$_target \
--prefix=/usr \
--with-sysroot=/usr/$_target \
- --@MULTILIB@-multilib \
--disable-werror \
--disable-nls \
--with-expat=yes \
diff --git a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
index fb7f0a8..4b5b36d 100644
--- a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
@@ -59,7 +59,6 @@ build() {
$srcdir/gcc/configure \
--target=$_target \
- @GCC_CONFIG_FLAGS@ \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
@@ -82,7 +81,8 @@ build() {
--disable-nls \
--@MULTILIB@-multilib \
--disable-bootstrap \
- --enable-checking=release
+ --enable-checking=release \
+ @GCC_CONFIG_FLAGS@
make inhibit-libc=true all-gcc
make inhibit-libc=true all-target-libgcc
diff --git a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
index 1f1dae3..fdf7f53 100644
--- a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
@@ -59,7 +59,6 @@ build() {
$srcdir/gcc/configure \
--target=$_target \
- @GCC_CONFIG_FLAGS@ \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
@@ -77,7 +76,8 @@ build() {
--disable-nls \
--@MULTILIB@-multilib \
--disable-bootstrap \
- --enable-checking=release
+ --enable-checking=release \
+ @GCC_CONFIG_FLAGS@
make
}
diff --git a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
index 3ff965c..d5b0e7b 100644
--- a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
@@ -80,8 +80,8 @@ build() {
CFLAGS=${CFLAGS/-fno-plt/}
CXXFLAGS=${CXXFLAGS/-fno-plt/}
- CFLAGS="$CFLAGS -mcmodel=medlow -g -O2 @PLATFORM32_CFLAGS@" \
- ASFLAGS="$ASFLAGS -mcmodel=medlow @PLATFORM32_CFLAGS@" \
+ CFLAGS="$CFLAGS -g -O2 @PLATFORM32_CFLAGS@" \
+ ASFLAGS="$ASFLAGS @PLATFORM32_CFLAGS@" \
"$srcdir/glibc-$pkgver/configure" \
--host=@CHOST32@ \
--libdir=/usr/lib32 \
@@ -102,13 +102,13 @@ build() {
}
package() {
- cd glibc-build
+ cd "$srcdir/glibc-build"
make install_root=$pkgdir/usr/$_target install
[ "x@MULTILIB@" == "xenable" ] || return 0
- cd lib32-glibc-build
+ cd "$srcdir/lib32-glibc-build"
make install_root=$pkgdir/usr/$_target install
}
diff --git a/src/stage2/patches/generic/binutils.patch b/src/stage2/patches/generic/binutils.patch
index 6f0895c..b7b6710 100644
--- a/src/stage2/patches/generic/binutils.patch
+++ b/src/stage2/patches/generic/binutils.patch
@@ -1,34 +1,7 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:42:42.595035360 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,14 +45,14 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
+--- a/PKGBUILD 2018-06-20 07:56:40.877881835 +0200
++++ b/PKGBUILD 2018-06-20 11:07:26.331329370 +0200
+@@ -51,6 +51,7 @@ build() {
cd binutils-build
"$srcdir/binutils-$pkgver/configure" \
@@ -36,7 +9,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--prefix=/usr \
--with-lib-path=/usr/lib:/usr/local/lib \
--with-bugurl=https://bugs.archlinux.org/ \
-@@ -66,7 +68,7 @@ build() {
+@@ -66,7 +67,7 @@ build() {
--disable-gdb \
--disable-werror \
--with-pic \
diff --git a/src/stage2/patches/generic/gcc.patch b/src/stage2/patches/generic/gcc.patch
index 98d6f8c..354d8a8 100644
--- a/src/stage2/patches/generic/gcc.patch
+++ b/src/stage2/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-25 10:15:30.533015789 +0200
-+++ b/PKGBUILD 2018-05-25 10:18:49.539689424 +0200
+--- a/PKGBUILD 2018-06-19 08:33:15.147041639 +0200
++++ b/PKGBUILD 2018-06-19 08:56:49.223722416 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -230,3 +230,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +355,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage2/patches/generic/glibc.patch b/src/stage2/patches/generic/glibc.patch
index 6be827b..6408bd9 100644
--- a/src/stage2/patches/generic/glibc.patch
+++ b/src/stage2/patches/generic/glibc.patch
@@ -1,6 +1,6 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-19 20:29:56.917412596 +0200
-+++ b/PKGBUILD 2018-05-19 20:33:17.550747931 +0200
+--- a/PKGBUILD 2018-06-18 22:54:08.616694943 +0200
++++ b/PKGBUILD 2018-06-18 22:55:09.746695552 +0200
@@ -6,7 +6,8 @@
# NOTE: valgrind requires rebuilt with each major glibc version
@@ -27,15 +27,29 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--enable-stack-protector=strong
--enable-stackguard-randomization
--enable-static-pie
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +89,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="@CHOST@-gcc @PLATFORM32_CFLAGS@"
++ export CXX="@CHOST@-g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +106,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
@@ -164,8 +168,8 @@ package_glibc() {
"$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
diff --git a/src/stage2/patches/powerpc64le/binutils.patch b/src/stage2/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..c8392a8
--- /dev/null
+++ b/src/stage2/patches/powerpc64le/binutils.patch
@@ -0,0 +1,27 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-20 07:56:40.877881835 +0200
++++ b/PKGBUILD 2018-06-20 11:06:02.564661867 +0200
+@@ -51,6 +51,7 @@ build() {
+ cd binutils-build
+
+ "$srcdir/binutils-$pkgver/configure" \
++ --host=@CHOST@ --build=@BUILDHOST@ \
+ --prefix=/usr \
+ --with-lib-path=/usr/lib:/usr/local/lib \
+ --with-bugurl=https://bugs.archlinux.org/ \
+@@ -61,12 +62,13 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
+ --with-pic \
+- --with-system-zlib
++ --with-system-zlib=@SYSROOT@/usr/lib/libz.so
+
+ make configure-host
+ make tooldir=/usr
diff --git a/src/stage3/patches/generic/binutils.patch b/src/stage3/patches/generic/binutils.patch
deleted file mode 100644
index 893089d..0000000
--- a/src/stage3/patches/generic/binutils.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:44:11.358369579 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,8 +45,7 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
diff --git a/src/stage3/patches/generic/gcc.patch b/src/stage3/patches/generic/gcc.patch
index 1b88c31..575521d 100644
--- a/src/stage3/patches/generic/gcc.patch
+++ b/src/stage3/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-26 12:05:20.233145125 +0200
-+++ b/PKGBUILD 2018-05-26 12:56:33.449842456 +0200
+--- a/PKGBUILD 2018-06-20 10:31:33.911307893 +0200
++++ b/PKGBUILD 2018-06-20 20:05:11.994984639 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -220,3 +220,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +346,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage3/patches/generic/glibc.patch b/src/stage3/patches/generic/glibc.patch
index ca64f4c..4531ac5 100644
--- a/src/stage3/patches/generic/glibc.patch
+++ b/src/stage3/patches/generic/glibc.patch
@@ -1,7 +1,7 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-06-10 02:55:37.495747371 +0200
-+++ b/PKGBUILD 2018-06-10 08:10:22.642602471 +0200
-@@ -6,13 +6,15 @@
+--- a/PKGBUILD 2018-06-18 09:36:19.679550645 +0200
++++ b/PKGBUILD 2018-06-19 15:05:54.550610043 +0200
+@@ -6,13 +6,14 @@
# NOTE: valgrind requires rebuilt with each major glibc version
pkgbase=glibc
@@ -14,12 +14,11 @@ diff -rupN a/PKGBUILD b/PKGBUILD
url='http://www.gnu.org/software/libc'
license=(GPL LGPL)
-makedepends=(git gd lib32-gcc-libs)
-+makedepends=(git gd)
+[ "x@MULTILIB@" != "xenable" ] || makedepends+=(lib32-gcc-libs)
options=(!strip staticlibs)
_commit=23158b08a0908f381459f273a984c6fd328363cb
#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit
-@@ -53,10 +55,10 @@ build() {
+@@ -53,10 +54,10 @@ build() {
--enable-add-ons
--enable-bind-now
--enable-lock-elision
@@ -32,7 +31,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--disable-profile
--disable-werror
)
-@@ -70,6 +70,8 @@ build() {
+@@ -70,6 +71,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
@@ -41,12 +40,34 @@ diff -rupN a/PKGBUILD b/PKGBUILD
"$srcdir/glibc/configure" \
--libdir=/usr/lib \
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +90,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="gcc @PLATFORM32_CFLAGS@"
++ export CXX="g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +107,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
+@@ -117,7 +122,6 @@ build() {
+ echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
+ make
+-
+ }
+
+ check() {
diff --git a/src/stage3/patches/powerpc64le/binutils.patch b/src/stage3/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..b85c25c
--- /dev/null
+++ b/src/stage3/patches/powerpc64le/binutils.patch
@@ -0,0 +1,13 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:36:34.209550790 +0200
++++ b/PKGBUILD 2018-06-20 08:01:20.661217960 +0200
+@@ -61,7 +61,8 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
diff --git a/src/stage3/stage3.sh b/src/stage3/stage3.sh
index 4722edb..342862b 100755
--- a/src/stage3/stage3.sh
+++ b/src/stage3/stage3.sh
@@ -35,6 +35,8 @@ stage3_makepkg() {
# substitute common variables
sed "s#@MULTILIB@#${MULTILIB:-disable}#g; \
s#@PLATFORM_CFLAGS@#${PLATFORM_CFLAGS[*]}#g; \
+ s#@CHOST32@#${CHOST32}#g; \
+ s#@PLATFORM32_CFLAGS@#${PLATFORM32_CFLAGS[*]}#g; \
s#@GCC_CONFIG_FLAGS@#${GCC_CONFIG_FLAGS[*]}#g" \
PKGBUILD.in > PKGBUILD
diff --git a/src/stage4/patches/generic/binutils.patch b/src/stage4/patches/generic/binutils.patch
deleted file mode 100644
index 893089d..0000000
--- a/src/stage4/patches/generic/binutils.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:44:11.358369579 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,8 +45,7 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
diff --git a/src/stage4/patches/generic/gcc.patch b/src/stage4/patches/generic/gcc.patch
index 4bb7c5e..8a19896 100644
--- a/src/stage4/patches/generic/gcc.patch
+++ b/src/stage4/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-06-07 04:45:58.776560502 +0200
-+++ b/PKGBUILD 2018-06-07 11:52:53.533482750 +0200
+--- a/PKGBUILD 2018-06-18 09:38:54.252885520 +0200
++++ b/PKGBUILD 2018-06-20 20:07:49.301652884 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -213,3 +213,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +350,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage4/patches/generic/glibc.patch b/src/stage4/patches/generic/glibc.patch
index ca64f4c..68cb28e 100644
--- a/src/stage4/patches/generic/glibc.patch
+++ b/src/stage4/patches/generic/glibc.patch
@@ -32,7 +32,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--disable-profile
--disable-werror
)
-@@ -70,6 +70,8 @@ build() {
+@@ -70,6 +72,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
@@ -41,12 +41,34 @@ diff -rupN a/PKGBUILD b/PKGBUILD
"$srcdir/glibc/configure" \
--libdir=/usr/lib \
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +91,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="gcc @PLATFORM32_CFLAGS@"
++ export CXX="g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +108,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
+@@ -117,7 +123,6 @@ build() {
+ echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
+ make
+-
+ }
+
+ check() {
diff --git a/src/stage4/patches/generic/grub.patch b/src/stage4/patches/generic/grub.patch
new file mode 100644
index 0000000..7787421
--- /dev/null
+++ b/src/stage4/patches/generic/grub.patch
@@ -0,0 +1,58 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:38:57.866218889 +0200
++++ b/PKGBUILD 2018-06-21 11:19:08.038865128 +0200
+@@ -7,7 +7,7 @@
+ # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
+
+ ## '1' to enable Xen support, '0' to disable
+-_XEN='1'
++_XEN='0'
+
+ ## '1' to enable IA32-EFI build in Arch x86_64, '0' to disable
+ _IA32_EFI_IN_ARCH_X64='1'
+@@ -351,7 +351,7 @@ _build_grub-ieee1275() {
+ msg 'Run ./configure for IEEE1275 (OpenFirmware) build'
+ ./configure \
+ --with-platform='ieee1275' \
+- --target='i386' \
++ --target="$CARCH" \
+ --disable-efiemu \
+ --enable-mm-debug \
+ --enable-nls \
+@@ -560,6 +560,11 @@ _build_grub-uboot() {
+ build() {
+ cd "${srcdir}/grub-${pkgver}/"
+
++ if [[ "${CARCH}" = 'powerpc64le' ]]; then
++ msg "Build grub ieee1275 stuff"
++ _build_grub-ieee1275
++ fi
++
+ if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
+ msg "Build grub ${_EFI_ARCH} EFI stuff"
+ _build_grub-efi
+@@ -661,9 +666,9 @@ _package_grub-ieee1275() {
+ make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
+
+ msg 'Remove gdb debugging related files for IEEE1275 (OpenFirmware) build'
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.module || true
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.image || true
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/*.module || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/*.image || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
+ }
+
+ _package_grub-libreboot() {
+@@ -728,6 +733,11 @@ package_grub() {
+
+ cd "${srcdir}/grub-${pkgver}/"
+
++ if [[ "${CARCH}" = 'powerpc64le' ]]; then
++ msg "Package grub ieee1275 stuff"
++ _package_grub-ieee1275
++ fi
++
+ if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
+ msg "Package grub ${_EFI_ARCH} EFI stuff"
+ _package_grub-efi
diff --git a/src/stage4/patches/powerpc64le/binutils.patch b/src/stage4/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..b85c25c
--- /dev/null
+++ b/src/stage4/patches/powerpc64le/binutils.patch
@@ -0,0 +1,13 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:36:34.209550790 +0200
++++ b/PKGBUILD 2018-06-20 08:01:20.661217960 +0200
+@@ -61,7 +61,8 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
diff --git a/src/stage4/stage4.sh b/src/stage4/stage4.sh
index 9b9b81a..e5154c6 100644
--- a/src/stage4/stage4.sh
+++ b/src/stage4/stage4.sh
@@ -35,6 +35,8 @@ stage4_makepkg() {
# substitute common variables
sed "s#@MULTILIB@#${MULTILIB:-disable}#g; \
s#@PLATFORM_CFLAGS@#${PLATFORM_CFLAGS[*]}#g; \
+ s#@CHOST32@#${CHOST32}#g; \
+ s#@PLATFORM32_CFLAGS@#${PLATFORM32_CFLAGS[*]}#g; \
s#@GCC_CONFIG_FLAGS@#${GCC_CONFIG_FLAGS[*]}#g" \
PKGBUILD.in > PKGBUILD