Bug#745816: live-build: please support ext[234]/btrfs binary.img, booted with extlinux
Package: live-build
Version: 4.0~alpha33-1
Severity: wishlist
Tags: patch
The syslinux family of bootloaders includes extlinux, which can boot
ext[234] and btrfs images. There are two ways this could work:
- ext* or btrfs as a replacement for FAT/NTFS: hdd image containing a
partition table with one ext* or btrfs partition, containing
kernel, initrd, extlinux, and /live/filesystem.squashfs (or whatever)
with the real root filesystem
(--binary-images hdd --binary-filesystem ext4 --chroot-filesystem squashfs)
- flat ext* or btrfs filesystem: hdd image containing a partition table
with one ext* or btrfs partition, containing the real root filesystem
rooted at /, and an additional /live directory containing only the
live kernel and initramfs
(--binary-images hdd --binary-filesystem ext4 --chroot-filesystem none)
The attached patch, which is relative to 4.0~alpha33-1, adds the
first of those. The second mode does not currently work without further
configuration (at least, not with live-boot from wheezy) because the
initramfs doesn't recognize the root filesystem as a viable live image.
The second mode would also be useful when live-build is used without
live-boot, to produce a general-purpose dd'able image for virtual machines
or embedded devices, which AFAICS can be done by omitting the live-*
packages, and providing a local extlinux configuration that boots
/vmlinuz with /initrd.img instead.
Regards,
S
-- System Information:
Debian Release: jessie/sid
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages live-build depends on:
ii cdebootstrap 0.5.10
ii debootstrap 1.0.59
ii python3 3.3.4-1
Versions of packages live-build recommends:
ii cpio 2.11+dfsg-2
ii live-boot-doc 4.0~alpha21-1
ii live-config-doc 4.0~alpha32-1
ii live-manual-html [live-manual] 1:4.0~alpha11-1
live-build suggests no packages.
-- no debconf information
>From bf2ab48435f41a169dcdd5d20ed1322e5f5ccd4f Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Fri, 25 Apr 2014 12:43:48 +0100
Subject: [PATCH] Add support for making ext[234] or btrfs hdd images bootable
with extlinux
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 | 2 +-
functions/defaults.sh | 6 +++---
scripts/build/binary_hdd | 42 +++++++++++++++++++++++++++++++++---------
scripts/build/binary_syslinux | 33 +++++++++++++++++++++++----------
4 files changed, 60 insertions(+), 23 deletions(-)
diff --git a/debian/live-build.bug-script b/debian/live-build.bug-script
index 4c2a21e..8a68d30 100644
--- a/debian/live-build.bug-script
+++ b/debian/live-build.bug-script
@@ -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}:"
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 000e224..f3e80c5 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -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
diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 5fd745d..68ae6ad 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -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
@@ -245,6 +257,7 @@ esac
mkdir -p chroot/binary.tmp
mount ${MOUNT_OPTIONS} ${FREELO} chroot/binary.tmp
+Echo_message "Copying binary contents into image..."
cp -r -T ${CP_OPTIONS} binary/ chroot/binary.tmp
FIXME()
@@ -278,22 +291,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 !!!"
diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
index 085595a..db6634f 100755
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -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
--
2.0.0.rc0
Reply to: