ports/152300: [PATCH] sysutils/syslinux: update to 4.03

Martin Matuska mm at FreeBSD.org
Tue Nov 16 15:20:06 UTC 2010


>Number:         152300
>Category:       ports
>Synopsis:       [PATCH] sysutils/syslinux: update to 4.03
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 16 15:20:05 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Martin Matuska
>Release:        FreeBSD 8.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD neo.vx.sk 8.1-STABLE FreeBSD 8.1-STABLE #0 r215048M: Thu Nov 11 13:36:47 CET
>Description:
- Unbreak and update to 4.03
- Fix and rename patches to match file names
- Depend on perl5 only during build
- Make portlint happy
- Replace with sed and do it in pre-patch stage
- Use DATADIR and MANPREFIX

Added file(s):
- files/patch-Makefile
- files/patch-com32-lib-MCONFIG
- files/patch-com32-libutil-md5.c
- files/patch-com32-libutil-sha256crypt.c
- files/patch-com32-libutil-sha512crypt.c
- files/patch-libinstaller-bin2c.pl
- files/patch-libinstaller-syslinux.h
- files/patch-libinstaller-syslxopt.c
- files/patch-libinstaller-syslxopt.h
- files/patch-man-syslinux.1
- files/patch-mtools-Makefile
- files/patch-mtools-syslinux.c

Removed file(s):
- files/patch-1
- files/patch-2
- files/patch-com32_lib_MCONFIG
- files/patch-libinstaller_syslinux.h
- files/patch-mtools_syslinux.c
- files/patch-syslinux.1

