mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
The syslinux program installs a linux bootloader on a FAT-formatted
filesystem or disk image. This FreeBSD port can additionally operate on plain files containing a FAT image, thus requiring no special privilege. The program relies on mtools to perform the manipulation of the FAT filesystem. WWW: http://syslinux.zytor.com/
This commit is contained in:
parent
29c9d45f89
commit
c7564382f2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=225051
9 changed files with 404 additions and 0 deletions
|
@ -692,6 +692,7 @@
|
|||
SUBDIR += su2
|
||||
SUBDIR += swapd
|
||||
SUBDIR += symlinks
|
||||
SUBDIR += symlinux
|
||||
SUBDIR += symon
|
||||
SUBDIR += synergy
|
||||
SUBDIR += syscp
|
||||
|
|
53
sysutils/syslinux/Makefile
Normal file
53
sysutils/syslinux/Makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
# New ports collection makefile for: syslinux
|
||||
# Date created: Nov.15, 2008
|
||||
# Whom: luigi@FreeBSD.org
|
||||
#
|
||||
# Maintainers: Luigi Rizzo <luigi@FreeBSD.org>
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= syslinux
|
||||
PORTVERSION= 3.72
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= http://www.kernel.org/pub/linux/utils/boot/syslinux/
|
||||
|
||||
MAINTAINER= luigi@FreeBSD.org
|
||||
COMMENT= Syslinux for FreeBSD
|
||||
|
||||
BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm
|
||||
RUN_DEPENDS= mtools:${PORTSDIR}/emulators/mtools
|
||||
|
||||
MAN1= syslinux.1
|
||||
|
||||
USE_BZIP2= yes
|
||||
USE_GMAKE= yes
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
# Following instructions at http://phaq.phunsites.net/2007/02/14/
|
||||
# compiling-pxelinux-and-memdisk-on-freebsd/
|
||||
# convert elf_i386 to elf_i386_fbsd
|
||||
post-extract:
|
||||
(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
|
||||
|
||||
build_pkg-plist:
|
||||
@( ${ECHO} "bin/syslinux" ; \
|
||||
cd ${WRKSRC}; for i in ${_A} ; do \
|
||||
${ECHO} share/syslinux/`basename $$i` ; done ; \
|
||||
${ECHO} "@dirrm share/syslinux" )
|
||||
|
||||
do-install:
|
||||
${MKDIR} ${PREFIX}/share/${PORTNAME}
|
||||
( cd ${WRKSRC}; ${INSTALL_DATA} ${_A} ${PREFIX}/share/${PORTNAME} )
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/mtools/syslinux ${PREFIX}/bin
|
||||
${INSTALL_MAN} ${WRKSRC}/man/syslinux.1 ${PREFIX}/man/man1
|
||||
|
||||
.include <bsd.port.post.mk>
|
3
sysutils/syslinux/distinfo
Normal file
3
sysutils/syslinux/distinfo
Normal file
|
@ -0,0 +1,3 @@
|
|||
MD5 (syslinux-3.72.tar.bz2) = 9858c801ecd36265f4374996324f01a0
|
||||
SHA256 (syslinux-3.72.tar.bz2) = dc19ea3e1297468d9b4c579aba1dd491c963a02887f7fb362c95c6f1c0567e90
|
||||
SIZE (syslinux-3.72.tar.bz2) = 3262688
|
142
sysutils/syslinux/files/patch-1
Normal file
142
sysutils/syslinux/files/patch-1
Normal file
|
@ -0,0 +1,142 @@
|
|||
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/lib/MCONFIG ../../work/syslinux-3.72/com32/lib/MCONFIG
|
||||
--- ./com32/lib/MCONFIG 2008-09-26 01:46:02.000000000 +0200
|
||||
+++ ../../work/syslinux-3.72/com32/lib/MCONFIG 2008-11-25 11:32:22.000000000 +0100
|
||||
@@ -47,7 +47,7 @@
|
||||
$(CC) $(CFLAGS) -S -o $@ $<
|
||||
|
||||
.S.o:
|
||||
- $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
|
||||
+ $(CC) $(filter-out -std=gnu99, $(CFLAGS)) -D__ASSEMBLY__ -c -o $@ $<
|
||||
|
||||
.S.s:
|
||||
$(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
|
||||
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@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@redhat.com>. */
|
||||
|
||||
-#include <alloca.h>
|
||||
-#include <endian.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <machine/endian.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
diff -ubwr ./mtools/syslinux.c ../../work/syslinux-3.72/mtools/syslinux.c
|
||||
--- ./mtools/syslinux.c 2008-09-26 01:46:02.000000000 +0200
|
||||
+++ ../../work/syslinux-3.72/mtools/syslinux.c 2008-11-25 11:32:22.000000000 +0100
|
||||
@@ -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;
|
||||
@@ -159,6 +161,8 @@
|
||||
while ( *opt ) {
|
||||
if ( *opt == 's' ) {
|
||||
stupid = 1;
|
||||
+ } else if ( *opt == 'v' ) {
|
||||
+ verbose++;
|
||||
} else if ( *opt == 'r' ) {
|
||||
raid_mode = 1;
|
||||
} else if ( *opt == 'f' ) {
|
||||
@@ -217,11 +221,9 @@
|
||||
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,
|
||||
+ device,
|
||||
(unsigned long long)filesystem_offset);
|
||||
fclose(mtc);
|
||||
|
||||
@@ -234,8 +236,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)
|
||||
@@ -248,7 +252,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);
|
||||
@@ -256,6 +262,7 @@
|
||||
*secp++ = s;
|
||||
nsectors++;
|
||||
s = libfat_nextsector(fs, s);
|
||||
+if (verbose) fprintf(stderr, "libfat_nextsector returns %d\n", s);
|
||||
}
|
||||
libfat_close(fs);
|
||||
|
41
sysutils/syslinux/files/patch-2
Normal file
41
sysutils/syslinux/files/patch-2
Normal file
|
@ -0,0 +1,41 @@
|
|||
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 -ubwr ../../work/syslinux-3.72/libinstaller/syslinux.h ./libinstaller/syslinux.h
|
||||
--- ../../work/syslinux-3.72/libinstaller/syslinux.h 2008-09-26 01:46:02.000000000 +0200
|
||||
+++ ./libinstaller/syslinux.h 2008-11-26 13:32:23.000000000 +0100
|
||||
@@ -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;
|
||||
|
65
sysutils/syslinux/files/patch-boot_option
Normal file
65
sysutils/syslinux/files/patch-boot_option
Normal file
|
@ -0,0 +1,65 @@
|
|||
diff -ubwr ../../work.2/syslinux-3.72/mtools/syslinux.c ./mtools/syslinux.c
|
||||
--- ../../work.2/syslinux-3.72/mtools/syslinux.c 2008-11-26 13:32:57.000000000 +0100
|
||||
+++ ./mtools/syslinux.c 2008-11-26 14:07:05.000000000 +0100
|
||||
@@ -123,6 +123,52 @@
|
||||
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[])
|
||||
{
|
||||
@@ -163,6 +209,8 @@
|
||||
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' ) {
|
68
sysutils/syslinux/files/patch-syslinux.1
Normal file
68
sysutils/syslinux/files/patch-syslinux.1
Normal file
|
@ -0,0 +1,68 @@
|
|||
--- 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@zytor.com>. The conversion to a manpage
|
||||
-was made by Arthur Korn <arthur@korn.ch>.
|
||||
+was made by Arthur Korn <arthur@korn.ch>. FreeBSD-specific notes
|
||||
+added by Luigi Rizzo.
|
7
sysutils/syslinux/pkg-descr
Normal file
7
sysutils/syslinux/pkg-descr
Normal file
|
@ -0,0 +1,7 @@
|
|||
The syslinux program installs a linux bootloader on a FAT-formatted
|
||||
filesystem or disk image.
|
||||
This FreeBSD port can additionally operate on plain files containing
|
||||
a FAT image, thus requiring no special privilege. The program relies
|
||||
on mtools to perform the manipulation of the FAT filesystem.
|
||||
|
||||
WWW: http://syslinux.zytor.com/
|
24
sysutils/syslinux/pkg-plist
Normal file
24
sysutils/syslinux/pkg-plist
Normal file
|
@ -0,0 +1,24 @@
|
|||
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/cpuidtest.c32
|
||||
share/syslinux/dmitest.c32
|
||||
share/syslinux/elf.c32
|
||||
share/syslinux/ethersel.c32
|
||||
share/syslinux/ifcpu64.c32
|
||||
share/syslinux/linux.c32
|
||||
share/syslinux/mboot.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
|
||||
@dirrm share/syslinux
|
Loading…
Add table
Reference in a new issue