From 0f4f88a9d9de039247c48dda5ff5bfb658d6c358 Mon Sep 17 00:00:00 2001 From: okuji Date: Mon, 9 Aug 1999 16:34:08 +0000 Subject: [PATCH] add NetBSD and OpenBSD partition slices support --- ChangeLog | 22 ++++++++++++++++++++++ NEWS | 2 ++ TODO | 5 ----- stage2/disk_io.c | 11 +++++++---- stage2/fsys_ext2fs.c | 2 +- stage2/fsys_fat.c | 2 +- stage2/fsys_ffs.c | 2 +- stage2/pc_slice.h | 16 +++++++++++++--- 8 files changed, 47 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4aa8c9dfc..b455fd9bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +1999-08-10 OKUJI Yoshinori + + Support the NetBSD and OpenBSD partition slices. + + * stage2/pc_slice.h (PC_SLICE_TYPE_BSD): Deleted. + (PC_SLICE_TYPE_FREEBSD): New macro. + (PC_SLICE_TYPE_OPENBSD): Likewise. + (PC_SLICE_TYPE_NETBSD): Likewise. + (IS_PC_SLICE_TYPE_BSD_WITH_FS): Likewise. + (IS_PC_SLICE_TYPE_BSD): Likewise. + * stage2/fsys_ffs.c (ffs_mount): Use the macro + IS_PC_SLICE_TYPE_BSD_WITH_FS instead of checking if + CURRECT_SLICE is equal to the BSD partition type directly. + * stage2/fsys_ext2fs.c (ext2fs_mount): Likewise. + * stage2/fsys_fat.c (fat_mount): Likewise. + * stage2/disk_io.c (check_BSD_parts): Set the low bits of + CURRENT_SLICE to PC_SLICE_TYPE_FREEBSD instead of + PC_SLICE_TYPE_BSD. + (real_open_partition): Use the macro IS_PC_SLICE_TYPE_BSD instead + of checking if CURRENT_SLICE is equal to the BSD partition type + directly. + 1999-08-09 OKUJI Yoshinori * stage2/cmdline.c (commands): Added geometry. diff --git a/NEWS b/NEWS index 584996e32..a821f69b1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ NEWS - list of user-visible changes between releases of GRUB New in 0.5.93: * ELF format of FreeBSD kernel is supported. +* Support the partition ids for NetBSD and OpenBSD. +* Exit from the grub emulator just by pushing the key `q' in the menu. New in 0.5.92 - 1999-07-26: * Bug fixes (i.e. Stage 1.5 can work fine again). diff --git a/TODO b/TODO index cae30a305..e5eb64168 100644 --- a/TODO +++ b/TODO @@ -12,9 +12,6 @@ Look at the network booting patches from L4. Add internationalization support, emulating gettext as much as is feasible. -Add support/delays so that a floppy can be installed from another -floppy. - Add bootable CDROM support (this probably means we have to support ISO-9660 plus maybe even the Rock Ridge extensions... ugh). @@ -30,8 +27,6 @@ larger than 16MB can be read. Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot parameters -Support new partition IDs for NetBSD and OpenBSD. - Add ``configfile'' command, in a clean way. Add keyboard layout configuration support. diff --git a/stage2/disk_io.c b/stage2/disk_io.c index d03b4a544..a775015b3 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -346,8 +346,11 @@ check_BSD_parts (int flags) { /* FIXME: should do BAD144 sector remapping setup here */ + /* XXX We cannot determine which variant of BSD owns + this slice, so set it to FreeBSD paritition type. + That should work fine for now. */ current_slice = ((BSD_PART_TYPE (label_buf, part_no) << 8) - | PC_SLICE_TYPE_BSD); + | PC_SLICE_TYPE_FREEBSD); part_start = BSD_PART_START (label_buf, part_no); part_length = BSD_PART_LENGTH (label_buf, part_no); @@ -487,7 +490,7 @@ real_open_partition (int flags) { current_partition |= 0xFFFF; printf (" Partition num: %d, ", slice_no); - if (current_slice != PC_SLICE_TYPE_BSD) + if (! IS_PC_SLICE_TYPE_BSD (current_slice)) check_and_print_mount (); else check_BSD_parts (1); @@ -499,11 +502,11 @@ real_open_partition (int flags) */ else if (part_no == slice_no || (part_no == 0xFF - && current_slice == PC_SLICE_TYPE_BSD)) + && IS_PC_SLICE_TYPE_BSD (current_slice))) { if ((current_partition & 0xFF00) != 0xFF00) { - if (current_slice == PC_SLICE_TYPE_BSD) + if (IS_PC_SLICE_TYPE_BSD (current_slice)) check_BSD_parts (0); else errnum = ERR_NO_PART; diff --git a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c index dadb4c158..f30d2bfd9 100644 --- a/stage2/fsys_ext2fs.c +++ b/stage2/fsys_ext2fs.c @@ -255,7 +255,7 @@ ext2fs_mount (void) if ((((current_drive & 0x80) || (current_slice != 0)) && (current_slice != PC_SLICE_TYPE_EXT2FS) - && (current_slice != (PC_SLICE_TYPE_BSD | (FS_OTHER << 8)))) + && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))) || part_length < (SBLOCK + (sizeof (struct ext2_super_block) / DEV_BSIZE)) || !devread (SBLOCK, 0, sizeof (struct ext2_super_block), (char *) SUPERBLOCK) diff --git a/stage2/fsys_fat.c b/stage2/fsys_fat.c index a50d30417..359921b5c 100644 --- a/stage2/fsys_fat.c +++ b/stage2/fsys_fat.c @@ -42,7 +42,7 @@ fat_mount (void) && (current_slice != PC_SLICE_TYPE_FAT12) && (current_slice != PC_SLICE_TYPE_FAT16_LT32M) && (current_slice != PC_SLICE_TYPE_FAT16_GT32M) - && (current_slice != (PC_SLICE_TYPE_BSD | (FS_MSDOS << 8)))) + && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS << 8))) || !devread (0, 0, SECTOR_SIZE, (char *) BPB) || FAT_BPB_BYTES_PER_SECTOR (BPB) != SECTOR_SIZE || FAT_BPB_SECT_PER_CLUST (BPB) < 1 || FAT_BPB_SECT_PER_CLUST (BPB) > 64 diff --git a/stage2/fsys_ffs.c b/stage2/fsys_ffs.c index a45e1a1f9..183ac294d 100644 --- a/stage2/fsys_ffs.c +++ b/stage2/fsys_ffs.c @@ -80,7 +80,7 @@ ffs_mount (void) int retval = 1; if ((((current_drive & 0x80) || (current_slice != 0)) - && current_slice != (PC_SLICE_TYPE_BSD | (FS_BSDFFS << 8))) + && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_BSDFFS << 8)) || part_length < (SBLOCK + (SBSIZE / DEV_BSIZE)) || !devread (SBLOCK, 0, SBSIZE, (char *) SUPERBLOCK) || SUPERBLOCK->fs_magic != FS_MAGIC) diff --git a/stage2/pc_slice.h b/stage2/pc_slice.h index 34bf36200..08195e199 100644 --- a/stage2/pc_slice.h +++ b/stage2/pc_slice.h @@ -105,9 +105,19 @@ #define PC_SLICE_TYPE_WIN95_EXTENDED 0xf #define PC_SLICE_TYPE_EXT2FS 0x83 - /* this next one is special, as it uses it's own partitioning scheme - to subdivide the PC partition from there */ -#define PC_SLICE_TYPE_BSD 0xa5 +/* these ones are special, as they use thier own partitioning scheme + to subdivide the PC partitions from there. */ +#define PC_SLICE_TYPE_FREEBSD 0xa5 +#define PC_SLICE_TYPE_OPENBSD 0xa6 +#define PC_SLICE_TYPE_NETBSD 0xa9 + +/* For convenience. */ +#define IS_PC_SLICE_TYPE_BSD_WITH_FS(type,fs) \ + ((type) == (PC_SLICE_TYPE_FREEBSD | ((fs) << 8)) \ + || (type) == (PC_SLICE_TYPE_OPENBSD | ((fs) << 8)) \ + || (type) == (PC_SLICE_TYPE_NETBSD | (fs) << 8)) + +#define IS_PC_SLICE_TYPE_BSD(type) IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0) /*