fix the problem that savedefault doesn't work with Stage 1.5.
This commit is contained in:
parent
9417ebb550
commit
00865a8027
11 changed files with 55 additions and 44 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2001-02-02 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
Make savedefault workable even with Stage 1.5. Reported by
|
||||
Thierry Laronde <thierry@cri74.org>.
|
||||
|
||||
* grub/asmstub.c (chain_stage2): Added an additional argument,
|
||||
SECOND_SECTOR.
|
||||
* stage2/asm.S [STAGE1_5] (chain_stage2): Set %ebp to
|
||||
SECOND_SECTOR.
|
||||
* stage2/disk_io.c [STAGE1_5] (disk_read_hook): Defined.
|
||||
[STAGE1_5] (disk_read_func): Likewise.
|
||||
(rawread) [STAGE1_5]: Handle DISK_READ_FUNC.
|
||||
(grub_read) [STAGE1_5]: Likewise.
|
||||
* stage2/fsys_ext2fs.c (ext2fs_read) [STAGE1_5]: Likewise.
|
||||
* stage2/fsys_fat.c (fat_read) [STAGE1_5]: Likewise.
|
||||
* stage2/fsys_ffs.c (ffs_read) [STAGE1_5]: Likewise.
|
||||
* stage2/fsys_minix.c (minix_read) [STAGE1_5]: Likewise.
|
||||
* stage2/fsys_reiserfs.c (reiserfs_read) [STAGE1_5]: Likewise.
|
||||
|
||||
2001-02-02 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
* netboot/config.c [GRUB && INCLUDE_PCI] (pci_dispatch_table):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* asmstub.c - a version of shared_src/asm.S that works under Unix */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2000, 2001 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
|
||||
|
@ -274,7 +274,7 @@ chain_stage1 (unsigned long segment, unsigned long offset,
|
|||
|
||||
|
||||
void
|
||||
chain_stage2 (unsigned long segment, unsigned long offset)
|
||||
chain_stage2 (unsigned long segment, unsigned long offset, int second_sector)
|
||||
{
|
||||
stop ();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2000, 2001 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
|
||||
|
@ -761,7 +761,7 @@ ENTRY(chain_stage1)
|
|||
|
||||
#ifdef STAGE1_5
|
||||
/*
|
||||
* chain_stage2(segment, offset)
|
||||
* chain_stage2(segment, offset, second_sector)
|
||||
*
|
||||
* This starts another stage2 loader, at segment:offset. It presumes
|
||||
* that the other one starts with this same "asm.S" file, and passes
|
||||
|
@ -791,6 +791,9 @@ ENTRY(chain_stage2)
|
|||
/* set up to pass the drive where stage2 is located in */
|
||||
movb EXT_C(current_drive), %dl
|
||||
|
||||
/* set up to pass the second sector of stage2 */
|
||||
movl 0xc(%esp), %ebp
|
||||
|
||||
call EXT_C(prot_to_real)
|
||||
.code16
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2000, 2001 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
|
||||
|
@ -28,11 +28,11 @@
|
|||
# include <device.h>
|
||||
#endif
|
||||
|
||||
#ifndef STAGE1_5
|
||||
/* instrumentation variables */
|
||||
void (*disk_read_hook) (int, int, int) = NULL;
|
||||
void (*disk_read_func) (int, int, int) = NULL;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
int print_possibilities;
|
||||
|
||||
static int do_completion;
|
||||
|
@ -209,7 +209,6 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
|
|||
if (size > ((num_sect * SECTOR_SIZE) - byte_offset))
|
||||
size = (num_sect * SECTOR_SIZE) - byte_offset;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
/*
|
||||
* Instrumentation to tell which sectors were read and used.
|
||||
*/
|
||||
|
@ -231,7 +230,7 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
|
|||
(*disk_read_func) (sector_num, 0, length);
|
||||
}
|
||||
}
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
memmove (buf, (char *) bufaddr, size);
|
||||
|
||||
buf += size;
|
||||
|
@ -1577,17 +1576,13 @@ grub_read (char *buf, int len)
|
|||
if (size > len)
|
||||
size = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
/* read current block and put it in the right place in memory */
|
||||
devread (BLK_BLKSTART (BLK_CUR_BLKLIST) + BLK_CUR_BLKNUM,
|
||||
off, size, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
len -= size;
|
||||
filepos += size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2001 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
|
||||
|
@ -433,16 +433,12 @@ ext2fs_read (char *buf, int len)
|
|||
if (size > len)
|
||||
size = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
|
||||
offset, size, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
buf += size;
|
||||
len -= size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000, 2001 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
|
||||
|
@ -244,15 +244,11 @@ fat_read (char *buf, int len)
|
|||
if (size > len)
|
||||
size = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
devread(sector, offset, size, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
len -= size;
|
||||
buf += size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000, 2001 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
|
||||
|
@ -161,15 +161,11 @@ ffs_read (char *buf, int len)
|
|||
if (size > len)
|
||||
size = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
devread (fsbtodb (SUPERBLOCK, map), off, size, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
buf += size;
|
||||
len -= size;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2000, 2001 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
|
||||
|
@ -268,16 +268,12 @@ minix_read (char *buf, int len)
|
|||
if (size > len)
|
||||
size = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
devread (map * (BLOCK_SIZE / DEV_BSIZE),
|
||||
offset, size, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* STAGE1_5 */
|
||||
|
||||
buf += size;
|
||||
len -= size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* fsys_reiserfs.c - an implementation for the ReiserFS filesystem */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000, 2001 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
|
||||
|
@ -910,7 +910,6 @@ reiserfs_read (char *buf, int len)
|
|||
if (to_read > len)
|
||||
to_read = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
if (disk_read_hook != NULL)
|
||||
{
|
||||
disk_read_func = disk_read_hook;
|
||||
|
@ -921,7 +920,6 @@ reiserfs_read (char *buf, int len)
|
|||
disk_read_func = NULL;
|
||||
}
|
||||
else
|
||||
#endif /* ! STAGE1_5 */
|
||||
memcpy (buf, INFO->current_item + offset, to_read);
|
||||
goto update_buf_len;
|
||||
}
|
||||
|
@ -939,9 +937,7 @@ reiserfs_read (char *buf, int len)
|
|||
if (to_read > len)
|
||||
to_read = len;
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = disk_read_hook;
|
||||
#endif /* ! STAGE1_5 */
|
||||
|
||||
/* Journal is only for meta data. Data blocks can be read
|
||||
* directly without using block_read
|
||||
|
@ -949,9 +945,7 @@ reiserfs_read (char *buf, int len)
|
|||
devread (blocknr << INFO->blocksize_shift,
|
||||
blk_offset, to_read, buf);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
disk_read_func = NULL;
|
||||
#endif /* ! STAGE1_5 */
|
||||
update_buf_len:
|
||||
len -= to_read;
|
||||
buf += to_read;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999, 2000, 2001 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
|
||||
|
@ -601,10 +601,11 @@ extern int no_decompression;
|
|||
extern int compressed_file;
|
||||
#endif
|
||||
|
||||
#ifndef STAGE1_5
|
||||
/* instrumentation variables */
|
||||
extern void (*disk_read_hook) (int, int, int);
|
||||
extern void (*disk_read_func) (int, int, int);
|
||||
|
||||
#ifndef STAGE1_5
|
||||
/* The flag for debug mode. */
|
||||
extern int debug;
|
||||
/* Color settings */
|
||||
|
@ -705,7 +706,8 @@ extern unsigned short io_map[];
|
|||
void chain_stage1 (unsigned long segment, unsigned long offset,
|
||||
unsigned long part_table_addr)
|
||||
__attribute__ ((noreturn));
|
||||
void chain_stage2 (unsigned long segment, unsigned long offset)
|
||||
void chain_stage2 (unsigned long segment, unsigned long offset,
|
||||
int second_sector)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
/* do some funky stuff, then boot linux */
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
|
||||
#include "shared.h"
|
||||
|
||||
static int saved_sector;
|
||||
|
||||
static void
|
||||
disk_read_savesect_func (int sector, int offset, int length)
|
||||
{
|
||||
saved_sector = sector;
|
||||
}
|
||||
|
||||
void
|
||||
cmain (void)
|
||||
{
|
||||
|
@ -30,12 +38,18 @@ cmain (void)
|
|||
|
||||
if (grub_open (config_file))
|
||||
{
|
||||
int ret = grub_read ((char *) 0x8000, -1);
|
||||
int ret;
|
||||
|
||||
disk_read_hook = disk_read_savesect_func;
|
||||
grub_read ((char *) 0x8000, SECTOR_SIZE * 2);
|
||||
disk_read_hook = NULL;
|
||||
|
||||
ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1);
|
||||
|
||||
grub_close ();
|
||||
|
||||
if (ret)
|
||||
chain_stage2 (0, 0x8200);
|
||||
chain_stage2 (0, 0x8200, saved_sector);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue