INCLUDE =
CFLAGS = -Wall -O2 -fomit-frame-pointer
LDFLAGS = -O2 -s
+AR = ar
+RANLIB = ranlib
NASM = nasm -O99
NINCLUDE =
# like to keep those uniform for debugging reasons; however, distributors
# want to recompile the installers (ITARGET).
#
-CSRC = syslinux.c gethostip.c
+CSRC = syslinux.c syslxmod.c gethostip.c
NASMSRC = ldlinux.asm syslinux.asm copybs.asm \
pxelinux.asm mbr.asm isolinux.asm isolinux-debug.asm
SOURCES = $(CSRC) $(NASMSRC) *.inc
BTARGET = kwdhash.gen version.gen ldlinux.bss ldlinux.sys ldlinux.bin \
- pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin
+ pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin libsyslinux.a
ITARGET = syslinux.com syslinux copybs.com gethostip mkdiskimage
DOCS = COPYING NEWS README TODO *.doc sample com32/include
OTHER = Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
$(NASM) -f bin -l copybs.lst -o copybs.com copybs.asm
bootsect_bin.c: ldlinux.bss bin2c.pl
- $(PERL) bin2c.pl bootsect < ldlinux.bss > bootsect_bin.c
+ $(PERL) bin2c.pl syslinux_bootsect < ldlinux.bss > bootsect_bin.c
ldlinux_bin.c: ldlinux.sys bin2c.pl
- $(PERL) bin2c.pl ldlinux < ldlinux.sys > ldlinux_bin.c
+ $(PERL) bin2c.pl syslinux_ldlinux < ldlinux.sys > ldlinux_bin.c
-syslinux: syslinux.o bootsect_bin.o ldlinux_bin.o
- $(CC) $(LDFLAGS) -o syslinux \
- syslinux.o bootsect_bin.o ldlinux_bin.o
+libsyslinux.a: bootsect_bin.o ldlinux_bin.o syslxmod.o
+ rm -f $@
+ $(AR) cq $@ $^
+ $(RANLIB) $@
-syslinux.o: syslinux.c patch.offset
+syslinux: syslinux.o libsyslinux.a
+ $(CC) $(LDFLAGS) -o $@ $^
+
+syslxmod.o: syslxmod.c patch.offset
$(CC) $(INCLUDE) $(CFLAGS) -DPATCH_OFFSET=`cat patch.offset` \
-c -o $@ $<
for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -M $$csrc >> .depend ; done
for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
-depend:
+local-depend:
rm -f .depend
$(MAKE) .depend
+depend: local-depend
+ $(MAKE) -C memdisk depend
+
# Hook to add private Makefile targets for the maintainer.
-include Makefile.private
versions, and be able to generate disk images with DOSEMU
headers (controlled by the -d option).
* Fix the COM32 sample program.
- * PXELINUX, ISOLINUX: Fix come COMBOOT API calls.
+ * PXELINUX, ISOLINUX: Fix some COMBOOT API calls.
+ * PXELINUX: Doc fix.
+ * Build SYSLINUX into a small library for encapsulation into
+ other programs.
Changes in 2.00:
* ALL: Add support for "COM32" (32-bit COMBOOT) images.
printf "\n};\n\nunsigned int %s_len = %u;\n", $table_name, $total_len;
+@st = stat STDIN;
+
+printf "\nint %s_mtime = %d;\n", $table_name, $st[9];
+
+exit 0;
for ssrc in $(SSRC) ; do $(CC) $(INCLUDE) -x c -traditional -M $$ssrc | sed -e 's/\.S16\.o/\.o16/' >> .depend ; done
for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
+depend:
+ rm -f .depend
+ $(MAKE) .depend
+
# This file contains the version number, so add a dependency for it
setup.s: ../version
#ident "$Id$"
/* ----------------------------------------------------------------------- *
*
- * Copyright 1998-2002 H. Peter Anvin - All Rights Reserved
+ * Copyright 1998-2001 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <sys/types.h>
#include <sys/wait.h>
+#include "syslinux.h"
+
#ifndef _PATH_MOUNT
#define _PATH_MOUNT "/bin/mount"
#endif
#define _PATH_UMOUNT "/bin/umount"
#endif
-extern unsigned char bootsect[];
-extern unsigned int bootsect_len;
-
-extern unsigned char ldlinux[];
-extern unsigned int ldlinux_len;
-
char *program; /* Name of program */
char *device; /* Device to install to */
uid_t ruid; /* Real uid */
bsSignature = 0x1fe
};
-#define bsCopyStart bsBytesPerSec
-#define bsCopyLen (bsCode-bsBytesPerSec)
-
/*
* Access functions for littleendian numbers, possibly misaligned.
*/
((u_int32_t)p[2] << 16) + ((u_int32_t)p[3] << 24);
}
+#if 0 /* Not needed */
static void set_16(unsigned char *p, u_int16_t v)
{
p[0] = (v & 0xff);
p[1] = ((v >> 8) & 0xff);
}
-#if 0 /* Not needed */
static void set_32(unsigned char *p, u_int32_t v)
{
p[0] = (v & 0xff);
}
#endif
-/* Patch the code so that we're running in stupid mode */
-static void make_stupid(void)
-{
- set_16(ldlinux+PATCH_OFFSET, 1); /* Access only one sector at a time */
-}
-
void usage(void)
{
fprintf(stderr, "Usage: %s [-sf] [-o offset] device\n", program);
while ( *opt ) {
if ( *opt == 's' ) {
- make_stupid(); /* Use "safe, slow and stupid" code */
+ syslinux_make_stupid(); /* Use "safe, slow and stupid" code */
} else if ( *opt == 'f' ) {
force = 1; /* Force install */
} else if ( *opt == 'o' && argp[1] ) {
goto umount;
}
- cdp = ldlinux;
- left = ldlinux_len;
+ cdp = syslinux_ldlinux;
+ left = syslinux_ldlinux_len;
while ( left ) {
nb = write(fd, cdp, left);
if ( nb == -1 && errno == EINTR )
/* Read the superblock again since it might have changed while mounted */
xpread(dev_fd, sectbuf, 512, offset);
- /* Copy the old superblock into the new boot sector */
- memcpy(bootsect+bsCopyStart, sectbuf+bsCopyStart, bsCopyLen);
+ /* Copy the syslinux code into the boot sector */
+ syslinux_make_bootsect(sectbuf);
/* Write new boot sector */
- xpwrite(dev_fd, bootsect, 512, offset);
+ xpwrite(dev_fd, sectbuf, 512, offset);
close(dev_fd);
sync();