From 127ed90d89325e3c070959404e55b79c56e8a562 Mon Sep 17 00:00:00 2001
From: Joshua Covington <joshuacov_at_gmail_dot_com>
Date: Wed, 24 Apr 2013 17:54:27 +0200
Subject: [PATCH] fix build with syslinux >= 5
This is based on F17 but should be easily rebased to f18+.
Syslinux 5.xx switched from the COM32 object format to much more
powerful ELF object format
that allows undefined symbols to be resolved at runtime and dynamic
loading of module
dependencies, which means modules now become shared object files
instead of statically
linked binaries - reducing both disk space and runtime memory
consumption. Furthermore
it split non-core functionality into ldlinux.c32
For more information look in the changelog under
http://www.syslinux.org/wiki/
Introduce these changes in the livecd-tools package.
---
imgcreate/live.py | 21 +++++++++++++++++++++
tools/livecd-iso-to-disk.sh | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 87d5129..3384fe5 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -416,6 +416,27 @@ class x86LiveImageCreator(LiveImageCreatorBase):
files = ["isolinux.bin", menu]
if mboot:
files += [mboot]
+
+ # Since Syslinux >= 5 and the switch from the COM32 object
format to ELF
+ # we need 'libcom32.c32' and 'libutil.c32' for
'*menu.c32' to
work properly
+ # as well as 'ldlinux.c32' for the bootloader.
+ version = 0
+ syslinux_version = subprocess.check_output([self._instroot +
"/usr/bin/rpm", "-qi", "syslinux"])
+ if len(syslinux_version) <= 0:
+ raise CreatorError("syslinux not installed or not in rpm
database")
+
+ for strings in syslinux_version.split('\n'):
+ if strings.startswith('Version'):
+ for part in strings.split(':'):
+ if part.startswith(' '):
+ version = int(float(part.strip()))
+ break
+
+ if version >= 5:
+ for lib in ("libcom32.c32", "libutil.c32",
"ldlinux.c32"):
+ for dir in ("/usr/lib/syslinux/",
"/usr/share/syslinux/"):
+ if os.path.isfile(self._instroot + dir + lib):
+ files += [lib]
for f in files:
if os.path.exists(self._instroot + "/usr/lib/syslinux/" + f):
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 0b4d2c8..7104d7c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1358,6 +1358,26 @@ if [ -z "$multi" ]; then
cp /usr/lib/syslinux/menu.c32 $TGTMNT/$SYSLINUXPATH/menu.c32
fi
+ # Since Syslinux >= 5 and the switch from the COM32 object format to ELF
+ # we need 'libcom32.c32' and 'libutil.c32' for '*menu.c32' to
work properly
+ # as well as 'ldlinux.c32' for the bootloader.
+ syslinux_version=`/usr/bin/rpm -qi syslinux | grep Version | cut
-d ':' -f 2 | cut -d '.' -f 1`
+ if (( "$syslinux_version" >= 5 )); then
+ if [ -f /usr/share/syslinux/libcom32.c32 -a -f
/usr/share/syslinux/libutil.c32 -a -f /usr/share/syslinux/ldlinux.c32
]; then
+ cp /usr/share/syslinux/libcom32.c32
$TGTMNT/$SYSLINUXPATH/libcom32.c32
+ cp /usr/share/syslinux/libutil.c32
$TGTMNT/$SYSLINUXPATH/libutil.c32
+ cp /usr/share/syslinux/ldlinux.c32
$TGTMNT/$SYSLINUXPATH/ldlinux.c32
+ elif [ -f /usr/lib/syslinux/libcom32.c32 -a -f
/usr/lib/syslinux/libutil.c32 -a -f /usr/lib/syslinux/ldlinux.c32 ];
then
+ cp /usr/lib/syslinux/libcom32.c32
$TGTMNT/$SYSLINUXPATH/libcom32.c32
+ cp /usr/lib/syslinux/libutil.c32 $TGTMNT/$SYSLINUXPATH/libutil.c32
+ cp /usr/lib/syslinux/ldlinux.c32 $TGTMNT/$SYSLINUXPATH/ldlinux.c32
+ else
+ echo "ERROR: Cannot find 'libcom32.c32, libutil.c32,
ldlinux.c32' which are needed for Syslinux >= 5."
+ cleanup
+ exit 1
+ fi
+ fi
+
if [ "$TGTFS" == "vfat" -o "$TGTFS" ==
"msdos" ]; then
# syslinux expects the config to be named syslinux.cfg
# and has to run with the file system unmounted
@@ -1366,6 +1386,9 @@ if [ -z "$multi" ]; then
if [ -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys ]; then
rm -f $TGTMNT/$SYSLINUXPATH/ldlinux.sys
fi
+ if [ -f $TGTMNT/$SYSLINUXPATH/ldlinux.c32 ]; then
+ rm -f $TGTMNT/$SYSLINUXPATH/ldlinux.c32
+ fi
cleanup
if [ -n "$SYSLINUXPATH" ]; then
syslinux -d $SYSLINUXPATH $TGTDEV
@@ -1373,6 +1396,17 @@ if [ -z "$multi" ]; then
syslinux $TGTDEV
fi
elif [ "$TGTFS" == "ext2" -o "$TGTFS" ==
"ext3" -o "$TGTFS" ==
"ext4" -o "$TGTFS" == "btrfs" ]; then
+ if (( "$syslinux_version" >= 5 )); then
+ if [ -f /boot/extlinux/libcom32.c32 -a -f
/boot/extlinux/libutil.c32 -a -f /boot/extlinux/ldlinux.c32 ]; then
+ cp /boot/extlinux/libcom32.c32
$TGTMNT/$SYSLINUXPATH/libcom32.c32
+ cp /boot/extlinux/libutil.c32 $TGTMNT/$SYSLINUXPATH/libutil.c32
+ cp /boot/extlinux/ldlinux.c32 $TGTMNT/$SYSLINUXPATH/ldlinux.c32
+ else
+ echo "ERROR: Cannot find 'libcom32.c32, libutil.c32,
ldlinux.c32' which are needed for Syslinux >= 5."
+ cleanup
+ exit 1
+ fi
+ fi
# extlinux expects the config to be named extlinux.conf
# and has to be run with the file system mounted
mv $TGTMNT/$SYSLINUXPATH/isolinux.cfg
$TGTMNT/$SYSLINUXPATH/extlinux.conf
--
1.8.2
--
--joshua