[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#119753: Resurrecting Lowmem Boot Disks



Package: boot-floppies
Version: 2.2.26

I figured out how to revive the low memory boot disk option which only a few
of minor changes to the package.  The first change is to
/usr/src/boot-floppies/utlities/lowmemrc/linuxrc.c and involves a changing
the mounting of the boot floppy and doing a zcat on /root.bin to not
mounting anything and doing a zcat on /dev/fd0 (since the install set is no
longer using a single boot/root disk).

The second change is to rootdisk.sh and involves changing the fstype
variable to minix instead of ext2.

I don't remember if the third change I have is necessary, but I did it while
trying to get the root floppy to work.  That is adding some
display devices in lowmemrd.sh, possibly needed by the kernel.
(/dev/console, /dev/ttyx, /dev/vcsx).

The first patch (for linuxrc.c) contains some additional code which I
borrowed from the same package but in a different dir.  Basically I borrowed
code from fdisk.c that display the list of partitions found by the fdisk
code.  This was helpful while hacking on the package but probably isn't that
useful/needed otherwise.

Here's the linuxrc.c patch:
#######################################################
--- /usr/src/boot-floppies/utilities/lowmemrd/linuxrc.c	Sun Mar 28 10:29:04
1999
+++ /usr/src/boot-floppies-mono/utilities/lowmemrd/linuxrc.c	Tue Aug  7
05:31:48 2001
@@ -25,6 +25,8 @@
 /* functions defined in mkswap.c */
 extern int mkswap_main(const char *device_name, int pages, int do_check);

+int test_fdisk(void);
+
 int zcat(const char *source, const char *target) {
   gzFile *fsrc;
   FILE *ftgt;
@@ -53,7 +55,7 @@
   struct fdisk_disk *disk;
   int i;
   if (NULL == fdisk_disks) {
-    printf(CLEAR
+    printf(CLEAR
 "No hard disk drives could be found. Make sure they are cabled correctly
and
 are turned on before the system is started. You may have to change driver
 settings when you start the system with a command at the \"boot:\" prompt,
@@ -166,7 +168,7 @@
 }

 int init_minix_fn(void){
-  printf(CLEAR "Put the rescue floppy on the first floppy drive."
MSG_ENTER);
+/* printf(CLEAR "Put the rescue floppy on the first floppy drive."
MSG_ENTER);
   read_line();
   if ( mount("/dev/fd0","/mnt","msdos",MS_RDONLY|MS_MGC_VAL,"\0") ) {
     printf("Unable to mount the rescue floppy disk!" MSG_ENTER);
@@ -183,6 +185,15 @@
   }
   umount("/mnt");
   return 0;
+*/
+   printf(CLEAR "Put the root floppy in the first floppy drive."
MSG_ENTER);
+   read_line();
+   if (zcat("/dev/fd0",minixpartition)){
+       printf("Error copying root filesystem!" MSG_ENTER);
+       read_line();
+       return 1;
+   }
+   return 0;
 }

 int config_minix(void) {
@@ -212,7 +223,7 @@
 #endif
   umount("/mnt");

-  mount(0,"/proc","proc",MS_MGC_VAL,"\0");
+  mount(0,"/proc","proc",MS_MGC_VAL,"\0");
   if((filep=fopen("/proc/sys/kernel/real-root-dev","w"))==NULL) {
     printf("Unable to open /proc/sys/kernel/real-root-dev!" MSG_ENTER);
     read_line();
@@ -222,6 +233,7 @@
   fprintf(filep,"%d\n",(int)info.st_rdev);
   fclose(filep);
   umount("/proc");
+  mount(0,"/proc","proc",MS_MGC_VAL,"\0");
   return 0;
 }

@@ -270,8 +282,8 @@
 }

 void print_menu(void) {
-  printf(CLEAR
-"This system has relatively little memory. For a system like this, special
+  printf(CLEAR
+ "This system has relatively little memory. For a system like this, special
 procedures are required, because there is not enough RAM available
 to run the graphical program without the virtual memory provided by the
swap
 partition. Thus, you should:
@@ -298,6 +310,7 @@
   if (minixpartition)
     printf("4. Exit.\n");
   printf("5. Reboot.\n");
+  printf("6. Disk partitioning program test information.\n");
 }

 void post_exit(int stat, void *foo);
@@ -308,6 +321,7 @@
   swappartition=NULL;
   minixpartition=NULL;
   on_exit(post_exit,NULL);
+  mount(0,"/proc","proc",MS_MGC_VAL,"\0");
   while (1) {
     fdisk_reread();
     print_menu();
@@ -331,6 +345,7 @@
 	break;
       case '4': if (minixpartition) return 0; break;
       case '5': reboot_system(); break;
+      case '6': test_fdisk(); break;
     }
   }
 }
@@ -347,4 +362,73 @@
     }
     main();
   }
+}
+
+int test_fdisk() {
+  int i;
+  struct fdisk_disk *d;
+  struct fdisk_partition *p;
+  FILE *f = NULL;
+
+  fdisk_reread();
+
+  d = fdisk_disks;
+
+  while (d) {
+    printf("%s: ", d->name);
+    p = d->partitions;
+    while (p) {
+      printf("%s, ", p->name);
+      p = p->next_by_disk;
+    }
+    printf("\n");
+
+    d = d->next;
+  }
+
+  p = fdisk_partitions;
+  while (p) {
+    printf("%s (%s), ", p->name, fdisk_sysname(p->type));
+    p = p->next;
+  }
+  printf("\n");
+
+  printf("Mounted partitions:");
+  p = mounted_partitions;
+  while (p) {
+    printf("%s (on %s), ", p->name, p->mount_point);
+    p = p->next_in_use;
+  }
+  printf("\n");
+
+  printf("Swap partitions in use:");
+  p = swapon_partitions;
+  while (p) {
+    printf("%s, ", p->name);
+    p = p->next_in_use;
+  }
+  printf("\n");
+
+  for( i = 0; i < FSTYPE_MAX; ++i ) {
+	  printf( "%s fs partitions: ", fstype_name[i] );
+	  p = fdisk_partitions_by_type[i];
+	  while (p) {
+		  printf("%s, ", p->name);
+		  p = p->next_by_type;
+	  }
+	  printf("\n");
+  }
+
+  f = fopen("/proc/partitions", "r");
+  if (f)
+  {
+      fclose(f);
+  }
+  else
+  {
+    printf("Unable to open /proc/partitions");
+  }
+    printf(MSG_ENTER);
+    read_line();
+  return(0);
 }
#######################################################

The rootdisk.sh patch:

#######################################################
--- /usr/src/boot-floppies/rootdisk.sh	Sat Mar 24 21:49:09 2001
+++ /usr/src/boot-floppies-mono/rootdisk.sh	Fri Nov  9 05:17:12 2001
@@ -12,7 +12,8 @@
 export LANG=C

 # configuration
-fstype=ext2
+#fstype=ext2
+fstype=minix
 if [ ${arch} = i386 -o ${arch} = m68k -o ${arch} = arm ]; then
 	# i386 and m68k have a lot of boot devices
 	inodes=900
#######################################################

The lowmemrd.sh patch:

#######################################################

--- /usr/src/boot-floppies/lowmemrd.sh	Sat Nov 13 22:36:30 1999
+++ /usr/src/boot-floppies-mono/lowmemrd.sh	Mon Aug  6 04:12:19 2001
@@ -40,7 +40,18 @@

 mkdir $mnt/dev
 (cd $mnt/dev; /sbin/MAKEDEV fd0 fd1 hda hdb hdc hdd sda sdb sdc sdd)
+mknod $mnt/dev/console c 5 1
+mknod $mnt/dev/tty0 c 4 0
 mknod $mnt/dev/tty1 c 4 1
+mknod $mnt/dev/tty2 c 4 2
+mknod $mnt/dev/vcs0 c 7 0
+mknod $mnt/dev/vcs1 c 7 1
+mknod $mnt/dev/vcsa0 c 7 128
+mknod $mnt/dev/vcsa1 c 7 129
+pushd $mnt/dev
+ln -s vcs0 vcs
+ln -s vcsa0 vcsa
+popd
 mkdir $mnt/proc
 mkdir $mnt/mnt
 chmod 555 $mnt/proc

#################################################################

Hope this helps.

Daniel F. Dickinson
Programmer/Analyst
C & I Technologies Inc.
(519) 763-1183





Reply to: