From c5912aade0fa8db9f4220f524f3277b947517d4c Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Thu, 18 Nov 2010 17:42:52 +0000 Subject: - 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 PR: ports/152300 Approved by: luigi (maintainer, private e-mail) --- sysutils/syslinux/files/patch-1 | 66 ---------- sysutils/syslinux/files/patch-2 | 19 --- sysutils/syslinux/files/patch-Makefile | 25 ++++ sysutils/syslinux/files/patch-com32-lib-MCONFIG | 11 ++ sysutils/syslinux/files/patch-com32-libutil-md5.c | 12 ++ .../files/patch-com32-libutil-sha256crypt.c | 14 +++ .../files/patch-com32-libutil-sha512crypt.c | 14 +++ sysutils/syslinux/files/patch-com32_lib_MCONFIG | 11 -- .../syslinux/files/patch-libinstaller-bin2c.pl | 18 +++ .../syslinux/files/patch-libinstaller-syslinux.h | 27 ++++ .../syslinux/files/patch-libinstaller-syslxopt.c | 64 ++++++++++ .../syslinux/files/patch-libinstaller-syslxopt.h | 11 ++ .../syslinux/files/patch-libinstaller_syslinux.h | 21 ---- sysutils/syslinux/files/patch-man-syslinux.1 | 70 +++++++++++ sysutils/syslinux/files/patch-mtools-Makefile | 13 ++ sysutils/syslinux/files/patch-mtools-syslinux.c | 140 +++++++++++++++++++++ sysutils/syslinux/files/patch-mtools_syslinux.c | 119 ------------------ sysutils/syslinux/files/patch-syslinux.1 | 68 ---------- 18 files changed, 419 insertions(+), 304 deletions(-) delete mode 100644 sysutils/syslinux/files/patch-1 delete mode 100644 sysutils/syslinux/files/patch-2 create mode 100644 sysutils/syslinux/files/patch-Makefile create mode 100644 sysutils/syslinux/files/patch-com32-lib-MCONFIG create mode 100644 sysutils/syslinux/files/patch-com32-libutil-md5.c create mode 100644 sysutils/syslinux/files/patch-com32-libutil-sha256crypt.c create mode 100644 sysutils/syslinux/files/patch-com32-libutil-sha512crypt.c delete mode 100644 sysutils/syslinux/files/patch-com32_lib_MCONFIG create mode 100644 sysutils/syslinux/files/patch-libinstaller-bin2c.pl create mode 100644 sysutils/syslinux/files/patch-libinstaller-syslinux.h create mode 100644 sysutils/syslinux/files/patch-libinstaller-syslxopt.c create mode 100644 sysutils/syslinux/files/patch-libinstaller-syslxopt.h delete mode 100644 sysutils/syslinux/files/patch-libinstaller_syslinux.h create mode 100644 sysutils/syslinux/files/patch-man-syslinux.1 create mode 100644 sysutils/syslinux/files/patch-mtools-Makefile create mode 100644 sysutils/syslinux/files/patch-mtools-syslinux.c delete mode 100644 sysutils/syslinux/files/patch-mtools_syslinux.c delete mode 100644 sysutils/syslinux/files/patch-syslinux.1 (limited to 'sysutils/syslinux/files') diff --git a/sysutils/syslinux/files/patch-1 b/sysutils/syslinux/files/patch-1 deleted file mode 100644 index e2a6061ef28a..000000000000 --- a/sysutils/syslinux/files/patch-1 +++ /dev/null @@ -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 --#include -+#include - #include - - 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 . */ - --#include --#include -+#include -+#include - #include - #include - #include -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 . */ - --#include --#include -+#include -+#include - #include - #include - #include diff --git a/sysutils/syslinux/files/patch-2 b/sysutils/syslinux/files/patch-2 deleted file mode 100644 index 0f1939ca2ac5..000000000000 --- a/sysutils/syslinux/files/patch-2 +++ /dev/null @@ -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; diff --git a/sysutils/syslinux/files/patch-Makefile b/sysutils/syslinux/files/patch-Makefile new file mode 100644 index 000000000000..365f38ad5c7b --- /dev/null +++ b/sysutils/syslinux/files/patch-Makefile @@ -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 \ diff --git a/sysutils/syslinux/files/patch-com32-lib-MCONFIG b/sysutils/syslinux/files/patch-com32-lib-MCONFIG new file mode 100644 index 000000000000..85bf06474295 --- /dev/null +++ b/sysutils/syslinux/files/patch-com32-lib-MCONFIG @@ -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 $@ $< diff --git a/sysutils/syslinux/files/patch-com32-libutil-md5.c b/sysutils/syslinux/files/patch-com32-libutil-md5.c new file mode 100644 index 000000000000..867449683bb1 --- /dev/null +++ b/sysutils/syslinux/files/patch-com32-libutil-md5.c @@ -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 +-#include ++#include + #include + + static void MD5Transform(uint32_t [4], const unsigned char [64]); diff --git a/sysutils/syslinux/files/patch-com32-libutil-sha256crypt.c b/sysutils/syslinux/files/patch-com32-libutil-sha256crypt.c new file mode 100644 index 000000000000..c3eaa532ef13 --- /dev/null +++ b/sysutils/syslinux/files/patch-com32-libutil-sha256crypt.c @@ -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 . */ + +-#include +-#include ++#include ++#include + #include + #include + #include diff --git a/sysutils/syslinux/files/patch-com32-libutil-sha512crypt.c b/sysutils/syslinux/files/patch-com32-libutil-sha512crypt.c new file mode 100644 index 000000000000..ad4cb60eff71 --- /dev/null +++ b/sysutils/syslinux/files/patch-com32-libutil-sha512crypt.c @@ -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 . */ + +-#include +-#include ++#include ++#include + #include + #include + #include diff --git a/sysutils/syslinux/files/patch-com32_lib_MCONFIG b/sysutils/syslinux/files/patch-com32_lib_MCONFIG deleted file mode 100644 index 85bf06474295..000000000000 --- a/sysutils/syslinux/files/patch-com32_lib_MCONFIG +++ /dev/null @@ -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 $@ $< diff --git a/sysutils/syslinux/files/patch-libinstaller-bin2c.pl b/sysutils/syslinux/files/patch-libinstaller-bin2c.pl new file mode 100644 index 000000000000..055f9c0fbea6 --- /dev/null +++ b/sysutils/syslinux/files/patch-libinstaller-bin2c.pl @@ -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; diff --git a/sysutils/syslinux/files/patch-libinstaller-syslinux.h b/sysutils/syslinux/files/patch-libinstaller-syslinux.h new file mode 100644 index 000000000000..b7b51bd3b082 --- /dev/null +++ b/sysutils/syslinux/files/patch-libinstaller-syslinux.h @@ -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; + diff --git a/sysutils/syslinux/files/patch-libinstaller-syslxopt.c b/sysutils/syslinux/files/patch-libinstaller-syslxopt.c new file mode 100644 index 000000000000..c23156d4fc68 --- /dev/null +++ b/sysutils/syslinux/files/patch-libinstaller-syslxopt.c @@ -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); diff --git a/sysutils/syslinux/files/patch-libinstaller-syslxopt.h b/sysutils/syslinux/files/patch-libinstaller-syslxopt.h new file mode 100644 index 000000000000..b8f0a4f76d45 --- /dev/null +++ b/sysutils/syslinux/files/patch-libinstaller-syslxopt.h @@ -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 { diff --git a/sysutils/syslinux/files/patch-libinstaller_syslinux.h b/sysutils/syslinux/files/patch-libinstaller_syslinux.h deleted file mode 100644 index 484e97f70b92..000000000000 --- a/sysutils/syslinux/files/patch-libinstaller_syslinux.h +++ /dev/null @@ -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; - diff --git a/sysutils/syslinux/files/patch-man-syslinux.1 b/sysutils/syslinux/files/patch-man-syslinux.1 new file mode 100644 index 000000000000..765b87af8469 --- /dev/null +++ b/sysutils/syslinux/files/patch-man-syslinux.1 @@ -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 . The conversion to a manpage +-was made by Arthur Korn . ++was made by Arthur Korn . FreeBSD-specific notes ++added by Luigi Rizzo. diff --git a/sysutils/syslinux/files/patch-mtools-Makefile b/sysutils/syslinux/files/patch-mtools-Makefile new file mode 100644 index 000000000000..add3529b4c18 --- /dev/null +++ b/sysutils/syslinux/files/patch-mtools-Makefile @@ -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 \ diff --git a/sysutils/syslinux/files/patch-mtools-syslinux.c b/sysutils/syslinux/files/patch-mtools-syslinux.c new file mode 100644 index 000000000000..3b5ef2420b80 --- /dev/null +++ b/sysutils/syslinux/files/patch-mtools-syslinux.c @@ -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 ++//#include + #include + #include + #include + #include +-#include ++//#include + #include + #include + #include +@@ -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); + diff --git a/sysutils/syslinux/files/patch-mtools_syslinux.c b/sysutils/syslinux/files/patch-mtools_syslinux.c deleted file mode 100644 index 6c5c99648f0e..000000000000 --- a/sysutils/syslinux/files/patch-mtools_syslinux.c +++ /dev/null @@ -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); - diff --git a/sysutils/syslinux/files/patch-syslinux.1 b/sysutils/syslinux/files/patch-syslinux.1 deleted file mode 100644 index 31d95947bfbc..000000000000 --- a/sysutils/syslinux/files/patch-syslinux.1 +++ /dev/null @@ -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 . The conversion to a manpage --was made by Arthur Korn . -+was made by Arthur Korn . FreeBSD-specific notes -+added by Luigi Rizzo. -- cgit v1.2.3