fix several bugs.

This commit is contained in:
okuji 1999-11-11 20:43:20 +00:00
parent a3d2f9bee9
commit c95941d65d
19 changed files with 137 additions and 21 deletions

View file

@ -1,3 +1,35 @@
1999-11-11 Michael Hohmuth <hohmuth@innocent.com>
* 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 <okuji@kuicr.kyoto-u.ac.jp>
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 <Klaus.Reichl@alcatel.at>
* 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 <gord@fig.org>
* debian/rules: Add variables for cross-compilation.

View file

@ -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

1
debian/Makefile.in vendored
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 \

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -417,6 +417,7 @@ get_cmdline (char *prompt, char *cmdline, int maxlen,
gotoxy (0, getxy () & 0xff);
print_completions (is_filename, 0);
errnum = ERR_NONE;
}
}

View file

@ -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 */

View file

@ -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);
}

View file

@ -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