public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Richard Farina" <zerochaos@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/, catalyst/targets/
Date: Thu,  5 Apr 2018 18:19:05 +0000 (UTC)	[thread overview]
Message-ID: <1522952336.272d0006341034d108ca2335d41f75835099384b.zerochaos@gentoo> (raw)

commit:     272d0006341034d108ca2335d41f75835099384b
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  5 18:18:56 2018 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Apr  5 18:18:56 2018 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=272d0006

helps a tiny bit to actually tell catalyst to use the new value

 catalyst/targets/livecd_stage2.py   |  2 +-
 targets/support/bootloader-setup.sh | 19 ++++++++++++--
 targets/support/create-iso.sh       |  2 +-
 targets/support/functions.sh        | 52 +++++++++++++++++++++++++++++++++----
 4 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 63f77ac3..b7ab0fb8 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -18,7 +18,7 @@ class livecd_stage2(StageBase):
 		self.valid_values=[]
 
 		self.valid_values.extend(self.required_values)
-		self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\
+		self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm","livecd/depclean"\
 			"livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\
 			"livecd/readme","livecd/motd","livecd/overlay",\
 			"livecd/modblacklist","livecd/splash_theme","livecd/rcadd",\

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 33e26874..9da6c969 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -5,7 +5,20 @@ source ${clst_shdir}/support/filesystem-functions.sh
 
 # $1 is the destination root
 
-extract_cdtar $1
+# We handle boot loader a little special.  Most arches require a cdtar with bootloader files
+# but we can generate one for amd64/x86 now
+if [ -n "${clst_cdtar}" ]
+then
+	extract_cdtar $1
+elif [ "${clst_buildarch}" = "x86" ] || [ "${clst_buildarch}" = "amd64" ]
+then
+	#assume if there is no cdtar and we are on a support arch that the user just wants us to handle this
+	create_bootloader $1
+else
+	#While this seems a little crazy, it's entirely possible the bootloader is just shoved in isoroot overlay
+	echo "No cdtar and unable to auto generate boot loader files... good luck"
+fi
+
 extract_kernels $1/boot
 check_bootargs
 check_filesystem_type
@@ -340,8 +353,10 @@ case ${clst_hostarch} in
 		fi
 
 		# GRUB2
-		if [ -d $1/grub ]
+		if [ -d $1/grub ] || [ -f "$1/boot/EFI/BOOT/BOOTX64.EFI" ]
 		then
+			#the grub dir may not exist, better safe than sorry
+			[ -d "$1/grub" ] || mkdir -p "$1/grub"
 			if [ -e $1/isolinux/isolinux.bin ]
 			then
 				kern_subdir=/isolinux

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 2c40f713..607a89aa 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -269,7 +269,7 @@ case ${clst_hostarch} in
 				mkdir -p "${clst_target_path}"/boot
 			else
 				echo "Preparing EFI boot image"
-				# prepare gentoo.efimg from cdtar's /boot/EFI dir
+				# prepare gentoo.efimg from clst_target_path /boot/EFI dir
 				iaSizeTemp=$(du -sk "${clst_target_path}/boot/EFI" 2>/dev/null)
 				iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
 				iaSize=$((${iaSizeB}+32)) # Add slack

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index cca2fd82..8eea1a07 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -53,13 +53,55 @@ extract_cdtar() {
 	# $clst_target_path. We extract the "cdtar" to this directory,
 	# which will normally contains a pre-built binary
 	# boot-loader/filesystem skeleton for the ISO.
-	cdtar=${clst_cdtar}
-	if [ -z "${cdtar}" ]
-	then
-		echo "No cdtar specified. Skipping."
+	tar -I lbzip2 -xpf ${clst_cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
+}
+
+generate_bootloader() {
+	# For amd64 and x86 we attempt to copy boot loader files from the live system and configure it right
+	# this prevents (among other issues) needing to keep a cdtar up to date.  All files are thrown into $clst_target_path
+	# Future improvement may make bootloaders optional, but for now there is only one option
+	if [ "${clst_buildarch}" = "amd64" ]; then
+		if [ -x "/usr/bin/grub2-mkstandalone" ]; then
+			grubmkstndaln="/usr/bin/grub2-mkstandalone"
+		elif [ -x "/usr/bin/grub-mkstandalone" ]; then
+			grubmkstndaln="/usr/bin/grub-mkstandalone"
+		else
+			die "Unable to find grub-mkstandalone\n"
+		fi
+		# while $1/grub is unused here, it triggers grub config building in bootloader-setup.sh
+		mkdir -p "$1/boot/EFI/BOOT" "$1/grub"
+		grub-stub="$(mktemp)"
+		echo "search --no-floppy --set=root --file /livecd" > "${grub-stub}"
+		echo "configfile /grub/grub.cfg" >> "${grub-stub}"
+		${grubmkstndaln} /boot/grub/grub.cfg="${grub-stub}" --compress=xz -O x86_64-efi -o "$1/boot/EFI/BOOT/BOOTX64.EFI" --themes= || die "${grubmkstndaln} failed"
+		rm "${grub-stub}"
+	fi
+
+	mkdir -p "$1/isolinux"
+	echo "Gentoo Linux Installation LiveCD                         http://www.gentoo.org/" > "$1/isolinux/boot.msg"
+	echo "Enter to boot; F1 for kernels  F2 for options." >> "$1/isolinux/boot.msg"
+	echo "Press any key in the next 15 seconds or we'll try to boot from disk." >> "$1/isolinux/boot.msg"
+	if [ -f /usr/share/syslinux/isolinux.bin ]; then
+		cp /usr/share/syslinux/isolinux.bin "$1/isolinux/"
 	else
-		tar -I lbzip2 -xpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
+		die "Unable to find isolinux.bin, which was requested"
 	fi
+	if [ -f /boot/memtest86plus/memtest ]; then
+		cp /boot/memtest86plus/memtest "$1/isolinux/"
+	else
+		die "Unable to find memtest, which was requested."
+	fi
+	if [ -f "/usr/share/syslinux/hdt.c32" ]; then
+		cp /usr/share/syslinux/hdt.c32 "$1/isolinux/"
+		if [ -f "/usr/share/misc/pci.ids" ]; then
+			cp /usr/share/misc/pci.ids "$1/isolinux/"
+		fi
+	fi
+	for i in libcom32.c32 libutil.c32 ldlinux.c32 reboot.c32 vesamenu.c32; do
+		if [ -f "/usr/share/syslinux/${i}" ]; then
+			cp "/usr/share/syslinux/${i}" "$1/isolinux/"
+		fi
+	done
 }
 
 extract_kernels() {


             reply	other threads:[~2018-04-05 18:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 18:19 Richard Farina [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-13 20:33 [gentoo-commits] proj/catalyst:master commit in: targets/support/, catalyst/targets/ Andreas K. Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522952336.272d0006341034d108ca2335d41f75835099384b.zerochaos@gentoo \
    --to=zerochaos@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox