Here is a version  using the cvs sources with device support.
hide=(hd0,0), unhide=(hd0,0).

Ed Killips

diff -ur grub.cvs/ChangeLog grub/ChangeLog
--- grub.cvs/ChangeLog  Wed Aug 25 03:46:52 1999
+++ grub/ChangeLog      Thu Aug 26 03:25:23 1999
@@ -1,3 +1,13 @@
+1999-08-26  Edward Killips  <[EMAIL PROTECTED]>
+       
+       * stage2/cmdline.c  added hide=<device>,
+        unhide=<device>
+       * stage2/shared.h   added protypes for
+       unhide_partition(void), hide_partition(void),
+       and defined HIDDEN=0x10
+       * stage2/disk_io.c  added functions unhide_partition,
+       hide_partition  
+
 1999-08-25  OKUJI Yoshinori  <[EMAIL PROTECTED]>
 
        From Jochen Hoenicke <[EMAIL PROTECTED]>:
diff -ur grub.cvs/stage2/cmdline.c grub/stage2/cmdline.c
--- grub.cvs/stage2/cmdline.c   Thu Aug 12 05:38:44 1999
+++ grub/stage2/cmdline.c       Thu Aug 26 02:08:13 1999
@@ -70,7 +70,8 @@
   \"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
   \"geometry= <drive>\",
   \"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
-  \"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\" and
+  \"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", \"quit\",
+  \"hide= <device>\", \"unhide= <device>\" and
   \"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
 
 static void
@@ -635,6 +636,28 @@
          debug = 1;
          grub_printf (" Debug mode is turned on\n");
        }
+    }
+  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 (substring ("color", cur_heap) < 1)
     {
diff -ur grub.cvs/stage2/disk_io.c grub/stage2/disk_io.c
--- grub.cvs/stage2/disk_io.c   Mon Aug  9 12:34:07 1999
+++ grub/stage2/disk_io.c       Thu Aug 26 02:14:37 1999
@@ -267,6 +267,66 @@
 #endif
 }
 
+#ifndef STAGE1_5
+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) & 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(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) & 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
Only in grub/stage2: e2fs_stage1_5
Only in grub/stage2: fat_stage1_5
Only in grub/stage2: ffs_stage1_5
diff -ur grub.cvs/stage2/shared.h grub/stage2/shared.h
--- grub.cvs/stage2/shared.h    Thu Aug 12 05:38:44 1999
+++ grub/stage2/shared.h        Thu Aug 26 02:13:02 1999
@@ -116,6 +116,7 @@
 #define BOOTSEC_PART_OFFSET  0x1BE
 #define BOOTSEC_PART_LENGTH  0x40
 #define BOOTSEC_SIG_OFFSET   0x1FE
+#define HIDDEN              0x10
 
 /*
  *  GRUB specific information
@@ -542,6 +543,12 @@
 
 /* Sets device to the one represented by the SAVED_* parameters. */
 int make_saved_active (void);
+
+/* Hide partition  */
+int hide_partition(void);
+
+/* Unhide partition. */
+int unhide_partition(void);
 
 /* Open a file or directory on the active device, using GRUB's
    internal filesystem support. */

Reply via email to