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 # 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 generation in 'xx_build_kernel.sh' and the build process uses the
# config file provided in this parameter. Place the configuration file here: # 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'. # 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. # 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 # Use already downloaded source bundles instead of downloading them from
# internet. This is useful when you have already downloaded the sources and have # 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 # no internet connection, or if you want to share your version of 'Minimal Linux
# Live" with predefined sources. # Live' with predefined sources.
# #
USE_LOCAL_SOURCE=false 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." echo "Removing old ISO image work area. This may take a while."
rm -rf $ISOIMAGE rm -rf $ISOIMAGE
# This is the root folder of the ISO image.
echo "Preparing new ISO image work area." echo "Preparing new ISO image work area."
mkdir -p $ISOIMAGE mkdir -p $ISOIMAGE
# This is the folder where we keep legacy BIOS boot artifacts.
mkdir -p $ISOIMAGE/boot
# Now we copy the kernel. # 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. # 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 # Now we copy the overlay content if it exists
if [ -d $ISOIMAGE_OVERLAY \ if [ -d $ISOIMAGE_OVERLAY \
-a ! "`ls $ISOIMAGE`" = "" ] ; then -a ! "`ls $ISOIMAGE_OVERLAY`" = "" ] ; then
echo "The ISO image will have overlay structure." echo "The ISO image will have overlay structure."
cp -r $ISOIMAGE_OVERLAY/* $ISOIMAGE cp -r $ISOIMAGE_OVERLAY/* $ISOIMAGE
@ -34,84 +38,26 @@ else
echo "The ISO image will have no overlay structure." echo "The ISO image will have no overlay structure."
fi fi
# Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image # Add the Syslinux configuration files for legacy BIOS and additional
# root folder. # UEFI startup script.
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.
# #
# Currently MLL doesn't provide native UEFI stub for boot manager and this # The existing UEFI startup script does not guarantee that you can run
# script is the only UEFI compliant way to pass the execution from the # MLL on UEFI systems. This script is invoked only in case your system
# firmware to the kernel. All this script does is to execute the kernel # drops you in UEFI shell with support level 1 or above. See UEFI shell
# which is masquaraded as PE/COFF image and pass arguments to the kernel, # specification 2.2, section 3.1. Depending on your system configuration
# e.g. 'initrd=<initramfs_archive>' and 'nomodeset'. # 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
# Currently the 'startup.nsh' approach is most likely not universally # UEFI error message.
# compatible. For example, this approach most probably will fail on UEFI cp -r $SRC_DIR/minimal_boot/bios/* \
# systems where the boot shell is missing or it is disabled. $ISOIMAGE
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
CEOF # Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32'. These files
# are used by Syslinux during the legacy BIOS boot process.
# UEFI hacks BEGIN mkdir -p $ISOIMAGE/boot/syslinux
# cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin \
# These files have no impact on the BIOS boot process. In $ISOIMAGE/boot/syslinux
# UEFI boot shell navigate to 'EFI/minimal' and try to cp $WORK_SYSLINUX_DIR/bios/com32/elflink/ldlinux/ldlinux.c32 \
# execute 'bootia32.efi' or 'bootx64.efi'. $ISOIMAGE/boot/syslinux
#
# 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
cd $SRC_DIR cd $SRC_DIR

View File

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

View File

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