Add support for making ext[234] or btrfs hdd images bootable with extlinux (Closes...
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Sun, 27 Apr 2014 10:35:58 +0000 (12:35 +0200)
committerDaniel Baumann <mail@daniel-baumann.ch>
Sun, 27 Apr 2014 10:37:37 +0000 (12:37 +0200)
extlinux configuration for the bootable image is installed to
/boot/extlinux, matching the extlinux-install script in Debian.

From the configuration point of view it's still called "syslinux",
the same as the rest of the syslinux family (pxelinux, isolinux etc.)

debian/live-build.bug-script
functions/defaults.sh
scripts/build/binary_hdd
scripts/build/binary_syslinux

index 4c2a21e..8a68d30 100644 (file)
@@ -6,7 +6,7 @@ DEFAULT_SETTINGS="/etc/live/build.conf"
 dpkg -l debootstrap cdebootstrap
 
 # Checking suggests
-dpkg -l dosfstools xorriso loadlin memtest86+ memtest86 mtools parted squashfs-tools mtd-tools syslinux grub uuid-runtime win32-loader
+dpkg -l dosfstools xorriso loadlin memtest86+ memtest86 mtools parted squashfs-tools mtd-tools syslinux syslinux-common extlinux grub uuid-runtime win32-loader
 
 if [ -e "${DEFAULT_SETTINGS}" ]; then
        echo "Contents of ${DEFAULT_SETTINGS}:"
index 92f0067..b1c22e2 100755 (executable)
@@ -1061,12 +1061,12 @@ Check_defaults ()
 
        if [ "${LB_BOOTLOADER}" = "syslinux" ]
        then
-               # syslinux + fat
+               # syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
                case "${LB_BINARY_FILESYSTEM}" in
-                       fat*|ntfs)
+                       fat*|ntfs|ext[234]|btrfs)
                                ;;
                        *)
-                               Echo_warning "You have selected values of LB_BOOTLOADER and LB_BINARY_FILESYSTEM which are incompatible - syslinux only supports FAT and NTFS filesystems."
+                               Echo_warning "You have selected values of LB_BOOTLOADER and LB_BINARY_FILESYSTEM which are incompatible - the syslinux family only support FAT, NTFS, ext[234] or btrfs filesystems."
                                ;;
                esac
        fi
index e335a81..1868d9d 100755 (executable)
@@ -77,7 +77,19 @@ case "${LB_BOOTLOADER}" in
                ;;
 
        syslinux)
-               Check_package chroot/usr/bin/syslinux syslinux
+               case ${LB_BINARY_FILESYSTEM} in
+                       fat*|ntfs)
+                               _BOOTLOADER=syslinux
+                               ;;
+                       ext[234]|btrfs)
+                               _BOOTLOADER=extlinux
+                               ;;
+                       *)
+                               Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
+                               exit 1
+                               ;;
+               esac
+               Check_package chroot/usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
                ;;
 esac
 
@@ -179,7 +191,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
 
                if [ "${LB_BOOTLOADER}" = "syslinux" ]
                then
-                       dd if=chroot/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1
+                       dd if=chroot/usr/lib/${_BOOTLOADER}/mbr.bin of=${FREELO} bs=440 count=1
                fi
                ;;
 
@@ -191,7 +203,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
 
                if [ "${LB_BOOTLOADER}" = "syslinux" ]
                then
-                       dd if=/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1
+                       dd if=/usr/lib/${_BOOTLOADER}/mbr.bin of=${FREELO} bs=440 count=1
                fi
                ;;
 esac
@@ -247,6 +259,8 @@ case "${LB_BINARY_FILESYSTEM}" in
                ;;
 esac
 
+Echo_message "Copying binary contents into image..."
+
 mkdir -p chroot/binary.tmp
 mount ${MOUNT_OPTIONS} ${FREELO} chroot/binary.tmp
 cp -T ${CP_OPTIONS} binary/ chroot/binary.tmp
@@ -282,22 +296,33 @@ EOF
 fi
 }
 
-umount chroot/binary.tmp
-rmdir chroot/binary.tmp
+case "${_BOOTLOADER}" in
+       syslinux)
+               _SYSLINUX_INSTALLER="syslinux ${FREELO}"
+               ;;
+       extlinux)
+               _SYSLINUX_INSTALLER="extlinux --install /binary.tmp/boot/extlinux"
+               ;;
+       *)
+               _SYSLINUX_INSTALLER=""
+               ;;
+esac
 
-if [ "${LB_BOOTLOADER}" = "syslinux" ]
+if [ -n "${_SYSLINUX_INSTALLER}" ]
 then
        case "${LB_BUILD_WITH_CHROOT}" in
                true)
-                       Chroot chroot "syslinux ${FREELO}"
+                       Chroot chroot "${_SYSLINUX_INSTALLER}"
                        ;;
-
                false)
-                       syslinux ${FREELO}
+                       ${_SYSLINUX_INSTALLER}
                        ;;
        esac
 fi
 
+umount chroot/binary.tmp
+rmdir chroot/binary.tmp
+
 Lodetach ${FREELO}
 
 echo "!!! The above error/warning messages can be ignored !!!"
index 1cf7f75..9d32e22 100755 (executable)
@@ -79,15 +79,28 @@ case "${LIVE_IMAGE_TYPE}" in
                ;;
 
        hdd*|*)
-               _BOOTLOADER="syslinux"
-
-               case "${LB_MODE}" in
-                       progress-linux)
-                               _TARGET="binary/boot"
+               case ${LB_BINARY_FILESYSTEM} in
+                       fat*|ntfs)
+                               _BOOTLOADER=syslinux
+
+                               case "${LB_MODE}" in
+                                       progress-linux)
+                                               _TARGET="binary/boot"
+                                               ;;
+
+                                       *)
+                                               _TARGET="binary/syslinux"
+                                               ;;
+                               esac
                                ;;
 
+                       ext[234]|btrfs)
+                               _BOOTLOADER=extlinux
+                               _TARGET="binary/boot/extlinux"
+                               ;;
                        *)
-                               _TARGET="binary/syslinux"
+                               Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
+                               exit 1
                                ;;
                esac
                ;;
@@ -110,7 +123,7 @@ fi
 # Checking depends
 case "${LB_BUILD_WITH_CHROOT}" in
        true)
-               Check_package chroot/usr/bin/syslinux syslinux
+               Check_package chroot/usr/bin/${_BOOTLOADER} ${_BOOTLOADER}
                Check_package chroot/usr/lib/syslinux syslinux-common
 
                if ls "${_SOURCE}"/*.svg* > /dev/null 2>&1
@@ -120,10 +133,10 @@ case "${LB_BUILD_WITH_CHROOT}" in
                ;;
 
        false)
-               if [ ! -e /usr/bin/syslinux ]
+               if [ ! -e /usr/bin/${_BOOTLOADER} ]
                then
-                       # syslinux
-                       Echo_error "/usr/bin/syslinux - no such file."
+                       # syslinux or extlinux
+                       Echo_error "/usr/bin/${_BOOTLOADER} - no such file."
                        exit 1
                fi