In discussion with a colleague about leaving a hidden partition with
FreeDOS on it for system repair, maintenance, etc. I cvs checked out the
code and hacked this little patch into the kernel.  I haven't tested it,
not even compiled it, but thought I'd post it for comment.

We'd be using grub or MS Windows XP Pro's boot loader (entry in
boot.ini) to do the actual boot loading for us.

What do you think of the patch?

Cheers,

Kenny.

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?b1ddyi.b3hwCs.YXJjaGl2
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================


diff -ur kernel.orig/docs/sys.txt kernel/docs/sys.txt
--- kernel.orig/docs/sys.txt	Sat Feb  9 00:40:30 2002
+++ kernel/docs/sys.txt	Sun Dec 15 00:33:00 2002
@@ -155,6 +155,14 @@
 you have LBA available, but in reality you do not.
 This setting is set to 1 by default.
 
+USEHIDDENPARTITIONS which may be 0 or 1
+USEHIDDENPARTITIONS=0 or USEHIDDENPARTITIONS=1
+If 0 then behave as standard DOS.  If 1 then allocate
+unit (drive) letters to hidden partitions.  Handy for
+keeping FreeDOS on a hidden partition which can still be
+booted from.
+This setting is set to 0 by default.
+
 Example: To set the kernel in the current directory
 to have a timeout of 5 seconds (default is 2) run
 SYS CONFIG SKI=5
diff -ur kernel.orig/hdr/kconfig.h kernel/hdr/kconfig.h
--- kernel.orig/hdr/kconfig.h	Wed Jan 23 22:29:41 2002
+++ kernel/hdr/kconfig.h	Sun Dec 15 00:29:28 2002
@@ -13,6 +13,10 @@
         < 0 : not possible to skip config.sys
         = 0 : only possible if already pressed before, no message
         > 0 : wait so long for F5/F8
+
+    UseHiddenPartitions:
+        0   : don't use hidden partitions (standard behaviour)
+	1   : allocate unit letters to hidden partitions
 */
 typedef struct _KernelConfig {
   char CONFIG[6];               /* "CONFIG" */
@@ -23,4 +27,6 @@
   signed char SkipConfigSeconds;
   unsigned char ForceLBA;
   unsigned char GlobalEnableLBAsupport; /* = 0 --> disable LBA support */
+  unsigned char UseHiddenPartitions; /* = 1 --> allocate unit letters to hidden partitions */
 } KernelConfig;
+
diff -ur kernel.orig/kernel/initdisk.c kernel/kernel/initdisk.c
--- kernel.orig/kernel/initdisk.c	Mon Dec  9 00:17:14 2002
+++ kernel/kernel/initdisk.c	Sun Dec 15 00:17:09 2002
@@ -196,6 +196,7 @@
                               /* boundary.  LBA is needed to access this.  */
 #define FAT16_LBA       0x0e    /* like 0x06, but it is supposed to end past */
                               /* the 8.4GB boundary                        */
+#define FAT32_HIDE_LBA  0x1c    /* same as FAT32_LBA except marked as hidden */
 #define FAT12_LBA       0xff    /* fake FAT12 LBA entry for internal use     */
 #define EXTENDED_LBA    0x0f    /* like 0x05, but it is supposed to end past */
 
@@ -222,6 +223,7 @@
                                  (parttyp) == FAT16_LBA  || \
                                  (parttyp) == FAT32      || \
                                  (parttyp) == FAT32_LBA)
+#define IsHiddenFATPartition(parttyp) ((parttyp) == FAT32_HIDE_LBA)
 #else
 #define IsFATPartition(parttyp) ((parttyp) == FAT12      || \
                                  (parttyp) == FAT16SMALL || \
@@ -826,7 +828,7 @@
 
     partitionStart = startSector + pEntry->RelSect;
 
-    if (!IsFATPartition(pEntry->FileSystem))
+    if (!((InitKernelConfig.UseHiddenPartitions && IsHiddenFATPartition(pEntry->FileSystem)) || IsFATPartition(pEntry->FileSystem)))
     {
       continue;
     }
diff -ur kernel.orig/kernel/kernel.asm kernel/kernel/kernel.asm
--- kernel.orig/kernel/kernel.asm	Mon Dec  9 00:17:14 2002
+++ kernel/kernel/kernel.asm	Sun Dec 15 00:48:57 2002
@@ -64,7 +64,7 @@
 SkipConfigSeconds           db 2        ;                 
 ForceLBA                    db 0        ;                 
 GlobalEnableLBAsupport      db 1        ;                 
-
+UseHiddenPartitions         db 0	; 
 configend:                
 
 ;************************************************************	    
diff -ur kernel.orig/kernel/main.c kernel/kernel/main.c
--- kernel.orig/kernel/main.c	Mon Dec  9 00:17:14 2002
+++ kernel/kernel/main.c	Sun Dec 15 00:37:00 2002
@@ -74,7 +74,7 @@
     "$Id: main.c,v 1.35 2002/12/09 00:17:14 bartoldeman Exp $";
 #endif
 
-struct _KernelConfig InitKernelConfig = { "", 0, 0, 0, 0, 0, 0 };
+struct _KernelConfig InitKernelConfig = { "", 0, 0, 0, 0, 0, 0, 0 };
 
 extern WORD days[2][13];
 extern BYTE FAR *lpBase;
diff -ur kernel.orig/sys/fdkrncfg.c kernel/sys/fdkrncfg.c
--- kernel.orig/sys/fdkrncfg.c	Wed May  8 23:49:35 2002
+++ kernel/sys/fdkrncfg.c	Sun Dec 15 00:44:22 2002
@@ -84,7 +84,8 @@
        "      the value set will be the rightmost one.\n");
   printf("  Current Options are: DLASORT=0|1, SHOWDRIVEASSIGNMENT=0|1\n"
          "                       SKIPCONFIGSECONDS=#, FORCELBA=0|1\n"
-         "                       GLOBALENABLELBASUPPORT=0|1\n");
+         "                       GLOBALENABLELBASUPPORT=0|1\n"
+         "                       USEHIDDENPARTITIONS=0|1\n");
 }
 
 /* simply reads in current configuration values, exiting program
@@ -182,6 +183,13 @@
          cfg->GlobalEnableLBAsupport);
   }
 
+  if (cfg->ConfigSize >= 6)
+  {
+    printf
+        ("USEHIDDENPARTITIONS=0x%02X Use hidden partitions:      *1=yes, 0=no\n",
+         cfg->UseHiddenPartitions);
+  }
+
 #if 0                           /* we assume that SYS is as current as the kernel */
 
   /* Print value any options added that are unknown as hex dump */
@@ -431,6 +439,11 @@
     {
       setByteOption(&(cfg.GlobalEnableLBAsupport),
                     cptr, 1, &updates, "GLOBALENABLELBASUPPORT");
+    }
+    else if (memicmp(argptr, "USEHIDDENPARTITIONS", 3) == 0)
+    {
+      setByteOption(&(cfg.UseHiddenPartitions),
+                    cptr, 1, &updates, "USEHIDDENPARTITIONS");
     }
     else
     {

Reply via email to