fix a bug in stage1_lba, and move all the constants in stage1 to stage1.h
This commit is contained in:
parent
cb7e6d5e4e
commit
95dfefd185
14 changed files with 238 additions and 75 deletions
57
ChangeLog
57
ChangeLog
|
@ -1,3 +1,60 @@
|
|||
1999-07-14 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
All constants in stage1s are moved to stage1.h and renamed
|
||||
appropriately, and include stage1.h instead.
|
||||
|
||||
* grub/Makefile.am (AM_CFLAGS): Added the include path to stage1.
|
||||
* stage2/Makefile.am (INCLUDES): New variable.
|
||||
* stage1/Makefile.am (stage1_exec_SOURCES): Added stage1.h
|
||||
(stage1_lba_exec_SOURCES): Likewise.
|
||||
* stage1/stage1.h: New file.
|
||||
* stage1/stage1.S (SIGNATURE): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_SIGNATURE): ... this.
|
||||
* stage1/stage1.S (BPBEND): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_BPBEND): ... this.
|
||||
* stage1/stage1.S (PARTSTART): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_PARTSTART): ... this.
|
||||
* stage1/stage1.S (MINPARMSIZ): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_MINPARMSIZE): ... this.
|
||||
* stage1/stage1.S (LISTSIZ): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_LISTSIZE): ... this.
|
||||
* stage1/stage1.S (REALSTACK): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_STACKSEG): ... this.
|
||||
* stage1/stage1.S (BUFFERSEG): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_BUFFERSEG): ... this.
|
||||
* stage1/stage1.S (BIOS_HD_FLAG): Renamed to ...
|
||||
* stage1/stage1.h (STAGE1_BIOS_HD_FLAG): ... this.
|
||||
* stage1/stage1_lba.S (SIGNATURE): Removed.
|
||||
* stage1/stage1_lba.S (BPBEND): Likewise.
|
||||
* stage1/stage1_lba.S (PARTSTART): Likewise.
|
||||
* stage1/stage1_lba.S (MINPARMSIZ): Likewise.
|
||||
* stage1/stage1_lba.S (LISTSIZ): Likewise.
|
||||
* stage1/stage1_lba.S (REALSTACK): Likewise.
|
||||
* stage1/stage1_lba.S (BUFFERSEG): Likewise.
|
||||
* stage1/stage1_lba.S (BIOS_HD_FLAG): Likewise.
|
||||
|
||||
* stage1/stage1.S (stage1_id): New variable.
|
||||
* stage1/stage1_lba.S (stage1_id): Likewise.
|
||||
* stage1/stage1.h (COMPAT_VERSION_MINOR): Set to 2.
|
||||
(STAGE1_ID_OFFSET): New macro.
|
||||
(STAGE1_ID_CHS): Likewise.
|
||||
(STAGE1_ID_LBA): Likewise.
|
||||
* stage2/cmdline.c (enter_cmdline) [!GRUB_UTIL]: When running
|
||||
the command `install' and STAGE1_FILE is stage1_lba, check if
|
||||
LBA is supported.
|
||||
(enter_cmdline) [GRUB_UTIL]: In the same case above, check only
|
||||
if CURRENT_DRIVE is a hard disk and, if so, print a warning
|
||||
message, because /sbin/grub cannot detect if LBA is supported or
|
||||
not.
|
||||
|
||||
* stage1/stage1_lba.S: Fix a bug that incorrectly assigns the
|
||||
segment of buffer address.
|
||||
|
||||
1999-07-13 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
* stage2/boot.c (load_image): When removing "vga=...", memmove
|
||||
the length of VGA_END plus one.
|
||||
|
||||
1999-07-12 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
* stage2/bios.c (get_diskinfo): In LBA mode, compute
|
||||
|
|
4
README
4
README
|
@ -52,6 +52,10 @@ See the file INSTALL for instructions on how to build and install the
|
|||
GRUB data and program files. See the GRUB manual for details about
|
||||
using GRUB as your bootloader.
|
||||
|
||||
GNU GRUB has a page on the web. See:
|
||||
|
||||
http://www.gnu.org/software/grub/grub.html
|
||||
|
||||
If you have any suggestions or bug reports, please send electronic
|
||||
mail to the GRUB mailing list <bug-grub@gnu.org>.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
sbin_PROGRAMS = grub
|
||||
|
||||
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -fwritable-strings \
|
||||
-I$(top_srcdir)/stage2
|
||||
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
||||
|
||||
grub_SOURCES = main.c asmstub.c
|
||||
grub_LDADD = ../stage2/libgrub.a @GRUB_LIBS@
|
||||
|
|
|
@ -80,7 +80,7 @@ install_sh = @install_sh@
|
|||
sbin_PROGRAMS = grub
|
||||
|
||||
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -fwritable-strings \
|
||||
-I$(top_srcdir)/stage2
|
||||
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
||||
|
||||
|
||||
grub_SOURCES = main.c asmstub.c
|
||||
|
|
|
@ -7,8 +7,8 @@ AM_CFLAGS = @STAGE1_CFLAGS@ -fno-builtin -nostdinc
|
|||
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
||||
|
||||
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
||||
stage1_exec_SOURCES = stage1.S
|
||||
stage1_lba_exec_SOURCES = stage1_lba.S
|
||||
stage1_exec_SOURCES = stage1.S stage1.h
|
||||
stage1_lba_exec_SOURCES = stage1_lba.S stage1.h
|
||||
|
||||
%: %.exec
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
|
|
@ -84,8 +84,8 @@ AM_CFLAGS = @STAGE1_CFLAGS@ -fno-builtin -nostdinc
|
|||
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
||||
|
||||
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
||||
stage1_exec_SOURCES = stage1.S
|
||||
stage1_lba_exec_SOURCES = stage1_lba.S
|
||||
stage1_exec_SOURCES = stage1.S stage1.h
|
||||
stage1_lba_exec_SOURCES = stage1_lba.S stage1.h
|
||||
subdir = stage1
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -124,7 +124,7 @@ OBJECTS = $(am_stage1_exec_OBJECTS) $(am_stage1_lba_exec_OBJECTS)
|
|||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o
|
||||
.SUFFIXES: .S .c .h .o
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu stage1/Makefile
|
||||
|
||||
|
|
|
@ -18,23 +18,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stage1.h>
|
||||
|
||||
/*
|
||||
* defines for the code go here
|
||||
*/
|
||||
|
||||
#define SIGNATURE 0xaa55
|
||||
#define BPBEND 0x3e
|
||||
#define PARTSTART 0x1be /* starting address of partition table */
|
||||
#define PARTEND 0x1fe /* ending addres of the partition table */
|
||||
#define MINPARAMSIZ 13 /* size of extra data parameters */
|
||||
#define LISTSIZ 8 /* size of sector list */
|
||||
#define REALSTACK 0x2000 /* stack for this code and BIOS calls */
|
||||
#define BUFFERSEG 0x7000 /* segment address of disk buffer, the
|
||||
disk buffer MUST be 32K long and cannot
|
||||
straddle a 64K boundary */
|
||||
#define BIOS_HD_FLAG 0x80 /* bit set in BIOS drive number to designate
|
||||
a hard disk vs. a floppy */
|
||||
|
||||
|
||||
/* Absolute addresses
|
||||
This makes the assembler generate the address without support
|
||||
from the linker. (ELF can't relocate 16-bit addresses!) */
|
||||
|
@ -87,12 +76,15 @@ cylinder_start:
|
|||
.word 0
|
||||
/* more space... */
|
||||
|
||||
. = _start + BPBEND
|
||||
. = _start + STAGE1_BPBEND
|
||||
|
||||
/*
|
||||
* End of BIOS parameter block.
|
||||
*/
|
||||
|
||||
stage1_id:
|
||||
.byte STAGE1_ID_CHS
|
||||
|
||||
after_BPB:
|
||||
|
||||
/* general setup */
|
||||
|
@ -104,7 +96,7 @@ after_BPB:
|
|||
movw %ax, %ss
|
||||
|
||||
/* set up the REAL stack */
|
||||
movw $REALSTACK, %sp
|
||||
movw $STAGE1_STACKSEG, %sp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
|
@ -130,7 +122,7 @@ after_BPB:
|
|||
/*
|
||||
* The call failed, so maybe use the floppy probe instead.
|
||||
*/
|
||||
testb $BIOS_HD_FLAG, %dl
|
||||
testb $STAGE1_BIOS_HD_FLAG, %dl
|
||||
jz floppy_probe
|
||||
|
||||
/* Nope, we definitely have a hard disk, and we're screwed. */
|
||||
|
@ -164,7 +156,7 @@ final_init:
|
|||
movl %eax, (%si)
|
||||
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
movw $ABS(firstlist - LISTSIZ), %di
|
||||
movw $ABS(firstlist - STAGE1_LISTSIZE), %di
|
||||
|
||||
|
||||
/* this is the loop for reading the secondary boot-loader in */
|
||||
|
@ -262,7 +254,7 @@ more_sectors:
|
|||
* %al = 0x0 on success; err code on failure
|
||||
*/
|
||||
|
||||
movw $BUFFERSEG, %bx
|
||||
movw $STAGE1_BUFFERSEG, %bx
|
||||
movw %bx, %es /* load %es segment with disk buffer */
|
||||
|
||||
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
|
||||
|
@ -315,7 +307,7 @@ more_sectors:
|
|||
jne setup_sectors
|
||||
|
||||
/* update position to load from */
|
||||
subw $LISTSIZ, %di
|
||||
subw $STAGE1_LISTSIZE, %di
|
||||
|
||||
/* jump to bootloop */
|
||||
jmp bootloop
|
||||
|
@ -387,11 +379,11 @@ lastlist:
|
|||
/*
|
||||
* This data area is for keeping general parameters.
|
||||
*/
|
||||
. = _start + PARTSTART - MINPARAMSIZ - LISTSIZ
|
||||
. = _start + STAGE1_PARTSTART - STAGE1_MINPARAMSIZE - STAGE1_LISTSIZE
|
||||
|
||||
/* this next data area before the partition area is specifically
|
||||
sized, you should update "MINPARAMSIZ" to reflect any additions
|
||||
or deletions to this area */
|
||||
sized, you should update "STAGE1_MINPARAMSIZ" to reflect any
|
||||
additions or deletions to this area. */
|
||||
|
||||
.word 0
|
||||
.word 0
|
||||
|
@ -426,12 +418,12 @@ bootit:
|
|||
|
||||
/*
|
||||
* This is the compatibility version number.
|
||||
* See ../stage2/shared.h for COMPAT_VERSION_* definitions used
|
||||
* See stage1.h for COMPAT_VERSION_* definitions used
|
||||
* in stage2 and stage1_5 modules.
|
||||
*
|
||||
* DO NOT MOVE THIS!!!
|
||||
*/
|
||||
.byte 2, 1
|
||||
.byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
|
||||
|
||||
/*
|
||||
* This is where an MBR would go if on a hard disk. The code
|
||||
|
@ -439,7 +431,7 @@ bootit:
|
|||
* sneaky, huh?
|
||||
*/
|
||||
|
||||
. = _start + PARTSTART
|
||||
. = _start + STAGE1_PARTSTART
|
||||
|
||||
probe_values:
|
||||
.byte 36, 18, 15, 9, 0
|
||||
|
@ -474,7 +466,7 @@ fd_probe_error_string: .string "Floppy"
|
|||
|
||||
1:
|
||||
/* perform read */
|
||||
movw $REALSTACK, %bx
|
||||
movw $STAGE1_BUFFERSEG, %bx
|
||||
movw $0x201, %ax
|
||||
movb $0, %ch
|
||||
movb $0, %dh
|
||||
|
@ -489,7 +481,7 @@ fd_probe_error_string: .string "Floppy"
|
|||
|
||||
jmp final_init
|
||||
|
||||
. = _start + PARTEND
|
||||
. = _start + STAGE1_PARTEND
|
||||
|
||||
/* the last 2 bytes in the sector 0 contain the signature */
|
||||
.word SIGNATURE
|
||||
.word STAGE1_SIGNATURE
|
||||
|
|
82
stage1/stage1.h
Normal file
82
stage1/stage1.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef STAGE1_HEADER
|
||||
#define STAGE1_HEADER 1
|
||||
|
||||
|
||||
/* Define the version numbers here, so that Stage 1 can know them. */
|
||||
#define COMPAT_VERSION_MAJOR 2
|
||||
#define COMPAT_VERSION_MINOR 2
|
||||
#define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \
|
||||
| COMPAT_VERSION_MAJOR)
|
||||
|
||||
/* The signature for bootloader. */
|
||||
#define STAGE1_SIGNATURE 0xaa55
|
||||
|
||||
/* The offset of the end of BPB (BIOS Parameter Block). */
|
||||
#define STAGE1_BPBEND 0x3e
|
||||
|
||||
/* The offset of FIRSTLIST. */
|
||||
#define STAGE1_FIRSTLIST 0x1b5
|
||||
|
||||
/* The offset of the major version. */
|
||||
#define STAGE1_VER_MAJ_OFFS 0x1bc
|
||||
|
||||
/* The offset of the install segment. */
|
||||
#define STAGE1_INSTALLSEG 0x1ba
|
||||
|
||||
/* The offset of the install address. */
|
||||
#define STAGE1_INSTALLADDR 0x1b8
|
||||
|
||||
/* The offset of the start of the partition table. */
|
||||
#define STAGE1_PARTSTART 0x1be
|
||||
|
||||
/* The offset of the end of the partition table. */
|
||||
#define STAGE1_PARTEND 0x1fe
|
||||
|
||||
/* The size of extra data parameters. */
|
||||
#define STAGE1_MINPARAMSIZE 13
|
||||
|
||||
/* The size of sector list. */
|
||||
#define STAGE1_LISTSIZE 8
|
||||
|
||||
/* The stack segment. */
|
||||
#define STAGE1_STACKSEG 0x2000
|
||||
|
||||
/* The segment of disk buffer. The disk buffer MUST be 32K long and
|
||||
cannot straddle a 64K boundary. */
|
||||
#define STAGE1_BUFFERSEG 0x7000
|
||||
|
||||
/* The flag for BIOS drive number to designate a hard disk vs. a
|
||||
floppy. */
|
||||
#define STAGE1_BIOS_HD_FLAG 0x80
|
||||
|
||||
/* Stage 1 identifiers */
|
||||
/* The offset of the id. */
|
||||
#define STAGE1_ID_OFFSET STAGE1_BPBEND
|
||||
|
||||
/* The id for the ``normal'' stage1. */
|
||||
#define STAGE1_ID_CHS 0x10
|
||||
|
||||
/* The id for the LBA version of stage1. */
|
||||
#define STAGE1_ID_LBA 0x20
|
||||
|
||||
|
||||
#endif /* ! STAGE1_HEADER */
|
|
@ -18,21 +18,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stage1.h>
|
||||
|
||||
/*
|
||||
* defines for the code go here
|
||||
*/
|
||||
|
||||
#define SIGNATURE 0xaa55
|
||||
#define BPBEND 0x3e
|
||||
#define PARTSTART 0x1be /* starting address of partition table */
|
||||
#define PARTEND 0x1fe /* ending addres of the partition table */
|
||||
#define MINPARAMSIZ 13 /* size of extra data parameters */
|
||||
#define LISTSIZ 8 /* size of sector list */
|
||||
#define REALSTACK 0x2000 /* stack for this code and BIOS calls */
|
||||
#define BUFFERSEG 0x7000 /* segment address of disk buffer, the
|
||||
disk buffer MUST be 32K long and cannot
|
||||
straddle a 64K boundary */
|
||||
|
||||
/* Absolute addresses
|
||||
This makes the assembler generate the address without support
|
||||
from the linker. (ELF can't relocate 16-bit addresses!) */
|
||||
|
@ -81,12 +72,15 @@ disk_address_packet:
|
|||
.quad 0
|
||||
/* more space... */
|
||||
|
||||
. = _start + BPBEND
|
||||
. = _start + STAGE1_BPBEND
|
||||
|
||||
/*
|
||||
* End of BIOS parameter block.
|
||||
*/
|
||||
|
||||
stage1_id:
|
||||
.byte STAGE1_ID_LBA
|
||||
|
||||
after_BPB:
|
||||
|
||||
/* general setup */
|
||||
|
@ -98,7 +92,7 @@ after_BPB:
|
|||
movw %ax, %ss
|
||||
|
||||
/* set up the REAL stack */
|
||||
movw $REALSTACK, %sp
|
||||
movw $STAGE1_STACKSEG, %sp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
|
@ -134,7 +128,7 @@ after_BPB:
|
|||
movl 0x10(%si), %ecx
|
||||
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
movw $ABS(firstlist - LISTSIZ), %di
|
||||
movw $ABS(firstlist - STAGE1_LISTSIZE), %di
|
||||
|
||||
/* this is the loop for reading the secondary boot-loader in */
|
||||
bootloop:
|
||||
|
@ -185,8 +179,7 @@ more_sectors:
|
|||
movl %ebx, 8(%si)
|
||||
|
||||
/* the segment of buffer address */
|
||||
movw 6(%di), %bx
|
||||
movw %bx, 6(%si)
|
||||
movw $STAGE1_BUFFERSEG, 6(%si)
|
||||
|
||||
pushw %ax /* save %ax from destruction! */
|
||||
|
||||
|
@ -214,9 +207,6 @@ more_sectors:
|
|||
|
||||
jc read_error
|
||||
|
||||
/* save source segment */
|
||||
movw %es, %bx
|
||||
|
||||
/* load addresses for copy from disk buffer to destination */
|
||||
movw 6(%di), %es /* load destination segment */
|
||||
|
||||
|
@ -241,7 +231,8 @@ more_sectors:
|
|||
|
||||
xorw %di, %di /* zero offset of destination addresses */
|
||||
xorw %si, %si /* zero offset of source addresses */
|
||||
movw %bx, %ds /* restore the source segment */
|
||||
movw $STAGE1_BUFFERSEG, %ax
|
||||
movw %ax, %ds
|
||||
|
||||
cld /* sets the copy direction to forward */
|
||||
|
||||
|
@ -260,7 +251,7 @@ more_sectors:
|
|||
jne setup_sectors
|
||||
|
||||
/* update position to load from */
|
||||
subw $LISTSIZ, %di
|
||||
subw $STAGE1_LISTSIZE, %di
|
||||
|
||||
/* jump to bootloop */
|
||||
jmp bootloop
|
||||
|
@ -332,11 +323,12 @@ lastlist:
|
|||
/*
|
||||
* This data area is for keeping general parameters.
|
||||
*/
|
||||
. = _start + PARTSTART - MINPARAMSIZ - LISTSIZ
|
||||
|
||||
. = _start + STAGE1_PARTSTART - STAGE1_MINPARAMSIZE - STAGE1_LISTSIZE
|
||||
|
||||
/* this next data area before the partition area is specifically
|
||||
sized, you should update "MINPARAMSIZ" to reflect any additions
|
||||
or deletions to this area */
|
||||
sized, you should update "STAGE1_MINPARAMSIZE" to reflect any
|
||||
additions or deletions to this area. */
|
||||
|
||||
.word 0
|
||||
.word 0
|
||||
|
@ -371,12 +363,12 @@ bootit:
|
|||
|
||||
/*
|
||||
* This is the compatibility version number.
|
||||
* See ../stage2/shared.h for COMPAT_VERSION_* definitions used
|
||||
* See stage1.h for COMPAT_VERSION_* definitions used
|
||||
* in stage2 and stage1_5 modules.
|
||||
*
|
||||
* DO NOT MOVE THIS!!!
|
||||
*/
|
||||
.byte 2, 1
|
||||
.byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
|
||||
|
||||
/*
|
||||
* This is where an MBR would go if on a hard disk. The code
|
||||
|
@ -384,11 +376,11 @@ bootit:
|
|||
* sneaky, huh?
|
||||
*/
|
||||
|
||||
. = _start + PARTSTART
|
||||
. = _start + STAGE1_PARTSTART
|
||||
|
||||
/* This space cannot be used by any bootloader, uggh... */
|
||||
|
||||
. = _start + PARTEND
|
||||
. = _start + STAGE1_PARTEND
|
||||
|
||||
/* the last 2 bytes in the sector 0 contain the signature */
|
||||
.word SIGNATURE
|
||||
.word STAGE1_SIGNATURE
|
||||
|
|
|
@ -8,6 +8,9 @@ noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \
|
|||
mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h
|
||||
EXTRA_DIST = smp-imps.c $(noinst_SCRIPTS)
|
||||
|
||||
# For <stage1.h>.
|
||||
INCLUDES = -I$(top_srcdir)/stage1
|
||||
|
||||
# The library for /sbin/grub.
|
||||
noinst_LIBRARIES = libgrub.a
|
||||
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
|
||||
|
|
|
@ -87,6 +87,9 @@ noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \
|
|||
|
||||
EXTRA_DIST = smp-imps.c $(noinst_SCRIPTS)
|
||||
|
||||
# For <stage1.h>.
|
||||
INCLUDES = -I$(top_srcdir)/stage1
|
||||
|
||||
# The library for /sbin/grub.
|
||||
noinst_LIBRARIES = libgrub.a
|
||||
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
|
||||
|
|
|
@ -232,7 +232,7 @@ load_image (void)
|
|||
|
||||
/* Remove the "vga=...". */
|
||||
vga_end = skip_to (0, vga);
|
||||
grub_memmove (vga, vga_end, grub_strlen (vga_end));
|
||||
grub_memmove (vga, vga_end, grub_strlen (vga_end) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,6 +405,41 @@ returnit:
|
|||
}
|
||||
else if (grub_open (file))
|
||||
{
|
||||
/* If STAGE1_FILE is the LBA version, do a sanity check. */
|
||||
if (buffer[STAGE1_ID_OFFSET] == STAGE1_ID_LBA)
|
||||
{
|
||||
/* The geometry of the drive in which FILE is located. */
|
||||
struct geometry load_geom;
|
||||
|
||||
/* Check if CURRENT_DRIVE is a floppy disk. */
|
||||
if (! (current_drive & 0x80))
|
||||
{
|
||||
errnum = ERR_DEV_VALUES;
|
||||
goto install_failure;
|
||||
}
|
||||
|
||||
/* Get the geometry of CURRENT_DRIVE. */
|
||||
if (get_diskinfo (current_drive, &load_geom))
|
||||
{
|
||||
errnum = ERR_NO_DISK;
|
||||
goto install_failure;
|
||||
}
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
/* XXX Can we determine if LBA is supported in
|
||||
/sbin/grub as well? */
|
||||
grub_printf ("Warning: make sure that the access mode for"
|
||||
"(hd%d) is LBA.\n", current_drive - 0x80);
|
||||
#else
|
||||
/* Check if LBA is supported. */
|
||||
if (! (load_geom.flags & BIOSDISK_FLAG_LBA_EXTENSION))
|
||||
{
|
||||
errnum = ERR_DEV_VALUES;
|
||||
goto install_failure;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!new_drive)
|
||||
new_drive = current_drive;
|
||||
|
||||
|
@ -488,7 +523,9 @@ returnit:
|
|||
no_decompression = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
install_failure:
|
||||
|
||||
/* Error running the install script, so drop to command line. */
|
||||
if (script)
|
||||
{
|
||||
|
|
|
@ -122,14 +122,7 @@ extern char *grub_scratch_mem;
|
|||
* (in LSB order)
|
||||
*/
|
||||
|
||||
#define COMPAT_VERSION_MAJOR 2
|
||||
#define COMPAT_VERSION_MINOR 1
|
||||
#define COMPAT_VERSION ((COMPAT_VERSION_MINOR<<8)|COMPAT_VERSION_MAJOR)
|
||||
|
||||
#define STAGE1_VER_MAJ_OFFS 0x1bc
|
||||
#define STAGE1_INSTALLSEG 0x1ba
|
||||
#define STAGE1_INSTALLADDR 0x1b8
|
||||
#define STAGE1_FIRSTLIST 0x1b5
|
||||
#include <stage1.h>
|
||||
|
||||
#define STAGE2_VER_MAJ_OFFS 0x6
|
||||
#define STAGE2_INSTALLPART 0x8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue