Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
To: gentoo-catalyst@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-catalyst] [PATCH 5/5] targets: Use GRUB for BIOS boot
Date: Wed, 08 Apr 2020 03:28:24
Message-Id: 20200408032753.105267-5-mattst88@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/5] targets: Drop SHA512 isoroot verification support by Matt Turner
1 grub-mkrescue produces an ISO that is bootable from EFI as well as from
2 the BIOS, so isolinux isn't necessary to accomplish that.
3
4 This patch has the side effect of removing the F[2-7] help texts and the
5 memtest86+ option, since those were done via isolinux. I feel okay
6 removing those since isolinux was only used on BIOS systems and not on
7 EFI, so none of those things were available to the vast majority of our
8 users.
9
10 Signed-off-by: Matt Turner <mattst88@g.o>
11 ---
12 doc/catalyst-spec.5.txt | 5 +-
13 examples/livecd-stage2_template.spec | 5 +-
14 livecd/files/x86-F2.msg | 22 ------
15 livecd/files/x86-F3.msg | 22 ------
16 livecd/files/x86-F4.msg | 20 -----
17 livecd/files/x86-F5.msg | 22 ------
18 livecd/files/x86-F6.msg | 14 ----
19 livecd/files/x86-F7.msg | 22 ------
20 targets/support/bootloader-setup.sh | 110 +--------------------------
21 targets/support/create-iso.sh | 68 +----------------
22 targets/support/functions.sh | 69 -----------------
23 11 files changed, 5 insertions(+), 374 deletions(-)
24 delete mode 100644 livecd/files/x86-F2.msg
25 delete mode 100644 livecd/files/x86-F3.msg
26 delete mode 100644 livecd/files/x86-F4.msg
27 delete mode 100644 livecd/files/x86-F5.msg
28 delete mode 100644 livecd/files/x86-F6.msg
29 delete mode 100644 livecd/files/x86-F7.msg
30
31 diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
32 index 03fdeecc..34c5c18d 100644
33 --- a/doc/catalyst-spec.5.txt
34 +++ b/doc/catalyst-spec.5.txt
35 @@ -203,10 +203,7 @@ Bootloader
36 This is required for livecd-stage2 on all arches except amd64 and x86 which can autogenerate one
37 if USE=system-bootloader is set.
38 The cdtar is essentially the bootloader for the CD. It also holds the
39 -main configuration for the bootloader. On x86/amd64, it also can
40 -include a small memory testing application, called memtest86+
41 -(example:
42 -`/usr/share/catalyst/livecd/cdtar/isolinux-2.13-memtest86+-cdtar.tar.bz2`).
43 +main configuration for the bootloader.
44
45 Kernel and boot issues
46 ~~~~~~~~~~~~~~~~~~~~~~
47 diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec
48 index 4cb94d40..7d8a09f7 100644
49 --- a/examples/livecd-stage2_template.spec
50 +++ b/examples/livecd-stage2_template.spec
51 @@ -100,10 +100,9 @@ livecd/fstype:
52 livecd/fsops:
53
54 # The cdtar is essentially the bootloader for the CD. It also holds the main
55 -# configuration for the bootloader. On x86/amd64, it also can include a small
56 -# memory testing application, called memtest86+.
57 +# configuration for the bootloader.
58 # example:
59 -# livecd/cdtar: /usr/share/catalyst/livecd/cdtar/isolinux-2.13-memtest86+-cdtar.tar.bz2
60 +# livecd/cdtar: /usr/share/catalyst/livecd/cdtar/[...].cdtar.tar.bz2
61 livecd/cdtar:
62
63 # This is the full path and filename to the ISO image that the livecd-stage2
64 diff --git a/livecd/files/x86-F2.msg b/livecd/files/x86-F2.msg
65 deleted file mode 100644
66 index eb1638b8..00000000
67 --- a/livecd/files/x86-F2.msg
68 +++ /dev/null
69 @@ -1,22 +0,0 @@
70 -Gentoo Linux LiveCD boot options - [F1 to display available kernels]
71 -
72 -Please hit F1 to see the available kernels on this livecd. Please note that
73 -the -nofb counterparts to each kernel disable the framebuffer
74 -and splash images. Additionally, the memtest86 boot option is available
75 -to test local RAM for errors. To use memtest86, just type 'memtest86'.
76 -
77 -This lists the possible command line options that can be used to tweak the boot
78 -process of this CD. This lists the Gentoo-specific options, along with a few
79 -options that are built-in to the kernel, but that have been proven very useful
80 -to our users. Also, all options that start with "do" have a "no" inverse, that
81 -does the opposite. For example, "doscsi" enables SCSI support in the initial
82 -ramdisk boot, while "noscsi" disables it.
83 -
84 -To list the options, please press keys from F3 through F7.
85 -
86 -F3: Hardware (Page 1)
87 -F4: Hardware (Page 2)
88 -F5: Hardware (Page 3)
89 -F6: Volume Management
90 -F7: Misc.
91 -
92 diff --git a/livecd/files/x86-F3.msg b/livecd/files/x86-F3.msg
93 deleted file mode 100644
94 index e0ec2bd8..00000000
95 --- a/livecd/files/x86-F3.msg
96 +++ /dev/null
97 @@ -1,22 +0,0 @@
98 -Hardware options (Page 1):
99 -acpi=on This loads support for ACPI and also causes the acpid daemon to
100 - be started by the CD on boot. This is only needed if your
101 - system requires ACPI to function properly. This is not
102 - required for Hyperthreading support.
103 -acpi=off Completely disables ACPI. This is useful on some older systems
104 - and is also a requirement for using APM. This will disable any
105 - Hyperthreading support of your processor.
106 -console=X This sets up serial console access for the CD. The first
107 - option is the device, usually ttyS0 on x86, followed by any
108 - connection options, which are comma separated. The default
109 - options are 9600,8,n,1.
110 -dmraid=X This allows for passing options to the device-mapper RAID
111 - subsystem. Options should be encapsulated in quotes.
112 -doapm This loads APM driver support. This requires you to also use
113 - acpi=off.
114 -dopcmcia This loads support for PCMCIA and Cardbus hardware and also
115 - causes the pcmcia cardmgr to be started by the CD on boot.
116 - This is only required when booting from PCMCIA/Cardbus devices.
117 -doscsi This loads support for most SCSI controllers. This is also a
118 - requirement for booting most USB devices, as they use the SCSI
119 - subsystem of the kernel.
120 diff --git a/livecd/files/x86-F4.msg b/livecd/files/x86-F4.msg
121 deleted file mode 100644
122 index 77ded0e3..00000000
123 --- a/livecd/files/x86-F4.msg
124 +++ /dev/null
125 @@ -1,20 +0,0 @@
126 -Hardware options (Page 2):
127 -hda=stroke This allows you to partition the whole hard disk even when your
128 - BIOS is unable to handle large disks. This option is only used
129 - on machines with an older BIOS. Replace hda with the device
130 - that is requiring this option.
131 -ide=nodma This forces the disabling of DMA in the kernel and is required
132 - by some IDE chipsets and also by some CDROM drives. If your
133 - system is having trouble reading from your IDE CDROM, try this
134 - option. This also disables the default hdparm settings from
135 - being executed.
136 -noapic This disables the Advanced Programmable Interrupt Controller
137 - that is present on newer motherboards. It has been known to
138 - cause some problems on older hardware.
139 -nodetect This disables all of the autodetection done by the CD,
140 - including device autodetection and DHCP probing. This is
141 - useful for doing debugging of a failing CD or driver.
142 -nodhcp This disables DHCP probing on detected network cards. This is
143 - useful on networks with only static addresses.
144 -nodmraid Disables support for device-mapper RAID, such as that used for
145 - on-board IDE/SATA RAID controllers.
146 diff --git a/livecd/files/x86-F5.msg b/livecd/files/x86-F5.msg
147 deleted file mode 100644
148 index adfb0197..00000000
149 --- a/livecd/files/x86-F5.msg
150 +++ /dev/null
151 @@ -1,22 +0,0 @@
152 -Hardware options (Page 3):
153 -nofirewire This disables the loading of Firewire modules. This should
154 - only be necessary if your Firewire hardware is causing
155 - a problem with booting the CD.
156 -nogpm This diables gpm console mouse support.
157 -nohotplug This disables the loading of the hotplug and coldplug init
158 - scripts at boot. This is useful for doing debugging of a
159 - failing CD or driver.
160 -nokeymap This disables the keymap selection used to select non-US
161 - keyboard layouts.
162 -nolapic This disables the local APIC on Uniprocessor kernels.
163 -nosata This disables the loading of Serial ATA modules. This is used
164 - if your system is having problems with the SATA subsystem.
165 -nosmp This disables SMP, or Symmetric Multiprocessing, on SMP-enabled
166 - kernels. This is useful for debugging SMP-related issues with
167 - certain drivers and motherboards.
168 -nosound This disables sound support and volume setting. This is useful
169 - for systems where sound support causes problems.
170 -nousb This disables the autoloading of USB modules. This is useful
171 - for debugging USB issues.
172 -slowusb This adds some extra pauses into the boot process for slow
173 - USB CDROMs, like in the IBM BladeCenter.
174 diff --git a/livecd/files/x86-F6.msg b/livecd/files/x86-F6.msg
175 deleted file mode 100644
176 index b61ee9c9..00000000
177 --- a/livecd/files/x86-F6.msg
178 +++ /dev/null
179 @@ -1,14 +0,0 @@
180 -Volume/Device Management:
181 -doevms This enables support for IBM's pluggable EVMS, or Enterprise
182 - Volume Management System. This is not safe to use with lvm2.
183 -dolvm This enables support for Linux's Logical Volume Management.
184 - This is not safe to use with evms2.
185 -Screen reader access:
186 -speakup.synth=synth starts speakup using a given synthesizer.
187 - supported synths are acntpc, acntsa, apollo, audptr, bns,
188 - decext, dectlk, dtlk, keypc, ltlk, spkout and txprt.
189 - Also, soft is supported for software speech and dummy is
190 - supported for testing.
191 -speakup.quiet=1 sets the synthesizer not to speak until a key is pressed.
192 -speakup_SYNTH.port=n sets the port for internal synthesizers.
193 -speakup_SYNTH.ser=n sets the serial port for external synthesizers.
194 diff --git a/livecd/files/x86-F7.msg b/livecd/files/x86-F7.msg
195 deleted file mode 100644
196 index 82306245..00000000
197 --- a/livecd/files/x86-F7.msg
198 +++ /dev/null
199 @@ -1,22 +0,0 @@
200 -Other options:
201 -debug Enables debugging code. This might get messy, as it displays
202 - a lot of data to the screen.
203 -docache This caches the entire runtime portion of the CD into RAM,
204 - which allows you to umount /mnt/cdrom and mount another CDROM.
205 - This option requires that you have at least twice as much
206 - available RAM as the size of the CD.
207 -doload=X This causes the initial ramdisk to load any module listed, as
208 - well as dependencies. Replace X with the module name.
209 - Multiple modules can be specified by a comma-separated list.
210 -noload=X This causes the initial ramdisk to skip the loading of a
211 - specific module that may be causing a problem. Syntax matches
212 - that of doload.
213 -nox This causes an X-enabled LiveCD to not automatically start X,
214 - but rather, to drop to the command line instead.
215 -scandelay This causes the CD to pause for 10 seconds during certain
216 - portions the boot process to allow for devices that are slow to
217 - initialize to be ready for use.
218 -scandelay=X This allows you to specify a given delay, in seconds, to be
219 - added to certain portions of the boot process to allow for
220 - devices that are slow to initialize to be ready for use.
221 - Replace X with the number of seconds to pause.
222 diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
223 index c52e0907..7414057f 100755
224 --- a/targets/support/bootloader-setup.sh
225 +++ b/targets/support/bootloader-setup.sh
226 @@ -5,15 +5,9 @@ source ${clst_shdir}/support/filesystem-functions.sh
227
228 # $1 is the destination root
229
230 -# We handle boot loader a little special. Most arches require a cdtar with bootloader files
231 -# but we can generate one for amd64/x86 now
232 if [ -n "${clst_cdtar}" ]
233 then
234 extract_cdtar $1
235 -elif [ "${clst_buildarch}" = "x86" ] || [ "${clst_buildarch}" = "amd64" ]
236 -then
237 - #assume if there is no cdtar and we are on a supported arch that the user just wants us to handle this
238 - create_bootloader $1
239 else
240 #While this seems a little crazy, it's entirely possible the bootloader is just shoved in isoroot overlay
241 echo "No cdtar and unable to auto generate boot loader files... good luck"
242 @@ -80,8 +74,7 @@ case ${clst_hostarch} in
243 echo "--recoverykernel=boot/${x}" >> ${icfg}
244 done
245 ;;
246 - ppc*|powerpc*|sparc*)
247 - # GRUB2 Openfirmware
248 + x86|amd64|ppc*|powerpc*|sparc*)
249 kern_subdir=/boot
250 iacfg=$1/boot/grub/grub.cfg
251 mkdir -p $1/boot/grub
252 @@ -155,107 +148,6 @@ case ${clst_hostarch} in
253 done
254 cp ${iacfg} $1/boot/efi/boot
255 ;;
256 - x86|amd64)
257 - if [ -e $1/isolinux/isolinux.bin ]
258 - then
259 - # the rest of this function sets up the config file for isolinux
260 - icfg=$1/isolinux/isolinux.cfg
261 - kmsg=$1/isolinux/kernels.msg
262 - echo "default ${first}" > ${icfg}
263 - echo "timeout 150" >> ${icfg}
264 - echo "ontimeout localhost" >> ${icfg}
265 - echo "prompt 1" >> ${icfg}
266 - echo "display boot.msg" >> ${icfg}
267 - echo "F1 kernels.msg" >> ${icfg}
268 - for k in {2..7}
269 - do
270 - echo "F${k} F${k}.msg" >> ${icfg}
271 - done
272 -
273 - echo "Available kernels:" > ${kmsg}
274 - for i in {2..7}
275 - do
276 - cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
277 - $1/isolinux/F$i.msg
278 - done
279 -
280 - for x in ${clst_boot_kernel}
281 - do
282 - eval custom_kopts=\$${x}_kernelopts
283 - echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
284 - echo >> ${icfg}
285 -
286 - eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
287 -
288 - if [ -n "${clst_kernel_softlevel}" ]
289 - then
290 - for y in ${clst_kernel_softlevel}
291 - do
292 - echo "label ${x}-${y}" >> ${icfg}
293 - echo " kernel /boot/${x}" >> ${icfg}
294 - echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg}
295 -
296 - echo >> ${icfg}
297 - echo " ${x}" >> ${kmsg}
298 - echo "label ${x}-${y}-nofb" >> ${icfg}
299 - echo " kernel /boot/${x}" >> ${icfg}
300 - echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg}
301 - echo >> ${icfg}
302 - echo " ${x}-nofb" >> ${kmsg}
303 - done
304 - else
305 - echo "label ${x}" >> ${icfg}
306 - echo " kernel /boot/${x}" >> ${icfg}
307 - echo " append ${default_append_line} initrd=/boot/${x}.igz vga=791" >> ${icfg}
308 - echo >> ${icfg}
309 - echo " ${x}" >> ${kmsg}
310 - echo "label ${x}-nofb" >> ${icfg}
311 - echo " kernel /boot/${x}" >> ${icfg}
312 - echo " append ${default_append_line} initrd=/boot/${x}.igz" >> ${icfg}
313 - echo >> ${icfg}
314 - echo " ${x}-nofb" >> ${kmsg}
315 - fi
316 - done
317 -
318 - if [ -f $1/isolinux/memtest86 ]
319 - then
320 - echo >> $icfg
321 - echo " memtest86" >> $kmsg
322 - echo "label memtest86" >> $icfg
323 - echo " kernel memtest86" >> $icfg
324 - fi
325 - echo >> $icfg
326 - echo "label localhost" >> $icfg
327 - echo " localboot -1" >> $icfg
328 - echo " MENU HIDE" >> $icfg
329 - fi
330 -
331 - # GRUB2
332 - if [ -d $1/grub ] || [ -f "$1/boot/EFI/BOOT/BOOTX64.EFI" ]
333 - then
334 - mkdir -p "$1/grub"
335 -
336 - iacfg=$1/grub/grub.cfg
337 - echo 'set default=0' > ${iacfg}
338 - echo 'set gfxpayload=keep' >> ${iacfg}
339 - echo 'set timeout=10' >> ${iacfg}
340 - echo 'insmod all_video' >> ${iacfg}
341 - echo '' >> ${iacfg}
342 - for x in ${clst_boot_kernel}
343 - do
344 - echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg}
345 - echo " linux /boot/${x} ${default_append_line}" >> ${iacfg}
346 - echo " initrd /boot/${x}.igz" >> ${iacfg}
347 - echo "}" >> ${iacfg}
348 - echo "" >> ${iacfg}
349 - echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {" >> ${iacfg}
350 - echo " linux /boot/${x} ${default_append_line} docache" >> ${iacfg}
351 - echo " initrd /boot/${x}.igz" >> ${iacfg}
352 - echo "}" >> ${iacfg}
353 - echo "" >> ${iacfg}
354 - done
355 - fi
356 - ;;
357 mips)
358 # NO SOFTLEVEL SUPPORT YET
359
360 diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
361 index 955fedd0..71b451c6 100755
362 --- a/targets/support/create-iso.sh
363 +++ b/targets/support/create-iso.sh
364 @@ -220,7 +220,7 @@ case ${clst_hostarch} in
365 *) die "SGI LiveCD(s) only support the 'squashfs' fstype!" ;;
366 esac
367 ;;
368 - ppc*|powerpc*|sparc*)
369 + x86|amd64|ppc*|powerpc*|sparc*)
370 isoroot_checksum
371
372 case ${clst_hostarch} in
373 @@ -230,71 +230,5 @@ case ${clst_hostarch} in
374 echo ">> Running grub-mkrescue to create iso image...."
375 grub-mkrescue ${extra_opts} -o "${1}" "${clst_target_path}"
376 ;;
377 - x86|amd64)
378 - # detect if an EFI bootloader is desired
379 - if [ -d "${clst_target_path}/boot/efi" ] || \
380 - [ -d "${clst_target_path}/boot/EFI" ] || \
381 - [ -e "${clst_target_path}/gentoo.efimg" ]
382 - then
383 - if [ -e "${clst_target_path}/gentoo.efimg" ]
384 - then
385 - echo "Found prepared EFI boot image at \
386 - ${clst_target_path}/gentoo.efimg"
387 - else
388 - echo "Preparing EFI boot image"
389 - if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d "${clst_target_path}/boot/EFI" ]; then
390 - echo "Moving /boot/efi to /boot/EFI"
391 - mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI"
392 - fi
393 - # prepare gentoo.efimg from clst_target_path /boot/EFI dir
394 - iaSizeTemp=$(du -sk "${clst_target_path}/boot/EFI" 2>/dev/null)
395 - iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
396 - iaSize=$((${iaSizeB}+64)) # add slack, tested near minimum for overhead
397 - echo "Creating loopback file of size ${iaSize}kB"
398 - dd if=/dev/zero of="${clst_target_path}/gentoo.efimg" bs=1k \
399 - count=${iaSize}
400 - echo "Formatting loopback file with FAT16 FS"
401 - mkfs.vfat -F 16 -n GENTOOLIVE "${clst_target_path}/gentoo.efimg"
402 -
403 - mkdir "${clst_target_path}/gentoo.efimg.mountPoint"
404 - echo "Mounting FAT16 loopback file"
405 - mount -t vfat -o loop "${clst_target_path}/gentoo.efimg" \
406 - "${clst_target_path}/gentoo.efimg.mountPoint" || die "Failed to mount EFI image file"
407 -
408 - echo "Populating EFI image file from ${clst_target_path}/boot/EFI"
409 - cp -rv "${clst_target_path}"/boot/EFI/ \
410 - "${clst_target_path}/gentoo.efimg.mountPoint" || die "Failed to populate EFI image file"
411 -
412 - umount "${clst_target_path}/gentoo.efimg.mountPoint"
413 - rmdir "${clst_target_path}/gentoo.efimg.mountPoint"
414 -
415 - echo "Copying /boot/EFI to /EFI for rufus compatability"
416 - cp -rv "${clst_target_path}"/boot/EFI/ "${clst_target_path}"
417 - fi
418 - fi
419 -
420 - if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]; then
421 - echo '** Found ISOLINUX bootloader'
422 - if [ -e "${clst_target_path}/gentoo.efimg" ]; then
423 - # have BIOS isolinux, plus an EFI loader image
424 - echo '** Found GRUB2 EFI bootloader'
425 - echo 'Creating ISO using both ISOLINUX and EFI bootloader'
426 - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/
427 - isohybrid --uefi "${1}"
428 - else
429 - echo 'Creating ISO using ISOLINUX bootloader'
430 - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
431 - isohybrid "${1}"
432 - fi
433 - elif [ -e "${clst_target_path}/gentoo.efimg" ]; then
434 - echo '** Found GRUB2 EFI bootloader'
435 - echo 'Creating ISO using EFI bootloader'
436 - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot "${clst_target_path}"/
437 - else
438 - echo '** Found no known bootloader'
439 - echo 'Creating ISO with fingers crossed that you know what you are doing...'
440 - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/
441 - fi
442 - ;;
443 esac
444 exit $?
445 diff --git a/targets/support/functions.sh b/targets/support/functions.sh
446 index d3414f80..4e226801 100755
447 --- a/targets/support/functions.sh
448 +++ b/targets/support/functions.sh
449 @@ -43,75 +43,6 @@ extract_cdtar() {
450 tar -I lbzip2 -xpf ${clst_cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
451 }
452
453 -create_bootloader() {
454 - # For amd64 and x86 we attempt to copy boot loader files from the live system and configure it right
455 - # this prevents (among other issues) needing to keep a cdtar up to date. All files are thrown into $clst_target_path
456 - # Future improvement may make bootloaders optional, but for now there is only one option
457 - if [ -x "/usr/bin/grub2-mkstandalone" ]; then
458 - grubmkstndaln="/usr/bin/grub2-mkstandalone"
459 - elif [ -x "/usr/bin/grub-mkstandalone" ]; then
460 - grubmkstndaln="/usr/bin/grub-mkstandalone"
461 - else
462 - die "Unable to find grub-mkstandalone"
463 - fi
464 -
465 - pushd "${1}" || die "Failed to enter livecd dir ${1}"
466 -
467 - # while $1/grub is unused here, it triggers grub config building in bootloader-setup.sh
468 - mkdir -p boot/EFI/BOOT isolinux
469 - #create boot.msg for isolinux
470 - echo "Gentoo Linux Installation LiveCD http://www.gentoo.org/" > isolinux/boot.msg
471 - echo "Enter to boot; F1 for kernels F2 for options." >> isolinux/boot.msg
472 - echo "Press any key in the next 15 seconds or we'll try to boot from disk." >> isolinux/boot.msg
473 - #install isolinux files
474 - if [ -f /usr/share/syslinux/isolinux.bin ]; then
475 - cp /usr/share/syslinux/isolinux.bin isolinux/
476 - #isolinux support files
477 - for i in libcom32.c32 libutil.c32 ldlinux.c32 reboot.c32 vesamenu.c32; do
478 - if [ -f "/usr/share/syslinux/${i}" ]; then
479 - cp "/usr/share/syslinux/${i}" isolinux/
480 - fi
481 - done
482 - #isolinux hardware detection toolkit, useful for system info and debugging
483 - if [ -f "/usr/share/syslinux/hdt.c32" ]; then
484 - cp /usr/share/syslinux/hdt.c32 isolinux/
485 - if [ -f "/usr/share/misc/pci.ids" ]; then
486 - cp /usr/share/misc/pci.ids isolinux/
487 - fi
488 - fi
489 - #memtest goes under isolinux since it doesn't work for uefi right now
490 - if [ -f /usr/share/memtest86+/memtest ]; then
491 - cp /usr/share/memtest86+/memtest.bin isolinux/memtest86
492 - else
493 - echo "Missing /usr/share/memtest86+/memtest.bin, this livecd will not have memtest86+ support. Enable USE=system-bootloader on catalyst to pull in the correct deps"
494 - fi
495 - else
496 - echo "Missing /usr/share/syslinux/isolinux.bin, this livecd will not bios boot. Enable USE=system-bootloader on catalyst to pull in the correct deps"
497 - fi
498 -
499 - #create grub-stub.cfg for embedding in grub-mkstandalone
500 - echo "insmod part_gpt" > grub-stub.cfg
501 - echo "insmod part_msdos" >> grub-stub.cfg
502 - echo "search --no-floppy --set=root --file /livecd" >> grub-stub.cfg
503 - echo "configfile /grub/grub.cfg" >> grub-stub.cfg
504 -
505 - # some 64 bit machines have 32 bit UEFI, and you might want to boot 32 bit on a 64 bit machine, so we take the safest path and include both
506 - # set up 32 bit uefi
507 - ${grubmkstndaln} /boot/grub/grub.cfg=./grub-stub.cfg --compress=xz -O i386-efi -o ./boot/EFI/BOOT/grubia32.efi --themes= || die "Failed to make grubia32.efi"
508 - #secure boot shim
509 - cp /usr/share/shim/BOOTIA32.EFI boot/EFI/BOOT/
510 - cp /usr/share/shim/mmia32.efi boot/EFI/BOOT/
511 -
512 - #set up 64 bit uefi
513 - ${grubmkstndaln} /boot/grub/grub.cfg=./grub-stub.cfg --compress=xz -O x86_64-efi -o ./boot/EFI/BOOT/grubx64.efi --themes= || die "Failed to make grubx64.efi"
514 - #secure boot shim
515 - cp /usr/share/shim/BOOTX64.EFI boot/EFI/BOOT/
516 - cp /usr/share/shim/mmx64.efi boot/EFI/BOOT/
517 -
518 - rm grub-stub.cfg || echo "Failed to remove grub-stub.cfg, but this hurts nothing"
519 - popd || die "Failed to leave livecd dir"
520 -}
521 -
522 extract_kernels() {
523 # extract multiple kernels
524 # $1 = Destination
525 --
526 2.24.1