summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-06-01 18:35:25 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-06-01 18:35:25 -0700
commit350051f3fe38c27e2c32e12aacd7417e845fd428 (patch)
tree096eb1d2b7a27566aab5d9c6254c1d603e482d30
parent43872677a6ebdb038f1b8069fc0e54e7b513cc02 (diff)
downloadsyslinux-3.50-pre18.tar.gz
RAID mode installer support for SYSLINUXsyslinux-3.50-pre18
Hook up RAID mode in the installers for SYSLINUX
-rw-r--r--dos/syslinux.c11
-rw-r--r--mtools/syslinux.c13
-rw-r--r--syslinux.h6
-rw-r--r--syslxmod.c23
-rw-r--r--unix/syslinux.c13
-rw-r--r--win32/syslinux.c11
6 files changed, 50 insertions, 27 deletions
diff --git a/dos/syslinux.c b/dos/syslinux.c
index 94c30fa5..58cc97ee 100644
--- a/dos/syslinux.c
+++ b/dos/syslinux.c
@@ -36,7 +36,7 @@ uint16_t dos_version;
void __attribute__((noreturn)) usage(void)
{
- puts("Usage: syslinux [-sfma][-d directory] <drive>: [bootsecfile]\n");
+ puts("Usage: syslinux [-sfmar][-d directory] <drive>: [bootsecfile]\n");
exit(1);
}
@@ -489,6 +489,8 @@ int main(int argc, char *argv[])
int writembr = 0; /* -m (write MBR) option */
int set_active = 0; /* -a (set partition active) option */
const char *subdir = NULL;
+ int stupid = 0;
+ int raid_mode = 0;
dprintf("argv = %p\n", argv);
for ( i = 0 ; i <= argc ; i++ )
@@ -507,7 +509,10 @@ int main(int argc, char *argv[])
while ( *opt ) {
switch ( *opt ) {
case 's': /* Use "safe, slow and stupid" code */
- syslinux_make_stupid();
+ stupid = 1;
+ break;
+ case 'r': /* RAID mode */
+ raid_mode = 1;
break;
case 'f': /* Force install */
force = 1;
@@ -635,7 +640,7 @@ int main(int argc, char *argv[])
/*
* Patch ldlinux.sys and the boot sector
*/
- syslinux_patch(sectors, nsectors);
+ syslinux_patch(sectors, nsectors, stupid, raid_mode);
/*
* Write the now-patched first sector of ldlinux.sys
diff --git a/mtools/syslinux.c b/mtools/syslinux.c
index e65b081f..7540b2fa 100644
--- a/mtools/syslinux.c
+++ b/mtools/syslinux.c
@@ -45,7 +45,7 @@ off_t filesystem_offset = 0; /* Offset of filesystem */
void __attribute__((noreturn)) usage(void)
{
- fprintf(stderr, "Usage: %s [-sf][-d directory][-o offset] device\n", program);
+ fprintf(stderr, "Usage: %s [-sfr][-d directory][-o offset] device\n", program);
exit(1);
}
@@ -129,7 +129,6 @@ int main(int argc, char *argv[])
struct stat st;
int status;
char **argp, *opt;
- int force = 0; /* -f (force) option */
char mtools_conf[] = "/tmp/syslinux-mtools-XXXXXX";
const char *subdir = NULL;
int mtc_fd;
@@ -140,6 +139,10 @@ int main(int argc, char *argv[])
int nsectors;
const char *errmsg;
+ int force = 0; /* -f (force) option */
+ int stupid = 0; /* -s (stupid) option */
+ int raid_mode = 0; /* -r (RAID) option */
+
(void)argc; /* Unused */
mypid = getpid();
@@ -155,7 +158,9 @@ int main(int argc, char *argv[])
while ( *opt ) {
if ( *opt == 's' ) {
- syslinux_make_stupid(); /* Use "safe, slow and stupid" code */
+ stupid = 1;
+ } else if ( *opt == 'r' ) {
+ raid_mode = 1;
} else if ( *opt == 'f' ) {
force = 1; /* Force install */
} else if ( *opt == 'd' && argp[1] ) {
@@ -255,7 +260,7 @@ int main(int argc, char *argv[])
libfat_close(fs);
/* Patch ldlinux.sys and the boot sector */
- syslinux_patch(sectors, nsectors);
+ syslinux_patch(sectors, nsectors, stupid, raid_mode);
/* Write the now-patched first sector of ldlinux.sys */
xpwrite(dev_fd, syslinux_ldlinux, 512,
diff --git a/syslinux.h b/syslinux.h
index 1e88013e..60b36ce5 100644
--- a/syslinux.h
+++ b/syslinux.h
@@ -28,9 +28,6 @@ extern unsigned char syslinux_mbr[];
extern unsigned int syslinux_mbr_len;
extern int syslinux_mbr_mtime;
-/* This switches the boot sector to "stupid mode" */
-void syslinux_make_stupid(void);
-
/* This takes a boot sector and merges in the syslinux fields */
void syslinux_make_bootsect(void *);
@@ -38,6 +35,7 @@ void syslinux_make_bootsect(void *);
const char *syslinux_check_bootsect(const void *bs);
/* This patches the boot sector and ldlinux.sys based on a sector map */
-int syslinux_patch(const uint32_t *sectors, int nsectors);
+int syslinux_patch(const uint32_t *sectors, int nsectors,
+ int stupid, int raid_mode);
#endif
diff --git a/syslxmod.c b/syslxmod.c
index 3bebc749..425756f3 100644
--- a/syslxmod.c
+++ b/syslxmod.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1998-2004 H. Peter Anvin - All Rights Reserved
+ * Copyright 1998-2007 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
@@ -127,13 +127,6 @@ static inline void set_32(unsigned char *p, uint32_t v)
#endif
}
-/* Patch the code so that we're running in stupid mode */
-void syslinux_make_stupid(void)
-{
- /* Access only one sector at a time */
- set_16(syslinux_bootsect+0x1FC, 1);
-}
-
void syslinux_make_bootsect(void *bs)
{
unsigned char *bootsect = bs;
@@ -237,7 +230,8 @@ const char *syslinux_check_bootsect(const void *bs)
*
* Return 0 if successful, otherwise -1.
*/
-int syslinux_patch(const uint32_t *sectors, int nsectors)
+int syslinux_patch(const uint32_t *sectors, int nsectors,
+ int stupid, int raid_mode)
{
unsigned char *patcharea, *p;
int nsect = (syslinux_ldlinux_len+511) >> 9;
@@ -247,6 +241,17 @@ int syslinux_patch(const uint32_t *sectors, int nsectors)
if ( nsectors < nsect )
return -1;
+ /* Patch in options, as appropriate */
+ if (stupid) {
+ /* Access only one sector at a time */
+ set_16(syslinux_bootsect+0x1FC, 1);
+ }
+
+ i = get_16(syslinux_bootsect+0x1FE);
+ if (raid_mode)
+ set_16(syslinux_bootsect+i, 0x18CD); /* INT 18h */
+ set_16(syslinux_bootsect+0x1FE, 0xAA55);
+
/* First sector need pointer in boot sector */
set_32(syslinux_bootsect+0x1F8, *sectors++);
nsect--;
diff --git a/unix/syslinux.c b/unix/syslinux.c
index ad729c11..5f04262a 100644
--- a/unix/syslinux.c
+++ b/unix/syslinux.c
@@ -81,7 +81,7 @@ int loop_fd = -1; /* Loop device */
void __attribute__((noreturn)) usage(void)
{
- fprintf(stderr, "Usage: %s [-sf][-d directory][-o offset] device\n", program);
+ fprintf(stderr, "Usage: %s [-sfr][-d directory][-o offset] device\n", program);
exit(1);
}
@@ -324,13 +324,16 @@ int main(int argc, char *argv[])
int err = 0;
char mntname[128];
char *ldlinux_name, **argp, *opt;
- int force = 0; /* -f (force) option */
const char *subdir = NULL;
uint32_t sectors[65]; /* 65 is maximum possible */
int nsectors = 0;
const char *errmsg;
int mnt_cookie;
+ int force = 0; /* -f (force) option */
+ int stupid = 0; /* -s (stupid) option */
+ int raid_mode = 0; /* -r (RAID) option */
+
(void)argc; /* Unused */
program = argv[0];
@@ -348,7 +351,9 @@ int main(int argc, char *argv[])
while ( *opt ) {
if ( *opt == 's' ) {
- syslinux_make_stupid(); /* Use "safe, slow and stupid" code */
+ stupid = 1;
+ } else if ( *opt == 'r' ) {
+ raid_mode = 1;
} else if ( *opt == 'f' ) {
force = 1; /* Force install */
} else if ( *opt == 'd' && argp[1] ) {
@@ -525,7 +530,7 @@ umount:
/*
* Patch ldlinux.sys and the boot sector
*/
- syslinux_patch(sectors, nsectors);
+ syslinux_patch(sectors, nsectors, stupid, raid_mode);
/*
* Write the now-patched first sector of ldlinux.sys
diff --git a/win32/syslinux.c b/win32/syslinux.c
index 6b48d5b9..7b205a9e 100644
--- a/win32/syslinux.c
+++ b/win32/syslinux.c
@@ -233,7 +233,7 @@ int libfat_readfile(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sect
noreturn usage(void)
{
- fprintf(stderr, "Usage: syslinux.exe [-sfma][-d directory] <drive>: [bootsecfile]\n");
+ fprintf(stderr, "Usage: syslinux.exe [-sfmar][-d directory] <drive>: [bootsecfile]\n");
exit(1);
}
@@ -261,6 +261,8 @@ int main(int argc, char *argv[])
int force = 0; /* -f (force) option */
int mbr = 0; /* -m (MBR) option */
int setactive = 0; /* -a (set partition active) */
+ int stupid = 0; /* -s (stupid) option */
+ int raid_mode = 0; /* -r (RAID) option */
(void)argc;
@@ -281,7 +283,10 @@ int main(int argc, char *argv[])
while ( *opt ) {
switch ( *opt ) {
case 's': /* Use "safe, slow and stupid" code */
- syslinux_make_stupid();
+ stupid = 1;
+ break;
+ case 'r': /* RAID mode */
+ raid_mode = 1;
break;
case 'f': /* Force install */
force = 1;
@@ -424,7 +429,7 @@ int main(int argc, char *argv[])
/*
* Patch ldlinux.sys and the boot sector
*/
- syslinux_patch(sectors, nsectors);
+ syslinux_patch(sectors, nsectors, stupid, raid_mode);
/*
* Rewrite the file