2017-11-26 21:17:09 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
|
|
|
|
|
|
|
_BASENAME="$(basename "${0}")"
|
2021-10-14 12:20:49 +02:00
|
|
|
X86_64="$(mktemp -d X86_64.XXX)"
|
|
|
|
_SHIM_URL="https://kojipkgs.fedoraproject.org/packages/shim/15.4/5/x86_64"
|
|
|
|
_SHIM_VERSION="shim-x64-15.4-5.x86_64.rpm"
|
|
|
|
_SHIM32_VERSION="shim-ia32-15.4-5.x86_64.rpm"
|
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
usage () {
|
|
|
|
echo "${_BASENAME}: usage"
|
|
|
|
echo "CREATE X86_64 USB/CD IMAGES"
|
|
|
|
echo "-----------------------------"
|
|
|
|
echo "Run in archboot x86_64 chroot first ..."
|
2017-11-26 21:18:32 +01:00
|
|
|
echo "archboot-x86_64-iso.sh -t"
|
2017-11-26 21:17:09 +01:00
|
|
|
echo ""
|
|
|
|
echo "PARAMETERS:"
|
|
|
|
echo " -t Start generation of tarball."
|
2021-09-10 11:54:51 +02:00
|
|
|
echo " -g Start generation of image."
|
2021-10-04 20:21:21 +02:00
|
|
|
echo " -p=PRESET Which preset should be used."
|
2021-10-07 11:21:28 +02:00
|
|
|
echo " /etc/archboot/presets locates the presets"
|
|
|
|
echo " default=x86_64"
|
2017-11-26 21:17:09 +01:00
|
|
|
echo " -i=IMAGENAME Your IMAGENAME."
|
|
|
|
echo " -r=RELEASENAME Use RELEASENAME in boot message."
|
|
|
|
echo " -k=KERNELNAME Use KERNELNAME in boot message."
|
2021-09-10 08:06:41 +02:00
|
|
|
echo " -T=tarball Use this tarball for image creation."
|
2017-11-26 21:17:09 +01:00
|
|
|
echo " -h This message."
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ -z "${1}" ]] && usage
|
|
|
|
|
2017-11-27 09:20:52 +01:00
|
|
|
|
2021-10-07 11:21:28 +02:00
|
|
|
PRESET_DIR="/etc/archboot/presets"
|
2017-11-26 21:17:09 +01:00
|
|
|
TARBALL_HELPER="/usr/bin/archboot-tarball-helper.sh"
|
|
|
|
|
|
|
|
# change to english locale!
|
|
|
|
export LANG="en_US"
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case ${1} in
|
|
|
|
-g|--g) GENERATE="1" ;;
|
|
|
|
-t|--t) TARBALL="1" ;;
|
2021-10-04 20:21:21 +02:00
|
|
|
-p=*|--p=*) PRESET="$(echo ${1} | awk -F= '{print $2;}')" ;;
|
2017-11-26 21:17:09 +01:00
|
|
|
-i=*|--i=*) IMAGENAME="$(echo ${1} | awk -F= '{print $2;}')" ;;
|
|
|
|
-r=*|--r=*) RELEASENAME="$(echo ${1} | awk -F= '{print $2;}')" ;;
|
|
|
|
-k=*|--k=*) KERNEL="$(echo ${1} | awk -F= '{print $2;}')" ;;
|
2021-09-10 08:06:41 +02:00
|
|
|
-T=*|--T=*) TARBALL_NAME="$(echo ${1} | awk -F= '{print $2;}')" ;;
|
2017-11-26 21:17:09 +01:00
|
|
|
-h|--h|?) usage ;;
|
|
|
|
*) usage ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2021-09-10 13:40:49 +02:00
|
|
|
### check for root
|
|
|
|
if ! [[ ${UID} -eq 0 ]]; then
|
|
|
|
echo "ERROR: Please run as root user!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-10-07 11:21:28 +02:00
|
|
|
#set PRESET
|
2021-10-07 11:23:44 +02:00
|
|
|
[[ -z "${PRESET}" ]] && PRESET="x86_64"
|
2021-10-07 14:46:50 +02:00
|
|
|
PRESET=""${PRESET_DIR}"/"${PRESET}""
|
2021-10-04 20:42:01 +02:00
|
|
|
|
2021-09-11 14:27:21 +02:00
|
|
|
# from initcpio functions
|
|
|
|
kver() {
|
|
|
|
# this is intentionally very loose. only ensure that we're
|
|
|
|
# dealing with some sort of string that starts with something
|
|
|
|
# resembling dotted decimal notation. remember that there's no
|
|
|
|
# requirement for CONFIG_LOCALVERSION to be set.
|
|
|
|
local kver re='^[[:digit:]]+(\.[[:digit:]]+)+'
|
|
|
|
|
|
|
|
# scrape the version out of the kernel image. locate the offset
|
|
|
|
# to the version string by reading 2 bytes out of image at at
|
|
|
|
# address 0x20E. this leads us to a string of, at most, 128 bytes.
|
|
|
|
# read the first word from this string as the kernel version.
|
|
|
|
local offset=$(hexdump -s 526 -n 2 -e '"%0d"' "/boot/vmlinuz-linux")
|
|
|
|
[[ $offset = +([0-9]) ]] || return 1
|
|
|
|
|
|
|
|
read kver _ < \
|
2021-09-11 15:18:44 +02:00
|
|
|
<(dd if="/boot/vmlinuz-linux" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null)
|
2021-09-11 14:27:21 +02:00
|
|
|
|
|
|
|
[[ $kver =~ $re ]] || return 1
|
|
|
|
|
2021-09-11 14:44:23 +02:00
|
|
|
KERNEL="$(printf '%s' "$kver")"
|
2021-09-11 14:27:21 +02:00
|
|
|
}
|
|
|
|
|
2021-09-09 15:06:55 +02:00
|
|
|
# set defaults, if nothing given
|
2021-09-11 14:44:23 +02:00
|
|
|
[[ -z "${KERNEL}" ]] && kver
|
2021-09-27 15:05:16 +02:00
|
|
|
[[ -z "${RELEASENAME}" ]] && RELEASENAME="$(date +%Y.%m.%d-%H.%M)"
|
2021-09-17 08:58:38 +02:00
|
|
|
[[ -z "${IMAGENAME}" ]] && IMAGENAME="archlinux-archboot-${RELEASENAME}-x86_64"
|
2021-09-09 15:06:55 +02:00
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
if [[ "${TARBALL}" == "1" ]]; then
|
2021-09-09 15:06:55 +02:00
|
|
|
"${TARBALL_HELPER}" -c="${PRESET}" -t="${IMAGENAME}.tar"
|
2017-11-26 21:17:09 +01:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [[ "${GENERATE}" == "1" ]]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2021-09-10 08:06:41 +02:00
|
|
|
if ! [[ "${TARBALL_NAME}" == "" ]]; then
|
2021-09-10 13:46:55 +02:00
|
|
|
CORE64="$(mktemp -d core64.XXX)"
|
2021-10-14 12:20:49 +02:00
|
|
|
tar xf ${TARBALL_NAME} -C "${CORE64}" || exit 1
|
2021-09-10 08:06:41 +02:00
|
|
|
else
|
|
|
|
echo "Please enter a tarball name with parameter -T=tarball"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-12 20:41:48 +02:00
|
|
|
mkdir -p "${X86_64}/EFI/BOOT"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
_prepare_kernel_initramfs_files() {
|
2021-09-10 22:12:46 +02:00
|
|
|
|
|
|
|
mkdir -p "${X86_64}/boot"
|
2021-09-10 08:06:41 +02:00
|
|
|
mv "${CORE64}"/*/boot/vmlinuz "${X86_64}/boot/vmlinuz_x86_64"
|
|
|
|
mv "${CORE64}"/*/boot/initrd.img "${X86_64}/boot/initramfs_x86_64.img"
|
2021-10-14 15:44:51 +02:00
|
|
|
mv "${CORE64}"/*/boot/{intel-ucode.img,amd-ucode.img} "${X86_64}/boot/"
|
|
|
|
[[ -f "${CORE64}/*/boot/memtest" ]] && mv "${CORE64}"/*/boot/memtest "${X86_64}/boot/"
|
2021-09-10 11:00:54 +02:00
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
}
|
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
_prepare_efitools_uefi () {
|
|
|
|
cp -f "/usr/share/efitools/efi/HashTool.efi" "${X86_64}/EFI/tools/HashTool.efi"
|
|
|
|
cp -f "/usr/share/efitools/efi/KeyTool.efi" "${X86_64}/EFI/tools/KeyTool.efi"
|
2021-09-12 20:41:48 +02:00
|
|
|
}
|
|
|
|
|
2021-10-14 12:20:49 +02:00
|
|
|
_prepare_fedora_shim_bootloaders () {
|
|
|
|
# Details on shim https://www.rodsbooks.com/efi-bootloaders/secureboot.html#initial_shim
|
|
|
|
# add shim x64 signed files from fedora
|
|
|
|
SHIM=$(mktemp -d shim.XXXX)
|
2021-10-14 21:44:13 +02:00
|
|
|
curl -s --create-dirs -L -O --output-dir "${SHIM}" "${_SHIM_URL}/${_SHIM_VERSION}"
|
2021-10-14 12:20:49 +02:00
|
|
|
bsdtar -C "${SHIM}" -xf "${SHIM}"/"${_SHIM_VERSION}"
|
2021-10-12 11:55:47 +02:00
|
|
|
cp "${SHIM}/boot/efi/EFI/fedora/mmx64.efi" "${X86_64}/EFI/BOOT/mmx64.efi"
|
2021-10-14 12:20:49 +02:00
|
|
|
cp "${SHIM}/boot/efi/EFI/fedora/shimx64.efi" "${X86_64}/EFI/BOOT/BOOTX64.efi"
|
|
|
|
# add shim ia32 signed files from fedora
|
|
|
|
SHIM32=$(mktemp -d shim32.XXXX)
|
2021-10-14 21:44:13 +02:00
|
|
|
curl -s --create-dirs -L -O --output-dir "${SHIM32}" "${_SHIM_URL}/${_SHIM32_VERSION}"
|
2021-10-14 12:20:49 +02:00
|
|
|
bsdtar -C "${SHIM32}" -xf "${SHIM32}/${_SHIM32_VERSION}"
|
|
|
|
cp "${SHIM32}/boot/efi/EFI/fedora/mmia32.efi" "${X86_64}/EFI/BOOT/mmia32.efi"
|
|
|
|
cp "${SHIM32}/boot/efi/EFI/fedora/shimia32.efi" "${X86_64}/EFI/BOOT/BOOTIA32.efi"
|
|
|
|
### adding this causes boot loop in ovmf and only tries create a boot entry
|
|
|
|
#cp "${SHIM}/boot/efi/EFI/BOOT/fbx64.efi" "${X86_64}/EFI/BOOT/fbx64.efi"
|
2021-10-12 11:55:47 +02:00
|
|
|
}
|
|
|
|
|
2021-09-10 11:54:51 +02:00
|
|
|
_prepare_uefi_image() {
|
2021-09-10 08:06:41 +02:00
|
|
|
|
|
|
|
## get size of boot x86_64 files
|
|
|
|
BOOTSIZE=$(du -bc ${X86_64} | grep total | cut -f1)
|
|
|
|
IMGSZ=$(( (${BOOTSIZE}*102)/100/1024 + 1)) # image size in sectors
|
|
|
|
|
|
|
|
mkdir -p "${X86_64}"/CDEFI/
|
|
|
|
|
|
|
|
## Create cdefiboot.img
|
|
|
|
dd if=/dev/zero of="${X86_64}"/CDEFI/cdefiboot.img bs="${IMGSZ}" count=1024
|
|
|
|
VFAT_IMAGE="${X86_64}/CDEFI/cdefiboot.img"
|
|
|
|
mkfs.vfat "${VFAT_IMAGE}"
|
|
|
|
|
|
|
|
## Copy all files to UEFI vfat image
|
2021-10-14 12:20:49 +02:00
|
|
|
mcopy -i "${VFAT_IMAGE}" -s "${X86_64}"/{EFI,boot} ::/
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_download_uefi_shell_tianocore() {
|
|
|
|
|
2017-11-27 15:43:56 +01:00
|
|
|
mkdir -p "${X86_64}/EFI/tools/"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-12 20:41:48 +02:00
|
|
|
## Install Tianocore UDK/EDK2 ShellBinPkg UEFI X64 "Full Shell" - For UEFI Spec. >=2.3 systems
|
|
|
|
cp /usr/share/edk2-shell/x64/Shell.efi "${X86_64}/EFI/tools/shellx64_v2.efi"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-12 20:41:48 +02:00
|
|
|
## Install Tianocore UDK/EDK2 EdkShellBinPkg UEFI X64 "Full Shell" - For UEFI Spec. <2.3 systems
|
|
|
|
cp /usr/share/edk2-shell/x64/Shell_Full.efi "${X86_64}/EFI/tools/shellx64_v1.efi"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-12 20:41:48 +02:00
|
|
|
## Install Tianocore UDK/EDK2 ShellBinPkg UEFI IA32 "Full Shell" - For UEFI Spec. >=2.3 systems
|
|
|
|
cp /usr/share/edk2-shell/ia32/Shell.efi "${X86_64}/EFI/tools/shellia32_v2.efi"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-12 20:41:48 +02:00
|
|
|
## InstallTianocore UDK/EDK2 EdkShellBinPkg UEFI IA32 "Full Shell" - For UEFI Spec. <2.3 systems
|
|
|
|
cp /usr/share/edk2-shell/ia32/Shell_Full.efi "${X86_64}/EFI/tools/shellia32_v1.efi"
|
2021-09-12 21:12:31 +02:00
|
|
|
}
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-18 08:27:12 +02:00
|
|
|
_uefi_GRUB_common() {
|
|
|
|
# create Arch Linux sbat file
|
|
|
|
# add sbat file: https://bugs.archlinux.org/task/72415
|
|
|
|
echo "sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md" > /tmp/sbat.csv
|
|
|
|
echo "grub,1,Free Software Foundation,grub,2.06,https//www.gnu.org/software/grub/" >> /tmp/sbat.csv
|
|
|
|
echo "arch,1,Arch Linux,\$pkgname,\$pkgver,https://archlinux.org/packages/core/x86_64/grub/" >> /tmp/sbat.csv
|
|
|
|
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407
|
|
|
|
_GRUB_MODULES="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat \
|
|
|
|
font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio \
|
|
|
|
halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd \
|
|
|
|
net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid \
|
|
|
|
search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb \
|
|
|
|
usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard"
|
|
|
|
# add -v for verbose
|
|
|
|
_COMMON_GRUB_OPTIONS="--sbat /tmp/sbat.csv --modules="${_GRUB_MODULES}" --fonts="unicode" --locales="en@quot" --themes="""
|
|
|
|
}
|
|
|
|
|
2021-10-14 12:20:49 +02:00
|
|
|
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382
|
|
|
|
# If you don't use shim use --disable-shim-lock
|
2017-11-26 21:17:09 +01:00
|
|
|
_prepare_uefi_X64_GRUB_USB_files() {
|
|
|
|
|
2021-10-18 08:27:12 +02:00
|
|
|
mkdir -p "${X86_64}/EFI/BOOT"
|
2021-10-14 12:20:49 +02:00
|
|
|
cat << GRUBEOF > "${X86_64}/EFI/BOOT/grubx64.cfg"
|
2017-11-26 21:17:09 +01:00
|
|
|
insmod part_gpt
|
|
|
|
insmod part_msdos
|
|
|
|
insmod fat
|
|
|
|
|
|
|
|
insmod efi_gop
|
|
|
|
insmod efi_uga
|
|
|
|
insmod video_bochs
|
|
|
|
insmod video_cirrus
|
|
|
|
|
|
|
|
insmod font
|
|
|
|
|
|
|
|
if loadfont "${prefix}/fonts/unicode.pf2" ; then
|
|
|
|
insmod gfxterm
|
|
|
|
set gfxmode="1366x768x32;1280x800x32;1024x768x32;auto"
|
|
|
|
terminal_input console
|
|
|
|
terminal_output gfxterm
|
|
|
|
fi
|
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
set default="Arch Linux x86_64 Archboot"
|
|
|
|
set timeout="10"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
menuentry "Arch Linux x86_64 Archboot" {
|
2017-11-26 21:17:09 +01:00
|
|
|
set gfxpayload=keep
|
|
|
|
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
|
|
|
|
linux /boot/vmlinuz_x86_64 cgroup_disable=memory add_efi_memmap _X64_UEFI=1 rootfstype=ramfs
|
2020-07-21 13:49:02 +02:00
|
|
|
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
|
2017-11-26 21:17:09 +01:00
|
|
|
}
|
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
menuentry "Secure Boot KeyTool" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/KeyTool.efi
|
|
|
|
chainloader /EFI/tools/KeyTool.efi
|
|
|
|
}
|
|
|
|
|
|
|
|
menuentry "Secure Boot HashTool" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/HashTool.efi
|
|
|
|
chainloader /EFI/tools/HashTool.efi
|
|
|
|
}
|
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
menuentry "UEFI Shell X64 v2" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/shellx64_v2.efi
|
|
|
|
chainloader /EFI/tools/shellx64_v2.efi
|
|
|
|
}
|
|
|
|
|
|
|
|
menuentry "UEFI Shell X64 v1" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/shellx64_v1.efi
|
|
|
|
chainloader /EFI/tools/shellx64_v1.efi
|
|
|
|
}
|
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
if [ "${grub_platform}" == "efi" ]; then
|
|
|
|
menuentry "Microsoft Windows" {
|
|
|
|
insmod part_gpt
|
|
|
|
insmod fat
|
|
|
|
insmod chain
|
|
|
|
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
|
|
|
|
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
menuentry "Exit GRUB" {
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
GRUBEOF
|
2021-10-18 08:27:12 +02:00
|
|
|
grub-mkstandalone -d /usr/lib/grub/x86_64-efi -O x86_64-efi ${_COMMON_GRUB_OPTIONS} -o "${X86_64}/EFI/BOOT/grubx64.efi" "boot/grub/grub.cfg=/${X86_64}/EFI/BOOT/grubx64.cfg"
|
2017-11-26 21:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_prepare_uefi_IA32_GRUB_USB_files() {
|
|
|
|
|
2017-11-27 15:43:56 +01:00
|
|
|
mkdir -p "${X86_64}/EFI/BOOT"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-18 08:27:12 +02:00
|
|
|
cat << GRUBEOF > "${X86_64}/EFI/BOOT/grubia32.cfg"
|
2017-11-26 21:17:09 +01:00
|
|
|
insmod part_gpt
|
|
|
|
insmod part_msdos
|
|
|
|
insmod fat
|
|
|
|
|
|
|
|
insmod efi_gop
|
|
|
|
insmod efi_uga
|
|
|
|
insmod video_bochs
|
|
|
|
insmod video_cirrus
|
|
|
|
|
|
|
|
insmod font
|
|
|
|
|
|
|
|
if loadfont "${prefix}/fonts/unicode.pf2" ; then
|
|
|
|
insmod gfxterm
|
|
|
|
set gfxmode="1366x768x32;1280x800x32;1024x768x32;auto"
|
|
|
|
terminal_input console
|
|
|
|
terminal_output gfxterm
|
|
|
|
fi
|
|
|
|
|
|
|
|
set default="Arch Linux x86_64 Archboot - EFI MIXED MODE"
|
2021-10-14 15:12:56 +02:00
|
|
|
set timeout="10"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
menuentry "Arch Linux x86_64 Archboot - EFI MIXED MODE" {
|
|
|
|
set gfxpayload=keep
|
|
|
|
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
|
|
|
|
linux /boot/vmlinuz_x86_64 cgroup_disable=memory add_efi_memmap _IA32_UEFI=1 rootfstype=ramfs
|
2020-07-21 13:49:02 +02:00
|
|
|
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
|
2017-11-26 21:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
menuentry "UEFI Shell IA32 v2" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/shellia32_v2.efi
|
|
|
|
chainloader /EFI/tools/shellia32_v2.efi
|
|
|
|
}
|
|
|
|
|
|
|
|
menuentry "UEFI Shell IA32 v1" {
|
|
|
|
search --no-floppy --set=root --file /EFI/tools/shellia32_v1.efi
|
|
|
|
chainloader /EFI/tools/shellia32_v1.efi
|
|
|
|
}
|
|
|
|
|
2021-10-14 15:12:56 +02:00
|
|
|
if [ "${grub_platform}" == "efi" ]; then
|
|
|
|
menuentry "Microsoft Windows" {
|
|
|
|
insmod part_gpt
|
|
|
|
insmod fat
|
|
|
|
insmod chain
|
|
|
|
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
|
|
|
|
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
menuentry "Exit GRUB" {
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
GRUBEOF
|
2021-10-18 08:27:12 +02:00
|
|
|
grub-mkstandalone -d /usr/lib/grub/i386-efi -O i386-efi ${_COMMON_GRUB_OPTIONS} -o "${X86_64}/EFI/BOOT/grubia32.efi" "boot/grub/grub.cfg=/${X86_64}/EFI/BOOT/grubia32.cfg"
|
|
|
|
|
2017-11-26 21:17:09 +01:00
|
|
|
}
|
|
|
|
|
2021-10-15 09:16:30 +02:00
|
|
|
echo "Starting ISO creation ..."
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare fedora shim ..."
|
|
|
|
_prepare_fedora_shim_bootloaders >/dev/null 2>&1
|
2021-10-12 12:55:10 +02:00
|
|
|
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare kernel and initramfs ..."
|
|
|
|
_prepare_kernel_initramfs_files >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare uefi shells ..."
|
|
|
|
_download_uefi_shell_tianocore >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-15 09:16:30 +02:00
|
|
|
echo "Prepare efitools ..."
|
2021-10-15 08:51:27 +02:00
|
|
|
_prepare_efitools_uefi >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-18 08:27:12 +02:00
|
|
|
echo "Prepare UEFI common Grub ..."
|
|
|
|
_uefi_GRUB_common
|
|
|
|
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare X64 Grub ..."
|
|
|
|
_prepare_uefi_X64_GRUB_USB_files >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare IA32 Grub ..."
|
|
|
|
_prepare_uefi_IA32_GRUB_USB_files >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-10-15 08:51:27 +02:00
|
|
|
echo "Prepare UEFI image ..."
|
|
|
|
_prepare_uefi_image >/dev/null 2>&1
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
# place syslinux files
|
2021-09-10 11:00:54 +02:00
|
|
|
mkdir -p "${X86_64}/boot/syslinux"
|
2021-09-10 08:06:41 +02:00
|
|
|
mv "${CORE64}"/*/boot/syslinux/* "${X86_64}/boot/syslinux/"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
# Change parameters in boot.msg
|
2017-11-27 15:43:56 +01:00
|
|
|
sed -i -e "s/@@DATE@@/$(date)/g" -e "s/@@KERNEL@@/$KERNEL/g" -e "s/@@RELEASENAME@@/$RELEASENAME/g" -e "s/@@BOOTLOADER@@/ISOLINUX/g" "${X86_64}/boot/syslinux/boot.msg"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
2021-09-10 08:06:41 +02:00
|
|
|
## Generate the BIOS+ISOHYBRID+UEFI CD image using xorriso (extra/libisoburn package) in mkisofs emulation mode
|
2017-11-27 15:43:56 +01:00
|
|
|
echo "Generating X86_64 hybrid ISO ..."
|
2017-11-26 21:17:09 +01:00
|
|
|
xorriso -as mkisofs \
|
|
|
|
-iso-level 3 \
|
|
|
|
-full-iso9660-filenames \
|
|
|
|
-volid "ARCHBOOT" \
|
|
|
|
-preparer "prepared by ${_BASENAME}" \
|
|
|
|
-eltorito-boot boot/syslinux/isolinux.bin \
|
|
|
|
-eltorito-catalog boot/syslinux/boot.cat \
|
|
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
|
|
-isohybrid-mbr /usr/lib/syslinux/bios/isohdpfx.bin \
|
2021-09-10 08:06:41 +02:00
|
|
|
-eltorito-alt-boot -e CDEFI/cdefiboot.img -isohybrid-gpt-basdat -no-emul-boot \
|
2021-09-10 13:46:55 +02:00
|
|
|
-output "${IMAGENAME}.iso" "${X86_64}/" &> "${IMAGENAME}.log"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
## create sha256sums.txt
|
2021-10-15 09:16:30 +02:00
|
|
|
echo "Generating sha256sum ..."
|
2021-09-10 13:46:55 +02:00
|
|
|
rm -f "sha256sums.txt" || true
|
2021-09-27 21:49:46 +02:00
|
|
|
cksum -a sha256 *.iso > "sha256sums.txt"
|
2017-11-26 21:17:09 +01:00
|
|
|
|
|
|
|
# cleanup
|
2021-10-15 09:16:30 +02:00
|
|
|
echo "Cleanup remove ${CORE64} and ${X86_64} ..."
|
2017-11-27 15:43:56 +01:00
|
|
|
rm -rf "${CORE64}"
|
|
|
|
rm -rf "${X86_64}"
|
2021-10-15 09:29:07 +02:00
|
|
|
echo "Finished ISO creation."
|