Port maintainer (luigi at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- syslinux-4.03.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/sysutils/syslinux/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile	10 Sep 2010 06:26:08 -0000	1.7
+++ Makefile	16 Nov 2010 15:00:47 -0000
@@ -7,8 +7,7 @@
 #
 
 PORTNAME=	syslinux
-PORTVERSION=	3.83
-PORTREVISION=	1
+PORTVERSION=	4.03
 CATEGORIES=	sysutils
 MASTER_SITES=	${MASTER_SITE_KERNEL_ORG}
 MASTER_SITE_SUBDIR=	linux/boot/syslinux
@@ -17,32 +16,27 @@
 COMMENT=	Syslinux for FreeBSD
 
 BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm
-RUN_DEPENDS= mtools:${PORTSDIR}/emulators/mtools
-
-IGNORE=		Does not run; segfaults.
+RUN_DEPENDS=	mtools:${PORTSDIR}/emulators/mtools
 
 MAN1=		syslinux.1
 
 USE_BZIP2=	yes
 USE_GMAKE=	yes
-# perl is used in post-extract to convert elf names.
-USE_PERL5=	yes
+USE_PERL5_BUILD=	yes
 
 .include <bsd.port.pre.mk>
 
-# Following instructions at http://phaq.phunsites.net/2007/02/14/
-#		compiling-pxelinux-and-memdisk-on-freebsd/
+# utility target to build pkg-plist
+_A =	mbr/mbr.bin mbr/gptmbr.bin \
+	core/pxelinux.0 core/isolinux.bin gpxe/gpxelinux.0 \
+	memdisk/memdisk \
+	com32/menu/*.c32 com32/modules/*.c32
+
 # convert elf_i386 to elf_i386_fbsd
-post-extract:
-	(cd ${WRKSRC}; 						\
+pre-patch:
+	@(cd ${WRKSRC}; 						\
 	${FIND} . -type f -exec ${GREP} -le 'elf_i386' \{\} \; | 	\
-		${XARGS} ${PERL} -i -p -e 's/elf_i386/elf_i386_fbsd/g;' )
-
-# utility target to build pkg-plist
-_A =	mbr/mbr.bin mbr/gptmbr.bin
-_A +=	core/pxelinux.0 core/isolinux.bin gpxe/gpxelinux.0
-_A +=	memdisk/memdisk
-_A +=	com32/menu/*.c32 com32/modules/*.c32
+		${XARGS} ${REINPLACE_CMD} -e 's/elf_i386/elf_i386_fbsd/g;' )
 
 build_pkg-plist:
 	@( ${ECHO} "bin/syslinux"	;		\
@@ -51,9 +45,9 @@
 	  ${ECHO} "@dirrm share/syslinux" )
 
 do-install:
-	${MKDIR} ${PREFIX}/share/${PORTNAME}
-	( cd ${WRKSRC}; ${INSTALL_DATA} ${_A} ${PREFIX}/share/${PORTNAME} )
+	${MKDIR} ${DATADIR}
+	( cd ${WRKSRC}; ${INSTALL_DATA} ${_A} ${DATADIR} )
 	${INSTALL_PROGRAM} ${WRKSRC}/mtools/syslinux ${PREFIX}/bin
-	${INSTALL_MAN} ${WRKSRC}/man/syslinux.1 ${PREFIX}/man/man1
+	${INSTALL_MAN} ${WRKSRC}/man/syslinux.1 ${MANPREFIX}/man/man1
 
 .include <bsd.port.post.mk>
Index: distinfo
===================================================================
RCS file: /home/pcvs/ports/sysutils/syslinux/distinfo,v
retrieving revision 1.2
diff -u -r1.2 distinfo
--- distinfo	8 Dec 2009 10:09:02 -0000	1.2
+++ distinfo	16 Nov 2010 15:00:47 -0000
@@ -1,3 +1,2 @@
-MD5 (syslinux-3.83.tar.bz2) = 069160bc3776eca71a57cabace22bb24
-SHA256 (syslinux-3.83.tar.bz2) = 9ec84d6dcc188f082a875b69796b196f98ea8c0102b55b03123616a285c2d9f9
-SIZE (syslinux-3.83.tar.bz2) = 3184349
+SHA256 (syslinux-4.03.tar.bz2) = c65567e324f9d1f7f794ae8f9578a0292bbd47d7b8d895a004d2f0152d0bda38
+SIZE (syslinux-4.03.tar.bz2) = 4381187
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/sysutils/syslinux/pkg-plist,v
retrieving revision 1.4
diff -u -r1.4 pkg-plist
--- pkg-plist	8 Dec 2009 12:43:38 -0000	1.4
+++ pkg-plist	16 Nov 2010 15:00:47 -0000
@@ -1,30 +1,38 @@
 bin/syslinux
-share/syslinux/mbr.bin
-share/syslinux/gptmbr.bin
-share/syslinux/pxelinux.0
-share/syslinux/isolinux.bin
-share/syslinux/gpxelinux.0
-share/syslinux/memdisk
-share/syslinux/menu.c32
-share/syslinux/vesamenu.c32
-share/syslinux/chain.c32
-share/syslinux/cmd.c32
-share/syslinux/config.c32
-share/syslinux/cpuidtest.c32
-share/syslinux/disk.c32
-share/syslinux/dmitest.c32
-share/syslinux/elf.c32
-share/syslinux/ethersel.c32
-share/syslinux/gpxecmd.c32
-share/syslinux/ifcpu64.c32
-share/syslinux/kbdmap.c32
-share/syslinux/linux.c32
-share/syslinux/meminfo.c32
-share/syslinux/pcitest.c32
-share/syslinux/pmload.c32
-share/syslinux/reboot.c32
-share/syslinux/sanboot.c32
-share/syslinux/sdi.c32
-share/syslinux/vesainfo.c32
-share/syslinux/vpdtest.c32
- at dirrm share/syslinux
+%%DATADIR%%/mbr.bin
+%%DATADIR%%/gptmbr.bin
+%%DATADIR%%/pxelinux.0
+%%DATADIR%%/isolinux.bin
+%%DATADIR%%/gpxelinux.0
+%%DATADIR%%/memdisk
+%%DATADIR%%/menu.c32
+%%DATADIR%%/vesamenu.c32
+%%DATADIR%%/cat.c32
+%%DATADIR%%/chain.c32
+%%DATADIR%%/cmd.c32
+%%DATADIR%%/config.c32
+%%DATADIR%%/cpuid.c32
+%%DATADIR%%/cpuidtest.c32
+%%DATADIR%%/disk.c32
+%%DATADIR%%/dmitest.c32
+%%DATADIR%%/elf.c32
+%%DATADIR%%/ethersel.c32
+%%DATADIR%%/gpxecmd.c32
+%%DATADIR%%/host.c32
+%%DATADIR%%/ifcpu.c32
+%%DATADIR%%/ifcpu64.c32
+%%DATADIR%%/ifplop.c32
+%%DATADIR%%/kbdmap.c32
+%%DATADIR%%/linux.c32
+%%DATADIR%%/ls.c32
+%%DATADIR%%/meminfo.c32
+%%DATADIR%%/pcitest.c32
+%%DATADIR%%/pmload.c32
+%%DATADIR%%/pwd.c32
+%%DATADIR%%/reboot.c32
+%%DATADIR%%/sanboot.c32
+%%DATADIR%%/sdi.c32
+%%DATADIR%%/vesainfo.c32
+%%DATADIR%%/vpdtest.c32
+%%DATADIR%%/whichsys.c32
+ at dirrm %%DATADIR%%
Index: files/patch-1
===================================================================
RCS file: files/patch-1
diff -N files/patch-1
--- files/patch-1	8 Dec 2009 10:09:02 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-diff -ubwr ./Makefile ../../work/syslinux-3.72/Makefile
---- ./Makefile	2008-09-26 01:46:02.000000000 +0200
-+++ ../../work/syslinux-3.72/Makefile	2008-11-25 11:38:14.000000000 +0100
-@@ -48,18 +48,18 @@
- # Note: libinstaller is both a BSUBDIR and an ISUBDIR.  It contains
- # files that depend only on the B phase, but may have to be regenerated
- # for "make installer".
--BSUBDIRS = codepage core memdisk modules com32 mbr memdump gpxe sample \
-+BSUBDIRS_ = codepage core memdisk modules com32 mbr memdump gpxe sample \
- 	   libinstaller dos win32
- ITARGET  =
- IOBJECTS = $(ITARGET) dos/copybs.com \
- 	utils/gethostip utils/isohybrid utils/mkdiskimage \
--	mtools/syslinux linux/syslinux extlinux/extlinux
--ISUBDIRS = libinstaller mtools linux extlinux utils
-+	mtools/syslinux
-+ISUBDIRS = libinstaller mtools
- 
- # Things to install in /usr/bin
- INSTALL_BIN   =	mtools/syslinux
- # Things to install in /sbin
--INSTALL_SBIN  = extlinux/extlinux
-+INSTALL_SBIN  = #extlinux/extlinux
- # Things to install in /usr/lib/syslinux
- INSTALL_AUX   =	core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
- 		core/isolinux-debug.bin \
-diff -ubwr ./com32/libutil/md5.c ../../work/syslinux-3.72/com32/libutil/md5.c
---- ./com32/libutil/md5.c	2008-09-26 01:46:02.000000000 +0200
-+++ ../../work/syslinux-3.72/com32/libutil/md5.c	2008-11-25 11:32:22.000000000 +0100
-@@ -27,7 +27,7 @@
-  */
- 
- #include <string.h>
--#include <endian.h>
-+#include <machine/endian.h>
- #include <md5.h>
- 
- static void MD5Transform(uint32_t [4], const unsigned char [64]);
-diff -ubwr ./com32/libutil/sha256crypt.c ../../work/syslinux-3.72/com32/libutil/sha256crypt.c
---- ./com32/libutil/sha256crypt.c	2008-09-26 01:46:02.000000000 +0200
-+++ ../../work/syslinux-3.72/com32/libutil/sha256crypt.c	2008-11-25 11:32:22.000000000 +0100
-@@ -1,8 +1,8 @@
- /* SHA256-based Unix crypt implementation.
-    Released into the Public Domain by Ulrich Drepper <drepper at redhat.com>.  */
- 
--#include <alloca.h>
--#include <endian.h>
-+#include <stdlib.h>
-+#include <machine/endian.h>
- #include <errno.h>
- #include <limits.h>
- #include <stdint.h>
-diff -ubwr ./com32/libutil/sha512crypt.c ../../work/syslinux-3.72/com32/libutil/sha512crypt.c
---- ./com32/libutil/sha512crypt.c	2008-09-26 01:46:02.000000000 +0200
-+++ ../../work/syslinux-3.72/com32/libutil/sha512crypt.c	2008-11-25 11:32:22.000000000 +0100
-@@ -1,8 +1,8 @@
- /* SHA512-based Unix crypt implementation.
-    Released into the Public Domain by Ulrich Drepper <drepper at redhat.com>.  */
- 
--#include <alloca.h>
--#include <endian.h>
-+#include <stdlib.h>
-+#include <machine/endian.h>
- #include <errno.h>
- #include <limits.h>
- #include <stdbool.h>
Index: files/patch-2
===================================================================
RCS file: files/patch-2
diff -N files/patch-2
--- files/patch-2	8 Dec 2009 10:09:02 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-diff -ubwr ../../work/syslinux-3.72/libinstaller/bin2c.pl ./libinstaller/bin2c.pl
---- ../../work/syslinux-3.72/libinstaller/bin2c.pl	2008-09-26 01:46:02.000000000 +0200
-+++ ./libinstaller/bin2c.pl	2008-11-26 13:32:45.000000000 +0100
-@@ -27,7 +27,7 @@
- 
- $pad = 1 if ($pad < 1);
- 
--printf "unsigned char %s[] = {\n", $table_name;
-+printf "static unsigned char _%s[] = {\n", $table_name;
- 
- $pos = 0;
- $linelen = 8;
-@@ -74,5 +74,6 @@
- @st = stat STDIN;
- 
- printf "\nint %s_mtime = %d;\n", $table_name, $st[9];
-+printf "\nunsigned char *%s = _%s;\n", $table_name, $table_name;
- 
- exit 0;
Index: files/patch-Makefile
===================================================================
RCS file: files/patch-Makefile
diff -N files/patch-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Makefile	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,25 @@
+--- Makefile.orig	2010-10-20 21:25:38.000000000 +0200
++++ Makefile	2010-11-16 14:26:43.525341037 +0100
+@@ -54,18 +54,18 @@
+ # Note: libinstaller is both a BSUBDIR and an ISUBDIR.  It contains
+ # files that depend only on the B phase, but may have to be regenerated
+ # for "make installer".
+-BSUBDIRS = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
++BSUBDIRS_ = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
+ 	   libinstaller dos win32 win64 dosutil
+ ITARGET  =
+ IOBJECTS = $(ITARGET) \
+ 	utils/gethostip utils/isohybrid utils/mkdiskimage \
+-	mtools/syslinux linux/syslinux extlinux/extlinux
+-ISUBDIRS = libinstaller mtools linux extlinux utils
++	mtools/syslinux
++ISUBDIRS = libinstaller mtools
+ 
+ # Things to install in /usr/bin
+ INSTALL_BIN   =	mtools/syslinux
+ # Things to install in /sbin
+-INSTALL_SBIN  = extlinux/extlinux
++INSTALL_SBIN  = #extlinux/extlinux
+ # Things to install in /usr/lib/syslinux
+ INSTALL_AUX   =	core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
+ 		core/isolinux-debug.bin \
Index: files/patch-com32-lib-MCONFIG
===================================================================
RCS file: files/patch-com32-lib-MCONFIG
diff -N files/patch-com32-lib-MCONFIG
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-com32-lib-MCONFIG	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,11 @@
+--- com32/lib/MCONFIG.orig	2009-10-06 02:06:06.000000000 +0400
++++ com32/lib/MCONFIG	2009-12-04 09:46:19.000000000 +0300
+@@ -45,7 +45,7 @@
+ 	$(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
+ 
+ .S.o:
+-	$(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
++	$(CC) $(MAKEDEPS) $(filter-out -std=gnu99, $(CFLAGS)) -D__ASSEMBLY__ -c -o $@ $<
+ 
+ .S.s:
+ 	$(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
Index: files/patch-com32-libutil-md5.c
===================================================================
RCS file: files/patch-com32-libutil-md5.c
diff -N files/patch-com32-libutil-md5.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-com32-libutil-md5.c	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,12 @@
+diff -ubwr ./com32/libutil/md5.c ../../work/syslinux-3.72/com32/libutil/md5.c
+--- ./com32/libutil/md5.c	2008-09-26 01:46:02.000000000 +0200
++++ ../../work/syslinux-3.72/com32/libutil/md5.c	2008-11-25 11:32:22.000000000 +0100
+@@ -27,7 +27,7 @@
+  */
+ 
+ #include <string.h>
+-#include <endian.h>
++#include <machine/endian.h>
+ #include <md5.h>
+ 
+ static void MD5Transform(uint32_t [4], const unsigned char [64]);
Index: files/patch-com32-libutil-sha256crypt.c
===================================================================
RCS file: files/patch-com32-libutil-sha256crypt.c
diff -N files/patch-com32-libutil-sha256crypt.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-com32-libutil-sha256crypt.c	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,14 @@
+diff -ubwr ./com32/libutil/sha256crypt.c ../../work/syslinux-3.72/com32/libutil/sha256crypt.c
+--- ./com32/libutil/sha256crypt.c	2008-09-26 01:46:02.000000000 +0200
++++ ../../work/syslinux-3.72/com32/libutil/sha256crypt.c	2008-11-25 11:32:22.000000000 +0100
+@@ -1,8 +1,8 @@
+ /* SHA256-based Unix crypt implementation.
+    Released into the Public Domain by Ulrich Drepper <drepper at redhat.com>.  */
+ 
+-#include <alloca.h>
+-#include <endian.h>
++#include <stdlib.h>
++#include <machine/endian.h>
+ #include <errno.h>
+ #include <limits.h>
+ #include <stdint.h>
Index: files/patch-com32-libutil-sha512crypt.c
===================================================================
RCS file: files/patch-com32-libutil-sha512crypt.c
diff -N files/patch-com32-libutil-sha512crypt.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-com32-libutil-sha512crypt.c	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,14 @@
+diff -ubwr ./com32/libutil/sha512crypt.c ../../work/syslinux-3.72/com32/libutil/sha512crypt.c
+--- ./com32/libutil/sha512crypt.c	2008-09-26 01:46:02.000000000 +0200
++++ ../../work/syslinux-3.72/com32/libutil/sha512crypt.c	2008-11-25 11:32:22.000000000 +0100
+@@ -1,8 +1,8 @@
+ /* SHA512-based Unix crypt implementation.
+    Released into the Public Domain by Ulrich Drepper <drepper at redhat.com>.  */
+ 
+-#include <alloca.h>
+-#include <endian.h>
++#include <stdlib.h>
++#include <machine/endian.h>
+ #include <errno.h>
+ #include <limits.h>
+ #include <stdbool.h>
Index: files/patch-com32_lib_MCONFIG
===================================================================
RCS file: files/patch-com32_lib_MCONFIG
diff -N files/patch-com32_lib_MCONFIG
--- files/patch-com32_lib_MCONFIG	8 Dec 2009 10:09:02 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- com32/lib/MCONFIG.orig	2009-10-06 02:06:06.000000000 +0400
-+++ com32/lib/MCONFIG	2009-12-04 09:46:19.000000000 +0300
-@@ -45,7 +45,7 @@
- 	$(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
- 
- .S.o:
--	$(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
-+	$(CC) $(MAKEDEPS) $(filter-out -std=gnu99, $(CFLAGS)) -D__ASSEMBLY__ -c -o $@ $<
- 
- .S.s:
- 	$(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
Index: files/patch-libinstaller-bin2c.pl
===================================================================
RCS file: files/patch-libinstaller-bin2c.pl
diff -N files/patch-libinstaller-bin2c.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-libinstaller-bin2c.pl	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,18 @@
+--- libinstaller/bin2c.pl.orig	2010-10-20 21:25:38.000000000 +0200
++++ libinstaller/bin2c.pl	2010-11-16 14:24:32.427122941 +0100
+@@ -27,7 +27,7 @@
+ 
+ $pad = 1 if ($pad < 1);
+ 
+-printf "unsigned char %s[] = {\n", $table_name;
++printf "static unsigned char _%s[] = {\n", $table_name;
+ 
+ $pos = 0;
+ $linelen = 8;
+@@ -74,5 +74,6 @@
+ @st = stat STDIN;
+ 
+ printf "\nconst int %s_mtime = %d;\n", $table_name, $st[9];
++printf "\nunsigned char *%s = _%s;\n", $table_name, $table_name;
+ 
+ exit 0;
Index: files/patch-libinstaller-syslinux.h
===================================================================
RCS file: files/patch-libinstaller-syslinux.h
diff -N files/patch-libinstaller-syslinux.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-libinstaller-syslinux.h	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,27 @@
+--- libinstaller/syslinux.h.orig	2010-10-20 21:25:38.000000000 +0200
++++ libinstaller/syslinux.h	2010-11-16 15:03:24.279408609 +0100
+@@ -18,12 +18,12 @@
+ #include "setadv.h"
+ 
+ /* The standard boot sector and ldlinux image */
+-extern unsigned char syslinux_bootsect[];
++extern unsigned char *syslinux_bootsect;
+ extern const unsigned int syslinux_bootsect_len;
+ extern const int syslinux_bootsect_mtime;
+ 
+-extern unsigned char syslinux_ldlinux[];
+-extern const unsigned int syslinux_ldlinux_len;
++extern unsigned char *syslinux_ldlinux;
++extern unsigned int syslinux_ldlinux_len;
+ extern const int syslinux_ldlinux_mtime;
+ 
+ #define boot_sector	syslinux_bootsect
+@@ -31,7 +31,7 @@
+ #define boot_image	syslinux_ldlinux
+ #define boot_image_len	syslinux_ldlinux_len
+ 
+-extern unsigned char syslinux_mbr[];
++extern unsigned char *syslinux_mbr;
+ extern const unsigned int syslinux_mbr_len;
+ extern const int syslinux_mbr_mtime;
+ 
Index: files/patch-libinstaller-syslxopt.c
===================================================================
RCS file: files/patch-libinstaller-syslxopt.c
diff -N files/patch-libinstaller-syslxopt.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-libinstaller-syslxopt.c	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,64 @@
+--- libinstaller/syslxopt.c.orig	2010-10-20 21:25:38.000000000 +0200
++++ libinstaller/syslxopt.c	2010-11-16 15:09:16.897550744 +0100
+@@ -44,6 +44,8 @@
+     .activate_partition = 0,
+     .force = 0,
+     .bootsecfile = NULL,
++    .verbose = 0,
++    .bimage = NULL,
+ };
+ 
+ const struct option long_options[] = {
+@@ -57,7 +59,7 @@
+     {"stupid", 0, NULL, 's'},
+     {"heads", 1, NULL, 'H'},
+     {"raid-mode", 0, NULL, 'r'},
+-    {"version", 0, NULL, 'v'},
++    {"version", 0, NULL, 'V'},
+     {"help", 0, NULL, 'h'},
+     {"once", 1, NULL, OPT_ONCE},
+     {"clear-once", 0, NULL, 'O'},
+@@ -65,10 +67,12 @@
+     {"menu-save", 1, NULL, 'M'},
+     {"mbr", 0, NULL, 'm'},	/* DOS/Win32 only */
+     {"active", 0, NULL, 'a'},	/* DOS/Win32 only */
++    {"verbose", 0, NULL, 'v' },
++    {"bimage", 1, NULL, 'b' },
+     {0, 0, 0, 0}
+ };
+ 
+-const char short_options[] = "t:fid:UuzsS:H:rvho:OM:ma";
++const char short_options[] = "t:fid:UuzsS:H:rVho:OM:mavb:";
+ 
+ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
+ {
+@@ -109,7 +113,9 @@
+ 	    "  --raid       -r  Fall back to the next device on boot failure\n"
+ 	    "  --once=...   %s  Execute a command once upon boot\n"
+ 	    "  --clear-once -O  Clear the boot-once command\n"
+-	    "  --reset-adv      Reset auxilliary data\n",
++	    "  --reset-adv      Reset auxilliary data\n"
++	    "  --bimage=#   -b  Load a custom boot image\n"
++	    "  --verbose    -v  Increase verbosity level\n",
+ 	    mode == MODE_SYSLINUX  ? "  " : "-o");
+     /*
+      * Have to chop this roughly in half for the DOS installer due
+@@ -209,11 +215,17 @@
+ 	case 'a':
+ 	    opt.activate_partition = 1;
+ 	    break;
+-	case 'v':
++	case 'V':
+ 	    fprintf(stderr,
+ 		    "%s " VERSION_STR "  Copyright 1994-" YEAR_STR
+ 		    " H. Peter Anvin et al\n", program);
+ 	    exit(0);
++	case 'v':
++	    opt.verbose = 1;
++	    break;
++	case 'b':
++	    opt.bimage = optarg;
++	    break;
+ 	default:
+ 	    fprintf(stderr, "%s: Unknown option: -%c\n", program, optopt);
+ 	    usage(EX_USAGE, mode);
Index: files/patch-libinstaller-syslxopt.h
===================================================================
RCS file: files/patch-libinstaller-syslxopt.h
diff -N files/patch-libinstaller-syslxopt.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-libinstaller-syslxopt.h	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,11 @@
+--- libinstaller/syslxopt.h.orig	2010-11-16 14:53:01.569209804 +0100
++++ libinstaller/syslxopt.h	2010-11-16 14:53:08.769406093 +0100
+@@ -18,6 +18,8 @@
+     int install_mbr;
+     int activate_partition;
+     const char *bootsecfile;
++    int verbose;
++    const char *bimage;
+ };
+ 
+ enum long_only_opt {
Index: files/patch-libinstaller_syslinux.h
===================================================================
RCS file: files/patch-libinstaller_syslinux.h
diff -N files/patch-libinstaller_syslinux.h
--- files/patch-libinstaller_syslinux.h	8 Dec 2009 10:09:02 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
---- libinstaller/syslinux.h.orig	2009-10-06 02:06:06.000000000 +0400
-+++ libinstaller/syslinux.h	2009-12-04 10:09:04.000000000 +0300
-@@ -17,15 +17,15 @@
- #include "advconst.h"
- 
- /* The standard boot sector and ldlinux image */
--extern unsigned char syslinux_bootsect[];
-+extern unsigned char *syslinux_bootsect;
- extern unsigned int syslinux_bootsect_len;
- extern int syslinux_bootsect_mtime;
- 
--extern unsigned char syslinux_ldlinux[];
-+extern unsigned char *syslinux_ldlinux;
- extern unsigned int syslinux_ldlinux_len;
- extern int syslinux_ldlinux_mtime;
- 
--extern unsigned char syslinux_mbr[];
-+extern unsigned char *syslinux_mbr;
- extern unsigned int syslinux_mbr_len;
- extern int syslinux_mbr_mtime;
- 
Index: files/patch-man-syslinux.1
===================================================================
RCS file: files/patch-man-syslinux.1
diff -N files/patch-man-syslinux.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-man-syslinux.1	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,70 @@
+--- man/syslinux.1.orig	2010-10-20 21:25:38.000000000 +0200
++++ man/syslinux.1	2010-11-16 14:50:50.947688888 +0100
+@@ -7,21 +7,23 @@
+ .I device
+ .SH DESCRIPTION
+ \fBSyslinux\fP is a boot loader for the Linux operating system which
+-operates off an MS-DOS/Windows FAT filesystem. It is intended to
++operates off a FAT filesystem. It is intended to
+ simplify first-time installation of Linux, and for creation of rescue
+ and other special-purpose boot disks.
+ .PP
+-In order to create a bootable Linux floppy using \fBSyslinux\fP, prepare a
+-normal MS-DOS formatted floppy. Copy one or more Linux kernel files to
+-it, then execute the command:
++In order to create a bootable Linux disk using \fBSyslinux\fP, prepare a
++normal FAT formatted disk (or file image), and
++execute the command:
+ .IP
+ .B syslinux \-\-install /dev/fd0
+ .PP
+-This will alter the boot sector on the disk and copy a file named
+-.I ldlinux.sys
+-into its root directory.
++This will alter the boot sector on the disk, copy a file named
++.I LDLINUX.SYS
++into its root directory and patch the boot sector and LDLINUX.SYS
++(see \fBNOTES\fP).
+ .PP
+-On boot time, by default, the kernel will be loaded from the image named
++On boot time, by default, the boot loader will try to load a linux
++kernel from the image named
+ LINUX on the boot floppy.  This default can be changed, see the section
+ on the \fBsyslinux\fP configuration file.
+ .PP
+@@ -36,6 +38,21 @@
+ .PP
+ \fBSyslinux\fP supports the loading of initial ramdisks (initrd) and the
+ bzImage kernel format.
++.SH NOTES
++The boot sector and LDLINUX.SYS rely heavily on the operation of
++the \fBsyslinux\fP program to run correctly. In particular,
++\fBsyslinux\fP patches the boot sector with the exact location on
++the disk of the first sector of LDLINUX.SYS, and also it patches
++the file LDLINUX.SYS with the exact location on the disk of each
++additional sector of LDLINUX.SYS itself.
++.PP
++This means that if you want to prepare a new bootable disk, it is
++not enough to duplicate the boot sector and LDLINUX.SYS, but you
++really need to run \fBsyslinux\fP to update the sectors addresses.
++.PP
++The version of \fBsyslinux\fP used on FreeBSD makes use of the
++\fBmtools\fP port to modify the FAT filesystem.
++
+ .SH OPTIONS
+ .TP
+ \fB\-i\fP, \fB\-\-install\fP
+@@ -412,9 +429,11 @@
+ .BR lilo (8),
+ .BR keytab-lilo.pl (8),
+ .BR fdisk (8),
+-.BR mkfs (8),
++.BR newfs_msdos (8),
++.BR mtools (1),
+ .BR superformat (1).
+ .SH AUTHOR
+ This manual page is a modified version of the original \fBsyslinux\fP
+ documentation by H. Peter Anvin <hpa at zytor.com>. The conversion to a manpage
+-was made by Arthur Korn <arthur at korn.ch>.
++was made by Arthur Korn <arthur at korn.ch>. FreeBSD-specific notes
++added by Luigi Rizzo.
Index: files/patch-mtools-Makefile
===================================================================
RCS file: files/patch-mtools-Makefile
diff -N files/patch-mtools-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-mtools-Makefile	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,13 @@
+--- mtools/Makefile.orig	2010-11-16 15:44:53.882896167 +0100
++++ mtools/Makefile	2010-11-16 15:45:31.261185647 +0100
+@@ -1,9 +1,8 @@
+ topdir = ..
+ include $(topdir)/MCONFIG
+ 
+-OPTFLAGS = -g -Os
+ INCLUDES = -I. -I.. -I../libfat -I../libinstaller
+-CFLAGS	 = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
++CFLAGS	+= $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(INCLUDES)
+ LDFLAGS	 = -s
+ 
+ SRCS     = syslinux.c \
Index: files/patch-mtools-syslinux.c
===================================================================
RCS file: files/patch-mtools-syslinux.c
diff -N files/patch-mtools-syslinux.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-mtools-syslinux.c	16 Nov 2010 15:00:47 -0000
@@ -0,0 +1,140 @@
+--- mtools/syslinux.c.orig	2010-10-20 21:25:38.000000000 +0200
++++ mtools/syslinux.c	2010-11-16 14:59:55.668749526 +0100
+@@ -20,12 +20,12 @@
+  */
+ 
+ #define _GNU_SOURCE
+-#include <alloca.h>
++//#include <alloca.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <getopt.h>
+ #include <inttypes.h>
+-#include <mntent.h>
++//#include <mntent.h>
+ #include <paths.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -42,6 +42,8 @@
+ #include "setadv.h"
+ #include "syslxopt.h"
+ 
++int verbose=0;
++
+ char *program;			/* Name of program */
+ pid_t mypid;
+ 
+@@ -124,6 +126,53 @@
+     return xpread(pp, buf, secsize, offset);
+ }
+ 
++/*
++ * load a file to be used as boot image
++ */
++static int load_boot_image(const char *name)
++{
++    int l, fd;
++    struct stat sb;
++    unsigned char *buf;
++
++    memset(&sb, 0, sizeof(sb));
++    fd = open(name, O_RDONLY);
++    if (fd < 0) {
++	fprintf(stderr, "cannot open boot image %s\n", name);
++	return 1;
++    }
++    if (fstat(fd, &sb)) {
++	fprintf(stderr, "cannot stat boot image %s\n", name);
++	return 1;
++    }
++    if ( (sb.st_mode & S_IFREG) == 0) {
++	fprintf(stderr, "boot image %s is not a file 0x%x\n", name, sb.st_mode);
++	return 1;
++    }
++    if (sb.st_size < 1024 || sb.st_size > 0x8000) {
++	fprintf(stderr, "boot image %s bad size %lld\n", name, (long long int)sb.st_size);
++	return 1;
++    }
++    buf = calloc(1, sb.st_size);
++    if (buf == NULL) {
++	fprintf(stderr, "malloc failed for boot image %s\n", name);
++	return 1;
++    }
++    l = read(fd, buf, sb.st_size);
++    if (l != sb.st_size) {
++	fprintf(stderr, "read failed for boot image %s got %d\n", name, l);
++	return 1;
++    }
++    if (buf[0] != 0xeb || buf[0x200] != 0x0d) {
++	fprintf(stderr, "bad content for boot image %s\n", name);
++	return 1;
++    }
++    syslinux_bootsect = buf;
++    syslinux_ldlinux = buf + 512;
++    syslinux_ldlinux_len = sb.st_size - 512;
++    return 0;
++}
++
+ int main(int argc, char *argv[])
+ {
+     static unsigned char sectbuf[SECTOR_SIZE];
+@@ -150,9 +199,15 @@
+ 
+     parse_options(argc, argv, MODE_SYSLINUX);
+ 
++    if (opt.verbose)
++	verbose = 1;
++
+     if (!opt.device)
+ 	usage(EX_USAGE, MODE_SYSLINUX);
+ 
++    if (opt.bimage != NULL)
++	load_boot_image(opt.bimage);
++
+     if (opt.sectors || opt.heads || opt.reset_adv || opt.set_once
+ 	|| (opt.update_only > 0) || opt.menu_save) {
+ 	fprintf(stderr,
+@@ -216,11 +271,9 @@
+ 	    /* These are needed for some flash memories */
+ 	    "MTOOLS_SKIP_CHECK=1\n"
+ 	    "MTOOLS_FAT_COMPATIBILITY=1\n"
+-	    "drive s:\n"
+-	    "  file=\"/proc/%lu/fd/%d\"\n"
++	    "drive s: file=\"%s\"\n"
+ 	    "  offset=%llu\n",
+-	    (unsigned long)mypid,
+-	    dev_fd, (unsigned long long)opt.offset);
++	    opt.device, (unsigned long long)opt.offset);
+ 
+     if (ferror(mtc) || fclose(mtc))
+ 	die_err(mtools_conf);
+@@ -239,9 +292,11 @@
+     syslinux_reset_adv(syslinux_adv);
+ 
+     /* This command may fail legitimately */
++    if (verbose) fprintf(stderr, "doing mattrib\n");
+     status = system("mattrib -h -r -s s:/ldlinux.sys 2>/dev/null");
+     (void)status;		/* Keep _FORTIFY_SOURCE happy */
+ 
++    if (verbose) fprintf(stderr, "doing mcopy\n");
+     mtp = popen("mcopy -D o -D O -o - s:/ldlinux.sys", "w");
+     if (!mtp ||
+ 	fwrite(syslinux_ldlinux, 1, syslinux_ldlinux_len, mtp)
+@@ -259,7 +314,9 @@
+ 		       + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
+     sectors = calloc(ldlinux_sectors, sizeof *sectors);
+     fs = libfat_open(libfat_xpread, dev_fd);
++    if (verbose) fprintf(stderr, "libfat_open returns %p\n", fs);
+     ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
++    if (verbose) fprintf(stderr, "libfat_searchdir returns %d\n", ldlinux_cluster);
+     secp = sectors;
+     nsectors = 0;
+     s = libfat_clustertosector(fs, ldlinux_cluster);
+@@ -267,6 +324,7 @@
+ 	*secp++ = s;
+ 	nsectors++;
+ 	s = libfat_nextsector(fs, s);
++	if (verbose) fprintf(stderr, "libfat_nextsector returns %d\n", (int)s);
+     }
+     libfat_close(fs);
+ 
Index: files/patch-mtools_syslinux.c
===================================================================
RCS file: files/patch-mtools_syslinux.c
diff -N files/patch-mtools_syslinux.c
--- files/patch-mtools_syslinux.c	8 Dec 2009 10:09:02 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,119 +0,0 @@
---- mtools/syslinux.c.orig	2009-10-06 02:06:06.000000000 +0400
-+++ mtools/syslinux.c	2009-12-04 11:18:37.000000000 +0300
-@@ -38,6 +38,8 @@
- #include "syslinux.h"
- #include "libfat.h"
- 
-+int verbose=0;
-+
- char *program;			/* Name of program */
- char *device;			/* Device to install to */
- pid_t mypid;
-@@ -123,6 +125,53 @@
-     return xpread(pp, buf, secsize, offset);
- }
- 
-+/*
-+ * load a file to be used as boot image
-+ */
-+static int load_boot_image(const char *name)
-+{
-+    int l, fd;
-+    struct stat sb;
-+    unsigned char *buf;
-+
-+    memset(&sb, 0, sizeof(sb));
-+    fd = open(name, O_RDONLY);
-+    if (fd < 0) {
-+	fprintf(stderr, "cannot open boot image %s\n", name);
-+	return 1;
-+    }
-+    if (fstat(fd, &sb)) {
-+	fprintf(stderr, "cannot stat boot image %s\n", name);
-+	return 1;
-+    }
-+    if ( (sb.st_mode & S_IFREG) == 0) {
-+	fprintf(stderr, "boot image %s is not a file 0x%x\n", name, sb.st_mode);
-+	return 1;
-+    }
-+    if (sb.st_size < 1024 || sb.st_size > 0x8000) {
-+	fprintf(stderr, "boot image %s bad size %lld\n", name, sb.st_size);
-+	return 1;
-+    }
-+    buf = calloc(1, sb.st_size);
-+    if (buf == NULL) {
-+	fprintf(stderr, "malloc failed for boot image %s\n", name);
-+	return 1;
-+    }
-+    l = read(fd, buf, sb.st_size);
-+    if (l != sb.st_size) {
-+	fprintf(stderr, "read failed for boot image %s got %d\n", name, l);
-+	return 1;
-+    }
-+    if (buf[0] != 0xeb || buf[0x200] != 0x0d) {
-+	fprintf(stderr, "bad content for boot image %s\n", name);
-+	return 1;
-+    }
-+    syslinux_bootsect = buf;
-+    syslinux_ldlinux = buf + 512;
-+    syslinux_ldlinux_len = sb.st_size - 512;
-+    return 0;
-+}
-+
- int main(int argc, char *argv[])
- {
-     static unsigned char sectbuf[512];
-@@ -160,6 +209,10 @@
- 	    while (*opt) {
- 		if (*opt == 's') {
- 		    stupid = 1;
-+		} else if ( *opt == 'v' ) {
-+		    verbose++;
-+		} else if ( *opt == 'b' && argp[1] ) {
-+		    load_boot_image(*++argp);
- 		} else if (*opt == 'r') {
- 		    raid_mode = 1;
- 		} else if (*opt == 'f') {
-@@ -220,11 +273,10 @@
-     fprintf(mtc,
- 	    /* "MTOOLS_NO_VFAT=1\n" */
- 	    "MTOOLS_SKIP_CHECK=1\n"	/* Needed for some flash memories */
--	    "drive s:\n"
--	    "  file=\"/proc/%lu/fd/%d\"\n"
-+	    "drive s: file=\"%s\"\n"
- 	    "  offset=%llu\n",
- 	    (unsigned long)mypid,
--	    dev_fd, (unsigned long long)filesystem_offset);
-+	    device, (unsigned long long)filesystem_offset);
-     fclose(mtc);
- 
-     /*
-@@ -236,8 +288,10 @@
-     }
- 
-     /* This command may fail legitimately */
-+    if (verbose) fprintf(stderr, "doing mattrib\n");
-     system("mattrib -h -r -s s:/ldlinux.sys 2>/dev/null");
- 
-+    if (verbose) fprintf(stderr, "doing mcopy\n");
-     mtp = popen("mcopy -D o -D O -o - s:/ldlinux.sys", "w");
-     if (!mtp || (fwrite(syslinux_ldlinux, 1, syslinux_ldlinux_len, mtp)
- 		 != syslinux_ldlinux_len) ||
-@@ -249,7 +303,9 @@
-      * Now, use libfat to create a block map
-      */
-     fs = libfat_open(libfat_xpread, dev_fd);
-+    if (verbose) fprintf(stderr, "libfat_open returns %p\n", fs);
-     ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
-+    if (verbose) fprintf(stderr, "libfat_searchdir returns %d\n", ldlinux_cluster);
-     secp = sectors;
-     nsectors = 0;
-     s = libfat_clustertosector(fs, ldlinux_cluster);
-@@ -257,6 +313,7 @@
- 	*secp++ = s;
- 	nsectors++;
- 	s = libfat_nextsector(fs, s);
-+	if (verbose) fprintf(stderr, "libfat_nextsector returns %d\n", s);
-     }
-     libfat_close(fs);
- 
Index: files/patch-syslinux.1
===================================================================
RCS file: files/patch-syslinux.1
diff -N files/patch-syslinux.1
--- files/patch-syslinux.1	31 Dec 2008 11:43:34 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
---- man/syslinux.1	2008-09-26 01:46:02.000000000 +0200
-+++ ../../files/syslinux.1	2008-11-25 15:38:02.000000000 +0100
-@@ -9,20 +9,22 @@
- .I device
- .SH DESCRIPTION
- \fBSyslinux\fP is a boot loader for the Linux operating system which
--operates off an MS-DOS/Windows FAT filesystem. It is intended to
-+operates off a FAT filesystem. It is intended to
- simplify first-time installation of Linux, and for creation of rescue
- and other special-purpose boot disks.
- .PP
--In order to create a bootable Linux floppy using \fBSyslinux\fP, prepare a
--normal MS-DOS formatted floppy. Copy one or more Linux kernel files to
--it, then execute the command:
-+In order to create a bootable Linux disk using \fBSyslinux\fP, prepare a
-+normal FAT formatted disk (or file image), and
-+execute the command:
- .IP
- .B syslinux /dev/fd0
- .PP
--This will alter the boot sector on the disk and copy a file named
--LDLINUX.SYS into its root directory.
-+This will copy a file named LDLINUX.SYS into the root directory of
-+the disk, install a suitable boot code in the boot sector, and patch the
-+boot sector and LDLINUX.SYS (see \fBNOTES\fP).
- .PP
--On boot time, by default, the kernel will be loaded from the image named
-+On boot time, by default, the boot loader will try to load a linux
-+kernel from the image named
- LINUX on the boot floppy.  This default can be changed, see the section
- on the \fBsyslinux\fP configuration file.
- .PP
-@@ -36,6 +38,21 @@
- .PP
- \fBSyslinux\fP supports the loading of initial ramdisks (initrd) and the
- bzImage kernel format.
-+.SH NOTES
-+The boot sector and LDLINUX.SYS rely heavily on the operation of
-+the \fBsyslinux\fP program to run correctly. In particular,
-+\fBsyslinux\fP patches the boot sector with the exact location on
-+the disk of the first sector of LDLINUX.SYS, and also it patches
-+the file LDLINUX.SYS with the exact location on the disk of each
-+additional sector of LDLINUX.SYS itself.
-+.PP
-+This means that if you want to prepare a new bootable disk, it is
-+not enough to duplicate the boot sector and LDLINUX.SYS, but you
-+really need to run \fBsyslinux\fP to update the sectors addresses.
-+.PP
-+The version of \fBsyslinux\fP used on FreeBSD makes use of the
-+\fBmtools\fP port to modify the FAT filesystem.
-+
- .SH OPTIONS
- .TP
- .B \-s
-@@ -380,9 +397,11 @@
- .BR lilo (8),
- .BR keytab-lilo.pl (8),
- .BR fdisk (8),
--.BR mkfs (8),
-+.BR newfs_msdos (8),
-+.BR mtools (1),
- .BR superformat (1).
- .SH AUTHOR
- This manual page is a modified version of the original \fBsyslinux\fP
- documentation by H. Peter Anvin <hpa at zytor.com>. The conversion to a manpage
--was made by Arthur Korn <arthur at korn.ch>.
-+was made by Arthur Korn <arthur at korn.ch>. FreeBSD-specific notes
-+added by Luigi Rizzo.
--- syslinux-4.03.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list