Get basic /sbin/grub GUI working

This commit is contained in:
gord committed 1999-03-14 03:32:01 +00:00
1 parent b296e6bad2
commit b0016b886e
13 files changed
+373 -146

No files matched your search

+1
View File
@@ -2,6 +2,7 @@ EXTRA_PROGRAMS = grub
sbin_PROGRAMS = $(sbingrub)
CLEANFILES = $(EXTRA_PROGRAMS)
COMPILE = $(CC) -DGRUB_UTIL=1 $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
grub_SOURCES = main.c asmstub.c
+1 -1
View File
@@ -74,6 +74,7 @@ EXTRA_PROGRAMS = grub
sbin_PROGRAMS = $(sbingrub)
CLEANFILES = $(EXTRA_PROGRAMS)
COMPILE = $(CC) -DGRUB_UTIL=1 $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
grub_SOURCES = main.c asmstub.c
@@ -96,7 +97,6 @@ grub_DEPENDENCIES = boot.o common.o char_io.o cmdline.o disk_io.o \
gunzip.o fsys_ffs.o fsys_ext2fs.o fsys_fat.o stage2.o
grub_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
+106 -22
View File
@@ -18,37 +18,78 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define end _end
#include "shared.h"
#undef end
/* We want to prevent any circularararity in our stubs, as well as
libc name clashes. */
#undef NULL
#undef bcopy
#undef bzero
#undef getc
#undef isspace
#undef printf
#undef putchar
#undef strncat
#undef strstr
#undef tolower
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
/* Simulated memory sizes. */
#define EXTENDED_MEMSIZE (4 * 1024 * 1024) /* 4MB */
#define CONVENTIONAL_MEMSIZE (640) /* 640kB */
char *end = _end;
unsigned long install_partition = 0x20000;
unsigned long boot_drive = 0;
char version_string[] = "0.5";
char config_file[] = "/boot/grub/menu.lst";
char *grub_scratch_mem = 0;
/* The main entry point into this mess. */
void
start_stage2 (void)
{
grub_scratch_mem = memalign (16, EXTENDED_MEMSIZE);
/* Check some invariants. */
assert (BUFFERADDR + BUFFERLEN == SCRATCHADDR);
assert (FSYS_BUF % 16 == 0);
assert (FSYS_BUF + FSYS_BUFLEN == BUFFERADDR);
#ifdef HAVE_LIBCURSES
/* Get into char-at-a-time mode. */
initscr ();
cbreak ();
noecho ();
scrollok (stdscr, TRUE);
#endif
init_bios_info ();
}
void
stop (void)
{
fprintf (stderr, "grub: aborting...\n");
exit (1);
}
/* calls for direct boot-loader chaining */
void
chain_stage1 (int segment, int offset, int part_table_addr)
{
stop ();
}
void
chain_stage2 (int segment, int offset)
{
stop ();
}
@@ -56,7 +97,7 @@ chain_stage2 (int segment, int offset)
void
linux_boot (void)
{
stop ();
}
@@ -64,7 +105,7 @@ linux_boot (void)
void
big_linux_boot (void)
{
stop ();
}
@@ -72,7 +113,7 @@ big_linux_boot (void)
void
multi_boot (int start, int mbi)
{
stop ();
}
/* sets it to linear or wired A20 operation */
@@ -83,34 +124,70 @@ gateA20 (int linear)
}
void *
get_code_end (void)
{
/* Just return a little area for simulation. */
return malloc (1024);
}
/* memory probe routines */
int
get_memsize (int type)
{
if (!type)
return 640 * 1024; /* 640kB conventional */
return CONVENTIONAL_MEMSIZE;
else
return 4 * 1024 * 1024; /* 4MB extended */
return EXTENDED_MEMSIZE;
}
/* get_eisamemsize() : return packed EISA memory map, lower 16 bits is
* memory between 1M and 16M in 1K parts, upper 16 bits is
* memory above 16M in 64K parts. If error, return -1.
*/
int
get_eisamemsize (void)
{
return (EXTENDED_MEMSIZE / 1024);
}
int
get_mmap_entry (int buf, int cont)
{
}
#define MMAR_DESC_TYPE_AVAILABLE 1 /* available to OS */
#define MMAR_DESC_TYPE_RESERVED 2 /* not available */
#define MMAR_DESC_TYPE_ACPI_RECLAIM 3 /* usable by OS after reading ACPI */
#define MMAR_DESC_TYPE_ACPI_NVS 4 /* required to save between NVS sessions */
/* Address and old continuation value for the Query System Address Map
BIOS call. */
int
get_mem_map (int addr, int cont)
/* Memory map address range descriptor. */
struct mmar_desc
{
unsigned long desc_len; /* Size of this descriptor. */
unsigned long long addr; /* Base address. */
unsigned long long length; /* Length in bytes. */
unsigned long type; /* Type of address range. */
};
/* Fetch the next entry in the memory map and return the continuation
value. DESC is a pointer to the descriptor buffer, and CONT is the
previous continuation value (0 to get the first entry in the
map). */
int
get_mem_map (struct mmar_desc *desc, int cont)
{
if (! cont)
{
/* First entry, located at 1MB. */
desc->desc_len = sizeof (*desc) - sizeof (desc->desc_len);
desc->addr = 1024 * 1024;
desc->length = EXTENDED_MEMSIZE;
desc->type = MMAR_DESC_TYPE_AVAILABLE;
}
else
{
/* No more entries, so give an error. */
desc->desc_len = 0;
}
return 0;
}
@@ -146,15 +223,21 @@ gotoxy (int x, int y)
/* displays an ASCII character. IBM displays will translate some
characters to special graphical ones */
void
putchar (int c)
grub_putchar (int c)
{
addch (c);
}
/* returns packed BIOS/ASCII code */
int
asm_getkey (void)
getkey (void)
{
int c;
nodelay (stdscr, FALSE);
c = getch ();
nodelay (stdscr, TRUE);
return c;
}
@@ -162,6 +245,7 @@ asm_getkey (void)
int
checkkey (void)
{
getch ();
}