From 5343bda83521a2af85d22925856fe208d5b73a1e Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 30 Nov 1999 11:13:00 +0000 Subject: [PATCH] fix a bug in partition search. --- ChangeLog | 7 +++++ TODO | 72 +++++++++++++++++++++++++++++++++++++++++++++++ stage2/disk_io.c | 2 ++ stage2/pc_slice.h | 4 +-- 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f4d379f3..55241c4d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-11-30 OKUJI Yoshinori + + * stage2/disk_io.c (real_open_partition): If SLICE_NO is greater + than or equal to PC_SLICE_MAX, skip any extended partition, when + searching for the right partition. Reported by Weil, Stefan 3732 + EPE-24 . + 1999-11-19 Gordon Matzigkeit * grub/asmstub.c (getkey): Stop immediately if we get an EOF. diff --git a/TODO b/TODO index 957ba72aa..32127e4a5 100644 --- a/TODO +++ b/TODO @@ -32,6 +32,78 @@ Priorities: * Complete the netboot support. ! + This is the proposed interface between the netboot module and the core + system: + + - The module contains a header like this: + + struct netboot_module_header + { + /* The same as the Multiboot header, but has a different magic. */ + struct multiboot_header mb_header; + /* The version number to avoid incompatibilities. */ + unsigned short compat_version; + /* The identifier (should be "netboot" with NUL-terminated). */ + char identifier[14]; + /* some pointers to callback functions. */ + unsigned long init_func; + unsigned long fini_func; + unsigned long mount_func; + unsinged long read_func; + unsinged long dir_func; + unsinged long close_func; + /* The address of the message buffer. The module should not print + anything on the screen directly. */ + unsinged long msg_addr; + /* The maximum size of the message buffer (perhaps should be less + than 80*24, because of the screen size). */ + unsinged long msg_size; + } + + - When the core system loads the module, check for the header + structure and store the image in the specified memory address (in + the ELF header or in MB_HEADER). If successful, call INIT_FUNC. + + - INIT_FUNC should initialize the module and return the required + memory space. The prototype is: + + grub_error_t init_func (const struct multiboot_info *mbi, + unsigned long *mem_start, + unsigned long *mem_end); + + If the module does not need any extra memory space, then set + *MEM_START to _START and *MEM_END to _END. MBI->CMDLINE has the + command-line argument specified (probably netmask=... or something). + + FIXME: Should the module return most of the information dynamically + from INIT_FUNC, instead of the module header? + + - When the core system unloads the module, call FINI_FUNC to restore + the resources cleanly. + + - The prototype of FINI_FUNC is: + + grub_error_t fini_func (const struct multiboot_info *mbi); + + - The rest of the callback functions are equivalent to the filesystem + callbacks. Their prototypes are: + + grub_error_t mount_func (const struct multiboot_info *mbi); + grub_error_t dir_func (const struct multiboot_info *mbi, + const char *filename); + grub_error_t read_func (const struct multiboot_info *mbi, + char *buffer, int len); + grub_error_t close_func (const struct multiboot_info *mbi); + + FIXME: How to add decompression support? + + - The core system will print the string MSG_ADDR after each call is + finished. + + - Each callback function will be run in the exactly same condition as + when a Multiboot kernel starts up, and it MUST restore the condition + before it returns (i.e. PIC or IDT). + * Add automatic configuration support. * Add bunzip2 support. diff --git a/stage2/disk_io.c b/stage2/disk_io.c index 4aeb5d501..f7e91ceb6 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -574,6 +574,8 @@ real_open_partition (int flags) * If we've found the right partition, we're done */ if (! flags + && (slice_no < PC_SLICE_MAX + || ! IS_PC_SLICE_TYPE_EXTENDED (current_slice)) && (part_no == slice_no || (part_no == 0xFF && IS_PC_SLICE_TYPE_BSD (current_slice)))) diff --git a/stage2/pc_slice.h b/stage2/pc_slice.h index 077391c2b..7378515bb 100644 --- a/stage2/pc_slice.h +++ b/stage2/pc_slice.h @@ -1,7 +1,7 @@ - /* * GRUB -- GRand Unified Bootloader * Copyright (C) 1996 Erich Boleyn + * 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 @@ -122,7 +122,7 @@ (((type) == PC_SLICE_TYPE_EXTENDED) \ || ((type) == PC_SLICE_TYPE_WIN95_EXTENDED)) -/* these ones are special, as they use thier own partitioning scheme +/* these ones are special, as they use their own partitioning scheme to subdivide the PC partitions from there. */ #define PC_SLICE_TYPE_FREEBSD 0xa5 #define PC_SLICE_TYPE_OPENBSD 0xa6