Better looking ISO image structure. Fixed issue with 'ghost' overlay bundles. Prepared the source structure for future UEFI enhancements.

This commit is contained in:
Ivan Davidov 2017-12-17 21:10:14 +02:00
parent 0b7877b5bc
commit 58e1b5b939
9 changed files with 93 additions and 96 deletions

View File

@ -39,6 +39,22 @@ SYSLINUX_SOURCE_URL=http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.0
# #
####################################################
# This property is not used at the moment.
#
# This property defines the firmware compatibility. You can specify on what
# systems MLL will be bootable.
#
# bios - the generated ISO image will be compatible with legacy BIOS systems.
# This is the defaut option and it does not require root privileges
#
# uefi - the generated ISO image will be compatible with UEFI systems. This
# option requires root privileges.
#
# both - the generated ISO image will be compatible with both legacy BIOS and
# modern UEFI systems. This option requires root privileges.
#
FIRMWARE_TYPE=bios
# Use predefined '.config' file when building the kernel. This overrides the
# config generation in 'xx_build_kernel.sh' and the build process uses the
# config file provided in this parameter. Place the configuration file here:
@ -146,7 +162,7 @@ OVERLAY_TYPE=folder
#
# The default overlay bundles are 'dhcp' and 'mll_source'.
#
OVERLAY_BUNDLES=dhcp,mll_source,kernel_modules
OVERLAY_BUNDLES=dhcp,mll_source
# The location where the overlay bundle software will be stored.
#
@ -162,8 +178,8 @@ OVERLAY_LOCATION=iso
# Use already downloaded source bundles instead of downloading them from
# internet. This is useful when you have already downloaded the sources and have
# no internet connection. Or if you want to share your version of "Minimal Linux
# Live" with predefined sources.
# no internet connection, or if you want to share your version of 'Minimal Linux
# Live' with predefined sources.
#
USE_LOCAL_SOURCE=false

View File

@ -14,19 +14,23 @@ WORK_SYSLINUX_DIR=`ls -d $WORK_DIR/syslinux/syslinux-*`
echo "Removing old ISO image work area. This may take a while."
rm -rf $ISOIMAGE
# This is the root folder of the ISO image.
echo "Preparing new ISO image work area."
mkdir -p $ISOIMAGE
# This is the folder where we keep legacy BIOS boot artifacts.
mkdir -p $ISOIMAGE/boot
# Now we copy the kernel.
cp $KERNEL_INSTALLED/kernel $ISOIMAGE/kernel.xz
cp $KERNEL_INSTALLED/kernel \
$ISOIMAGE/boot/kernel.xz
# Now we copy the root file system.
cp $WORK_DIR/rootfs.cpio.xz $ISOIMAGE/rootfs.xz
cp $WORK_DIR/rootfs.cpio.xz \
$ISOIMAGE/boot/rootfs.xz
# Now we copy the overlay content if it exists
if [ -d $ISOIMAGE_OVERLAY \
-a ! "`ls $ISOIMAGE`" = "" ] ; then
-a ! "`ls $ISOIMAGE_OVERLAY`" = "" ] ; then
echo "The ISO image will have overlay structure."
cp -r $ISOIMAGE_OVERLAY/* $ISOIMAGE
@ -34,84 +38,26 @@ else
echo "The ISO image will have no overlay structure."
fi
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image
# root folder.
cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin $ISOIMAGE
cp $WORK_SYSLINUX_DIR/bios/com32/elflink/ldlinux/ldlinux.c32 $ISOIMAGE
# Create the ISOLINUX configuration file.
cat << CEOF > $ISOIMAGE/syslinux.cfg
PROMPT 1
TIMEOUT 50
DEFAULT mll
SAY
SAY ##################################################################
SAY # #
SAY # Press <ENTER> to boot Minimal Linux Live or wait 5 seconds. #
SAY # #
SAY # Press <TAB> to view available boot entries or enter Syslinux #
SAY # commands directly. #
SAY # #
SAY ##################################################################
SAY
LABEL mll
LINUX kernel.xz
APPEND vga=ask
INITRD rootfs.xz
LABEL mll_nomodeset
LINUX kernel.xz
APPEND vga=ask nomodeset
INITRD rootfs.xz
CEOF
# Create UEFI start script '/efi/boot/startup.nsh'. This script should be
# executed by the firmware on boot if there is no UEFI compatible 'eltorito'
# boot image in the ISO image *and* the UEFI boot shell is enabled.
# Add the Syslinux configuration files for legacy BIOS and additional
# UEFI startup script.
#
# Currently MLL doesn't provide native UEFI stub for boot manager and this
# script is the only UEFI compliant way to pass the execution from the
# firmware to the kernel. All this script does is to execute the kernel
# which is masquaraded as PE/COFF image and pass arguments to the kernel,
# e.g. 'initrd=<initramfs_archive>' and 'nomodeset'.
#
# Currently the 'startup.nsh' approach is most likely not universally
# compatible. For example, this approach most probably will fail on UEFI
# systems where the boot shell is missing or it is disabled.
mkdir -p $ISOIMAGE/EFI/boot
cat << CEOF > $ISOIMAGE/EFI/boot/startup.nsh
echo -off
echo Minimal Linux Live is starting.
\\kernel.xz initrd=\\rootfs.xz nomodeset
# The existing UEFI startup script does not guarantee that you can run
# MLL on UEFI systems. This script is invoked only in case your system
# drops you in UEFI shell with support level 1 or above. See UEFI shell
# specification 2.2, section 3.1. Depending on your system configuration
# you may not end up with UEFI shell even if your system supports it.
# In this case MLL will not boot and you will end up with some kind of
# UEFI error message.
cp -r $SRC_DIR/minimal_boot/bios/* \
$ISOIMAGE
CEOF
# UEFI hacks BEGIN
#
# These files have no impact on the BIOS boot process. In
# UEFI boot shell navigate to 'EFI/minimal' and try to
# execute 'bootia32.efi' or 'bootx64.efi'.
#
# TODO - remove before next MLL release or fix the UEFI issue.
# The proper way to fix the UEFI issue is to provide
# secondary 'eltorito' boot image which is FAT32 and
# contains proper /EFI/boot/xxx files.
mkdir -p $ISOIMAGE/EFI/minimal
cp $WORK_SYSLINUX_DIR/efi32/efi/syslinux.efi \
$ISOIMAGE/EFI/minimal/bootia32.efi
cp $WORK_SYSLINUX_DIR/efi32/com32/elflink/ldlinux/ldlinux.e32 \
$ISOIMAGE/EFI/minimal
cp $WORK_SYSLINUX_DIR/efi64/efi/syslinux.efi \
$ISOIMAGE/EFI/minimal/bootx64.efi
cp $WORK_SYSLINUX_DIR/efi64/com32/elflink/ldlinux/ldlinux.e64 \
$ISOIMAGE/EFI/minimal
# UEFI hacks END
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32'. These files
# are used by Syslinux during the legacy BIOS boot process.
mkdir -p $ISOIMAGE/boot/syslinux
cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin \
$ISOIMAGE/boot/syslinux
cp $WORK_SYSLINUX_DIR/bios/com32/elflink/ldlinux/ldlinux.c32 \
$ISOIMAGE/boot/syslinux
cd $SRC_DIR

View File

@ -14,18 +14,16 @@ fi
cd $ISOIMAGE
# Now we generate the ISO image file.
xorriso \
-as mkisofs \
-R \
-r \
-o $SRC_DIR/minimal_linux_live.iso \
-b isolinux.bin \
-c boot.cat \
-input-charset UTF-8 \
# Now we generate 'hybrid' ISO image file which can also be used on
# USB flash drive, e.g. 'dd if=minimal_linux_live.iso of=/dev/sdb'.
xorriso -as mkisofs \
-isohybrid-mbr $WORK_DIR/syslinux/syslinux-*/bios/mbr/isohdpfx.bin \
-c boot/syslinux/boot.cat \
-b boot/syslinux/isolinux.bin \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-o $SRC_DIR/minimal_linux_live.iso \
$ISOIMAGE
cd $SRC_DIR

View File

@ -1,7 +1,6 @@
The easiest way to build 'Minimal Linux Live' is to run the following script:
sh build_minimal_linux_live.sh
./build_minimal_linux_live.sh
Note that the build process requires proper toolchain already installed and
configured. Check the project website for more information:

View File

@ -0,0 +1,3 @@
echo -off
echo Minimal Linux Live is starting.
\boot\kernel.xz initrd=\boot\rootfs.xz

View File

@ -0,0 +1,24 @@
PROMPT 1
TIMEOUT 50
DEFAULT mll
SAY
SAY ##################################################################
SAY # #
SAY # Press <ENTER> to boot Minimal Linux Live or wait 5 seconds. #
SAY # #
SAY # Press <TAB> to view available boot entries or enter Syslinux #
SAY # commands directly. #
SAY # #
SAY ##################################################################
SAY
LABEL mll
LINUX /boot/kernel.xz
APPEND vga=ask
INITRD /boot/rootfs.xz
LABEL mll_nomodeset
LINUX /boot/kernel.xz
APPEND vga=ask nomodeset
INITRD /boot/rootfs.xz

View File

@ -0,0 +1,4 @@
title Minimal Linux Live
version x86
efi /minimal/x86/kernel.xz
options initrd=/minimal/x86/rootfs.xz

View File

@ -0,0 +1,4 @@
title Minimal Linux Live
version x86_64
efi /minimal/x86_64/kernel.xz
options initrd=/minimal/x86_64/rootfs.xz

View File

@ -0,0 +1,3 @@
default mll-x86_64
timeout 5
editor 1