1 |
/* |
/* |
2 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
3 |
* Copyright (C) 2001 Free Software Foundation, Inc. |
* Copyright (C) 2001,2002 Free Software Foundation, Inc. |
4 |
* |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
19 |
|
|
20 |
#include "shared.h" |
#include "shared.h" |
21 |
|
|
22 |
static int saved_sector; |
static int saved_sector = -1; |
23 |
|
|
24 |
static void |
static void |
25 |
disk_read_savesect_func (int sector, int offset, int length) |
disk_read_savesect_func (int sector, int offset, int length) |
30 |
void |
void |
31 |
cmain (void) |
cmain (void) |
32 |
{ |
{ |
33 |
printf ("\n\nGRUB loading, please wait...\n"); |
grub_printf ("\n\nGRUB loading, please wait...\n"); |
34 |
|
|
35 |
/* |
/* |
36 |
* Here load the true second-stage boot-loader. |
* Here load the true second-stage boot-loader. |
43 |
disk_read_hook = disk_read_savesect_func; |
disk_read_hook = disk_read_savesect_func; |
44 |
grub_read ((char *) 0x8000, SECTOR_SIZE * 2); |
grub_read ((char *) 0x8000, SECTOR_SIZE * 2); |
45 |
disk_read_hook = NULL; |
disk_read_hook = NULL; |
46 |
|
|
47 |
|
/* Sanity check: catch an internal error. */ |
48 |
|
if (saved_sector == -1) |
49 |
|
{ |
50 |
|
grub_printf ("internal error: the second sector of Stage 2 is unknown."); |
51 |
|
stop (); |
52 |
|
} |
53 |
|
|
54 |
ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1); |
ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1); |
55 |
|
|