View | Details | Raw Unified | Return to bug 152300
Collapse All | Expand All

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

Return to bug 152300