diff --git a/ChangeLog b/ChangeLog index 0988d1421..8d2115fd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +1999-11-11 Michael Hohmuth + + * stage2/boot.c (load_image): grub_close was called after + return, so exchange the order. + * stage2/stage1_5.c (cmain): Call grub_close after grub_read. + Set RET to the value returned by grub_read, and if RET is + non-zero, call chain_stage2. + * stage1/Makefile.am (BUILT_SOURCES): Removed. + (CLEANFILES): Set to $(nodist_pkgdata_DATA). + +1999-11-11 OKUJI Yoshinori + + Suggested by Klaus Reichl: + * stage2/builtins.c (print_root_device): New function. + (root_func): If no argument is specified, call the function + print_root_device and return. + (rootnoverify_func): Likewise. + * stage2/disk_io.c [!STAGE1_5] (print_completions): Call + print_error even if IS_FILENAME is zero. + If ERRNUM is non-zero, then return -1. + * stage2/char_io.c [!STAGE1_5] (get_cmdline): Clear ERRNUM after + calling print_completions to print the list as well. + + * stage2/asm.S [!STAGE1_5] (currticks): Set %eax to %cx:%dx + correctly. Reported by Michael Hohmuth. + +1999-11-06 Klaus Reichl + + * grub/asmstub.c (get_diskinfo) [__linux__]: After opening the + drive, flush the cache, other progs may have left over something + in the cache. + 1999-11-03 Gordon Matzigkeit * debian/rules: Add variables for cross-compilation. diff --git a/Makefile.in b/Makefile.in index 9b85d9285..6f1604a06 100644 --- a/Makefile.in +++ b/Makefile.in @@ -246,6 +246,7 @@ maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) + # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. @@ -262,7 +263,11 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && $(MAKE) $(AM_MAKEFLAGS) distclean \ + && test `find . -type f -print | wc -l` -eq 0 -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ @@ -349,6 +354,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-recursive diff --git a/debian/Makefile.in b/debian/Makefile.in index e822cdc32..2e5760632 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -160,6 +160,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-generic mostlyclean: mostlyclean-am diff --git a/docs/Makefile.in b/docs/Makefile.in index 604a067a6..6e0112bff 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -229,9 +229,8 @@ uninstall-info: @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - d=$(srcdir); \ - echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $$d/$$file"; \ - install-info --info-dir=$(DESTDIR)$(infodir) --remove $$d/$$file; \ + echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \ + install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @@ -412,6 +411,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic mostlyclean: mostlyclean-am diff --git a/docs/multiboot.texi b/docs/multiboot.texi index d9b229f39..8922cc028 100644 --- a/docs/multiboot.texi +++ b/docs/multiboot.texi @@ -543,6 +543,12 @@ follows: 52 | drives_count | (present if flags[7] is set) 56 | drives_addr | (present if flags[7] is set) +-------------------+ +60 | config_table | (present if flags[8] is set) + +-------------------+ +64 | boot_loader_name | (present if flags[9] is set) + +-------------------+ +68 - ?? | apm_table | (present if flags[10] is set) + +-------------------+ @end group @end example @@ -782,6 +788,9 @@ ports). The last field @samp{reserved} is reserved for future use, and must be zero. The size is four bytes. +@c I'll write the descriptions about config_table, boot_loader_name and +@c apm_tabel. Just wait for a while. - okuji + @node Examples @chapter Examples diff --git a/grub/Makefile.in b/grub/Makefile.in index 32ce21f9d..46d6a4303 100644 --- a/grub/Makefile.in +++ b/grub/Makefile.in @@ -296,6 +296,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic diff --git a/grub/asmstub.c b/grub/asmstub.c index 9998e6b2b..1b5aa863e 100644 --- a/grub/asmstub.c +++ b/grub/asmstub.c @@ -513,7 +513,7 @@ check_device (const char *device) /* Error opening the device. */ return 0; } - + /* Attempt to read the first sector. */ if (fread (buf, 1, 512, fp) != 512) { @@ -957,6 +957,12 @@ get_diskinfo (int drive, struct geometry *geometry) if (disks[drive].flags == -1) return -1; +#ifdef __linux__ + /* In Linux, invalidate the buffer cache, so that left overs + from other program in the cache are flushed and seen by us */ + ioctl (disks[drive].flags, BLKFLSBUF, 0); +#endif + *geometry = disks[drive]; return 0; } diff --git a/lib/Makefile.in b/lib/Makefile.in index 0c3e2f749..a373cba35 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -271,6 +271,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic diff --git a/netboot/Makefile.in b/netboot/Makefile.in index 372753a5f..239693069 100644 --- a/netboot/Makefile.in +++ b/netboot/Makefile.in @@ -486,6 +486,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic diff --git a/stage1/Makefile.am b/stage1/Makefile.am index dee0a3504..1cfae995f 100644 --- a/stage1/Makefile.am +++ b/stage1/Makefile.am @@ -1,8 +1,7 @@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) nodist_pkgdata_DATA = stage1 -BUILT_SOURCES = stage2_size.h -CLEANFILES = $(nodist_pkgdata_DATA) $(BUILT_SOURCES) +CLEANFILES = $(nodist_pkgdata_DATA) # We can't use builtins or standard includes. AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc diff --git a/stage1/Makefile.in b/stage1/Makefile.in index 776c62bcb..354a585ad 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -83,8 +83,7 @@ install_sh = @install_sh@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) nodist_pkgdata_DATA = stage1 -BUILT_SOURCES = stage2_size.h -CLEANFILES = $(nodist_pkgdata_DATA) $(BUILT_SOURCES) +CLEANFILES = $(nodist_pkgdata_DATA) # We can't use builtins or standard includes. AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc @@ -272,12 +271,14 @@ installdirs: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 82741be3a..fbd5354ee 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -110,7 +110,7 @@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ minix_stage1_5 -CLEANFILES = $(nodist_pkgdata_DATA) +CLEANFILES = $(nodist_pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES) noinst_DATA = pre_stage2 start noinst_PROGRAMS = pre_stage2.exec start.exec \ e2fs_stage1_5.exec fat_stage1_5.exec \ @@ -136,7 +136,6 @@ pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) @NETBOOT_SUPPORT_TRUE@pre_stage2_exec_LDADD = @NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a BUILT_SOURCES = stage2_size.h -CLEANFILES = $(nodist_pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES) start_exec_SOURCES = start.S start_exec_CFLAGS = $(STAGE2_COMPILE) @@ -1557,6 +1556,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-noinstPROGRAMS mostlyclean-tags \ diff --git a/stage2/asm.S b/stage2/asm.S index ac5a1c38f..ec46b250b 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -1877,9 +1877,9 @@ ENTRY(currticks) DATA32 call EXT_C(real_to_prot) .code32 - shll $16, %ecx - movl %edx, %eax - orl %ecx, %eax + movl %ecx, %eax + shll $16, %eax + movw %dx, %ax popl %edx popl %ecx diff --git a/stage2/boot.c b/stage2/boot.c index 368664d2b..01923d762 100644 --- a/stage2/boot.c +++ b/stage2/boot.c @@ -239,8 +239,8 @@ load_image (char *kernel, char *arg) { /* ERRNUM is already set inside the function safe_parse_maxint. */ - return KERNEL_TYPE_NONE; grub_close (); + return KERNEL_TYPE_NONE; } /* Set the vid mode to VID_MODE. Note that this can work diff --git a/stage2/builtins.c b/stage2/builtins.c index fd78b8253..59f30a133 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -1842,6 +1842,40 @@ static struct builtin builtin_read = }; +/* Print the root device information. */ +static void +print_root_device (void) +{ + if (saved_drive == 0x20) + { + /* Network drive. */ + grub_printf (" (nd):"); + } + else if (saved_drive & 0x80) + { + /* Hard disk drive. */ + grub_printf (" (hd%d", saved_drive - 0x80); + + if ((saved_partition & 0xFF0000) != 0xFF0000) + grub_printf (",%d", saved_partition >> 16); + + if ((saved_partition & 0x00FF00) != 0x00FF00) + grub_printf (",%c", ((saved_partition >> 8) & 0xFF) + 'a'); + + grub_printf ("):"); + } + else + { + /* Floppy disk drive. */ + grub_printf (" (fd%d):", saved_drive); + } + + /* Print the filesystem information. */ + current_partition = saved_partition; + current_drive = saved_drive; + print_fsys_type (); +} + static int root_func (char *arg, int flags) { @@ -1849,6 +1883,13 @@ root_func (char *arg, int flags) char *biasptr; char *next; + /* If ARG is empty, just print the current root device. */ + if (! *arg) + { + print_root_device (); + return 0; + } + /* Call set_device to get the drive and the partition in ARG. */ next = set_device (arg); if (! next) @@ -1880,7 +1921,7 @@ static struct builtin builtin_root = "root", root_func, BUILTIN_CMDLINE, - "root DEVICE [HDBIAS]", + "root [DEVICE [HDBIAS]]", "Set the current \"root device\" to the device DEVICE, then" " attempt to mount it to get the partition size (for passing the" " partition descriptor in `ES:ESI', used by some chain-loaded" @@ -1898,6 +1939,13 @@ static struct builtin builtin_root = static int rootnoverify_func (char *arg, int flags) { + /* If ARG is empty, just print the current root device. */ + if (! *arg) + { + print_root_device (); + return 0; + } + if (! set_device (arg)) return 1; @@ -1912,7 +1960,7 @@ static struct builtin builtin_rootnoverify = "rootnoverify", rootnoverify_func, BUILTIN_CMDLINE, - "rootnoverify DEVICE [HDBIAS]", + "rootnoverify [DEVICE [HDBIAS]]", "Similar to `root', but don't attempt to mount the partition. This" " is useful for when an OS is outside of the area of the disk that" " GRUB can read, but setting the correct root device is still" diff --git a/stage2/char_io.c b/stage2/char_io.c index d53a38a7d..09810194a 100644 --- a/stage2/char_io.c +++ b/stage2/char_io.c @@ -417,6 +417,7 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, gotoxy (0, getxy () & 0xff); print_completions (is_filename, 0); + errnum = ERR_NONE; } } diff --git a/stage2/disk_io.c b/stage2/disk_io.c index 6d3b0b2e0..2dbd73a9d 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -1050,8 +1050,12 @@ print_completions (int is_filename, int is_completion) if (! is_completion) grub_putchar ('\n'); + print_error (); do_completion = 0; - return unique - 1; + if (errnum) + return -1; + else + return unique - 1; } if (*buf == '/' || (ptr = set_device (buf)) || incomplete) @@ -1194,7 +1198,10 @@ print_completions (int is_filename, int is_completion) print_error (); do_completion = 0; - return unique - 1; + if (errnum) + return -1; + else + return unique - 1; } #endif /* STAGE1_5 */ diff --git a/stage2/stage1_5.c b/stage2/stage1_5.c index 2fb26e43c..3b4e481a1 100644 --- a/stage2/stage1_5.c +++ b/stage2/stage1_5.c @@ -30,9 +30,11 @@ cmain (void) if (grub_open (config_file)) { - grub_close (); + int ret = grub_read ((char *) 0x8000, -1); - if (grub_read ((char *) 0x8000, -1)) + grub_close (); + + if (ret) chain_stage2 (0, 0x8200); } diff --git a/util/Makefile.in b/util/Makefile.in index f37541702..7d2f26e5c 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -293,6 +293,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -rm -f Makefile.in mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic