2011-05-19 16:02:37 +02:00
|
|
|
# livecd post script
|
|
|
|
#
|
|
|
|
# creates a fake installation aimed at producing a kernel image and initrd
|
|
|
|
# for livecd boot
|
|
|
|
|
|
|
|
# make initramfs
|
|
|
|
|
2022-06-10 18:06:40 +02:00
|
|
|
[ -e $MOUNTDIR2/boot/grub ] || mkdir -p $MOUNTDIR2/boot/grub
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2011-10-19 13:11:02 +02:00
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
|
|
|
|
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
|
2019-05-25 17:59:36 +02:00
|
|
|
-a dmsquash-live -o squash-live \
|
2022-06-10 18:06:40 +02:00
|
|
|
--filesystems "autofs4 ext4 overlay squashfs isofs hfsplus nls_utf8" \
|
2011-10-19 13:11:02 +02:00
|
|
|
--nomdadmconf --nolvmconf \
|
|
|
|
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
|
|
|
|
${KERNEL_MAJVER}${K}
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2011-10-19 13:11:02 +02:00
|
|
|
# Note: isolinux requires 8.3 filenames
|
|
|
|
cp $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
|
2021-06-29 11:34:10 +02:00
|
|
|
$MOUNTDIR2/boot/initrd${ISOID}.gz || {
|
|
|
|
echo "Error: cannot copy file $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz to $MOUNTDIR2/boot/initrd${ISOID}.gz.";
|
|
|
|
exit 1; }
|
2011-10-19 13:11:02 +02:00
|
|
|
cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${K} \
|
2021-06-29 11:34:10 +02:00
|
|
|
$MOUNTDIR2/boot/vmlinuz${ISOID} || {
|
|
|
|
echo "Error: cannot copy file $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${K}.img.gz to $MOUNTDIR2/boot/vmlinuz${ISOID}.gz.";
|
|
|
|
exit 1; }
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2011-10-19 13:11:02 +02:00
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2022-10-22 12:39:45 +02:00
|
|
|
# copy grub theme
|
|
|
|
mkdir -p $MOUNTDIR2/boot/grub/themes
|
|
|
|
cp -a $MOUNTDIR/usr/share/grub/themes/breeze $MOUNTDIR2/boot/grub/themes/
|
|
|
|
|
2011-05-19 16:02:37 +02:00
|
|
|
# add buildinfo
|
|
|
|
buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}"
|
|
|
|
|
2022-06-10 18:06:40 +02:00
|
|
|
# configure grub boot loader
|
|
|
|
cat > $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
#
|
|
|
|
# GRUB configuration generated by openmamba makedist
|
|
|
|
#
|
|
|
|
font=unicode
|
|
|
|
set gfxmode=auto
|
|
|
|
insmod all_video
|
|
|
|
insmod gfxterm
|
|
|
|
insmod gettext
|
|
|
|
insmod iso9660
|
|
|
|
insmod biosdisk
|
2022-10-22 12:39:45 +02:00
|
|
|
terminal_output gfxterm
|
|
|
|
set timeout=10
|
2022-06-10 18:06:40 +02:00
|
|
|
# theme
|
2022-10-22 12:39:45 +02:00
|
|
|
loadfont /boot/grub/themes/breeze/unifont-bold-16.pf2
|
|
|
|
loadfont /boot/grub/themes/breeze/unifont-regular-14.pf2
|
|
|
|
loadfont /boot/grub/themes/breeze/unifont-regular-16.pf2
|
|
|
|
loadfont /boot/grub/themes/breeze/unifont-regular-32.pf2
|
|
|
|
loadfont /boot/grub/fonts/unicode.pf2
|
|
|
|
insmod png
|
|
|
|
set theme=/boot/grub/themes/breeze/theme.txt
|
|
|
|
export theme
|
2022-06-10 18:06:40 +02:00
|
|
|
_EOF
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot entries
|
|
|
|
#
|
2023-12-25 13:46:18 +01:00
|
|
|
ROOT_ARGS="root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} rd.live.overlay.overlayfs"
|
2022-06-10 18:06:40 +02:00
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
menuentry "openmamba GNU/Linux (${KERNEL_MAJVER}${K})" {
|
|
|
|
echo "Loading /boot/vmlinuz${ISOID}"
|
2023-12-25 13:46:18 +01:00
|
|
|
linux /boot/vmlinuz${ISOID} ${ROOT_ARGS} selinux=0 quiet splash ro
|
2022-06-10 18:06:40 +02:00
|
|
|
echo "Loading /boot/initrd${ISOID}.gz"
|
|
|
|
initrd /boot/initrd${ISOID}.gz
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
submenu "Advanced options for openmamba GNU/Linux" {
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
#ISOID=
|
|
|
|
#for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
# cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
# menuentry "No modeset (${KERNEL_MAJVER}${K})" {
|
|
|
|
# echo "Loading /boot/vmlinuz${ISOID}"
|
2023-12-25 13:46:18 +01:00
|
|
|
# linux /boot/vmlinuz${ISOID} ${ROOT_ARGS} selinux=0 quiet splash ro nomodeset
|
2022-06-10 18:06:40 +02:00
|
|
|
# echo "Loading /boot/initrd${ISOID}.gz"
|
|
|
|
# initrd /boot/initrd${ISOID}.gz
|
|
|
|
# }
|
|
|
|
#_EOF
|
|
|
|
# ISOID=$(($ISOID + 1))
|
|
|
|
#done
|
|
|
|
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
menuentry "Debug mode (${KERNEL_MAJVER}${K})" {
|
|
|
|
echo "Loading /boot/vmlinuz${ISOID}"
|
2023-12-25 13:46:18 +01:00
|
|
|
linux /boot/vmlinuz${ISOID} ${ROOT_ARGS} ro selinux=0 rddebug
|
2022-06-10 18:06:40 +02:00
|
|
|
echo "Loading /boot/initrd${ISOID}.gz"
|
|
|
|
initrd /boot/initrd${ISOID}.gz
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
menuentry "Debug mode with nomodeset (${KERNEL_MAJVER}${K})" {
|
|
|
|
echo "Loading /boot/vmlinuz${ISOID}"
|
2023-12-25 13:46:18 +01:00
|
|
|
linux /boot/vmlinuz${ISOID} ${ROOT_ARGS} ro selinux=0 rddebug nomodeset
|
2022-06-10 18:06:40 +02:00
|
|
|
echo "Loading /boot/initrd${ISOID}.gz"
|
|
|
|
initrd /boot/initrd${ISOID}.gz
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
# install memtest
|
|
|
|
if [ -e $MOUNTDIR/boot/memtest86+.bin ]; then
|
|
|
|
cp $MOUNTDIR/boot/memtest86+.bin $MOUNTDIR2/boot/memtest
|
|
|
|
|
|
|
|
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
|
|
|
|
menuentry 'Memory test' {
|
|
|
|
insmod part_gpt
|
|
|
|
insmod fat
|
|
|
|
linux16 /boot/memtest
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "Error: /boot/memtest86+.bin not found. Please install the memtest86 package."
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-05-19 16:02:37 +02:00
|
|
|
|
|
|
|
# copy static files for specific platform
|
|
|
|
[ -e $TARGETDIR/platforms/$PLATFORM/root ] &&
|
2012-03-17 18:03:13 +01:00
|
|
|
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root/* $MOUNTDIR2/
|
2011-05-19 16:02:37 +02:00
|
|
|
|
|
|
|
# copy localized static files for specific platform
|
|
|
|
[ "$LANGUAGE" -a -e $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE ] &&
|
2012-03-17 18:03:13 +01:00
|
|
|
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE/* $MOUNTDIR2/
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2015-03-07 19:55:19 +01:00
|
|
|
#
|
|
|
|
# EFI support section BEGIN
|
|
|
|
#
|
|
|
|
|
|
|
|
# create EFI grub 32 and 64 bit images
|
2024-11-02 10:55:52 +01:00
|
|
|
mkdir -p $MOUNTDIR/boot/efi/EFI/openmamba/
|
|
|
|
chroot $MOUNTDIR grub-mkimage -o /boot/efi/EFI/openmamba/grubx64.efi -O x86_64-efi \
|
|
|
|
-p /boot/grub --sbat /usr/share/grub/sbat.csv \
|
|
|
|
all_video bli boot chain configfile cpuid echo efifwsetup efi_gop efi_uga efinet ext2 \
|
|
|
|
fat font gettext gfxmenu gfxterm gfxterm gfxterm_background gzio halt help hfsplus \
|
|
|
|
iso9660 jpeg keystatus linux loadenv loopback ls lsefi lsefimmap lsefisystab lssal \
|
|
|
|
memdisk minicmd normal ntfs ntfscomp part_apple part_gpt part_msdos password_pbkdf2 \
|
|
|
|
play png probe reboot regexp search search_fs_file search_fs_uuid search_label sleep \
|
|
|
|
smbios squash4 test tpm true video video_bochs video_cirrus xfs zfs zfscrypt zfsinfo || {
|
|
|
|
echo $"Error: unable to create GRUB x86_64-efi image"
|
|
|
|
exit 1
|
2015-03-07 19:55:19 +01:00
|
|
|
}
|
|
|
|
|
2024-11-02 10:55:52 +01:00
|
|
|
# Sign EFI image for secure boot
|
|
|
|
chroot $MOUNTDIR openssl req -newkey rsa:2048 -nodes -keyout /root/MOK.key -new -x509 -sha256 -days 3650 -subj "/CN=openmamba Machine Owner Key/" -out /root/MOK.crt
|
|
|
|
chroot $MOUNTDIR openssl x509 -outform DER -in /root/MOK.crt -out /root/MOK.cer
|
|
|
|
chroot $MOUNTDIR sbsign --key /root/MOK.key --cert /root/MOK.crt --output /boot/efi/EFI/openmamba/grubx64.efi /boot/efi/EFI/openmamba/grubx64.efi
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
chroot $MOUNTDIR sbsign --key /root/MOK.key --cert /root/MOK.crt --output /boot/vmlinuz-${KERNEL_MAJVER}${K} /boot/vmlinuz-${KERNEL_MAJVER}${K}
|
|
|
|
cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${K} \
|
|
|
|
$MOUNTDIR2/boot/vmlinuz${ISOID}
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $MOUNTDIR2/EFI/BOOT/
|
|
|
|
cp $MOUNTDIR/root/MOK.cer $MOUNTDIR2/EFI/
|
|
|
|
cp $MOUNTDIR/boot/efi/EFI/openmamba/grubx64.efi $MOUNTDIR2/EFI/BOOT/grubx64.efi
|
|
|
|
|
|
|
|
# Install shim-signed
|
|
|
|
cp $MOUNTDIR/usr/share/shim-signed/shimx64.efi $MOUNTDIR2/EFI/BOOT/bootx64.efi
|
|
|
|
cp $MOUNTDIR/usr/share/shim-signed/mmx64.efi $MOUNTDIR2/EFI/BOOT/
|
|
|
|
|
2015-03-07 19:55:19 +01:00
|
|
|
#
|
|
|
|
# EFI support section END
|
|
|
|
#
|
|
|
|
|
2011-05-19 16:02:37 +02:00
|
|
|
|
2017-12-24 11:54:06 +01:00
|
|
|
# Finally produce the medium
|
2011-05-19 16:02:37 +02:00
|
|
|
MOUNTDIR=$MOUNTDIR2 produce_media $MEDIA_NAME
|
|
|
|
|
|
|
|
for i in $SUBPLATFORM; do
|
|
|
|
. $TARGETDIR/platforms/$i/settings.inc
|
|
|
|
CURR_MEDIA_NAME=`PLATFORM=$i media_name`
|
|
|
|
cat >> $LOCALSTATEDIR/.$MEDIA_NAME.inc.html << _EOF
|
|
|
|
<br><p><b>Root target(s):</b>
|
|
|
|
<div><table width="90%"><tr><td>
|
|
|
|
_EOF
|
|
|
|
cat $LOCALSTATEDIR/.$CURR_MEDIA_NAME.inc.html >> \
|
|
|
|
$LOCALSTATEDIR/.$MEDIA_NAME.inc.html
|
|
|
|
echo "</td></tr></table></div>" >> $LOCALSTATEDIR/.$MEDIA_NAME.inc.html
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|