1 |
commit: 272d0006341034d108ca2335d41f75835099384b |
2 |
Author: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 5 18:18:56 2018 +0000 |
4 |
Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 5 18:18:56 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=272d0006 |
7 |
|
8 |
helps a tiny bit to actually tell catalyst to use the new value |
9 |
|
10 |
catalyst/targets/livecd_stage2.py | 2 +- |
11 |
targets/support/bootloader-setup.sh | 19 ++++++++++++-- |
12 |
targets/support/create-iso.sh | 2 +- |
13 |
targets/support/functions.sh | 52 +++++++++++++++++++++++++++++++++---- |
14 |
4 files changed, 66 insertions(+), 9 deletions(-) |
15 |
|
16 |
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py |
17 |
index 63f77ac3..b7ab0fb8 100644 |
18 |
--- a/catalyst/targets/livecd_stage2.py |
19 |
+++ b/catalyst/targets/livecd_stage2.py |
20 |
@@ -18,7 +18,7 @@ class livecd_stage2(StageBase): |
21 |
self.valid_values=[] |
22 |
|
23 |
self.valid_values.extend(self.required_values) |
24 |
- self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\ |
25 |
+ self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm","livecd/depclean"\ |
26 |
"livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\ |
27 |
"livecd/readme","livecd/motd","livecd/overlay",\ |
28 |
"livecd/modblacklist","livecd/splash_theme","livecd/rcadd",\ |
29 |
|
30 |
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh |
31 |
index 33e26874..9da6c969 100755 |
32 |
--- a/targets/support/bootloader-setup.sh |
33 |
+++ b/targets/support/bootloader-setup.sh |
34 |
@@ -5,7 +5,20 @@ source ${clst_shdir}/support/filesystem-functions.sh |
35 |
|
36 |
# $1 is the destination root |
37 |
|
38 |
-extract_cdtar $1 |
39 |
+# We handle boot loader a little special. Most arches require a cdtar with bootloader files |
40 |
+# but we can generate one for amd64/x86 now |
41 |
+if [ -n "${clst_cdtar}" ] |
42 |
+then |
43 |
+ extract_cdtar $1 |
44 |
+elif [ "${clst_buildarch}" = "x86" ] || [ "${clst_buildarch}" = "amd64" ] |
45 |
+then |
46 |
+ #assume if there is no cdtar and we are on a support arch that the user just wants us to handle this |
47 |
+ create_bootloader $1 |
48 |
+else |
49 |
+ #While this seems a little crazy, it's entirely possible the bootloader is just shoved in isoroot overlay |
50 |
+ echo "No cdtar and unable to auto generate boot loader files... good luck" |
51 |
+fi |
52 |
+ |
53 |
extract_kernels $1/boot |
54 |
check_bootargs |
55 |
check_filesystem_type |
56 |
@@ -340,8 +353,10 @@ case ${clst_hostarch} in |
57 |
fi |
58 |
|
59 |
# GRUB2 |
60 |
- if [ -d $1/grub ] |
61 |
+ if [ -d $1/grub ] || [ -f "$1/boot/EFI/BOOT/BOOTX64.EFI" ] |
62 |
then |
63 |
+ #the grub dir may not exist, better safe than sorry |
64 |
+ [ -d "$1/grub" ] || mkdir -p "$1/grub" |
65 |
if [ -e $1/isolinux/isolinux.bin ] |
66 |
then |
67 |
kern_subdir=/isolinux |
68 |
|
69 |
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh |
70 |
index 2c40f713..607a89aa 100755 |
71 |
--- a/targets/support/create-iso.sh |
72 |
+++ b/targets/support/create-iso.sh |
73 |
@@ -269,7 +269,7 @@ case ${clst_hostarch} in |
74 |
mkdir -p "${clst_target_path}"/boot |
75 |
else |
76 |
echo "Preparing EFI boot image" |
77 |
- # prepare gentoo.efimg from cdtar's /boot/EFI dir |
78 |
+ # prepare gentoo.efimg from clst_target_path /boot/EFI dir |
79 |
iaSizeTemp=$(du -sk "${clst_target_path}/boot/EFI" 2>/dev/null) |
80 |
iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) |
81 |
iaSize=$((${iaSizeB}+32)) # Add slack |
82 |
|
83 |
diff --git a/targets/support/functions.sh b/targets/support/functions.sh |
84 |
index cca2fd82..8eea1a07 100755 |
85 |
--- a/targets/support/functions.sh |
86 |
+++ b/targets/support/functions.sh |
87 |
@@ -53,13 +53,55 @@ extract_cdtar() { |
88 |
# $clst_target_path. We extract the "cdtar" to this directory, |
89 |
# which will normally contains a pre-built binary |
90 |
# boot-loader/filesystem skeleton for the ISO. |
91 |
- cdtar=${clst_cdtar} |
92 |
- if [ -z "${cdtar}" ] |
93 |
- then |
94 |
- echo "No cdtar specified. Skipping." |
95 |
+ tar -I lbzip2 -xpf ${clst_cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}" |
96 |
+} |
97 |
+ |
98 |
+generate_bootloader() { |
99 |
+ # For amd64 and x86 we attempt to copy boot loader files from the live system and configure it right |
100 |
+ # this prevents (among other issues) needing to keep a cdtar up to date. All files are thrown into $clst_target_path |
101 |
+ # Future improvement may make bootloaders optional, but for now there is only one option |
102 |
+ if [ "${clst_buildarch}" = "amd64" ]; then |
103 |
+ if [ -x "/usr/bin/grub2-mkstandalone" ]; then |
104 |
+ grubmkstndaln="/usr/bin/grub2-mkstandalone" |
105 |
+ elif [ -x "/usr/bin/grub-mkstandalone" ]; then |
106 |
+ grubmkstndaln="/usr/bin/grub-mkstandalone" |
107 |
+ else |
108 |
+ die "Unable to find grub-mkstandalone\n" |
109 |
+ fi |
110 |
+ # while $1/grub is unused here, it triggers grub config building in bootloader-setup.sh |
111 |
+ mkdir -p "$1/boot/EFI/BOOT" "$1/grub" |
112 |
+ grub-stub="$(mktemp)" |
113 |
+ echo "search --no-floppy --set=root --file /livecd" > "${grub-stub}" |
114 |
+ echo "configfile /grub/grub.cfg" >> "${grub-stub}" |
115 |
+ ${grubmkstndaln} /boot/grub/grub.cfg="${grub-stub}" --compress=xz -O x86_64-efi -o "$1/boot/EFI/BOOT/BOOTX64.EFI" --themes= || die "${grubmkstndaln} failed" |
116 |
+ rm "${grub-stub}" |
117 |
+ fi |
118 |
+ |
119 |
+ mkdir -p "$1/isolinux" |
120 |
+ echo "Gentoo Linux Installation LiveCD http://www.gentoo.org/" > "$1/isolinux/boot.msg" |
121 |
+ echo "Enter to boot; F1 for kernels F2 for options." >> "$1/isolinux/boot.msg" |
122 |
+ echo "Press any key in the next 15 seconds or we'll try to boot from disk." >> "$1/isolinux/boot.msg" |
123 |
+ if [ -f /usr/share/syslinux/isolinux.bin ]; then |
124 |
+ cp /usr/share/syslinux/isolinux.bin "$1/isolinux/" |
125 |
else |
126 |
- tar -I lbzip2 -xpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}" |
127 |
+ die "Unable to find isolinux.bin, which was requested" |
128 |
fi |
129 |
+ if [ -f /boot/memtest86plus/memtest ]; then |
130 |
+ cp /boot/memtest86plus/memtest "$1/isolinux/" |
131 |
+ else |
132 |
+ die "Unable to find memtest, which was requested." |
133 |
+ fi |
134 |
+ if [ -f "/usr/share/syslinux/hdt.c32" ]; then |
135 |
+ cp /usr/share/syslinux/hdt.c32 "$1/isolinux/" |
136 |
+ if [ -f "/usr/share/misc/pci.ids" ]; then |
137 |
+ cp /usr/share/misc/pci.ids "$1/isolinux/" |
138 |
+ fi |
139 |
+ fi |
140 |
+ for i in libcom32.c32 libutil.c32 ldlinux.c32 reboot.c32 vesamenu.c32; do |
141 |
+ if [ -f "/usr/share/syslinux/${i}" ]; then |
142 |
+ cp "/usr/share/syslinux/${i}" "$1/isolinux/" |
143 |
+ fi |
144 |
+ done |
145 |
} |
146 |
|
147 |
extract_kernels() { |