add hide and unhide commands. add additional minix fs support. some code cleanups.
This commit is contained in:
parent
434d8607cc
commit
83b3d5eee0
17 changed files with 249 additions and 79 deletions
45
ChangeLog
45
ChangeLog
|
@ -1,3 +1,48 @@
|
||||||
|
1999-08-30 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
From Edward Killips <ekillips@triton.net>:
|
||||||
|
* stage2/cmdline.c (commands): Added hide and unhide.
|
||||||
|
(enter_cmdline): Likewise.
|
||||||
|
* stage2/disk_io.c (unhide_partition): New function.
|
||||||
|
(hide_partition): Likewise.
|
||||||
|
* stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): New macro.
|
||||||
|
|
||||||
|
1999-08-29 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
From Pavel Roskin <pavel_roskin@geocities.com>:
|
||||||
|
* stage2/fsys_minix.c (namelen): New variable.
|
||||||
|
(MINIX_NAME_LEN): Deleted.
|
||||||
|
(minix_mount): Set NAMELEN to 14 if SUPRTBLOCK->S_MAGIC is
|
||||||
|
MINIX_SUPER_MAGIC, and set NAMELEN to 30 if it is
|
||||||
|
MINIX_SUPER_MAGIC2.
|
||||||
|
(minix_dir): Use NAMELEN instead of MINIX_NAME_LEN.
|
||||||
|
|
||||||
|
1999-08-29 Pavel Roskin <pavel_roslin@geocities.com>
|
||||||
|
|
||||||
|
* grub/Makefile.am, stage1/Makefile.am, stage2/Makefile.am:
|
||||||
|
Avoid using variables inclosed in '@' because they cannot be
|
||||||
|
overridden at the make time.
|
||||||
|
|
||||||
|
1999-08-29 Pavel Roskin <pavel_roskin@geocities.com>
|
||||||
|
|
||||||
|
* stage2/fsys_fat.c (fat_create_blocklist): Return 1 for the
|
||||||
|
root directory on FAT12 and FAT16.
|
||||||
|
|
||||||
|
1999-08-27 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* stage2/boot.c (load_image): Accept two arguments, KERNEL and
|
||||||
|
ARG. And use them instead of CUR_CMDLINE.
|
||||||
|
(load_module): Accept two arguments, MODULE and ARG. And use
|
||||||
|
them instead of CUR_CMDLINE.
|
||||||
|
(load_initrd): Accept one argument, INITRD. And use it instead
|
||||||
|
of CUR_CMDLINE.
|
||||||
|
(bsd_boot): Accept one additional argument, ARG. And use it
|
||||||
|
instead of CUR_CMDLINE.
|
||||||
|
* stage2/cmdline.c (enter_cmdline): Use MB_CMDLINE instead of
|
||||||
|
HEAP for the Multiboot command-line buffer.
|
||||||
|
* stage2/shared.h (MB_CMDLINE_BUF): New macro.
|
||||||
|
(MB_CMDLINE_BUFLEN): Likewise.
|
||||||
|
|
||||||
1999-08-26 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-08-26 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
* docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the
|
* docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -8,6 +8,7 @@ New in 0.5.93:
|
||||||
ext2fs, FAT and FFS support in Stage 2 respectively.
|
ext2fs, FAT and FFS support in Stage 2 respectively.
|
||||||
* FAT32 support is added.
|
* FAT32 support is added.
|
||||||
* Minix fs support is added.
|
* Minix fs support is added.
|
||||||
|
* The new commands "hide" and "unhide" are added.
|
||||||
|
|
||||||
New in 0.5.92 - 1999-07-26:
|
New in 0.5.92 - 1999-07-26:
|
||||||
* Bug fixes (i.e. Stage 1.5 can work fine again).
|
* Bug fixes (i.e. Stage 1.5 can work fine again).
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -11,6 +11,7 @@ Bradford Hovinen <hovinen@redrose.net>
|
||||||
Brian Brunswick <brian@skarpsey.demon.co.uk>
|
Brian Brunswick <brian@skarpsey.demon.co.uk>
|
||||||
Bryan Ford <baford@cs.utah.edu>
|
Bryan Ford <baford@cs.utah.edu>
|
||||||
Dan J. Walters <djw@cs.utexas.edu>
|
Dan J. Walters <djw@cs.utexas.edu>
|
||||||
|
Edward Killips <ekillips@triton.net>
|
||||||
Eric Hanchrow <erich@microsoft.com>
|
Eric Hanchrow <erich@microsoft.com>
|
||||||
Heiko Schroeder <heiko@pool.informatik.rwth-aachen.de>
|
Heiko Schroeder <heiko@pool.informatik.rwth-aachen.de>
|
||||||
Jochen Hoenicke <jochen@gnu.org>
|
Jochen Hoenicke <jochen@gnu.org>
|
||||||
|
|
2
TODO
2
TODO
|
@ -35,6 +35,4 @@ Clean up and enhance the manuals, especially concept indexes.
|
||||||
|
|
||||||
Add more filesystems support (XFS, NTFS, etc.)
|
Add more filesystems support (XFS, NTFS, etc.)
|
||||||
|
|
||||||
??? Add hide and unhide facilities.
|
|
||||||
|
|
||||||
Add remote console support (serial, parallel and net).
|
Add remote console support (serial, parallel and net).
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
sbin_PROGRAMS = grub
|
sbin_PROGRAMS = grub
|
||||||
|
|
||||||
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
|
AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
|
||||||
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
|
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
|
||||||
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
||||||
|
|
||||||
grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h
|
grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h
|
||||||
grub_LDADD = ../stage2/libgrub.a @GRUB_LIBS@
|
grub_LDADD = ../stage2/libgrub.a $(GRUB_LIBS)
|
||||||
|
|
|
@ -81,13 +81,13 @@ install_sh = @install_sh@
|
||||||
|
|
||||||
sbin_PROGRAMS = grub
|
sbin_PROGRAMS = grub
|
||||||
|
|
||||||
AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
|
AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
|
||||||
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
|
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
|
||||||
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
|
||||||
|
|
||||||
|
|
||||||
grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h
|
grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h
|
||||||
grub_LDADD = ../stage2/libgrub.a @GRUB_LIBS@
|
grub_LDADD = ../stage2/libgrub.a $(GRUB_LIBS)
|
||||||
subdir = grub
|
subdir = grub
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
|
|
|
@ -3,7 +3,7 @@ nodist_pkgdata_DATA = stage1 stage1_lba
|
||||||
CLEANFILES = $(pkgdata_DATA)
|
CLEANFILES = $(pkgdata_DATA)
|
||||||
|
|
||||||
# We can't use builtins or standard includes.
|
# We can't use builtins or standard includes.
|
||||||
AM_CFLAGS = @STAGE1_CFLAGS@ -fno-builtin -nostdinc
|
AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
|
||||||
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
||||||
|
|
||||||
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
||||||
|
|
|
@ -82,7 +82,7 @@ nodist_pkgdata_DATA = stage1 stage1_lba
|
||||||
CLEANFILES = $(pkgdata_DATA)
|
CLEANFILES = $(pkgdata_DATA)
|
||||||
|
|
||||||
# We can't use builtins or standard includes.
|
# We can't use builtins or standard includes.
|
||||||
AM_CFLAGS = @STAGE1_CFLAGS@ -fno-builtin -nostdinc
|
AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
|
||||||
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
|
||||||
|
|
||||||
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
noinst_PROGRAMS = stage1.exec stage1_lba.exec
|
||||||
|
|
|
@ -16,7 +16,7 @@ noinst_LIBRARIES = libgrub.a
|
||||||
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
|
libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
|
||||||
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
|
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
|
||||||
stage2.c
|
stage2.c
|
||||||
libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
|
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
|
||||||
-DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
|
-DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
# Stage 2 and Stage 1.5's.
|
||||||
|
@ -29,7 +29,7 @@ noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \
|
||||||
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
|
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
|
||||||
|
|
||||||
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
|
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
|
||||||
STAGE2_COMPILE = @STAGE2_CFLAGS@ -fno-builtin -nostdinc
|
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
|
||||||
|
|
||||||
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
|
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
|
||||||
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
|
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
|
||||||
|
@ -40,7 +40,7 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
|
||||||
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
|
stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
|
||||||
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
|
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
|
||||||
fsys_fat.c fsys_ffs.c fsys_minix.c
|
fsys_fat.c fsys_ffs.c fsys_minix.c
|
||||||
stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@
|
stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
|
||||||
stage2_exec_LDFLAGS = $(STAGE2_LINK)
|
stage2_exec_LDFLAGS = $(STAGE2_LINK)
|
||||||
|
|
||||||
# For e2fs_stage1_5 target.
|
# For e2fs_stage1_5 target.
|
||||||
|
|
|
@ -98,7 +98,7 @@ libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
|
||||||
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
|
gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c fsys_minix.c \
|
||||||
stage2.c
|
stage2.c
|
||||||
|
|
||||||
libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
|
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
|
||||||
-DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
|
-DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \
|
||||||
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
|
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
|
||||||
|
|
||||||
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
|
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
|
||||||
STAGE2_COMPILE = @STAGE2_CFLAGS@ -fno-builtin -nostdinc
|
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
|
||||||
|
|
||||||
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
|
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
|
||||||
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
|
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
|
||||||
|
@ -127,7 +127,7 @@ stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
|
||||||
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
|
disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
|
||||||
fsys_fat.c fsys_ffs.c fsys_minix.c
|
fsys_fat.c fsys_ffs.c fsys_minix.c
|
||||||
|
|
||||||
stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@
|
stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
|
||||||
stage2_exec_LDFLAGS = $(STAGE2_LINK)
|
stage2_exec_LDFLAGS = $(STAGE2_LINK)
|
||||||
|
|
||||||
# For e2fs_stage1_5 target.
|
# For e2fs_stage1_5 target.
|
||||||
|
|
|
@ -39,7 +39,7 @@ static struct mod_list mll[99];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
load_image (void)
|
load_image (char *kernel, char *arg)
|
||||||
{
|
{
|
||||||
int len, i, exec_type = 0, align_4k = 1, type = 0;
|
int len, i, exec_type = 0, align_4k = 1, type = 0;
|
||||||
unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0;
|
unsigned long flags = 0, text_len = 0, data_len = 0, bss_len = 0;
|
||||||
|
@ -59,7 +59,7 @@ load_image (void)
|
||||||
buffer by default */
|
buffer by default */
|
||||||
pu.aout = (struct exec *) buffer;
|
pu.aout = (struct exec *) buffer;
|
||||||
|
|
||||||
if (!grub_open (cur_cmdline))
|
if (!grub_open (kernel))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(len = grub_read (buffer, MULTIBOOT_SEARCH)) || len < 32)
|
if (!(len = grub_read (buffer, MULTIBOOT_SEARCH)) || len < 32)
|
||||||
|
@ -213,7 +213,7 @@ load_image (void)
|
||||||
char *vga;
|
char *vga;
|
||||||
|
|
||||||
/* Find the substring "vga=". */
|
/* Find the substring "vga=". */
|
||||||
vga = grub_strstr (cur_cmdline, "vga=");
|
vga = grub_strstr (arg, "vga=");
|
||||||
if (vga)
|
if (vga)
|
||||||
{
|
{
|
||||||
char *value = vga + 4;
|
char *value = vga + 4;
|
||||||
|
@ -250,7 +250,7 @@ load_image (void)
|
||||||
|
|
||||||
/* copy command-line plus memory hack to staging area */
|
/* copy command-line plus memory hack to staging area */
|
||||||
{
|
{
|
||||||
char *src = cur_cmdline;
|
char *src = arg;
|
||||||
char *dest = (char *) (CL_MY_LOCATION + 4);
|
char *dest = (char *) (CL_MY_LOCATION + 4);
|
||||||
|
|
||||||
memmove ((char *) CL_MY_LOCATION, "mem=", 4);
|
memmove ((char *) CL_MY_LOCATION, "mem=", 4);
|
||||||
|
@ -290,7 +290,7 @@ load_image (void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* fill the multiboot info structure */
|
/* fill the multiboot info structure */
|
||||||
mbi.cmdline = (int) cur_cmdline;
|
mbi.cmdline = (int) arg;
|
||||||
mbi.mods_count = 0;
|
mbi.mods_count = 0;
|
||||||
mbi.mods_addr = 0;
|
mbi.mods_addr = 0;
|
||||||
mbi.boot_device = (saved_drive << 24) | saved_partition;
|
mbi.boot_device = (saved_drive << 24) | saved_partition;
|
||||||
|
@ -473,14 +473,14 @@ load_image (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
load_module (void)
|
load_module (char *module, char *arg)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* if we are supposed to load on 4K boundaries */
|
/* if we are supposed to load on 4K boundaries */
|
||||||
cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000;
|
cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000;
|
||||||
|
|
||||||
if (!grub_open (cur_cmdline) || !(len = grub_read ((char *) cur_addr, -1)))
|
if (!grub_open (module) || !(len = grub_read ((char *) cur_addr, -1)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
printf (" [Multiboot-module @ 0x%x, 0x%x bytes]\n", cur_addr, len);
|
printf (" [Multiboot-module @ 0x%x, 0x%x bytes]\n", cur_addr, len);
|
||||||
|
@ -489,7 +489,7 @@ load_module (void)
|
||||||
mbi.flags |= MB_INFO_MODS;
|
mbi.flags |= MB_INFO_MODS;
|
||||||
mbi.mods_addr = (int) mll;
|
mbi.mods_addr = (int) mll;
|
||||||
|
|
||||||
mll[mbi.mods_count].cmdline = (int) cur_cmdline;
|
mll[mbi.mods_count].cmdline = (int) arg;
|
||||||
mll[mbi.mods_count].mod_start = cur_addr;
|
mll[mbi.mods_count].mod_start = cur_addr;
|
||||||
cur_addr += len;
|
cur_addr += len;
|
||||||
mll[mbi.mods_count].mod_end = cur_addr;
|
mll[mbi.mods_count].mod_end = cur_addr;
|
||||||
|
@ -502,12 +502,12 @@ load_module (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
load_initrd (void)
|
load_initrd (char *initrd)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
long *ramdisk, moveto;
|
long *ramdisk, moveto;
|
||||||
|
|
||||||
if (!grub_open (cur_cmdline) || !(len = grub_read ((char *) cur_addr, -1)))
|
if (! grub_open (initrd) || ! (len = grub_read ((char *) cur_addr, -1)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
moveto = ((mbi.mem_upper + 0x400) * 0x400 - len) & 0xfffff000;
|
moveto = ((mbi.mem_upper + 0x400) * 0x400 - len) & 0xfffff000;
|
||||||
|
@ -532,7 +532,7 @@ load_initrd (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bsd_boot (int type, int bootdev)
|
bsd_boot (int type, int bootdev, char *arg)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
int clval = 0, i;
|
int clval = 0, i;
|
||||||
|
@ -540,8 +540,8 @@ bsd_boot (int type, int bootdev)
|
||||||
|
|
||||||
stop_floppy ();
|
stop_floppy ();
|
||||||
|
|
||||||
while (*(++cur_cmdline) && *cur_cmdline != ' ');
|
while (*(++arg) && *arg != ' ');
|
||||||
str = cur_cmdline;
|
str = arg;
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
if (*str == '-')
|
if (*str == '-')
|
||||||
|
@ -579,10 +579,10 @@ bsd_boot (int type, int bootdev)
|
||||||
|
|
||||||
bi.bi_version = BOOTINFO_VERSION;
|
bi.bi_version = BOOTINFO_VERSION;
|
||||||
|
|
||||||
*cur_cmdline = 0;
|
*arg = 0;
|
||||||
while ((--cur_cmdline) > (char *) (mbi.cmdline) && *cur_cmdline != '/');
|
while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/');
|
||||||
if (*cur_cmdline == '/')
|
if (*arg == '/')
|
||||||
bi.bi_kernelname = cur_cmdline + 1;
|
bi.bi_kernelname = arg + 1;
|
||||||
else
|
else
|
||||||
bi.bi_kernelname = 0;
|
bi.bi_kernelname = 0;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ char commands[] =
|
||||||
" Possible commands are: \"pause= ...\", \"uppermem= <kbytes>\", \"root= <device>\",
|
" Possible commands are: \"pause= ...\", \"uppermem= <kbytes>\", \"root= <device>\",
|
||||||
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\",
|
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\",
|
||||||
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
|
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
|
||||||
\"geometry= <drive>\",
|
\"geometry= <drive>\", \"hide= <device>\", \"unhide= <device>\",
|
||||||
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
|
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
|
||||||
\"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and
|
\"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and
|
||||||
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
|
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
|
||||||
|
@ -117,6 +117,7 @@ enter_cmdline (char *script, char *heap)
|
||||||
{
|
{
|
||||||
int bootdev, cmd_len, type = 0, run_cmdline = 1, have_run_cmdline = 0;
|
int bootdev, cmd_len, type = 0, run_cmdline = 1, have_run_cmdline = 0;
|
||||||
char *cur_heap = heap, *cur_entry = script, *old_entry;
|
char *cur_heap = heap, *cur_entry = script, *old_entry;
|
||||||
|
char *mb_cmdline = (char *) MB_CMDLINE_BUF;
|
||||||
|
|
||||||
/* initialization */
|
/* initialization */
|
||||||
saved_drive = boot_drive;
|
saved_drive = boot_drive;
|
||||||
|
@ -185,20 +186,20 @@ returnit:
|
||||||
if (run_cmdline && get_cmdline (PACKAGE "> ", commands, cur_heap, 2048, 0))
|
if (run_cmdline && get_cmdline (PACKAGE "> ", commands, cur_heap, 2048, 0))
|
||||||
return CMDLINE_ERROR;
|
return CMDLINE_ERROR;
|
||||||
|
|
||||||
if (substring("boot", cur_heap) == 0 || (script && !*cur_heap))
|
if (substring ("boot", cur_heap) == 0 || (script && !*cur_heap))
|
||||||
{
|
{
|
||||||
if ((type == 'f') | (type == 'n'))
|
if ((type == 'f') | (type == 'n'))
|
||||||
bsd_boot(type, bootdev);
|
bsd_boot (type, bootdev, (char *) MB_CMDLINE_BUF);
|
||||||
if (type == 'l')
|
if (type == 'l')
|
||||||
linux_boot();
|
linux_boot ();
|
||||||
if (type == 'L')
|
if (type == 'L')
|
||||||
big_linux_boot();
|
big_linux_boot ();
|
||||||
|
|
||||||
if (type == 'c')
|
if (type == 'c')
|
||||||
{
|
{
|
||||||
gateA20(0);
|
gateA20 (0);
|
||||||
boot_drive = saved_drive;
|
boot_drive = saved_drive;
|
||||||
chain_stage1(0, BOOTSEC_LOCATION, BOOTSEC_LOCATION-16);
|
chain_stage1 (0, BOOTSEC_LOCATION, BOOTSEC_LOCATION-16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!type)
|
if (!type)
|
||||||
|
@ -271,17 +272,21 @@ returnit:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (substring("kernel", cur_heap) < 1)
|
else if (substring ("kernel", cur_heap) < 1)
|
||||||
{
|
{
|
||||||
/* make sure it's at the beginning of the boot heap area */
|
/* Reset MB_CMDLINE. */
|
||||||
memmove (heap, cur_heap,
|
mb_cmdline = (char *) MB_CMDLINE_BUF;
|
||||||
cmd_len + (((int)cur_cmdline) - ((int)cur_heap)));
|
if (cmd_len + 1 > MB_CMDLINE_BUFLEN)
|
||||||
cur_cmdline = heap + (((int)cur_cmdline) - ((int)cur_heap));
|
errnum = ERR_WONT_FIT;
|
||||||
cur_heap = heap;
|
else
|
||||||
if ((type = load_image()) != 0)
|
{
|
||||||
cur_heap = cur_cmdline + cmd_len;
|
/* Copy the command-line to MB_CMDLINE. */
|
||||||
|
grub_memmove (mb_cmdline, cur_cmdline, cmd_len + 1);
|
||||||
|
if ((type = load_image (cur_cmdline, mb_cmdline)) != 0)
|
||||||
|
mb_cmdline += cmd_len + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (substring("module", cur_heap) < 1)
|
else if (substring ("module", cur_heap) < 1)
|
||||||
{
|
{
|
||||||
if (type == 'm')
|
if (type == 'm')
|
||||||
{
|
{
|
||||||
|
@ -292,8 +297,16 @@ returnit:
|
||||||
no_decompression = 1;
|
no_decompression = 1;
|
||||||
#endif /* NO_DECOMPRESSION */
|
#endif /* NO_DECOMPRESSION */
|
||||||
|
|
||||||
if (load_module())
|
if (mb_cmdline + cmd_len + 1
|
||||||
cur_heap = cur_cmdline + cmd_len;
|
> (char *) MB_CMDLINE_BUF + MB_CMDLINE_BUFLEN)
|
||||||
|
errnum = ERR_WONT_FIT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Copy the command-line to MB_CMDLINE. */
|
||||||
|
grub_memmove (mb_cmdline, cur_cmdline, cmd_len + 1);
|
||||||
|
if (load_module (cur_cmdline, mb_cmdline))
|
||||||
|
mb_cmdline += cmd_len + 1;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NO_DECOMPRESSION
|
#ifndef NO_DECOMPRESSION
|
||||||
no_decompression = 0;
|
no_decompression = 0;
|
||||||
|
@ -301,7 +314,7 @@ returnit:
|
||||||
}
|
}
|
||||||
else if (type == 'L' || type == 'l')
|
else if (type == 'L' || type == 'l')
|
||||||
{
|
{
|
||||||
load_initrd ();
|
load_initrd (cur_cmdline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
errnum = ERR_NEED_MB_KERNEL;
|
errnum = ERR_NEED_MB_KERNEL;
|
||||||
|
@ -310,7 +323,7 @@ returnit:
|
||||||
{
|
{
|
||||||
if (type == 'L' || type == 'l')
|
if (type == 'L' || type == 'l')
|
||||||
{
|
{
|
||||||
load_initrd ();
|
load_initrd (cur_cmdline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
errnum = ERR_NEED_LX_KERNEL;
|
errnum = ERR_NEED_LX_KERNEL;
|
||||||
|
@ -693,6 +706,28 @@ returnit:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (substring ("hide", cur_heap) < 1)
|
||||||
|
{
|
||||||
|
set_device (cur_cmdline);
|
||||||
|
|
||||||
|
if (! errnum)
|
||||||
|
{
|
||||||
|
saved_partition = current_partition;
|
||||||
|
saved_drive = current_drive;
|
||||||
|
hide_partition ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (substring ("unhide", cur_heap) < 1)
|
||||||
|
{
|
||||||
|
set_device (cur_cmdline);
|
||||||
|
|
||||||
|
if (! errnum)
|
||||||
|
{
|
||||||
|
saved_partition = current_partition;
|
||||||
|
saved_drive = current_drive;
|
||||||
|
unhide_partition ();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (*cur_heap && *cur_heap != ' ')
|
else if (*cur_heap && *cur_heap != ' ')
|
||||||
errnum = ERR_UNRECOGNIZED;
|
errnum = ERR_UNRECOGNIZED;
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,69 @@ make_saved_active (void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
unhide_partition (void)
|
||||||
|
{
|
||||||
|
if (saved_drive)
|
||||||
|
{
|
||||||
|
int part = saved_partition >> 16;
|
||||||
|
|
||||||
|
if (part > 3)
|
||||||
|
{
|
||||||
|
errnum = ERR_NO_PART;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG)
|
||||||
|
{
|
||||||
|
PC_SLICE_TYPE (SCRATCHADDR, part) ^= PC_SLICE_TYPE_HIDDEN_FLAG;
|
||||||
|
buf_track = -1;
|
||||||
|
if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom,
|
||||||
|
0, 1, SCRATCHSEG))
|
||||||
|
{
|
||||||
|
errnum = ERR_WRITE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
hide_partition (void)
|
||||||
|
{
|
||||||
|
if (saved_drive)
|
||||||
|
{
|
||||||
|
int part = saved_partition >> 16;
|
||||||
|
|
||||||
|
if (part > 3)
|
||||||
|
{
|
||||||
|
errnum = ERR_NO_PART;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (! (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG))
|
||||||
|
{
|
||||||
|
PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG;
|
||||||
|
buf_track = -1;
|
||||||
|
if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom,
|
||||||
|
0, 1, SCRATCHSEG))
|
||||||
|
{
|
||||||
|
errnum = ERR_WRITE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_and_print_mount (void)
|
check_and_print_mount (void)
|
||||||
|
|
|
@ -87,6 +87,7 @@ fat_create_blocklist (int first_fat_entry)
|
||||||
BLK_BLKSTART (BLK_BLKLIST_START) = FAT_BPB_ROOT_DIR_START (BPB);
|
BLK_BLKSTART (BLK_BLKLIST_START) = FAT_BPB_ROOT_DIR_START (BPB);
|
||||||
fsmax = filemax = SECTOR_SIZE * (BLK_BLKLENGTH (BLK_BLKLIST_START)
|
fsmax = filemax = SECTOR_SIZE * (BLK_BLKLENGTH (BLK_BLKLIST_START)
|
||||||
= FAT_BPB_ROOT_DIR_LENGTH (BPB));
|
= FAT_BPB_ROOT_DIR_LENGTH (BPB));
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* any real directory/file */
|
/* any real directory/file */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
/* Restrictions:
|
/* Restrictions:
|
||||||
This is MINIX V1 only (yet)
|
This is MINIX V1 only (yet)
|
||||||
Disk creation is like:
|
Disk creation is like:
|
||||||
mkfs.minix -c -n14 DEVICE
|
mkfs.minix -c DEVICE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef FSYS_MINIX
|
#ifdef FSYS_MINIX
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
/* #define DEBUG_MINIX */
|
/* #define DEBUG_MINIX */
|
||||||
|
|
||||||
/* indirect blocks */
|
/* indirect blocks */
|
||||||
static int mapblock1, mapblock2;
|
static int mapblock1, mapblock2, namelen;
|
||||||
|
|
||||||
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
|
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
|
||||||
#define DEV_BSIZE 512
|
#define DEV_BSIZE 512
|
||||||
|
@ -80,8 +80,6 @@ typedef unsigned int __u32;
|
||||||
here we have */
|
here we have */
|
||||||
#define INODE_VERSION(inode) (SUPERBLOCK->s_version)
|
#define INODE_VERSION(inode) (SUPERBLOCK->s_version)
|
||||||
|
|
||||||
#define MINIX_NAME_LEN 14 /* XXX depend on version */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the original minix inode layout on disk.
|
* This is the original minix inode layout on disk.
|
||||||
* Note the 8-bit gid and atime and ctime.
|
* Note the 8-bit gid and atime and ctime.
|
||||||
|
@ -162,19 +160,32 @@ struct minix_dir_entry {
|
||||||
int
|
int
|
||||||
minix_mount (void)
|
minix_mount (void)
|
||||||
{
|
{
|
||||||
int retval = 1;
|
if (((current_drive & 0x80 || current_slice != 0))
|
||||||
|
&& (current_slice != PC_SLICE_TYPE_MINIX)
|
||||||
|
&& ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
|
||||||
|
return 0; /* The partition is not of MINIX type */
|
||||||
|
|
||||||
if ((((current_drive & 0x80 || current_slice != 0))
|
if (part_length < (SBLOCK +
|
||||||
&& (current_slice != PC_SLICE_TYPE_MINIX)
|
(sizeof (struct minix_super_block) / DEV_BSIZE)))
|
||||||
&& ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
|
return 0; /* The partition is too short */
|
||||||
|| part_length < (SBLOCK +
|
|
||||||
(sizeof (struct minix_super_block) / DEV_BSIZE))
|
|
||||||
|| ! devread (SBLOCK, 0, sizeof (struct minix_super_block),
|
|
||||||
(char *) SUPERBLOCK)
|
|
||||||
|| SUPERBLOCK->s_magic != MINIX_SUPER_MAGIC)
|
|
||||||
retval = 0;
|
|
||||||
|
|
||||||
return retval;
|
if (!devread (SBLOCK, 0, sizeof (struct minix_super_block),
|
||||||
|
(char *) SUPERBLOCK))
|
||||||
|
return 0; /* Cannot read superblock */
|
||||||
|
|
||||||
|
switch (SUPERBLOCK->s_magic)
|
||||||
|
{
|
||||||
|
case MINIX_SUPER_MAGIC:
|
||||||
|
namelen = 14;
|
||||||
|
break;
|
||||||
|
case MINIX_SUPER_MAGIC2:
|
||||||
|
namelen = 30;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0; /* Unsupported type */
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Takes a file system block number and reads it into BUFFER. */
|
/* Takes a file system block number and reads it into BUFFER. */
|
||||||
|
@ -482,9 +493,10 @@ minix_dir (char *dirname)
|
||||||
off = loc & (BLOCK_SIZE - 1);
|
off = loc & (BLOCK_SIZE - 1);
|
||||||
dp = (struct minix_dir_entry *) (DATABLOCK2 + off);
|
dp = (struct minix_dir_entry *) (DATABLOCK2 + off);
|
||||||
/* advance loc prematurely to next on-disk directory entry */
|
/* advance loc prematurely to next on-disk directory entry */
|
||||||
loc += sizeof (dp->inode) + 14; /* XXX */
|
loc += sizeof (dp->inode) + namelen;
|
||||||
|
|
||||||
/* NOTE: minix filenames are NULL terminated if < 14 else exact */
|
/* NOTE: minix filenames are NULL terminated if < NAMELEN
|
||||||
|
else exact */
|
||||||
|
|
||||||
#ifdef DEBUG_MINIX
|
#ifdef DEBUG_MINIX
|
||||||
printf ("directory entry ino=%d\n", dp->inode);
|
printf ("directory entry ino=%d\n", dp->inode);
|
||||||
|
@ -494,9 +506,9 @@ minix_dir (char *dirname)
|
||||||
|
|
||||||
if (dp->inode)
|
if (dp->inode)
|
||||||
{
|
{
|
||||||
int saved_c = dp->name[MINIX_NAME_LEN+1];
|
int saved_c = dp->name[namelen + 1];
|
||||||
|
|
||||||
dp->name[MINIX_NAME_LEN+1] = 0;
|
dp->name[namelen+1] = 0;
|
||||||
str_chk = substring (dirname, dp->name);
|
str_chk = substring (dirname, dp->name);
|
||||||
|
|
||||||
# ifndef STAGE1_5
|
# ifndef STAGE1_5
|
||||||
|
@ -509,7 +521,7 @@ minix_dir (char *dirname)
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
dp->name[MINIX_NAME_LEN+1] = saved_c;
|
dp->name[namelen + 1] = saved_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,8 @@
|
||||||
|
|
||||||
#define IS_PC_SLICE_TYPE_BSD(type) IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0)
|
#define IS_PC_SLICE_TYPE_BSD(type) IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0)
|
||||||
|
|
||||||
|
/* This is not a flag actually, but used as if it were a flag. */
|
||||||
|
#define PC_SLICE_TYPE_HIDDEN_FLAG 0x10
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* *BSD-style disklabel & partition definitions.
|
* *BSD-style disklabel & partition definitions.
|
||||||
|
|
|
@ -68,6 +68,12 @@ extern char *grub_scratch_mem;
|
||||||
#define FSYS_BUFLEN 0x8000
|
#define FSYS_BUFLEN 0x8000
|
||||||
#define FSYS_BUF RAW_ADDR (0x68000)
|
#define FSYS_BUF RAW_ADDR (0x68000)
|
||||||
|
|
||||||
|
/* Command-line buffer for Multiboot kernels and modules. This area
|
||||||
|
includes the area into which Stage 1.5 and Stage 1 are loaded, but
|
||||||
|
that's no problem. */
|
||||||
|
#define MB_CMDLINE_BUF RAW_ADDR (0x2000)
|
||||||
|
#define MB_CMDLINE_BUFLEN 0x6000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linux setup parameters
|
* Linux setup parameters
|
||||||
*/
|
*/
|
||||||
|
@ -546,6 +552,12 @@ int open_partition (void);
|
||||||
/* Sets device to the one represented by the SAVED_* parameters. */
|
/* Sets device to the one represented by the SAVED_* parameters. */
|
||||||
int make_saved_active (void);
|
int make_saved_active (void);
|
||||||
|
|
||||||
|
/* Hide a partition. */
|
||||||
|
int hide_partition (void);
|
||||||
|
|
||||||
|
/* Unhide a partition. */
|
||||||
|
int unhide_partition (void);
|
||||||
|
|
||||||
/* Open a file or directory on the active device, using GRUB's
|
/* Open a file or directory on the active device, using GRUB's
|
||||||
internal filesystem support. */
|
internal filesystem support. */
|
||||||
int grub_open (char *filename);
|
int grub_open (char *filename);
|
||||||
|
@ -570,10 +582,10 @@ void print_completions (char *filename);
|
||||||
/* Copies the current partition data to the desired address. */
|
/* Copies the current partition data to the desired address. */
|
||||||
void copy_current_part_entry (char *buf);
|
void copy_current_part_entry (char *buf);
|
||||||
|
|
||||||
void bsd_boot (int type, int bootdev) __attribute__ ((noreturn));
|
void bsd_boot (int type, int bootdev, char *arg) __attribute__ ((noreturn));
|
||||||
int load_image (void);
|
int load_image (char *kernel, char *arg);
|
||||||
int load_module (void);
|
int load_module (char *module, char *arg);
|
||||||
int load_initrd (void);
|
int load_initrd (char *initrd);
|
||||||
|
|
||||||
void init_bios_info (void);
|
void init_bios_info (void);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue