aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCONFIG.local1
-rwxr-xr-x[-rw-r--r--]dos/Makefile9
-rw-r--r--dos/ctype.h3
-rwxr-xr-x[-rw-r--r--]dos/dosexe.ld10
-rwxr-xr-xdos/getopt.h25
-rwxr-xr-xdos/getopt_long.c152
-rw-r--r--dos/getsetsl.c19
-rw-r--r--dos/stdio.h2
-rwxr-xr-x[-rw-r--r--]dos/stdlib.h3
-rw-r--r--dos/strchr.c17
-rw-r--r--dos/string.h2
-rw-r--r--dos/strntoumax.c73
-rw-r--r--dos/strtoul.c15
-rw-r--r--dos/sysexits.h1
-rwxr-xr-x[-rw-r--r--]dos/syslinux.c86
-rwxr-xr-x[-rw-r--r--]extlinux/main.c0
-rw-r--r--libinstaller/syslxint.h6
-rwxr-xr-x[-rw-r--r--]libinstaller/syslxmod.c0
-rwxr-xr-x[-rw-r--r--]libinstaller/syslxopt.c8
-rwxr-xr-x[-rw-r--r--]libinstaller/syslxopt.h0
-rwxr-xr-x[-rw-r--r--]linux/syslinux.c0
-rwxr-xr-x[-rw-r--r--]mtools/Makefile0
-rwxr-xr-x[-rw-r--r--]mtools/syslinux.c1
-rwxr-xr-x[-rw-r--r--]win32/Makefile0
-rwxr-xr-x[-rw-r--r--]win32/syslinux.c0
25 files changed, 373 insertions, 60 deletions
diff --git a/MCONFIG.local b/MCONFIG.local
new file mode 100644
index 00000000..f91fc160
--- /dev/null
+++ b/MCONFIG.local
@@ -0,0 +1 @@
+CFLAGS += -DDEBUG=1
diff --git a/dos/Makefile b/dos/Makefile
index 574b65ec..9f48962b 100644..100755
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -28,15 +28,16 @@ INCLUDES = -include code16.h -nostdinc -iwithprefix include \
SRCS = syslinux.c \
../libinstaller/fat.c \
../libinstaller/syslxmod.c \
+ ../libinstaller/syslxopt.c \
../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
- ../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
$(wildcard ../libfat/*.c)
-OBJS = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
+OBJS = header.o crt0.o ldlinux.o \
+ $(patsubst %.c,%.o,$(notdir $(SRCS)))
LIBOBJS = int2526.o conio.o memcpy.o memset.o memmove.o skipatou.o atou.o \
- malloc.o free.o getsetsl.o \
- argv.o printf.o __divdi3.o __udivmoddi4.o
+ malloc.o free.o getopt_long.o getsetsl.o strchr.o strtoul.o \
+ strntoumax.o argv.o printf.o __divdi3.o __udivmoddi4.o
VPATH = .:../libfat:../libinstaller
diff --git a/dos/ctype.h b/dos/ctype.h
new file mode 100644
index 00000000..c0d00c04
--- /dev/null
+++ b/dos/ctype.h
@@ -0,0 +1,3 @@
+static int isspace(int c) {
+ return (c == ' ');
+}
diff --git a/dos/dosexe.ld b/dos/dosexe.ld
index 4612b30a..c67c5060 100644..100755
--- a/dos/dosexe.ld
+++ b/dos/dosexe.ld
@@ -26,20 +26,22 @@ SECTIONS
__header_size = .;
__payload_lma = .;
- . = 0;
+ . = 0x100000000 - syslinux_ldlinux_size;
.payload : AT (__payload_lma) {
__payload_start = .;
- ldlinux_bin.o(.data)
+ *(.payload)
__payload_end = .;
}
__payload_len = __payload_end - __payload_start;
__payload_dwords = __payload_len >> 2;
- . = ALIGN(16);
- __text_lma = __payload_lma + .;
+ __text_lma = __payload_lma + syslinux_ldlinux_size;
__payload_sseg = (__payload_lma - __text_lma) >> 4;
_exe_text_seg = (__text_lma - __header_size) >> 4;
+ __assert1 = ASSERT((__payload_len == syslinux_ldlinux_size),
+ "syslinux_ldlinux_size must equal the size of .payload");
+
. = 0;
.text : AT (__text_lma) {
*(.text .stub .text.* .gnu.linkonce.t.*)
diff --git a/dos/getopt.h b/dos/getopt.h
new file mode 100755
index 00000000..a1b74b10
--- /dev/null
+++ b/dos/getopt.h
@@ -0,0 +1,25 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+/* (Very slightly) adapted from klibc */
+
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+enum {
+ no_argument = 0,
+ required_argument = 1,
+ optional_argument = 2,
+};
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+extern int getopt_long(int, char *const *, const char *,
+ const struct option *, int *);
+
+#endif /* _GETOPT_H */
diff --git a/dos/getopt_long.c b/dos/getopt_long.c
new file mode 100755
index 00000000..14587797
--- /dev/null
+++ b/dos/getopt_long.c
@@ -0,0 +1,152 @@
+/*
+ * getopt.c
+ *
+ * getopt_long(), or at least a common subset thereof:
+ *
+ * - Option reordering is not supported
+ * - -W foo is not supported
+ * - First optstring character "-" not supported.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <getopt.h>
+#include "mystuff.h"
+
+char *optarg;
+int optind, opterr, optopt;
+static struct getopt_private_state {
+ const char *optptr;
+ const char *last_optstring;
+ char *const *last_argv;
+} pvt;
+
+static inline const char *option_matches(const char *arg_str,
+ const char *opt_name)
+{
+ while (*arg_str != '\0' && *arg_str != '=') {
+ if (*arg_str++ != *opt_name++)
+ return NULL;
+ }
+
+ if (*opt_name)
+ return NULL;
+
+ return arg_str;
+}
+
+int getopt_long(int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longindex)
+{
+ const char *carg;
+ const char *osptr;
+ int opt;
+
+ /* getopt() relies on a number of different global state
+ variables, which can make this really confusing if there is
+ more than one use of getopt() in the same program. This
+ attempts to detect that situation by detecting if the
+ "optstring" or "argv" argument have changed since last time
+ we were called; if so, reinitialize the query state. */
+
+ if (optstring != pvt.last_optstring || argv != pvt.last_argv ||
+ optind < 1 || optind > argc) {
+ /* optind doesn't match the current query */
+ pvt.last_optstring = optstring;
+ pvt.last_argv = argv;
+ optind = 1;
+ pvt.optptr = NULL;
+ }
+
+ carg = argv[optind];
+
+ /* First, eliminate all non-option cases */
+
+ if (!carg || carg[0] != '-' || !carg[1])
+ return -1;
+
+ if (carg[1] == '-') {
+ const struct option *lo;
+ const char *opt_end = NULL;
+
+ optind++;
+
+ /* Either it's a long option, or it's -- */
+ if (!carg[2]) {
+ /* It's -- */
+ return -1;
+ }
+
+ for (lo = longopts; lo->name; lo++) {
+ if ((opt_end = option_matches(carg+2, lo->name)))
+ break;
+ }
+ if (!opt_end)
+ return '?';
+
+ if (longindex)
+ *longindex = lo-longopts;
+
+ if (*opt_end == '=') {
+ if (lo->has_arg)
+ optarg = (char *)opt_end+1;
+ else
+ return '?';
+ } else if (lo->has_arg == 1) {
+ if (!(optarg = argv[optind]))
+ return '?';
+ optind++;
+ }
+
+ if (lo->flag) {
+ *lo->flag = lo->val;
+ return 0;
+ } else {
+ return lo->val;
+ }
+ }
+
+ if ((uintptr_t) (pvt.optptr - carg) > (uintptr_t) strlen(carg)) {
+ /* Someone frobbed optind, change to new opt. */
+ pvt.optptr = carg + 1;
+ }
+
+ opt = *pvt.optptr++;
+
+ if (opt != ':' && (osptr = strchr(optstring, opt))) {
+ if (osptr[1] == ':') {
+ if (*pvt.optptr) {
+ /* Argument-taking option with attached
+ argument */
+ optarg = (char *)pvt.optptr;
+ optind++;
+ } else {
+ /* Argument-taking option with non-attached
+ argument */
+ if (argv[optind + 1]) {
+ optarg = (char *)argv[optind+1];
+ optind += 2;
+ } else {
+ /* Missing argument */
+ optind++;
+ return (optstring[0] == ':')
+ ? ':' : '?';
+ }
+ }
+ return opt;
+ } else {
+ /* Non-argument-taking option */
+ /* pvt.optptr will remember the exact position to
+ resume at */
+ if (!*pvt.optptr)
+ optind++;
+ return opt;
+ }
+ } else {
+ /* Unknown option */
+ optopt = opt;
+ if (!*pvt.optptr)
+ optind++;
+ return '?';
+ }
+}
diff --git a/dos/getsetsl.c b/dos/getsetsl.c
index a48f3df2..67e954d1 100644
--- a/dos/getsetsl.c
+++ b/dos/getsetsl.c
@@ -87,7 +87,7 @@ void memcpy_to_sl(void *dst, const void *src, size_t len)
uint16_t seg;
uint16_t off;
- seg = ldlinux_seg + ((size_t)dst >> 4);
+ seg = ds() + ((size_t)dst >> 4);
off = (size_t)dst & 15;
asm volatile("pushw %%es ; "
@@ -98,3 +98,20 @@ void memcpy_to_sl(void *dst, const void *src, size_t len)
: "r" (seg)
: "memory");
}
+
+void memcpy_from_sl(void *dst, const void *src, size_t len)
+{
+ uint16_t seg;
+ uint16_t off;
+
+ seg = ds() + ((size_t)src >> 4);
+ off = (size_t)src & 15;
+
+ asm volatile("pushw %%ds ; "
+ "movw %3,%%ds ; "
+ "rep ; movsb ; "
+ "popw %%ds"
+ : "+D" (dst), "+S" (off), "+c" (len)
+ : "r" (seg)
+ : "memory");
+}
diff --git a/dos/stdio.h b/dos/stdio.h
index 2c256669..c7ca25cb 100644
--- a/dos/stdio.h
+++ b/dos/stdio.h
@@ -16,6 +16,8 @@ int printf(const char *fmt, ...);
#define stdout 1
#define stderr 2
+#define EOF (-1)
+
#define fprintf(x, y, ...) printf(y, ## __VA_ARGS__)
#endif /* STDIO_H */
diff --git a/dos/stdlib.h b/dos/stdlib.h
index 71af6907..d3467056 100644..100755
--- a/dos/stdlib.h
+++ b/dos/stdlib.h
@@ -10,4 +10,7 @@ void *malloc(size_t);
void *calloc(size_t, size_t);
void free(void *);
+extern unsigned long int strtoul(const char *nptr,
+ char **endptr, int base);
+
#endif
diff --git a/dos/strchr.c b/dos/strchr.c
new file mode 100644
index 00000000..83153113
--- /dev/null
+++ b/dos/strchr.c
@@ -0,0 +1,17 @@
+/*
+ * strchr.c
+ */
+
+#include <string.h>
+#include "mystuff.h"
+
+char *strchr(const char *s, int c)
+{
+ while (*s != (char)c) {
+ if (!*s)
+ return NULL;
+ s++;
+ }
+
+ return (char *)s;
+}
diff --git a/dos/string.h b/dos/string.h
index 5ee829e8..f648de2d 100644
--- a/dos/string.h
+++ b/dos/string.h
@@ -21,4 +21,6 @@ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
return rv;
}
+extern char *strchr(const char *s, int c);
+
#endif /* _STRING_H */
diff --git a/dos/strntoumax.c b/dos/strntoumax.c
new file mode 100644
index 00000000..d8bc73bc
--- /dev/null
+++ b/dos/strntoumax.c
@@ -0,0 +1,73 @@
+/*
+ * strntoumax.c
+ *
+ * The strntoumax() function and associated
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <ctype.h>
+
+static inline int digitval(int ch)
+{
+ if (ch >= '0' && ch <= '9') {
+ return ch - '0';
+ } else if (ch >= 'A' && ch <= 'Z') {
+ return ch - 'A' + 10;
+ } else if (ch >= 'a' && ch <= 'z') {
+ return ch - 'a' + 10;
+ } else {
+ return -1;
+ }
+}
+
+uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n)
+{
+ int minus = 0;
+ uintmax_t v = 0;
+ int d;
+
+ while (n && isspace((unsigned char)*nptr)) {
+ nptr++;
+ n--;
+ }
+
+ /* Single optional + or - */
+ if (n && *nptr == '-') {
+ minus = 1;
+ nptr++;
+ n--;
+ } else if (n && *nptr == '+') {
+ nptr++;
+ }
+
+ if (base == 0) {
+ if (n >= 2 && nptr[0] == '0' && (nptr[1] == 'x' || nptr[1] == 'X')) {
+ n -= 2;
+ nptr += 2;
+ base = 16;
+ } else if (n >= 1 && nptr[0] == '0') {
+ n--;
+ nptr++;
+ base = 8;
+ } else {
+ base = 10;
+ }
+ } else if (base == 16) {
+ if (n >= 2 && nptr[0] == '0' && (nptr[1] == 'x' || nptr[1] == 'X')) {
+ n -= 2;
+ nptr += 2;
+ }
+ }
+
+ while (n && (d = digitval(*nptr)) >= 0 && d < base) {
+ v = v * base + d;
+ n--;
+ nptr++;
+ }
+
+ if (endptr)
+ *endptr = (char *)nptr;
+
+ return minus ? -v : v;
+}
diff --git a/dos/strtoul.c b/dos/strtoul.c
new file mode 100644
index 00000000..3be94307
--- /dev/null
+++ b/dos/strtoul.c
@@ -0,0 +1,15 @@
+/*
+ * strtoul.c
+ *
+ * strtoul() function
+ */
+
+#include <stddef.h>
+#include <inttypes.h>
+
+extern uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n);
+
+unsigned long strtoul(const char *nptr, char **endptr, int base)
+{
+ return (unsigned long) strntoumax(nptr, endptr, base, ~(size_t) 0);
+}
diff --git a/dos/sysexits.h b/dos/sysexits.h
new file mode 100644
index 00000000..483d3bab
--- /dev/null
+++ b/dos/sysexits.h
@@ -0,0 +1 @@
+#define EX_USAGE 0x40
diff --git a/dos/syslinux.c b/dos/syslinux.c
index 9574553d..1e086596 100644..100755
--- a/dos/syslinux.c
+++ b/dos/syslinux.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* 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
@@ -18,6 +18,7 @@
*/
#include <errno.h>
+#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -27,6 +28,9 @@
#include "syslinux.h"
#include "libfat.h"
#include "setadv.h"
+#include "sysexits.h"
+#include "syslxopt.h"
+#include "syslxint.h"
const char *program = "syslinux"; /* Name of program */
uint16_t dos_version;
@@ -44,12 +48,6 @@ void pause(void)
# define pause() ((void)0)
#endif
-void __attribute__ ((noreturn)) usage(void)
-{
- puts("Usage: syslinux [-sfmar][-d directory] <drive>: [bootsecfile]\n");
- exit(1);
-}
-
void unlock_device(int);
void __attribute__ ((noreturn)) die(const char *msg)
@@ -122,11 +120,9 @@ int rename(const char *oldname, const char *newname)
return 0;
}
-extern const char __payload_sseg[];
-uint16_t ldlinux_seg;
-
ssize_t write_ldlinux(int fd)
{
+ uint16_t ldlinux_seg = ((size_t)syslinux_ldlinux >> 4) + ds();
uint32_t offset = 0;
uint16_t rv;
uint8_t err;
@@ -139,8 +135,8 @@ ssize_t write_ldlinux(int fd)
"movw %6,%%ds ; "
"int $0x21 ; "
"popw %%ds ; " "setc %0":"=bcdm" (err), "=a"(rv)
- :"a"(0x4000), "b"(fd), "c"(chunk), "d"(offset & 15),
- "SD"((uint16_t) (ldlinux_seg + (offset >> 4))));
+ :"a"(0x4000), "b"(fd), "c"(chunk), "d" (offset & 15),
+ "SD" ((uint16_t)(ldlinux_seg + (offset >> 4))));
if (err || rv == 0)
die("file write error");
offset += rv;
@@ -181,7 +177,7 @@ uint16_t data_segment(void)
void write_device(int drive, const void *buf, size_t nsecs, unsigned int sector)
{
- uint16_t errnum;
+ uint16_t errnum = 0x0001;
struct diskio dio;
dprintf("write_device(%d,%p,%u,%u)\n", drive, buf, nsecs, sector);
@@ -190,14 +186,17 @@ void write_device(int drive, const void *buf, size_t nsecs, unsigned int sector)
dio.sectors = nsecs;
dio.bufoffs = (uintptr_t) buf;
dio.bufseg = data_segment();
-
- /* Try FAT32-aware system call first */
- asm volatile("int $0x21 ; jc 1f ; xorw %0,%0\n"
- "1:"
- : "=a" (errnum)
- : "a" (0x7305), "b" (&dio), "c" (-1), "d" (drive),
- "S" (1), "m" (dio)
- : "memory");
+
+ if (dos_version >= 0x070a) {
+ /* Try FAT32-aware system call first */
+ asm volatile("int $0x21 ; jc 1f ; xorw %0,%0\n"
+ "1:"
+ : "=a" (errnum)
+ : "a" (0x7305), "b" (&dio), "c" (-1), "d" (drive),
+ "S" (1), "m" (dio)
+ : "memory");
+ dprintf(" rv(7305) = %04x", errnum);
+ }
/* If not supported, try the legacy system call (int2526.S) */
if (errnum == 0x0001)
@@ -209,9 +208,9 @@ void write_device(int drive, const void *buf, size_t nsecs, unsigned int sector)
}
}
-void read_device(int drive, const void *buf, size_t nsecs, unsigned int sector)
+void read_device(int drive, void *buf, size_t nsecs, unsigned int sector)
{
- uint16_t errnum;
+ uint16_t errnum = 0x0001;
struct diskio dio;
dprintf("read_device(%d,%p,%u,%u)\n", drive, buf, nsecs, sector);
@@ -220,13 +219,16 @@ void read_device(int drive, const void *buf, size_t nsecs, unsigned int sector)
dio.sectors = nsecs;
dio.bufoffs = (uintptr_t) buf;
dio.bufseg = data_segment();
-
- /* Try FAT32-aware system call first */
- asm volatile("int $0x21 ; jc 1f ; xorw %0,%0\n"
- "1:"
- : "=a" (errnum)
- : "a" (0x7305), "b" (&dio), "c" (-1), "d" (drive),
- "S" (0), "m" (dio));
+
+ if (dos_version >= 0x070a) {
+ /* Try FAT32-aware system call first */
+ asm volatile("int $0x21 ; jc 1f ; xorw %0,%0\n"
+ "1:"
+ : "=a" (errnum)
+ : "a" (0x7305), "b" (&dio), "c" (-1), "d" (drive),
+ "S" (0), "m" (dio));
+ dprintf(" rv(7305) = %04x", errnum);
+ }
/* If not supported, try the legacy system call (int2526.S) */
if (errnum == 0x0001)
@@ -602,8 +604,7 @@ int main(int argc, char *argv[])
int stupid = 0;
int raid_mode = 0;
int patch_sectors;
-
- ldlinux_seg = (size_t) __payload_sseg + data_segment();
+ unsigned char *dp;
dprintf("argv = %p\n", argv);
for (i = 0; i <= argc; i++)
@@ -617,7 +618,7 @@ int main(int argc, char *argv[])
if (**argp == '-') {
opt = *argp + 1;
if (!*opt)
- usage();
+ usage(EX_USAGE, MODE_SYSLINUX_DOSWIN);
while (*opt) {
switch (*opt) {
@@ -641,13 +642,13 @@ int main(int argc, char *argv[])
subdir = *++argp;
break;
default:
- usage();
+ usage(EX_USAGE, MODE_SYSLINUX_DOSWIN);
}
opt++;
}
} else {
if (bootsecfile)
- usage();
+ usage(EX_USAGE, MODE_SYSLINUX_DOSWIN);
else if (device)
bootsecfile = *argp;
else
@@ -656,7 +657,7 @@ int main(int argc, char *argv[])
}
if (!device)
- usage();
+ usage(EX_USAGE, MODE_SYSLINUX_DOSWIN);
/*
* Create an ADV in memory... this should be smarter.
@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
*/
dev_fd = (device[0] & ~0x20) - 0x40;
if (dev_fd < 1 || dev_fd > 26 || device[1] != ':' || device[2])
- usage();
+ usage(EX_USAGE, MODE_SYSLINUX_DOSWIN);
set_lock_device(dev_fd);
@@ -770,15 +771,10 @@ int main(int argc, char *argv[])
* Overwrite the now-patched ldlinux.sys
*/
/* lock_device(3); -- doesn't seem to be needed */
+ dp = syslinux_ldlinux;
for (i = 0; i < patch_sectors; i++) {
- uint16_t si, di, cx;
- si = 0;
- di = (size_t) sectbuf;
- cx = SECTOR_SIZE >> 2;
- asm volatile ("movw %3,%%fs ; fs ; rep ; movsl":"+S" (si), "+D"(di),
- "+c"(cx)
- :"abd"((uint16_t)
- (ldlinux_seg + (i << (SECTOR_SHIFT - 4)))));
+ memcpy_from_sl(sectbuf, dp, SECTOR_SIZE);
+ dp += SECTOR_SIZE;
write_device(dev_fd, sectbuf, 1, sectors[i]);
}
diff --git a/extlinux/main.c b/extlinux/main.c
index a541e38a..a541e38a 100644..100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index f16c2e5c..14a7fc2b 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -111,8 +111,6 @@ static inline void set_64(uint64_t *p, uint64_t v)
*/
#ifdef __MSDOS__
-extern uint16_t ldlinux_seg; /* Defined in dos/syslinux.c */
-
static inline __attribute__ ((const))
uint16_t ds(void)
{
@@ -125,7 +123,7 @@ static inline void *set_fs(const void *p)
{
uint16_t seg;
- seg = ldlinux_seg + ((size_t) p >> 4);
+ seg = ds() + ((size_t) p >> 4);
asm volatile ("movw %0,%%fs"::"rm" (seg));
return (void *)((size_t) p & 0xf);
}
@@ -139,6 +137,7 @@ void set_16_sl(uint16_t * p, uint16_t v);
void set_32_sl(uint32_t * p, uint32_t v);
void set_64_sl(uint64_t * p, uint64_t v);
void memcpy_to_sl(void *dst, const void *src, size_t len);
+void memcpy_from_sl(void *dst, const void *src, size_t len);
#else
@@ -152,6 +151,7 @@ void memcpy_to_sl(void *dst, const void *src, size_t len);
#define set_32_sl(x,y) set_32(x,y)
#define set_64_sl(x,y) set_64(x,y)
#define memcpy_to_sl(d,s,l) memcpy(d,s,l)
+#define memcpy_from_sl(d,s,l) memcpy(d,s,l)
#endif
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index a68f19fb..a68f19fb 100644..100755
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c
index e7f405a1..eb00dbd2 100644..100755
--- a/libinstaller/syslxopt.c
+++ b/libinstaller/syslxopt.c
@@ -108,7 +108,10 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
" --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",
+ mode == MODE_SYSLINUX ? " " : "-o");
+ /* Have to chop this roughly in half for the DOS installer for some reason */
+ fprintf(stderr,
" --menu-save= -M Set the label to select as default on the next boot\n"
" --mbr -m Install an MBR (DOS/Win32 installers only)\n"
" --active -a Mark partition as active (DOS/Win32 installers only)\n"
@@ -120,8 +123,7 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
" which includes zipdisks and LS-120 superfloppies.\n"
"\n"
" The -z option is useful for USB devices which are considered\n"
- " hard disks by some BIOSes and zipdrives by other BIOSes.\n",
- mode == MODE_SYSLINUX ? " " : "-o");
+ " hard disks by some BIOSes and zipdrives by other BIOSes.\n");
exit(rv);
}
diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h
index bcbe0352..bcbe0352 100644..100755
--- a/libinstaller/syslxopt.h
+++ b/libinstaller/syslxopt.h
diff --git a/linux/syslinux.c b/linux/syslinux.c
index 9807bdf0..9807bdf0 100644..100755
--- a/linux/syslinux.c
+++ b/linux/syslinux.c
diff --git a/mtools/Makefile b/mtools/Makefile
index 6164d24c..6164d24c 100644..100755
--- a/mtools/Makefile
+++ b/mtools/Makefile
diff --git a/mtools/syslinux.c b/mtools/syslinux.c
index b5f52000..ac189c61 100644..100755
--- a/mtools/syslinux.c
+++ b/mtools/syslinux.c
@@ -221,6 +221,7 @@ int main(int argc, char *argv[])
" offset=%llu\n",
(unsigned long)mypid,
dev_fd, (unsigned long long)opt.offset);
+
if (ferror(mtc) || fclose(mtc))
die_err(mtools_conf);
diff --git a/win32/Makefile b/win32/Makefile
index 81a6e9ec..81a6e9ec 100644..100755
--- a/win32/Makefile
+++ b/win32/Makefile
diff --git a/win32/syslinux.c b/win32/syslinux.c
index 94593859..94593859 100644..100755
--- a/win32/syslinux.c
+++ b/win32/syslinux.c