From 0fa4369624b4637a7e36ed22e89a759031f08327 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 19 May 2009 16:30:09 -0700 Subject: FAT: change DOS installer to EXE; additional 32K limit fixes Additional fixes for the 32K limits in the installers. In the case of the DOS installer, that means changing it from COM format to EXE format (since COM format has a 63K hard limit); retain the name syslinux.com for user compatibility, though (DOS doesn't care what the extension except for pathname search; if it finds an MZ EXE header it will use it.) With the change to EXE means having to handle more than one segment. Since we don't have a real DOS compiler we have to wing it a bit. Signed-off-by: H. Peter Anvin --- win32/syslinux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'win32') diff --git a/win32/syslinux.c b/win32/syslinux.c index 1699125b..7a0fafb2 100644 --- a/win32/syslinux.c +++ b/win32/syslinux.c @@ -36,7 +36,6 @@ void error(char* msg); #include -#define SECTOR_SIZE 512 #define PART_TABLE 0x1be #define PART_SIZE 0x10 #define PART_COUNT 4 @@ -252,7 +251,9 @@ int main(int argc, char *argv[]) static char ldlinux_name[] = "?:\\ldlinux.sys" ; const char *errmsg; struct libfat_filesystem *fs; - libfat_sector_t s, *secp, sectors[65]; /* 65 is maximum possible */ + libfat_sector_t s, *secp; + libfat_sector_t *sectors; + int ldlinux_sectors; uint32_t ldlinux_cluster; int nsectors; const char *bootsecfile = NULL; @@ -414,12 +415,14 @@ int main(int argc, char *argv[]) } /* Map the file (is there a better way to do this?) */ + ldlinux_sectors = (syslinux_ldlinux_len+SECTOR_SIZE-1) >> SECTOR_BITS; + sectors = calloc(ldlinux_sectors, sizeof *sectors); fs = libfat_open(libfat_readfile, (intptr_t)d_handle); ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL); secp = sectors; nsectors = 0; s = libfat_clustertosector(fs, ldlinux_cluster); - while ( s && nsectors < 65 ) { + while ( s && nsectors < ldlinux_sectors ) { *secp++ = s; nsectors++; s = libfat_nextsector(fs, s); -- cgit v1.2.1