From 24db52325c5db349a662148344220140fb435d5e Mon Sep 17 00:00:00 2001
From: Roberto Oliveira <robertoguimaraes8@gmail.com>
Date: Fri, 28 Apr 2017 16:25:14 +0000
Subject: [PATCH] scripts: add support for ppc64le in vanilla configuration

To boot ppc64le we need to use grub with ieee1275 platform. Said that,
a new section to support grub ieee1275 was created.
Also needed to change xorrisofs command by grub-mkrescue, that is the one
used to create a bootable image for power and it is also a wrapper to xorriso.
---
 scripts/mkimg.base.sh     | 36 ++++++++++++++++++++++++------------
 scripts/mkimg.standard.sh |  1 +
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/scripts/mkimg.base.sh b/scripts/mkimg.base.sh
index 7eedb022e0a0..bcfcc7168e16 100755
--- a/scripts/mkimg.base.sh
+++ b/scripts/mkimg.base.sh
@@ -190,6 +190,13 @@ build_grubefi_img() {
 	mcopy -s -i ${DESTDIR}/boot/grub/efiboot.img $_tmpdir/efi ::
 }
 
+section_grubieee1275() {
+	[ "$ARCH" = ppc64le ] || return 0
+	[ "$output_format" = "iso" ] || return 0
+
+	build_section grub_cfg boot/grub/grub.cfg $(grub_gen_config | checksum)
+}
+
 section_grubefi() {
 	[ -n "$grub_mod" ] || return 0
 	[ "$output_format" = "iso" ] || return 0
@@ -249,18 +256,23 @@ create_image_iso() {
 				"
 		fi
 	fi
-	xorrisofs \
-		-quiet \
-		-output ${ISO} \
-		-full-iso9660-filenames \
-		-joliet \
-		-rock \
-		-volid "alpine-$PROFILE $RELEASE $ARCH" \
-		$_isolinux \
-		$_efiboot \
-		-follow-links \
-		${iso_opts} \
-		${DESTDIR}
+
+	if [ "$ARCH" = ppc64le ]; then
+		grub-mkrescue --output ${ISO} ${DESTDIR} -follow-links
+	else
+		xorrisofs \
+			-quiet \
+			-output ${ISO} \
+			-full-iso9660-filenames \
+			-joliet \
+			-rock \
+			-volid "alpine-$PROFILE $RELEASE $ARCH" \
+			$_isolinux \
+			$_efiboot \
+			-follow-links \
+			${iso_opts} \
+			${DESTDIR}
+	fi
 }
 
 create_image_targz() {
diff --git a/scripts/mkimg.standard.sh b/scripts/mkimg.standard.sh
index 54c7b8002182..6bc01e843145 100755
--- a/scripts/mkimg.standard.sh
+++ b/scripts/mkimg.standard.sh
@@ -10,6 +10,7 @@ profile_standard() {
 profile_vanilla() {
 	profile_standard
 	#arch="$arch aarch64"
+	arch="$arch ppc64le"
 	kernel_flavors="vanilla"
 	kernel_addons=
 }
-- 
GitLab