From 553fec60221be5d267987dedcd0d105f7d5a7259 Mon Sep 17 00:00:00 2001 From: gord Date: Mon, 22 Feb 1999 03:20:36 +0000 Subject: [PATCH] Getting ready for 0.5.1 --- ChangeLog | 57 ++++++++++++++++++++++ Makefile.end | 2 +- configure | 3 +- debian/changelog | 6 +++ debian/control | 10 ++-- debian/rules | 4 +- e2fs_stage1_5/Makefile | 18 ++++--- fat_stage1_5/Makefile | 18 ++++--- ffs_stage1_5/Makefile | 17 ++++--- mail | 43 +++++++++++++++++ shared_src/char_io.c | 13 +++-- shared_src/cmdline.c | 33 ++++++------- shared_src/common.c | 61 ++++++++++++----------- shared_src/fsys_ext2fs.c | 102 +++++++++++++++++++++++++++++++++------ shared_src/fsys_fat.c | 7 ++- shared_src/fsys_ffs.c | 16 +++--- shared_src/shared.h | 66 +++++++++++++------------ shared_src/stage2.c | 10 ++-- stage1/Makefile | 7 ++- stage2/Makefile | 60 ++++++++++------------- stage2_debug/Makefile | 34 +++++-------- 21 files changed, 379 insertions(+), 208 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ac8bf046..d39a222de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,60 @@ +1999-02-21 Gordon Matzigkeit + + * debian: Add to the distribution, since we maintain the GRUB + Debian package ourselves. + + * grub/asmstub.c: New file to implement stubbed assembly functions + under Unix. + + * stage1/Makefile: Delete spurious dependencies on Makefile. + * stage2/Makefile: Likewise. + * stage2_debug/Makefile: Likewise. + * grub/Makefile: Likewise. + + * shared_src/fsys_ext2fs.c (ext2fs_dir): Follow symbolic links + rather than giving an error. + + * shared_src/common.c (err_list): Use labeled elements to + associate messages with error codes. + * shared_src/shared.h: Make error codes into an enumerated type. + + * shared_src/common.c (err_list): Add ERR_SYMLINK_LOOP. + * shared_src/shared.h: Likewise. + + * shared_src/char_io.c (bcopy): Don't make any assumptions about + the length of an unsigned long. + + * grub/Makefile: Treat CFLAGS, CPPFLAGS, LDFLAGS according to + GNU standards. + * stage2/Makefile: Likewise. + * e2fs_stage1_5/Makefile: Likewise. + * fat_stage1_5/Makefile: Likewise. + * ffs_stage1_5/Makefile: Likewise. + +1999-02-20 Gordon Matzigkeit + + * docs/index.html: Rename to grub.html, so that we don't hide + files in this directory from a web browser. + +1999-02-15 Gordon Matzigkeit + + * Makefile.end (PROGS): Add grub. + + * grub/main.c: New file. + + * grub/Makefile: New directory to contain the stage2 Unix program. + + * shared_src/cmdline.c: Use substring. + * shared_src/fsys_ext2fs.c: Likewise. + * shared_src/fsys_fat.c: Likewise. + * shared_src/fsys_ffs.c: Likewise. + * shared_src/stage2.c: Likewise. + + * shared_src/shared.h: Delete strcmp, declare substring. + + * shared_src/char_io.c (strcmp): Rename to `substring', because + this function doesn't behave the same as libc's strcmp. + 1999-02-14 Gordon Matzigkeit * shared_src/shared.h: (addr32, data32): Delete definitions. diff --git a/Makefile.end b/Makefile.end index 724a5e3f3..d4173ce5f 100644 --- a/Makefile.end +++ b/Makefile.end @@ -3,7 +3,7 @@ # part created by configure. # -PROGS= stage1 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ +PROGS= grub stage1 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ stage2 stage2_debug all: diff --git a/configure b/configure index 1d27807eb..83625954e 100644 --- a/configure +++ b/configure @@ -391,7 +391,8 @@ for tool_var in $tool_vars ; do done cat << EOF >> Makefile -export SHARED_FLAGS = -pipe -fno-builtin -nostdinc -O2 -DEXT_C\(x\)="$munge_func1" +export CFLAGS = -O2 +export SHARED_FLAGS = -pipe -fno-builtin -nostdinc -DEXT_C\(x\)="$munge_func1" # (END OF AUTOMATICALLY GENERATED PORTION) # diff --git a/debian/changelog b/debian/changelog index 21d30feae..677c93fab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +grub (0.5-3) unstable; urgency=low + + * GRUB now understands symbolic links (fixes: #17306). + + -- Gordon Matzigkeit Sun, 21 Feb 1999 05:13:25 -0600 + grub (0.5-2) unstable; urgency=low * Assembly source cleanups. diff --git a/debian/control b/debian/control index a68f8a180..bf05c1a3d 100644 --- a/debian/control +++ b/debian/control @@ -8,8 +8,8 @@ Package: grub Architecture: i386 hurd-i386 Depends: ${shlibs:Depends} Description: GRand Unified Bootloader - GRUB is a GPLed bootloader intended to unify bootloading across x86 - operating systems. In addition to loading Linux and FreeBSD, it - implements the Multiboot standard, which allows for flexible loading - of multiple boot images (needed for modular kernels such as the GNU - Hurd). + GRUB is a GPLed bootloader intended to unify bootloading across x86 + operating systems. In addition to loading Linux and FreeBSD, it + implements the Multiboot standard, which allows for flexible loading + of multiple boot images (needed for modular kernels such as the GNU + Hurd). diff --git a/debian/rules b/debian/rules index 551e1e44a..8b4b8e1e0 100644 --- a/debian/rules +++ b/debian/rules @@ -41,8 +41,8 @@ binary-arch: checkroot build cp -r docs debian/tmp/usr/doc/grub rm -f debian/tmp/usr/doc/grub/docs/COPYING - $(INSTALL_DATA) ChangeLog debian/tmp/usr/doc/grub/ - gzip -f9 debian/tmp/usr/doc/grub/ChangeLog + $(INSTALL_DATA) ChangeLog debian/tmp/usr/doc/grub/changelog + gzip -f9 debian/tmp/usr/doc/grub/changelog $(INSTALL_DATA) debian/changelog debian/tmp/usr/doc/grub/changelog.Debian gzip -f9 debian/tmp/usr/doc/grub/changelog.Debian $(INSTALL_DATA) debian/copyright debian/tmp/usr/doc/grub/ diff --git a/e2fs_stage1_5/Makefile b/e2fs_stage1_5/Makefile index 3968e43cf..25e38a982 100644 --- a/e2fs_stage1_5/Makefile +++ b/e2fs_stage1_5/Makefile @@ -2,13 +2,15 @@ # GRUB e2fs_stage1_5 makefile # -SHARED_FLAGS += -DFSYS_EXT2FS -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ +COMPILE = $(CC) $(CFLAGS) $(CPPFLAGS) $(SHARED_FLAGS) \ + -DFSYS_EXT2FS -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ -DNO_BLOCK_FILES -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ -I../shared_src +# FIXME: is this really true? # There are problems inheriting flags that work fine with stage1 and stage2 # so... don't use them at all! -CFLAGS= $(SHARED_FLAGS) +#CFLAGS= $(SHARED_FLAGS) # "asm.o" absolutely has to come first in the link line! SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_ext2fs.o @@ -16,24 +18,24 @@ SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_ext2fs.o all: ../bin/e2fs_stage1_5 asm.o: ../shared_src/asm.S ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/asm.S + $(COMPILE) -c ../shared_src/asm.S char_io.o: ../shared_src/char_io.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/char_io.c + $(COMPILE) -c ../shared_src/char_io.c common.o: ../shared_src/common.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/common.c + $(COMPILE) -c ../shared_src/common.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + $(COMPILE) -c ../shared_src/disk_io.c stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c + $(COMPILE) -c ../shared_src/stage1_5.c fsys_ext2fs.o: ../shared_src/fsys_ext2fs.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/fsys_ext2fs.c + $(COMPILE) -c ../shared_src/fsys_ext2fs.c # "asm.o" absolutely has to come first in the link line! e2fs_stage1_5.exec: $(SHARED_OBJS) diff --git a/fat_stage1_5/Makefile b/fat_stage1_5/Makefile index 9982ec371..18fdfda19 100644 --- a/fat_stage1_5/Makefile +++ b/fat_stage1_5/Makefile @@ -2,13 +2,15 @@ # GRUB fat_stage1_5 makefile # -SHARED_FLAGS += -DFSYS_FAT -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ +COMPILE = $(CC) $(CFLAGS) $(CPPFLAGS) $(SHARED_FLAGS) \ + -DFSYS_FAT -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ -I../shared_src +# FIXME: Is this really true? # There are problems inheriting flags that work fine with stage1 and stage2 # so... don't use them at all! -CFLAGS= $(SHARED_FLAGS) +#CFLAGS= $(SHARED_FLAGS) # "asm.o" absolutely has to come first in the link line! SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_fat.o @@ -16,24 +18,24 @@ SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_fat.o all: ../bin/fat_stage1_5 asm.o: ../shared_src/asm.S ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/asm.S + $(COMPILE) -c ../shared_src/asm.S char_io.o: ../shared_src/char_io.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/char_io.c + $(COMPILE) -c ../shared_src/char_io.c common.o: ../shared_src/common.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/common.c + $(COMPILE) -c ../shared_src/common.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + $(COMPILE) -c ../shared_src/disk_io.c stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c + $(COMPILE) -c ../shared_src/stage1_5.c fsys_fat.o: ../shared_src/fsys_fat.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/fsys_fat.c + $(COMPILE) -c ../shared_src/fsys_fat.c # "asm.o" absolutely has to come first in the link line! fat_stage1_5.exec: $(SHARED_OBJS) diff --git a/ffs_stage1_5/Makefile b/ffs_stage1_5/Makefile index 10b1c1a6a..6e5879db0 100644 --- a/ffs_stage1_5/Makefile +++ b/ffs_stage1_5/Makefile @@ -3,8 +3,9 @@ # IMPORTANT_SIZE_LIMIT = 7168 -CFLAGS= $(SHARED_FLAGS) -DFSYS_FFS -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ - -DNO_BLOCK_FILES -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ +COMPILE= $(CC) $(CFLAGS) $(CPPFLAGS) $(SHARED_FLAGS) -DFSYS_FFS \ + -DNO_DECOMPRESSION -DNO_FANCY_STUFF -DNO_BLOCK_FILES \ + -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ -I../shared_src # "asm.o" absolutely has to come first in the link line! @@ -13,27 +14,27 @@ SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_ffs.o all: ../bin/ffs_stage1_5 asm.o: ../shared_src/asm.S ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/asm.S + $(COMPILE) -c ../shared_src/asm.S char_io.o: ../shared_src/char_io.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/char_io.c + $(COMPILE) -c ../shared_src/char_io.c common.o: ../shared_src/common.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/common.c + $(COMPILE) -c ../shared_src/common.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + $(COMPILE) -c ../shared_src/disk_io.c stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h - $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c + $(COMPILE) -c ../shared_src/stage1_5.c fsys_ffs.o: ../shared_src/fsys_ffs.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ ../shared_src/defs.h ../shared_src/disk_inode.h \ ../shared_src/disk_inode_ffs.h ../shared_src/dir.h \ ../shared_src/fs.h - $(CC) $(CFLAGS) -c ../shared_src/fsys_ffs.c + $(COMPILE) -c ../shared_src/fsys_ffs.c # "asm.o" absolutely has to come first in the link line! ffs_stage1_5.exec: $(SHARED_OBJS) diff --git a/mail b/mail index 7124b92d9..79863e74d 100644 --- a/mail +++ b/mail @@ -153,3 +153,46 @@ Comments? Gordon Matzigkeit //\ I'm a FIG (http://www.fig.org/) Lovers of freedom, unite! \// I use GNU (http://www.gnu.org/) [Unfortunately, www.fig.org is broken. Please stay tuned for details.] +From nobody Sun Feb 21 01:59:03 1999 +X-From-Line: dunham@cse.msu.edu Sat Feb 20 17:43:34 1999 +Return-Path: +Delivered-To: gord@trick.fig.org +Received: (qmail 16082 invoked from network); 20 Feb 1999 17:43:34 -0000 +Received: from sargasso.cse.msu.edu (35.9.20.14) + by ip223.net247210.cr.sk.ca with SMTP; 20 Feb 1999 17:43:34 -0000 +Received: from fatneck.cse.msu.edu (dunham@fatneck.cse.msu.edu [35.9.20.47]) + by sargasso.cse.msu.edu (8.8.8/8.8.8) with ESMTP id MAA25678 + for ; Sat, 20 Feb 1999 12:43:26 -0500 (EST) +Received: (from dunham@localhost) + by fatneck.cse.msu.edu (8.9.2/8.9.2/Debian/GNU) id MAA19662; + Sat, 20 Feb 1999 12:45:10 -0500 (EST) +To: Gordon Matzigkeit +Subject: GRUB +Mime-Version: 1.0 (generated by tm-edit 7.108) +Content-Type: text/plain; charset=US-ASCII +From: Steve Dunham +Date: 20 Feb 1999 12:45:09 -0500 +In-Reply-To: Gordon Matzigkeit's message of "18 Feb 1999 09:12:49 -0600" +Message-ID: +X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" +Lines: 18 +Xref: trick.fig.org misc:2354 + + +IIRC, you took over the Grub package and upstream Grub. + +You might be interested in the work by the "Fiasco" (aka L4) people at +tu-dresden - they taken Grub 0.4.1 and added network booting to it. +You can get their code at: + + ftp://ftp.inf.tu-dresden.de/pub/os/L4/devel/ + +or grab a local copy of it that I put up at: + + http://www.cse.msu.edu/~dunham/out/grub-l4-981207.tar.gz + + +Steve +dunham@cse.msu.edu + + diff --git a/shared_src/char_io.c b/shared_src/char_io.c index bbb22248b..d7b9cbb12 100644 --- a/shared_src/char_io.c +++ b/shared_src/char_io.c @@ -521,18 +521,21 @@ strncat(char *s1, char *s2, int n) int -strcmp(char *s1, char *s2) +substring(char *s1, char *s2) { while (*s1 == *s2) { + /* The strings match, so return 0. */ if (!*(s1++)) return 0; s2++; } + /* S1 is shorter than S2. */ if (*s1 == 0) return -1; + /* S1 is a substring of S2. */ return 1; } @@ -577,9 +580,9 @@ bcopy(char *from, char *to, int len) { if ((to >= from+len) || (to <= from)) { - while (len > 3) + while (len >= sizeof (unsigned long)) { - len -= 4; + len -= sizeof (unsigned long); *(((unsigned long *)to)++) = *(((unsigned long *)from)++); } while (len-- > 0) @@ -587,6 +590,8 @@ bcopy(char *from, char *to, int len) } else { + /* We have a region that overlaps, but would be overwritten + if we copied it forward. */ while (len-- > 0) to[len] = from[len]; } @@ -607,5 +612,3 @@ bzero(char *start, int len) return (!errnum); } - - diff --git a/shared_src/cmdline.c b/shared_src/cmdline.c index 50786aabd..9449217bc 100644 --- a/shared_src/cmdline.c +++ b/shared_src/cmdline.c @@ -214,7 +214,7 @@ returnit: if (run_cmdline && get_cmdline("command> ", commands, cur_heap, 2048)) return 1; - if (strcmp("boot", cur_heap) == 0 || (script && !*cur_heap)) + if (substring("boot", cur_heap) == 0 || (script && !*cur_heap)) { if ((type == 'f') | (type == 'n')) bsd_boot(type, bootdev); @@ -245,9 +245,9 @@ returnit: cmd_len = 0; while (cur_cmdline[cmd_len++]); - if (strcmp("chainloader", cur_heap) < 1) + if (substring("chainloader", cur_heap) < 1) { - if (open(cur_cmdline) && (read(BOOTSEC_LOCATION, SECTOR_SIZE) + if (open(cur_cmdline) && (read(BOOTSEC_LOCATION, SECTOR_SIZE) == SECTOR_SIZE) && (*((unsigned short *) (BOOTSEC_LOCATION+BOOTSEC_SIG_OFFSET)) == BOOTSEC_SIGNATURE)) @@ -258,17 +258,17 @@ returnit: type = 0; } } - else if (strcmp("pause", cur_heap) < 1) + else if (substring("pause", cur_heap) < 1) { if (getc() == 27) return 1; } - else if (strcmp("uppermem", cur_heap) < 1) + else if (substring("uppermem", cur_heap) < 1) { if (safe_parse_maxint(&cur_cmdline, (int *)&(mbi.mem_upper))) mbi.flags &= ~MB_INFO_MEM_MAP; } - else if (strcmp("root", cur_heap) < 1) + else if (substring("root", cur_heap) < 1) { int hdbias = 0; char *biasptr = skip_to(0, set_device(cur_cmdline)); @@ -295,7 +295,7 @@ returnit: current_drive = -1; } } - else if (strcmp("kernel", cur_heap) < 1) + else if (substring("kernel", cur_heap) < 1) { /* make sure it's at the beginning of the boot heap area */ bcopy(cur_heap, heap, cmd_len + (((int)cur_cmdline) - ((int)cur_heap))); @@ -304,7 +304,7 @@ returnit: if (type = load_image()) cur_heap = cur_cmdline + cmd_len; } - else if (strcmp("module", cur_heap) < 1) + else if (substring("module", cur_heap) < 1) { if (type == 'm') { @@ -329,7 +329,7 @@ returnit: else errnum = ERR_NEED_MB_KERNEL; } - else if (strcmp("initrd", cur_heap) < 1) + else if (substring("initrd", cur_heap) < 1) { if (type == 'L' || type == 'l') { @@ -338,7 +338,7 @@ returnit: else errnum = ERR_NEED_LX_KERNEL; } - else if (strcmp("install", cur_heap) < 1) + else if (substring("install", cur_heap) < 1) { char *stage1_file = cur_cmdline, *dest_dev, *file, *addr, *config_file; char buffer[SECTOR_SIZE], old_sect[SECTOR_SIZE]; @@ -470,7 +470,7 @@ returnit: } } #ifdef DEBUG - else if (strcmp("testload", cur_heap) < 1) + else if (substring("testload", cur_heap) < 1) { type = 0; if (open(cur_cmdline)) @@ -534,13 +534,13 @@ returnit: debug_fs = NULL; } } - else if (strcmp("read", cur_heap) < 1) + else if (substring("read", cur_heap) < 1) { int myaddr; if (safe_parse_maxint(&cur_cmdline, &myaddr)) printf("Address 0x%x: Value 0x%x", myaddr, *((unsigned *)myaddr)); } - else if (strcmp("fstest", cur_heap) == 0) + else if (substring("fstest", cur_heap) == 0) { if (debug_fs) { @@ -553,12 +553,12 @@ returnit: printf(" Filesystem tracing is now on\n"); } } - else if (strcmp("impsprobe", cur_heap) == 0) + else if (substring("impsprobe", cur_heap) == 0) { if (!imps_probe()) printf(" No MPS information found or probe failed\n"); } - else if (strcmp("displaymem", cur_heap) == 0) + else if (substring("displaymem", cur_heap) == 0) { if (get_eisamemsize() != -1) printf(" EISA Memory BIOS Interface is present\n"); @@ -592,11 +592,10 @@ returnit: } } #endif /* DEBUG */ - else if (strcmp("makeactive", cur_heap) == 0) + else if (substring("makeactive", cur_heap) == 0) make_saved_active(); else if (*cur_heap && *cur_heap != ' ') errnum = ERR_UNRECOGNIZED; goto restart; } - diff --git a/shared_src/common.c b/shared_src/common.c index 25a498a06..c12900377 100644 --- a/shared_src/common.c +++ b/shared_src/common.c @@ -41,36 +41,36 @@ int errnum = 0; char *err_list[] = { - 0, - "Selected item won\'t fit into memory", - "Selected disk doesn\'t exist", - "Disk read error", - "Disk write error", - "Disk geometry error", - "Attempt to access block outside partition", - "Partition table invalid or corrupt", - "No such partition", - "Bad filename (must be absolute pathname or blocklist)", - "Bad file or directory type", - "File not found", - "Cannot mount selected partition", - "Inconsistent filesystem structure", - "Filesystem compatibility error, can\'t read whole file", - "Error while parsing number", - "Device string unrecognizable", - "Invalid device requested", - "Invalid or unsupported executable format", - "Loading below 1MB is not supported", - "Unsupported Multiboot features requested", - "Unknown boot failure", - "Must load Multiboot kernel before modules", - "Must load Linux kernel before initrd", - "Cannot boot without kernel loaded", - "Unrecognized command", - "Bad or incompatible header on compressed file", - "Bad or corrupt data while decompressing file", - "Bad or corrupt version of stage1/stage2", - 0 + [ERR_NONE] = 0, + [ERR_BAD_FILENAME] = "Bad filename (must be absolute pathname or blocklist)", + [ERR_BAD_FILETYPE] = "Bad file or directory type", + [ERR_BAD_GZIP_DATA] = "Bad or corrupt data while decompressing file", + [ERR_BAD_GZIP_HEADER] = "Bad or incompatible header on compressed file", + [ERR_BAD_PART_TABLE] = "Partition table invalid or corrupt", + [ERR_BAD_VERSION] = "Bad or corrupt version of stage1/stage2", + [ERR_BELOW_1MB] = "Loading below 1MB is not supported", + [ERR_BOOT_COMMAND] = "Cannot boot without kernel loaded", + [ERR_BOOT_FAILURE] = "Unknown boot failure", + [ERR_BOOT_FEATURES] = "Unsupported Multiboot features requested", + [ERR_DEV_FORMAT] = "Device string unrecognizable", + [ERR_DEV_VALUES] = "Invalid device requested", + [ERR_EXEC_FORMAT] = "Invalid or unsupported executable format", + [ERR_FILELENGTH] = "Filesystem compatibility error, cannot read whole file", + [ERR_FILE_NOT_FOUND] = "File not found", + [ERR_FSYS_CORRUPT] = "Inconsistent filesystem structure", + [ERR_FSYS_MOUNT] = "Cannot mount selected partition", + [ERR_GEOM] = "Disk geometry error", + [ERR_NEED_LX_KERNEL] = "Must load Linux kernel before initrd", + [ERR_NEED_MB_KERNEL] = "Must load Multiboot kernel before modules", + [ERR_NO_DISK] = "Selected disk does not exist", + [ERR_NO_PART] = "No such partition", + [ERR_NUMBER_PARSING] = "Error while parsing number", + [ERR_OUTSIDE_PART] = "Attempt to access block outside partition", + [ERR_READ] = "Disk read error", + [ERR_SYMLINK_LOOP] = "Too many symbolic links", + [ERR_UNRECOGNIZED] = "Unrecognized command", + [ERR_WONT_FIT] = "Selected item cannot fit into memory", + [ERR_WRITE] = "Disk write error", }; @@ -212,4 +212,3 @@ init_bios_info(void) cmain(); } - diff --git a/shared_src/fsys_ext2fs.c b/shared_src/fsys_ext2fs.c index e0081b14b..c2563b0a6 100644 --- a/shared_src/fsys_ext2fs.c +++ b/shared_src/fsys_ext2fs.c @@ -1,6 +1,7 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1996 Erich Boleyn + * Copyright (C) 1996 Erich Boleyn + * Copyright (C) 1999 Free Software Foundation, Inc. * * 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 @@ -19,12 +20,7 @@ #include "shared.h" - -#ifdef E2DEBUG -#include "pc_slice.h" -#else #include "filesys.h" -#endif static int mapblock1, mapblock2; @@ -180,7 +176,9 @@ struct ext2_dir_entry { #define log2(n) ffz(~(n)) #define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */ -#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ +#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ +#define PATH_MAX 1024 /* include/linux/limits.h */ +#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */ /* made up, these are pointers into FSYS_BUF */ /* read once, always stays there: */ @@ -209,8 +207,10 @@ struct ext2_dir_entry { (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) /* linux/stat.h */ #define S_IFMT 00170000 +#define S_IFLNK 0120000 #define S_IFREG 0100000 #define S_IFDIR 0040000 +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) @@ -358,12 +358,13 @@ ext2fs_read(int addr, int len) int size = 0; #ifdef E2DEBUG + static char hexdigit[] = "0123456789abcdef"; unsigned char * i; for (i = (unsigned char *)INODE; i < ((unsigned char *)INODE + sizeof(struct ext2_inode)); i++) { - printf("%c", "0123456789abcdef"[*i >> 4]); - printf("%c", "0123456789abcdef"[*i % 16]); + printf("%c", hexdigit[*i >> 4]); + printf("%c", hexdigit[*i % 16]); if (!((i + 1 - (unsigned char *)INODE) % 16)) { printf("\n"); } else { printf(" "); } } @@ -390,7 +391,7 @@ ext2fs_read(int addr, int len) devread(map * (EXT2_BLOCK_SIZE(SUPERBLOCK) / DEV_BSIZE), offset, size, addr); - + #ifndef NO_FANCY_STUFF debug_fs_func = NULL; #endif /* NO_FANCY_STUFF */ @@ -442,6 +443,7 @@ int ext2fs_dir(char *dirname) { int current_ino = EXT2_ROOT_INO; /* start at the root */ + int updir_ino = current_ino; /* the parent of the current directory */ int group_id; /* which group the inode is in */ int group_desc; /* fs pointer to that group */ int desc; /* index within that group */ @@ -450,6 +452,9 @@ ext2fs_dir(char *dirname) struct ext2_group_desc * gdp; struct ext2_inode * raw_inode; /* inode info corresponding to current_ino */ + char linkbuf[PATH_MAX]; /* buffer for following symbolic links */ + int link_count = 0; + char *rest; char ch; /* temp char holder */ @@ -527,6 +532,74 @@ ext2fs_dir(char *dirname) printf("first word=%x\n", *((int *)INODE)); #endif /* E2DEBUG */ + /* If we've got a symbolic link, then chase it. */ + if (S_ISLNK(INODE->i_mode)) + { + int len, remaining; + if (++ link_count > MAX_LINK_COUNT) + { + errnum = ERR_SYMLINK_LOOP; + return 0; + } + + /* Find out how long our remaining name is. */ + len = 0; + while (dirname[len] && !isspace (dirname[len])) + len ++; + + /* Get the symlink size. */ + filemax = (INODE->i_size); + if (filemax + len > sizeof (linkbuf) - 2) + { + errnum = ERR_FILELENGTH; + return 0; + } + + if (len) + { + /* Copy the remaining name to the end of the symlink data. + Note that DIRNAME and LINKBUF may overlap! */ + bcopy (dirname, linkbuf + filemax, len); + } + linkbuf[filemax + len] = '\0'; + + /* Read the symlink data. */ + if (INODE->i_blocks) + { + /* Read the necessary blocks, and reset the file pointer. */ + len = read ((int) linkbuf, filemax); + filepos = 0; + if (!len) + return 0; + } + else + { + /* Copy the data directly from the inode. */ + len = filemax; + bcopy ((char *) INODE->i_block, linkbuf, len); + } + +#if E2DEBUG + printf ("symlink=%s\n", linkbuf); +#endif + + dirname = linkbuf; + if (*dirname == '/') + { + /* It's an absolute link, so look it up in root. */ + current_ino = EXT2_ROOT_INO; + updir_ino = current_ino; + } + else + { + /* Relative, so look it up in our parent directory. */ + current_ino = updir_ino; + } + + /* Try again using the new name. */ + continue; + } + /* if end of filename, INODE points to the file's inode */ if (!*dirname || isspace(*dirname)) { @@ -541,6 +614,7 @@ ext2fs_dir(char *dirname) } /* else we have to traverse a directory */ + updir_ino = current_ino; /* skip over slashes */ while (*dirname == '/') @@ -573,7 +647,7 @@ ext2fs_dir(char *dirname) if (print_possibilities < 0) { putchar('\n'); } - else { + else { errnum = ERR_FILE_NOT_FOUND; *rest = ch; } @@ -583,7 +657,7 @@ ext2fs_dir(char *dirname) /* else, find the (logical) block component of our location */ blk = loc >> EXT2_BLOCK_SIZE_BITS(SUPERBLOCK); - /* now we know which logical block of the directory entry we are looking + /* we know which logical block of the directory entry we are looking for, now we have to translate that to the physical (fs) block on the disk */ map = ext2fs_block_map(blk); @@ -605,7 +679,7 @@ ext2fs_dir(char *dirname) #ifdef E2DEBUG printf("directory entry ino=%d\n", dp->inode); - if (dp->inode) + if (dp->inode) printf("entry=%s\n", dp->name); #endif /* E2DEBUG */ @@ -614,7 +688,7 @@ ext2fs_dir(char *dirname) int saved_c = dp->name[dp->name_len]; dp->name[dp->name_len] = 0; - str_chk = strcmp(dirname, dp->name); + str_chk = substring(dirname, dp->name); if (print_possibilities && ch != '/' && (!*dirname || str_chk <= 0)) diff --git a/shared_src/fsys_fat.c b/shared_src/fsys_fat.c index e91d0d0f5..c153d85ce 100644 --- a/shared_src/fsys_fat.c +++ b/shared_src/fsys_fat.c @@ -234,14 +234,15 @@ loop: } if (print_possibilities && ch != '/' - && (!*dirname || strcmp(dirname, filename) <= 0)) + && (!*dirname || substring(dirname, filename) <= 0)) { if (print_possibilities > 0) print_possibilities = -print_possibilities; printf(" %s", filename); } } - while (strcmp(dirname, filename) != 0 || (print_possibilities && ch != '/')); + while (substring(dirname, filename) != 0 || + (print_possibilities && ch != '/')); *(dirname = rest) = ch; @@ -252,5 +253,3 @@ loop: /* go back to main loop at top of function */ goto loop; } - - diff --git a/shared_src/fsys_ffs.c b/shared_src/fsys_ffs.c index 1a1ddc07d..56e2e8c57 100644 --- a/shared_src/fsys_ffs.c +++ b/shared_src/fsys_ffs.c @@ -28,24 +28,24 @@ * Mach Operating System * Copyright (c) 1992, 1991 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. * @@ -244,7 +244,7 @@ loop: loc += dp->d_reclen; if (dp->d_ino && print_possibilities && ch != '/' - && (!*dirname || strcmp(dirname, dp->d_name) <= 0)) + && (!*dirname || substring(dirname, dp->d_name) <= 0)) { if (print_possibilities > 0) print_possibilities = -print_possibilities; @@ -252,7 +252,7 @@ loop: printf(" %s", dp->d_name); } } - while (!dp->d_ino || (strcmp(dirname, dp->d_name) != 0 + while (!dp->d_ino || (substring(dirname, dp->d_name) != 0 || (print_possibilities && ch != '/')) ); /* only get here if we have a matching directory entry */ @@ -263,5 +263,3 @@ loop: /* go back to main loop at top of function */ goto loop; } - - diff --git a/shared_src/shared.h b/shared_src/shared.h index b4c550b41..48b82ceae 100644 --- a/shared_src/shared.h +++ b/shared_src/shared.h @@ -316,36 +316,40 @@ int special_attribute; #endif /* _CHAR_IO_C */ -#define ERR_NONE 0 -#define ERR_WONT_FIT (ERR_NONE + 1) -#define ERR_NO_DISK (ERR_WONT_FIT + 1) -#define ERR_READ (ERR_NO_DISK + 1) -#define ERR_WRITE (ERR_READ + 1) -#define ERR_GEOM (ERR_WRITE + 1) -#define ERR_OUTSIDE_PART (ERR_GEOM + 1) -#define ERR_BAD_PART_TABLE (ERR_OUTSIDE_PART + 1) -#define ERR_NO_PART (ERR_BAD_PART_TABLE + 1) -#define ERR_BAD_FILENAME (ERR_NO_PART + 1) -#define ERR_BAD_FILETYPE (ERR_BAD_FILENAME + 1) -#define ERR_FILE_NOT_FOUND (ERR_BAD_FILETYPE + 1) -#define ERR_FSYS_MOUNT (ERR_FILE_NOT_FOUND + 1) -#define ERR_FSYS_CORRUPT (ERR_FSYS_MOUNT + 1) -#define ERR_FILELENGTH (ERR_FSYS_CORRUPT + 1) -#define ERR_NUMBER_PARSING (ERR_FILELENGTH + 1) -#define ERR_DEV_FORMAT (ERR_NUMBER_PARSING + 1) -#define ERR_DEV_VALUES (ERR_DEV_FORMAT + 1) -#define ERR_EXEC_FORMAT (ERR_DEV_VALUES + 1) -#define ERR_BELOW_1MB (ERR_EXEC_FORMAT + 1) -#define ERR_BOOT_FEATURES (ERR_BELOW_1MB + 1) -#define ERR_BOOT_FAILURE (ERR_BOOT_FEATURES + 1) -#define ERR_NEED_MB_KERNEL (ERR_BOOT_FAILURE + 1) -#define ERR_NEED_LX_KERNEL (ERR_NEED_MB_KERNEL + 1) -#define ERR_BOOT_COMMAND (ERR_NEED_LX_KERNEL + 1) -#define ERR_UNRECOGNIZED (ERR_BOOT_COMMAND + 1) -#define ERR_BAD_GZIP_HEADER (ERR_UNRECOGNIZED + 1) -#define ERR_BAD_GZIP_DATA (ERR_BAD_GZIP_HEADER + 1) -#define ERR_BAD_VERSION (ERR_BAD_GZIP_DATA + 1) -#define MAX_ERR_NUM (ERR_BAD_VERSION + 1) +enum grub_error_t { + ERR_NONE = 0, + ERR_BAD_FILENAME, + ERR_BAD_FILETYPE, + ERR_BAD_GZIP_DATA, + ERR_BAD_GZIP_HEADER, + ERR_BAD_PART_TABLE, + ERR_BAD_VERSION, + ERR_BELOW_1MB, + ERR_BOOT_COMMAND, + ERR_BOOT_FAILURE, + ERR_BOOT_FEATURES, + ERR_DEV_FORMAT, + ERR_DEV_VALUES, + ERR_EXEC_FORMAT, + ERR_FILELENGTH, + ERR_FILE_NOT_FOUND, + ERR_FSYS_CORRUPT, + ERR_FSYS_MOUNT, + ERR_GEOM, + ERR_NEED_LX_KERNEL, + ERR_NEED_MB_KERNEL, + ERR_NO_DISK, + ERR_NO_PART, + ERR_NUMBER_PARSING, + ERR_OUTSIDE_PART, + ERR_READ, + ERR_SYMLINK_LOOP, + ERR_UNRECOGNIZED, + ERR_WONT_FIT, + ERR_WRITE, + + MAX_ERR_NUM +}; /* returns packed BIOS/ASCII code */ #define BIOS_CODE(x) ((x) >> 8) @@ -371,7 +375,7 @@ int get_cmdline(char *prompt, char *commands, char *cmdline, int maxlen); int tolower(int c); int isspace(int c); int strncat(char *s1, char *s2, int n); -int strcmp(char *s1, char *s2); +int substring(char *s1, char *s2); char *strstr(char *s1, char *s2); int bcopy(char *from, char *to, int len); int bzero(char *start, int len); diff --git a/shared_src/stage2.c b/shared_src/stage2.c index e363a63cd..6405e8aa6 100644 --- a/shared_src/stage2.c +++ b/shared_src/stage2.c @@ -529,7 +529,7 @@ cmain(void) { ptr = skip_to(1, cmdline); - if (strcmp("title", cmdline) < 1) + if (substring("title", cmdline) < 1) { if (state > 1) { @@ -551,13 +551,13 @@ cmain(void) } else if (!state) { - if (strcmp("timeout", cmdline) < 1) + if (substring("timeout", cmdline) < 1) safe_parse_maxint(&ptr, &timeout); - if (strcmp("fallback", cmdline) < 1) + if (substring("fallback", cmdline) < 1) safe_parse_maxint(&ptr, &fallback); - if (strcmp("default", cmdline) < 1) + if (substring("default", cmdline) < 1) safe_parse_maxint(&ptr, &default_entry); - if (strcmp("password", cmdline) < 1) + if (substring("password", cmdline) < 1) { char *ptrend = ptr; password = config_entries; diff --git a/stage1/Makefile b/stage1/Makefile index c920e22b0..81f3ca211 100644 --- a/stage1/Makefile +++ b/stage1/Makefile @@ -6,15 +6,14 @@ CFLAGS= $(SHARED_FLAGS) all: ../bin/stage1 -stage1.o: stage1.S Makefile ../Makefile +stage1.o: stage1.S $(CC) $(CFLAGS) -c -o stage1.o stage1.S -stage1.exec: stage1.o Makefile ../Makefile +stage1.exec: stage1.o $(LD) -N -Ttext 7C00 -o stage1.exec stage1.o -../bin/stage1: stage1.exec Makefile ../Makefile +../bin/stage1: stage1.exec $(OBJCOPY) -O binary stage1.exec ../bin/stage1 clean: rm -f stage1.o stage1.exec - diff --git a/stage2/Makefile b/stage2/Makefile index 7fc864c2b..1f7f4e1d5 100644 --- a/stage2/Makefile +++ b/stage2/Makefile @@ -1,8 +1,8 @@ # -# GRUB stage2 makefile +# GRUB program makefile # -CFLAGS= $(SHARED_FLAGS) -I../shared_src +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(SHARED_FLAGS) -I../shared_src # "asm.o" absolutely must come first!!! SHARED_OBJS= asm.o common.o char_io.o boot.o cmdline.o gunzip.o \ @@ -10,61 +10,53 @@ SHARED_OBJS= asm.o common.o char_io.o boot.o cmdline.o gunzip.o \ all: ../bin/stage2 -asm.o: ../shared_src/asm.S ../shared_src/shared.h Makefile ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/asm.S +asm.o: ../shared_src/asm.S ../shared_src/shared.h + $(COMPILE) -c ../shared_src/asm.S -boot.o: ../shared_src/boot.c ../shared_src/shared.h Makefile ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/boot.c +boot.o: ../shared_src/boot.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/boot.c -char_io.o: ../shared_src/char_io.c ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/char_io.c +char_io.o: ../shared_src/char_io.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/char_io.c -cmdline.o: ../shared_src/cmdline.c ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/cmdline.c +cmdline.o: ../shared_src/cmdline.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/cmdline.c -common.o: ../shared_src/common.c ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/common.c +common.o: ../shared_src/common.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/common.c -gunzip.o: ../shared_src/gunzip.c ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/gunzip.c +gunzip.o: ../shared_src/gunzip.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/gunzip.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ - ../shared_src/pc_slice.h ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + ../shared_src/pc_slice.h ../shared_src/shared.h + $(COMPILE) -c ../shared_src/disk_io.c -stage2.o: ../shared_src/stage2.c ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/stage2.c +stage2.o: ../shared_src/stage2.c ../shared_src/shared.h + $(COMPILE) -c ../shared_src/stage2.c fsys_ffs.o: ../shared_src/fsys_ffs.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ ../shared_src/defs.h ../shared_src/disk_inode.h \ ../shared_src/disk_inode_ffs.h ../shared_src/dir.h \ - ../shared_src/fs.h Makefile ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/fsys_ffs.c + ../shared_src/fs.h + $(COMPILE) -c ../shared_src/fsys_ffs.c fsys_ext2fs.o: ../shared_src/fsys_ext2fs.c ../shared_src/filesys.h \ - ../shared_src/pc_slice.h ../shared_src/shared.h Makefile \ - ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/fsys_ext2fs.c + ../shared_src/pc_slice.h ../shared_src/shared.h + $(COMPILE) -c ../shared_src/fsys_ext2fs.c fsys_fat.o: ../shared_src/fsys_fat.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ - ../shared_src/fat.h Makefile ../Makefile - $(CC) $(CFLAGS) -c ../shared_src/fsys_fat.c + ../shared_src/fat.h + $(COMPILE) -c ../shared_src/fsys_fat.c # "asm.o" absolutely has to come first in the link line! -stage2.exec: $(SHARED_OBJS) Makefile ../Makefile +stage2.exec: $(SHARED_OBJS) $(LD) -N -Ttext 8000 -o stage2.exec $(SHARED_OBJS) -../bin/stage2: stage2.exec Makefile ../Makefile +../bin/stage2: stage2.exec $(OBJCOPY) -O binary stage2.exec ../bin/stage2 clean: rm -f $(SHARED_OBJS) stage2.exec - diff --git a/stage2_debug/Makefile b/stage2_debug/Makefile index 1931644e8..0cd2769e8 100644 --- a/stage2_debug/Makefile +++ b/stage2_debug/Makefile @@ -10,61 +10,53 @@ SHARED_OBJS= asm.o common.o char_io.o boot.o cmdline.o gunzip.o \ all: ../bin/stage2_debug -asm.o: ../shared_src/asm.S ../shared_src/shared.h Makefile ../Makefile +asm.o: ../shared_src/asm.S ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/asm.S -boot.o: ../shared_src/boot.c ../shared_src/shared.h Makefile ../Makefile +boot.o: ../shared_src/boot.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/boot.c -char_io.o: ../shared_src/char_io.c ../shared_src/shared.h Makefile \ - ../Makefile +char_io.o: ../shared_src/char_io.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/char_io.c -cmdline.o: ../shared_src/cmdline.c ../shared_src/shared.h Makefile \ - ../Makefile +cmdline.o: ../shared_src/cmdline.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/cmdline.c -common.o: ../shared_src/common.c ../shared_src/shared.h Makefile \ - ../Makefile +common.o: ../shared_src/common.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/common.c -gunzip.o: ../shared_src/gunzip.c ../shared_src/shared.h Makefile \ - ../Makefile +gunzip.o: ../shared_src/gunzip.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/gunzip.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ - ../shared_src/pc_slice.h ../shared_src/shared.h Makefile \ - ../Makefile + ../shared_src/pc_slice.h ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/disk_io.c -stage2.o: ../shared_src/stage2.c ../shared_src/shared.h Makefile \ - ../Makefile +stage2.o: ../shared_src/stage2.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/stage2.c fsys_ffs.o: ../shared_src/fsys_ffs.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ ../shared_src/defs.h ../shared_src/disk_inode.h \ ../shared_src/disk_inode_ffs.h ../shared_src/dir.h \ - ../shared_src/fs.h Makefile ../Makefile + ../shared_src/fs.h $(CC) $(CFLAGS) -c ../shared_src/fsys_ffs.c fsys_ext2fs.o: ../shared_src/fsys_ext2fs.c ../shared_src/filesys.h \ - ../shared_src/pc_slice.h ../shared_src/shared.h Makefile \ - ../Makefile + ../shared_src/pc_slice.h ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/fsys_ext2fs.c fsys_fat.o: ../shared_src/fsys_fat.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ - ../shared_src/fat.h Makefile ../Makefile + ../shared_src/fat.h $(CC) $(CFLAGS) -c ../shared_src/fsys_fat.c # "asm.o" absolutely has to come first in the link line! -stage2.exec: $(SHARED_OBJS) Makefile ../Makefile +stage2.exec: $(SHARED_OBJS) $(LD) -N -Ttext 8000 -o stage2.exec $(SHARED_OBJS) -../bin/stage2_debug: stage2.exec Makefile ../Makefile +../bin/stage2_debug: stage2.exec $(OBJCOPY) -O binary stage2.exec ../bin/stage2_debug clean: rm -f $(SHARED_OBJS) stage2.exec -