From 69e36bc54705439c146c24c7f66ff214b62363f7 Mon Sep 17 00:00:00 2001 From: okuji Date: Fri, 29 Sep 2000 02:26:59 +0000 Subject: [PATCH] rewrite the command find, update TODO. --- ChangeLog | 11 ++++++ TODO | 26 ++++++++++++--- stage2/builtins.c | 85 ++++++++++++++++++++++++++--------------------- 3 files changed, 79 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e41d5911..533a4a42a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-09-29 OKUJI Yoshinori + + * stage2/builtins.c (find_func): New variable GOT_FILE is set to + one if FILENAME is found. Otherwise, it is set to zero. + Clear ERRNUM at the end in the loop for floppies, to ensure that + ERRNUM is cleared before examining hard disks. + Rewrite the loop for hard disks using next_partitions, so this + function now checks all partitions you have certainly. + If GOT_FILE is non-zero, set ERRNUM to ERR_FILE_NOT_FOUND and + return one. + 2000-09-29 OKUJI Yoshinori * stage2/disk_io.c (check_BSD_parts): Removed. diff --git a/TODO b/TODO index 3e25c8155..20d157463 100644 --- a/TODO +++ b/TODO @@ -16,9 +16,19 @@ Priorities: * Port the script ``grub-install'' to FreeBSD, NetBSD and OpenBSD. At least you will have to modify the function `convert' so that it can translate a native device name into the corresponding GRUB drive - representation. + representation. ! -* Add configuration inclusion support by adding a command "include". +* Add configuration inclusion support by adding a command "include". ! + +* Add a command to run a GRUB script file. !! + +* Finish the Multiboot Speicification 0.7. !!! + +* Add commands to manipulate the menu from the command-line interface. ! + +* Add more --disable-FOO options to configure, so that you can create a + minimum GRUB image. This is useful for boot floppies because of the size + restriction. ! * Make symbolic links work for BSD FFS. @@ -44,15 +54,13 @@ Priorities: * Add ISA PnP support. -* Fix the completion so that it works for BSD partitions as well. ! - * Add BSD syntax support, using results of ioprobe to map drives. ! (0x1f0-0x1f7 = primary IDE, 0x170-0x176 = secondary, 0x1e8-0x1ef = tertiary, 0x168-0x16f = quaternary). * Add more filesystems support (XFS, NTFS, etc.) -* Add remote console support (parallel and net). ! +* Add more remote console support (parallel and net). * Add RAID support. @@ -72,3 +80,11 @@ Priorities: BIOSes which have bootable-CDROM support (so you may use the "Bootable CDROM" BIOS calls). It is not trivial to support BIOSes without the capability to boot CDROM. + +? Divide pxegrub into two parts, so the initial image doesn't exceed + the 32KB limit. I'm not sure if this is really necessary, because the + PXE standard just says that it is _recommended_ to improve the + modularity of a boot image. Obviously, this reason doesn't apply to + GRUB, as pxegrub is merely a secondary boot loader. So whether this + task should be done depends on if existing PXE ROMs support >32KB + images or not, after all. diff --git a/stage2/builtins.c b/stage2/builtins.c index 80822b9d5..7a1a0ae21 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -1028,76 +1028,85 @@ find_func (char *arg, int flags) unsigned long drive; unsigned long tmp_drive = saved_drive; unsigned long tmp_partition = saved_partition; + int got_file = 0; /* Floppies. */ for (drive = 0; drive < 8; drive++) { - errnum = ERR_NONE; current_drive = drive; current_partition = 0xFFFFFF; - if (! open_device ()) - continue; - - saved_drive = current_drive; - saved_partition = current_partition; - if (grub_open (filename)) + if (open_device ()) { - grub_close (); - grub_printf (" (fd%d)\n", drive); + saved_drive = current_drive; + saved_partition = current_partition; + if (grub_open (filename)) + { + grub_close (); + grub_printf (" (fd%d)\n", drive); + got_file = 1; + } } + + errnum = ERR_NONE; } /* Hard disks. */ for (drive = 0x80; drive < 0x88; drive++) { - unsigned long slice; + unsigned long part = 0xFFFFFF; + unsigned long start, len, offset, ext_offset; + int type, entry; + char buf[SECTOR_SIZE]; current_drive = drive; - /* FIXME: is what maximum number right? */ - for (slice = 0; slice < 12; slice++) + while (next_partition (drive, 0xFFFFFF, &part, &type, + &start, &len, &offset, &entry, + &ext_offset, buf)) { - errnum = ERR_NONE; - current_partition = (slice << 16) | 0xFFFF; - if (open_device ()) + if (type != PC_SLICE_TYPE_NONE + && ! IS_PC_SLICE_TYPE_BSD (type) + && ! IS_PC_SLICE_TYPE_EXTENDED (type)) { - errnum = ERR_NONE; - saved_drive = current_drive; - saved_partition = current_partition; - if (grub_open (filename)) + current_partition = part; + if (open_device ()) { - grub_close (); - grub_printf (" (hd%d,%d)", drive - 0x80, slice); - } - } - else if (IS_PC_SLICE_TYPE_BSD (current_slice)) - { - unsigned long part; - - for (part = 0; part < 8; part++) - { - errnum = ERR_NONE; - current_partition = (slice << 16) | (part << 8) | 0xFF; - if (! open_device ()) - continue; - saved_drive = current_drive; saved_partition = current_partition; if (grub_open (filename)) { + int bsd_part = (part >> 8) & 0xFF; + int pc_slice = part >> 16; + grub_close (); - grub_printf (" (hd%d,%d,%c)", - drive - 0x80, slice, part + 'a'); + + if (bsd_part == 0xFF) + grub_printf (" (hd%d,%d)\n", + drive - 0x80, pc_slice); + else + grub_printf (" (hd%d,%d,%c)\n", + drive - 0x80, pc_slice, bsd_part + 'a'); + + got_file = 1; } } } + + errnum = ERR_NONE; } } - errnum = ERR_NONE; saved_drive = tmp_drive; saved_partition = tmp_partition; - return 0; + + if (got_file) + { + errnum = ERR_NONE; + return 0; + } + + errnum = ERR_FILE_NOT_FOUND; + return 1; } static struct builtin builtin_find =