From 6eb3c5e7ade4e74c5446d1a0776c0f49c7072d07 Mon Sep 17 00:00:00 2001 From: hpa Date: Tue, 21 Dec 2004 22:32:12 +0000 Subject: [PATCH] extlinux: Document need for MBR, and usage on a RAID system. Add cat.c32 as one of the sample programs. --- com32/samples/Makefile | 4 ++-- com32/samples/cat.c | 31 +++++++++++++++++++++++++++++++ extlinux.doc | 24 ++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 com32/samples/cat.c diff --git a/com32/samples/Makefile b/com32/samples/Makefile index ddcdaa2..07d8156 100644 --- a/com32/samples/Makefile +++ b/com32/samples/Makefile @@ -39,9 +39,9 @@ LNXLIBS = ../libutil/libutil_lnx.a .SUFFIXES: .lss .c .o .elf .c32 .lnx -all: hello.c32 \ +all: hello.c32 cat.c32 \ fancyhello.c32 fancyhello.lnx \ - keytest.c32 keytest.lnx + keytest.c32 keytest.lnx \ .PRECIOUS: %.o %.o: %.S diff --git a/com32/samples/cat.c b/com32/samples/cat.c new file mode 100644 index 0000000..277427f --- /dev/null +++ b/com32/samples/cat.c @@ -0,0 +1,31 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + FILE *f; + int ch; + int i; + + openconsole(&dev_stdcon_r, &dev_stdcon_w); + + printf("argv = %p\n", argv); + for ( i = 0 ; i <= argc ; i++ ) + printf("argv[%d] = %p = \"%s\"\n", i, argv[i], argv[i]); + + if ( argc < 2 ) { + fprintf(stderr, "Missing file name!\n"); + exit(1); + } + + printf("File = %s\n", argv[1]); + + f = fopen(argv[1], "r"); + while ( (ch = getc(f)) != EOF ) + putchar(ch); + + fclose(f); + + return 0; +} diff --git a/extlinux.doc b/extlinux.doc index 9844cb7..54e649d 100644 --- a/extlinux.doc +++ b/extlinux.doc @@ -30,3 +30,27 @@ It works the same way as SYSLINUX, with a few slight modifications. limited to 255 characters. + +Note that EXTLINUX installs in the filesystem partition like a +well-behaved bootloader :) Thus, it needs a master boot record in the +partition table; the mbr.bin shipped with SYSLINUX should work well. +To install it just do: + + cat mbr.bin > /dev/XXX + +... where /dev/XXX is the appropriate master device, e.g. /dev/hda, +and make sure the correct partition in set active. + + +If you have multiple disks in a software RAID configuration, the +preferred way to boot is: + +- Create a separate RAID-1 partition for /boot. Note that the Linux + RAID-1 driver can span as many disks as you wish. + +- Install the MBR on *each disk*, and mark the RAID-1 partition + active. + +- Run "extlinux /boot" to install extlinux. This will install it on + all the drives in the RAID-1 set, which means you can boot any + combination of drives in any order. -- 2.7.4