aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rw-r--r--NEWS1
-rw-r--r--syslinux-nomtools.c111
-rw-r--r--syslinux.c108
-rw-r--r--syslinux.doc7
-rw-r--r--syslinux.h3
-rw-r--r--syslxmod.c91
-rw-r--r--win32/Makefile5
8 files changed, 102 insertions, 241 deletions
diff --git a/Makefile b/Makefile
index 95211e01..6c7a6d4b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,11 +15,12 @@
# Main Makefile for SYSLINUX
#
+OSTYPE = $(shell uname -msr)
CC = gcc
INCLUDE =
-CFLAGS = -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
+CFLAGS = -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
PIC = -fPIC
-LDFLAGS = -O2 -s
+LDFLAGS = -O2 -s
AR = ar
RANLIB = ranlib
@@ -50,9 +51,11 @@ CSRC = syslinux.c syslinux-nomtools.c syslxmod.c gethostip.c
NASMSRC = ldlinux.asm syslinux.asm copybs.asm \
pxelinux.asm mbr.asm isolinux.asm isolinux-debug.asm
SOURCES = $(CSRC) *.h $(NASMSRC) *.inc
+# syslinux.exe is BTARGET so as to not require everyone to have the
+# mingw suite installed
BTARGET = kwdhash.gen version.gen ldlinux.bss ldlinux.sys ldlinux.bin \
pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin \
- libsyslinux.a $(LIB_SO)
+ libsyslinux.a syslinux.exe $(LIB_SO)
ITARGET = syslinux.com syslinux syslinux-nomtools copybs.com gethostip \
mkdiskimage
DOCS = COPYING NEWS README TODO *.doc sample com32
@@ -65,7 +68,7 @@ OBSOLETE = pxelinux.bin
INSTALL_BIN = syslinux gethostip ppmtolss16 lss16toppm
# Things to install in /usr/lib/syslinux
INSTALL_AUX = pxelinux.0 isolinux.bin isolinux-debug.bin \
- syslinux.com copybs.com memdisk/memdisk
+ syslinux.com syslinux.exe copybs.com memdisk/memdisk
# Things to install in /usr/lib
INSTALL_LIB = $(LIB_SO) libsyslinux.a
# Things to install in /usr/include
@@ -164,6 +167,9 @@ syslxmod.o: syslxmod.c patch.offset
$(CC) $(INCLUDE) $(CFLAGS) $(PIC) -DPATCH_OFFSET=`cat patch.offset` \
-c -o $@ $<
+syslinux.exe: win32/syslinux-mingw.c libsyslinux.a
+ $(MAKE) -C win32 all
+
gethostip.o: gethostip.c
gethostip: gethostip.o
@@ -193,6 +199,7 @@ local-tidy:
tidy: local-tidy
$(MAKE) -C memdisk tidy
+ $(MAKE) -C win32 tidy
local-clean:
rm -f $(ITARGET)
@@ -200,6 +207,7 @@ local-clean:
clean: local-tidy local-clean
$(MAKE) -C sample clean
$(MAKE) -C memdisk clean
+ $(MAKE) -C win32 clean
dist: tidy
for dir in . sample memdisk ; do \
@@ -212,6 +220,7 @@ local-spotless:
spotless: local-clean dist local-spotless
$(MAKE) -C sample spotless
$(MAKE) -C memdisk spotless
+ $(MAKE) -C win32 spotless
.depend:
rm -f .depend
diff --git a/NEWS b/NEWS
index 1e045b57..411b962a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Changes in 2.05:
example, the Ethernet (type 1) address 88:99:AA:BB:CC:DD
would query the file pxelinux.cfg/01-88-99-aa-bb-cc-dd.
* PXELINUX: Fix bug involving non-IP-based config file names.
+ * SYSLINUX: New installer for WinNT-based systems, from Lars Munch.
Changes in 2.04:
* ALL: Reclaim even more low memory by observing that
diff --git a/syslinux-nomtools.c b/syslinux-nomtools.c
index f2dba342..b4b95ecd 100644
--- a/syslinux-nomtools.c
+++ b/syslinux-nomtools.c
@@ -52,61 +52,6 @@ uid_t ruid; /* Real uid */
uid_t euid; /* Initial euid */
pid_t mypid;
-enum bs_offsets {
- bsJump = 0x00,
- bsOemName = 0x03,
- bsBytesPerSec = 0x0b,
- bsSecPerClust = 0x0d,
- bsResSectors = 0x0e,
- bsFATs = 0x10,
- bsRootDirEnts = 0x11,
- bsSectors = 0x13,
- bsMedia = 0x15,
- bsFATsecs = 0x16,
- bsSecPerTrack = 0x18,
- bsHeads = 0x1a,
- bsHiddenSecs = 0x1c,
- bsHugeSectors = 0x20,
- bsDriveNumber = 0x24,
- bsReserved1 = 0x25,
- bsBootSignature = 0x26,
- bsVolumeID = 0x27,
- bsVolumeLabel = 0x2b,
- bsFileSysType = 0x36,
- bsCode = 0x3e,
- bsSignature = 0x1fe
-};
-
-/*
- * Access functions for littleendian numbers, possibly misaligned.
- */
-static u_int16_t get_16(unsigned char *p)
-{
- return (u_int16_t)p[0] + ((u_int16_t)p[1] << 8);
-}
-
-static u_int32_t get_32(unsigned char *p)
-{
- return (u_int32_t)p[0] + ((u_int32_t)p[1] << 8) +
- ((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);
-}
-
-static void set_32(unsigned char *p, u_int32_t v)
-{
- p[0] = (v & 0xff);
- p[1] = ((v >> 8) & 0xff);
- p[2] = ((v >> 16) & 0xff);
- p[3] = ((v >> 24) & 0xff);
-}
-#endif
-
void usage(void)
{
fprintf(stderr, "Usage: %s [-sf] [-o offset] device\n", program);
@@ -177,8 +122,7 @@ int main(int argc, char *argv[])
const unsigned char *cdp;
int dev_fd, fd;
struct stat st;
- int nb, left, veryold;
- unsigned int sectors, clusters;
+ int nb, left;
int err = 0;
pid_t f, w;
int status;
@@ -256,62 +200,13 @@ int main(int argc, char *argv[])
xpread(dev_fd, sectbuf, 512, offset);
fsync(dev_fd);
-
+
/*
* Check to see that what we got was indeed an MS-DOS boot sector/superblock
*/
-
- if ( sectbuf[bsBootSignature] == 0x29 ) {
- /* It's DOS, and it has all the new nice fields */
-
- veryold = 0;
-
- sectors = get_16(sectbuf+bsSectors);
- sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
- clusters = sectors / sectbuf[bsSecPerClust];
-
- if ( !memcmp(sectbuf+bsFileSysType, "FAT12 ", 8) ) {
- if ( clusters > 4086 ) {
- fprintf(stderr, "%s: ERROR: FAT12 but claims more than 4086 clusters\n",
- device);
- exit(1);
- }
- } else if ( !memcmp(sectbuf+bsFileSysType, "FAT16 ", 8) ) {
- if ( clusters <= 4086 ) {
- fprintf(stderr, "%s: ERROR: FAT16 but claims less than 4086 clusters\n",
- device);
- exit(1);
- }
- } else if ( !memcmp(sectbuf+bsFileSysType, "FAT ", 8) ) {
- /* OS/2 sets up the filesystem as just `FAT'. */
- } else {
- fprintf(stderr, "%s: filesystem type \"%8.8s\" not supported\n",
- device, sectbuf+bsFileSysType);
- exit(1);
- }
- } else {
- veryold = 1;
-
- if ( sectbuf[bsSecPerClust] & (sectbuf[bsSecPerClust] - 1) ||
- sectbuf[bsSecPerClust] == 0 ) {
- fprintf(stderr, "%s: This doesn't look like a FAT filesystem\n",
- device);
- }
-
- sectors = get_16(sectbuf+bsSectors);
- sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
- clusters = sectors / sectbuf[bsSecPerClust];
- }
-
- if ( get_16(sectbuf+bsBytesPerSec) != 512 ) {
- fprintf(stderr, "%s: Sector sizes other than 512 not supported\n",
- device);
+ if(!syslinux_check_bootsect(sectbuf,device)) {
exit(1);
}
- if ( sectbuf[bsSecPerClust] > 32 ) {
- fprintf(stderr, "%s: Cluster sizes larger than 16K not supported\n",
- device);
- }
/*
* Now mount the device.
diff --git a/syslinux.c b/syslinux.c
index 5f7c4ebd..a4a5e6d9 100644
--- a/syslinux.c
+++ b/syslinux.c
@@ -42,61 +42,6 @@ char *program; /* Name of program */
char *device; /* Device to install to */
pid_t mypid;
-enum bs_offsets {
- bsJump = 0x00,
- bsOemName = 0x03,
- bsBytesPerSec = 0x0b,
- bsSecPerClust = 0x0d,
- bsResSectors = 0x0e,
- bsFATs = 0x10,
- bsRootDirEnts = 0x11,
- bsSectors = 0x13,
- bsMedia = 0x15,
- bsFATsecs = 0x16,
- bsSecPerTrack = 0x18,
- bsHeads = 0x1a,
- bsHiddenSecs = 0x1c,
- bsHugeSectors = 0x20,
- bsDriveNumber = 0x24,
- bsReserved1 = 0x25,
- bsBootSignature = 0x26,
- bsVolumeID = 0x27,
- bsVolumeLabel = 0x2b,
- bsFileSysType = 0x36,
- bsCode = 0x3e,
- bsSignature = 0x1fe
-};
-
-/*
- * Access functions for littleendian numbers, possibly misaligned.
- */
-static u_int16_t get_16(unsigned char *p)
-{
- return (u_int16_t)p[0] + ((u_int16_t)p[1] << 8);
-}
-
-static u_int32_t get_32(unsigned char *p)
-{
- return (u_int32_t)p[0] + ((u_int32_t)p[1] << 8) +
- ((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);
-}
-
-static void set_32(unsigned char *p, u_int32_t v)
-{
- p[0] = (v & 0xff);
- p[1] = ((v >> 8) & 0xff);
- p[2] = ((v >> 16) & 0xff);
- p[3] = ((v >> 24) & 0xff);
-}
-#endif
-
void usage(void)
{
fprintf(stderr, "Usage: %s [-sf] [-o offset] device\n", program);
@@ -169,8 +114,6 @@ int main(int argc, char *argv[])
static unsigned char sectbuf[512];
int dev_fd;
struct stat st;
- int veryold;
- unsigned int sectors, clusters;
int status;
char **argp, *opt;
int force = 0; /* -f (force) option */
@@ -237,58 +180,9 @@ int main(int argc, char *argv[])
/*
* Check to see that what we got was indeed an MS-DOS boot sector/superblock
*/
-
- if ( sectbuf[bsBootSignature] == 0x29 ) {
- /* It's DOS, and it has all the new nice fields */
-
- veryold = 0;
-
- sectors = get_16(sectbuf+bsSectors);
- sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
- clusters = sectors / sectbuf[bsSecPerClust];
-
- if ( !memcmp(sectbuf+bsFileSysType, "FAT12 ", 8) ) {
- if ( clusters > 4086 ) {
- fprintf(stderr, "%s: ERROR: FAT12 but claims more than 4086 clusters\n",
- device);
- exit(1);
- }
- } else if ( !memcmp(sectbuf+bsFileSysType, "FAT16 ", 8) ) {
- if ( clusters <= 4086 ) {
- fprintf(stderr, "%s: ERROR: FAT16 but claims less than 4086 clusters\n",
- device);
- exit(1);
- }
- } else if ( !memcmp(sectbuf+bsFileSysType, "FAT ", 8) ) {
- /* OS/2 sets up the filesystem as just `FAT'. */
- } else {
- fprintf(stderr, "%s: filesystem type \"%8.8s\" not supported\n",
- device, sectbuf+bsFileSysType);
- exit(1);
- }
- } else {
- veryold = 1;
-
- if ( sectbuf[bsSecPerClust] & (sectbuf[bsSecPerClust] - 1) ||
- sectbuf[bsSecPerClust] == 0 ) {
- fprintf(stderr, "%s: This doesn't look like a FAT filesystem\n",
- device);
- }
-
- sectors = get_16(sectbuf+bsSectors);
- sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
- clusters = sectors / sectbuf[bsSecPerClust];
- }
-
- if ( get_16(sectbuf+bsBytesPerSec) != 512 ) {
- fprintf(stderr, "%s: Sector sizes other than 512 not supported\n",
- device);
+ if(!syslinux_check_bootsect(sectbuf,device)) {
exit(1);
}
- if ( sectbuf[bsSecPerClust] > 32 ) {
- fprintf(stderr, "%s: Cluster sizes larger than 16K not supported\n",
- device);
- }
/*
* Create an mtools configuration file
diff --git a/syslinux.doc b/syslinux.doc
index 1da5fb34..9948991d 100644
--- a/syslinux.doc
+++ b/syslinux.doc
@@ -486,10 +486,12 @@ appropriate drive designator.
umount /mnt
- ---- DOS procedure ----
+ ---- DOS/Windows procedure ----
To make this installation in DOS only, you need the utility copybs.com
-(included with SYSLINUX) as well as the syslinux.com installer.
+(included with SYSLINUX) as well as the syslinux.com installer. If
+you are on an WinNT-based system (WinNT, Win2k, WinXP or later), use
+syslinux.exe instead.
1. Make a DOS bootable disk. This can be done either by specifying
the /s option when formatting the disk in DOS, or by running the
@@ -506,7 +508,6 @@ To make this installation in DOS only, you need the utility copybs.com
3. Run SYSLINUX on the disk:
- [lock a: if you're running under Win95/98/ME]
syslinux a:
4. Copy the Linux kernel image(s), initrd(s), etc to the disk, and
diff --git a/syslinux.h b/syslinux.h
index 855cda71..c40926a7 100644
--- a/syslinux.h
+++ b/syslinux.h
@@ -29,4 +29,7 @@ void syslinux_make_stupid(void);
/* This takes a boot sector and merges in the syslinux fields */
void syslinux_make_bootsect(void *);
+/* Check to see that what we got was indeed an MS-DOS boot sector/superblock */
+int syslinux_check_bootsect(void *bs, char* device);
+
#endif
diff --git a/syslxmod.c b/syslxmod.c
index faf71d88..8225d06a 100644
--- a/syslxmod.c
+++ b/syslxmod.c
@@ -17,18 +17,9 @@
#define _XOPEN_SOURCE 500 /* Required on glibc 2.x */
#define _BSD_SOURCE
-#include <alloca.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <mntent.h>
-#include <paths.h>
#include <stdio.h>
+#include <inttypes.h>
#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
#include "syslinux.h"
@@ -64,25 +55,25 @@ enum bs_offsets {
/*
* Access functions for littleendian numbers, possibly misaligned.
*/
-static inline u_int16_t get_16(unsigned char *p)
+static inline uint16_t get_16(unsigned char *p)
{
- return (u_int16_t)p[0] + ((u_int16_t)p[1] << 8);
+ return (uint16_t)p[0] + ((uint16_t)p[1] << 8);
}
-static inline u_int32_t get_32(unsigned char *p)
+static inline uint32_t get_32(unsigned char *p)
{
- return (u_int32_t)p[0] + ((u_int32_t)p[1] << 8) +
- ((u_int32_t)p[2] << 16) + ((u_int32_t)p[3] << 24);
+ return (uint32_t)p[0] + ((uint32_t)p[1] << 8) +
+ ((uint32_t)p[2] << 16) + ((uint32_t)p[3] << 24);
}
-static inline void set_16(unsigned char *p, u_int16_t v)
+static inline void set_16(unsigned char *p, uint16_t v)
{
p[0] = (v & 0xff);
p[1] = ((v >> 8) & 0xff);
}
#if 0 /* Not needed */
-static inline void set_32(unsigned char *p, u_int32_t v)
+static inline void set_32(unsigned char *p, uint32_t v)
{
p[0] = (v & 0xff);
p[1] = ((v >> 8) & 0xff);
@@ -105,3 +96,69 @@ void syslinux_make_bootsect(void *bs)
memcpy(bootsect+bsHead, syslinux_bootsect+bsHead, bsHeadLen);
memcpy(bootsect+bsCode, syslinux_bootsect+bsCode, bsCodeLen);
}
+
+/*
+ * Check to see that what we got was indeed an MS-DOS boot sector/superblock
+ */
+int syslinux_check_bootsect(void *bs, char* device)
+{
+ int veryold;
+ unsigned int sectors, clusters;
+ unsigned char *sectbuf = bs;
+
+ if ( sectbuf[bsBootSignature] == 0x29 ) {
+ /* It's DOS, and it has all the new nice fields */
+
+ veryold = 0;
+
+ sectors = get_16(sectbuf+bsSectors);
+ sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
+ clusters = sectors / sectbuf[bsSecPerClust];
+
+ if ( !memcmp(sectbuf+bsFileSysType, "FAT12 ", 8) ) {
+ if ( clusters > 4086 ) {
+ fprintf(stderr, "%s: ERROR: FAT12 but claims more than 4086 clusters\n",
+ device);
+ return 0;
+ }
+ } else if ( !memcmp(sectbuf+bsFileSysType, "FAT16 ", 8) ) {
+ if ( clusters <= 4086 ) {
+ fprintf(stderr, "%s: ERROR: FAT16 but claims less than 4086 clusters\n",
+ device);
+ return 0;
+ }
+ } else if ( !memcmp(sectbuf+bsFileSysType, "FAT ", 8) ) {
+ /* OS/2 sets up the filesystem as just `FAT'. */
+ } else {
+ fprintf(stderr, "%s: filesystem type \"%8.8s\" not supported\n",
+ device, sectbuf+bsFileSysType);
+ return 0;
+ }
+ } else {
+ veryold = 1;
+
+ if ( sectbuf[bsSecPerClust] & (sectbuf[bsSecPerClust] - 1) ||
+ sectbuf[bsSecPerClust] == 0 ) {
+ fprintf(stderr, "%s: This doesn't look like a FAT filesystem\n",
+ device);
+ }
+
+ sectors = get_16(sectbuf+bsSectors);
+ sectors = sectors ? sectors : get_32(sectbuf+bsHugeSectors);
+ clusters = sectors / sectbuf[bsSecPerClust];
+ }
+
+ if ( get_16(sectbuf+bsBytesPerSec) != 512 ) {
+ fprintf(stderr, "%s: Sector sizes other than 512 not supported\n",
+ device);
+ return 0;
+ }
+
+ if ( sectbuf[bsSecPerClust] > 32 ) {
+ fprintf(stderr, "%s: Cluster sizes larger than 16K not supported\n",
+ device);
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/win32/Makefile b/win32/Makefile
index c295c4fa..b570d6b6 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -77,5 +77,6 @@ tidy:
clean: tidy
-spotless:
- rm -f ../syslinux.exe
+spotless: clean
+ rm -f ../syslinux.exe *~
+