The enclosed patch adds hide= and unhide= commands.
diff -u -r grub-0.5.92/ChangeLog grub/ChangeLog --- grub-0.5.92/ChangeLog Mon Jul 26 18:57:52 1999 +++ grub/ChangeLog Mon Aug 16 01:50:27 1999 @@ -1,3 +1,12 @@ +1999-08-16 Edward Killips <[EMAIL PROTECTED]> + + * stage2/shared.h added define for HIDDEN added prototypes for + hide_partition and unhide_partiton + + * stage2/cmdline.c added commands hide and unhide + + * stage2/disk_io.c added hide_partition and unhide_partition + 1999-07-15 Gordon Matzigkeit <[EMAIL PROTECTED]> * docs/Makefile.am (grub.info): Use an ugly hack to downgrade diff -u -r grub-0.5.92/stage2/cmdline.c grub/stage2/cmdline.c --- grub-0.5.92/stage2/cmdline.c Thu Jul 15 07:22:18 1999 +++ grub/stage2/cmdline.c Tue Aug 17 13:28:08 1999 @@ -69,7 +69,8 @@ \"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\", \"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\", \"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\", - \"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and + \"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\", + \"hide= <partition>\", \"unhide= <partition>\" and \"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n"; static void @@ -633,6 +634,30 @@ { debug = 1; grub_printf (" Debug mode is turned on\n"); + } + } + else if (substring ("hide", cur_heap) < 1) + { + char *pnumb; + int part; + + pnumb = cur_cmdline; + + if (safe_parse_maxint (&pnumb, &part)) + { + hide_partition(part); + } + } + else if (substring ("unhide", cur_heap) < 1) + { + char *pnumb; + int part; + + pnumb = cur_cmdline; + + if (safe_parse_maxint (&pnumb, &part)) + { + unhide_partition(part); } } else if (substring ("color", cur_heap) < 1) diff -u -r grub-0.5.92/stage2/disk_io.c grub/stage2/disk_io.c --- grub-0.5.92/stage2/disk_io.c Fri Jun 25 06:24:46 1999 +++ grub/stage2/disk_io.c Tue Aug 17 13:30:19 1999 @@ -267,6 +267,63 @@ #endif } +#ifndef STAGE1_5 +int unhide_partition(int part) +{ + if (saved_drive) + { + 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) & HIDDEN) == HIDDEN) + { + PC_SLICE_TYPE (SCRATCHADDR, part) ^= HIDDEN; + buf_track=-1; + if (biosdisk(BIOSDISK_WRITE, saved_drive, &buf_geom, + 0, 1, SCRATCHSEG)) + { + errnum = ERR_WRITE; + return 0; + } + } + } + return 1; +} +#endif /* STAGE1_5 */ + + +#ifndef STAGE1_5 +int hide_partition(int part) +{ + if (saved_drive) + { + 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) & HIDDEN) != HIDDEN) + { + PC_SLICE_TYPE (SCRATCHADDR, part) |= HIDDEN; + buf_track=-1; + if (biosdisk(BIOSDISK_WRITE, saved_drive, &buf_geom, + 0, 1, SCRATCHSEG)) + { + errnum = ERR_WRITE; + return 0; + } + } + } + return 1; +} +#endif /* STAGE1_5 */ #ifndef STAGE1_5 int @@ -289,7 +346,7 @@ { int i; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) PC_SLICE_FLAG (SCRATCHADDR, i) = 0; PC_SLICE_FLAG (SCRATCHADDR, part) = PC_SLICE_FLAG_BOOTABLE; diff -u -r grub-0.5.92/stage2/shared.h grub/stage2/shared.h --- grub-0.5.92/stage2/shared.h Tue Jul 13 11:46:28 1999 +++ grub/stage2/shared.h Tue Aug 17 13:29:13 1999 @@ -33,6 +33,8 @@ # define RAW_SEG(x) x #endif +#define HIDDEN 0x10 + /* * Integer sizes */ @@ -540,6 +542,12 @@ /* Sets device to the one represented by the SAVED_* parameters. */ int make_saved_active (void); + +/* Hide partition */ +int hide_partition(int partition); + +/* Unhide partition. */ +int unhide_partition(int partition); /* Open a file or directory on the active device, using GRUB's internal filesystem support. */