Add the Unix stage2 attempt
This commit is contained in:
parent
553fec6022
commit
8b2e640b8c
3 changed files with 283 additions and 0 deletions
62
grub/Makefile
Normal file
62
grub/Makefile
Normal file
|
@ -0,0 +1,62 @@
|
|||
#
|
||||
# GRUB program makefile
|
||||
#
|
||||
|
||||
CFLAGS = -g -O2
|
||||
COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(SHARED_FLAGS) -I../shared_src
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS)
|
||||
|
||||
SHARED_OBJS= common.o char_io.o boot.o cmdline.o gunzip.o \
|
||||
disk_io.o stage2.o fsys_ffs.o fsys_ext2fs.o fsys_fat.o
|
||||
|
||||
all: grub
|
||||
|
||||
boot.o: ../shared_src/boot.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/boot.c
|
||||
|
||||
char_io.o: ../shared_src/char_io.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/char_io.c
|
||||
|
||||
cmdline.o: ../shared_src/cmdline.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/cmdline.c
|
||||
|
||||
common.o: ../shared_src/common.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/common.c
|
||||
|
||||
gunzip.o: ../shared_src/gunzip.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/gunzip.c
|
||||
|
||||
disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \
|
||||
../shared_src/pc_slice.h ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/disk_io.c
|
||||
|
||||
stage2.o: ../shared_src/stage2.c ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/stage2.c
|
||||
|
||||
fsys_ffs.o: ../shared_src/fsys_ffs.c ../shared_src/filesys.h \
|
||||
../shared_src/pc_slice.h ../shared_src/shared.h \
|
||||
../shared_src/defs.h ../shared_src/disk_inode.h \
|
||||
../shared_src/disk_inode_ffs.h ../shared_src/dir.h \
|
||||
../shared_src/fs.h
|
||||
$(COMPILE) -c ../shared_src/fsys_ffs.c
|
||||
|
||||
fsys_ext2fs.o: ../shared_src/fsys_ext2fs.c ../shared_src/filesys.h \
|
||||
../shared_src/pc_slice.h ../shared_src/shared.h
|
||||
$(COMPILE) -c ../shared_src/fsys_ext2fs.c
|
||||
|
||||
fsys_fat.o: ../shared_src/fsys_fat.c ../shared_src/filesys.h \
|
||||
../shared_src/pc_slice.h ../shared_src/shared.h \
|
||||
../shared_src/fat.h
|
||||
$(COMPILE) -c ../shared_src/fsys_fat.c
|
||||
|
||||
main.o: main.c ../shared_src/shared.h
|
||||
$(COMPILE) -c main.c
|
||||
|
||||
asmstub.o: asmstub.c ../shared_src/shared.h
|
||||
$(COMPILE) -c asmstub.c
|
||||
|
||||
grub: main.o asmstub.o $(SHARED_OBJS)
|
||||
$(LINK) -o $@ main.o asmstub.o $(SHARED_OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o grub
|
192
grub/asmstub.c
Normal file
192
grub/asmstub.c
Normal file
|
@ -0,0 +1,192 @@
|
|||
/* asmstub.c - a version of shared_src/asm.S that works under Unix */
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define end _end
|
||||
#include "shared.h"
|
||||
#undef end
|
||||
|
||||
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";
|
||||
|
||||
|
||||
/* The main entry point into this mess. */
|
||||
void
|
||||
start_stage2 (void)
|
||||
{
|
||||
init_bios_info ();
|
||||
}
|
||||
|
||||
/* calls for direct boot-loader chaining */
|
||||
void
|
||||
chain_stage1(int segment, int offset, int part_table_addr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
chain_stage2(int segment, int offset)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* do some funky stuff, then boot linux */
|
||||
void
|
||||
linux_boot(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* For bzImage kernels. */
|
||||
void
|
||||
big_linux_boot(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* booting a multiboot executable */
|
||||
void
|
||||
multi_boot(int start, int mbi)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* sets it to linear or wired A20 operation */
|
||||
void
|
||||
gateA20 (int linear)
|
||||
{
|
||||
/* Nothing to do in the simulator. */
|
||||
}
|
||||
|
||||
|
||||
/* memory probe routines */
|
||||
int
|
||||
get_memsize (int type)
|
||||
{
|
||||
if (! type)
|
||||
return 640 * 1024; /* 640kB conventional */
|
||||
else
|
||||
return 4 * 1024 * 1024; /* 4MB extended */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
get_eisamemsize (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
get_mmap_entry (int buf, int cont)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Address and old continuation value for the Query System Address Map
|
||||
BIOS call. */
|
||||
int
|
||||
get_mem_map (int addr, int cont)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* low-level timing info */
|
||||
int
|
||||
getrtsecs (void)
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
/* low-level character I/O */
|
||||
void
|
||||
cls(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* returns packed values, LSB+1 is x, LSB is y */
|
||||
int
|
||||
getxy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gotoxy(int x, int y)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* displays an ASCII character. IBM displays will translate some
|
||||
characters to special graphical ones */
|
||||
void
|
||||
putchar(int c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* returns packed BIOS/ASCII code */
|
||||
int
|
||||
asm_getkey(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* like 'getkey', but doesn't wait, returns -1 if nothing available */
|
||||
int
|
||||
checkkey(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* sets text mode character attribute at the cursor position */
|
||||
void
|
||||
set_attrib(int attr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* low-level disk I/O */
|
||||
int
|
||||
get_diskinfo(int drive)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
biosdisk(int subfunc, int drive, int geometry,
|
||||
int sector, int nsec, int segment)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
stop_floppy(void)
|
||||
{
|
||||
}
|
29
grub/main.c
Normal file
29
grub/main.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* main.c - experimental GRUB stage2 that runs under Unix */
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
extern void start_stage2 (void);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
/* Call the main entry point. */
|
||||
start_stage2 ();
|
||||
exit (0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue