[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop: [1137] ipcop/trunk
From:       owes () users ! sourceforge ! net
Date:       2008-02-21 21:50:02
Message-ID: E1JSJIo-0004zX-5e () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]

Revision: 1137
          http://ipcop.svn.sourceforge.net/ipcop/?rev=1137&view=rev
Author:   owes
Date:     2008-02-21 13:50:01 -0800 (Thu, 21 Feb 2008)

Log Message:
-----------
2 installer changes.

See ipcop-devel mail for more details.

Modified Paths:
--------------
    ipcop/trunk/config/i486/syslinux.cfg
    ipcop/trunk/config/mkinitramfs/mkinitramfs
    ipcop/trunk/src/installer/arch_defs.h
    ipcop/trunk/src/installer/installer.c
    ipcop/trunk/src/installer/partition.c

Property Changed:
----------------
    ipcop/trunk/config/mkinitramfs/mkinitramfs

Modified: ipcop/trunk/config/i486/syslinux.cfg
===================================================================
--- ipcop/trunk/config/i486/syslinux.cfg	2008-02-21 19:07:13 UTC (rev 1136)
+++ ipcop/trunk/config/i486/syslinux.cfg	2008-02-21 21:50:01 UTC (rev 1137)
@@ -21,6 +21,6 @@
 LABEL dma
   KERNEL vmlinuz
   APPEND mode=install initrd=instroot.img
-LABEL disk256
+LABEL parted
   KERNEL vmlinuz
-  APPEND mode=install initrd=instroot.img disk256
+  APPEND mode=install initrd=instroot.img ide=nodma parted

Modified: ipcop/trunk/config/mkinitramfs/mkinitramfs
===================================================================
--- ipcop/trunk/config/mkinitramfs/mkinitramfs	2008-02-21 19:07:13 UTC (rev 1136)
+++ ipcop/trunk/config/mkinitramfs/mkinitramfs	2008-02-21 21:50:01 UTC (rev 1137)
@@ -1,4 +1,27 @@
 #!/bin/sh
+#
+# mkinitramfs, creates initramfs from installer/kernel update
+#
+# This file is part of the IPCop Firewall.
+#
+# IPCop is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# IPCop is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with IPCop; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Copyright (C) 2007-2008, the IPCop team.
+#
+# $Id$
+#
 
 # Copy all the script arguments here
 ARGUMENTS="$@"
@@ -174,9 +197,8 @@
 do
 	case ${ARG} in
 		--with-modules=*)
-			MODULES=`echo ${ARG} | cut -d"=" -f 2`
-			OLD_IFS=$IFS
-			IFS=,
+			MODULESFILE=`echo ${ARG} | cut -d"=" -f 2`
+			MODULES=`cat $MODULESFILE`
 			for MODULE in ${MODULES}
 			do
 				REQUESTED_MODULES[${COUNTER}]="${MODULE}.ko"
@@ -196,8 +218,6 @@
 	esac
 done
 
-IFS=$OLD_IFS
-
 check_kernel ${KVER}
 
 echo "Creating bootstrap / rescue initramfs for kernel ${KVER}"


Property changes on: ipcop/trunk/config/mkinitramfs/mkinitramfs
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: ipcop/trunk/src/installer/arch_defs.h
===================================================================
--- ipcop/trunk/src/installer/arch_defs.h	2008-02-21 19:07:13 UTC (rev 1136)
+++ ipcop/trunk/src/installer/arch_defs.h	2008-02-21 21:50:01 UTC (rev 1137)
@@ -100,7 +100,7 @@
     Various function implemented in hardware.c and partition.c    
 */
 void scan_hardware(int installer_setup, int nopcmcia, int nousb, int noscsi);
-int  make_partitions(char *device, long int disk_size);
+int  make_partitions(char *device, long int disk_size, int parted);
 int  make_disk(char *device, int *bootpartexist);
 void create_initramfs(void);
 void make_bootable(char *device, int bootpartexist);

Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c	2008-02-21 19:07:13 UTC (rev 1136)
+++ ipcop/trunk/src/installer/installer.c	2008-02-21 21:50:01 UTC (rev 1137)
@@ -353,12 +353,6 @@
   fclose(handle);
   fprintf(flog, "Hard disk selected %s. Size:%ld MByte\n", hardwares[*ddisk].device, \
*disk_size);  
-  if ( find_kv(kv, "disk256") != NULL )
-  {
-    *disk_size = 256;
-    fprintf(flog, "Hard disk set to:%ld MByte\n", *disk_size);
-  }
-
   /* warn about disk destroying and ask for (additional) confirmation */
   rc = newtWinChoice(ipcop_gettext("TR_TITLE_DISK"),
                     ipcop_gettext("TR_CANCEL"), ipcop_gettext("TR_OK"), 
@@ -443,6 +437,7 @@
   int nopcmcia = 0;
   int nousb = 0;
   int noscsi = 0;
+  int parted = 0;
   if ( find_kv(kv, "nopcmcia") != NULL )
   {
     nopcmcia = 1;
@@ -458,6 +453,11 @@
     noscsi = 1;
     fprintf(flog, "Skip SCSI detection\n");
   }
+  if ( find_kv(kv, "parted") != NULL )
+  {
+    parted = 1;
+    fprintf(flog, "Manual partitioning\n");
+  }
 
   // find nics cdrom harddisk & floppies
   scan_hardware(1, nopcmcia, nousb, noscsi);
@@ -488,7 +488,7 @@
     goto EXIT;
   }
 
-  if ( make_partitions(hardwares[selected_hd].device, disk_size) )
+  if ( make_partitions(hardwares[selected_hd].device, disk_size, parted) )
     goto EXIT;
   if ( make_disk( hardwares[selected_hd].device,
                    &bootpartindex       // return index id '/boot'

Modified: ipcop/trunk/src/installer/partition.c
===================================================================
--- ipcop/trunk/src/installer/partition.c	2008-02-21 19:07:13 UTC (rev 1136)
+++ ipcop/trunk/src/installer/partition.c	2008-02-21 21:50:01 UTC (rev 1137)
@@ -53,7 +53,7 @@
     Calculate for the user a useable disk schema partition
     and make it so.
 */
-int make_partitions(char *dev, long int disk_size)
+int make_partitions(char *dev, long int disk_size, int parted)
 {
   int retcode = 1;  /* ERROR */
   long int swap_file, boot_partition, log_partition;
@@ -103,7 +103,93 @@
 
   start_partition = 1;            /* in MB */
 
+  /* 
+    We now have auto-partition data (in MB)
+    start:                    end:
+    start_p                   boot_p
+    boot_p                    boot_p + root_p
+    boot_p + root_p           disk_size
+  */
 
+#if defined(__i386__) || defined(__x86_64__)
+  strcpy(partition_label[0], "/boot");
+  strcpy(partition_label[1], "/");
+  strcpy(partition_label[2], "/var/log");
+#endif
+#if defined(__powerpc__) || defined(__powerpc64__)
+  strcpy(partition_label[0], "skip");
+  strcpy(partition_label[1], "skip");
+  strcpy(partition_label[2], "/boot");
+  strcpy(partition_label[3], "/");
+  strcpy(partition_label[4], "/var/log");
+#endif
+#if defined(__sparc__) || defined(__sparc64__)
+  strcpy(partition_label[0], "/boot");
+  strcpy(partition_label[1], "/");
+  strcpy(partition_label[2], "skip");
+  strcpy(partition_label[3], "/var/log");
+#endif
+#if defined(__alpha__)
+  strcpy(partition_label[0], "/boot");
+  strcpy(partition_label[1], "/");
+  strcpy(partition_label[2], "/var/log");
+#endif
+
+  if ( parted )
+  {
+    /*
+        OK, user thinks he's smart enough to do by himself 
+    */
+    FILE *f;
+
+    f = fopen("/tmp/parthelp", "w");
+
+    fprintf(f, "#Selected device is %s\n", device);
+    fprintf(f, "#suggested partitioning:\n");
+    fprintf(f,  "/bin/dd if=/dev/zero of=%s bs=512 count=1\n", device );
+
+#if defined(__i386__) || defined(__x86_64__)
+    fprintf(f, "/usr/bin/parted -s %s mklabel msdos\n", device);
+    fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
start_partition, boot_partition); +    fprintf(f, "/usr/bin/parted -s %s mkpart \
primary ext2 %d %d\n", device, boot_partition, boot_partition+root_partition); +    \
fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
boot_partition+root_partition, disk_size); +    fprintf(f, "/usr/bin/parted -s %s set \
1 boot on\n", device); +#endif
+#if defined(__powerpc__) || defined(__powerpc64__)
+    fprintf(f, "/usr/bin/parted -s %s mklabel mac\n", device);
+    fprintf(f, "/usr/bin/parted -s %s mkpart primary hfs 33k %d\n", device, \
start_partition); +    fprintf(f, "/usr/bin/parted -s %s name 2 bootstrap\n", \
device); +    fprintf(f, "/usr/bin/parted -s %s set 2 boot on\n", device);
+    fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
start_partition, boot_partition); +    fprintf(f, "/usr/bin/parted -s %s name 3 \
/boot\n", device); +    fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d \
%d\n", device, boot_partition, boot_partition+root_partition); +    fprintf(f, \
"/usr/bin/parted -s %s name 4 /\n", device); +    fprintf(f, "/usr/bin/parted -s %s \
mkpart primary ext2 %d %d\n", device, boot_partition+root_partition, disk_size); +    \
fprintf(f, "/usr/bin/parted -s %s name 5 /var/log\n", device); +#endif
+#if defined(__sparc__) || defined(__sparc64__)
+    fprintf(f, "/usr/bin/parted -s %s mklabel sun\n", device);
+    fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
start_partition, boot_partition); +    fprintf(f, "/usr/bin/parted -s %s mkpart \
primary ext2 %d %d\n", device, boot_partition, boot_partition+root_partition); +    \
fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
boot_partition+root_partition, disk_size); +#endif
+#if defined(__alpha__)
+    fprintf(f, "/usr/bin/parted -s %s mklabel bsd\n", device);
+    fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
start_partition, boot_partition); +    fprintf(f, "/usr/bin/parted -s %s mkpart \
primary ext2 %d %d\n", device, boot_partition, boot_partition+root_partition); +    \
fprintf(f, "/usr/bin/parted -s %s mkpart primary ext2 %d %d\n", device, \
boot_partition+root_partition, disk_size); +    fprintf(f, "/usr/bin/parted -s %s set \
1 boot on\n", device); +#endif
+
+    fclose(f);
+
+    mysystem("/bin/chmod 755 /tmp/parthelp");
+
+    newtWinMessage(ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_OK"), "Do your \
thing with parted now!"); +    return(0);
+  }
+  
+
   statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), \
ipcop_gettext("TR_MAKING_PARTITIONS"));  
 
@@ -123,15 +209,12 @@
     goto PARTITION_EXIT;
   }
 
+  /* convert MByte to PedSector */
   pedsector_start = ((PedSector)1*1024*1024 / ped_dev->sector_size);
   pedsector_boot  = ((PedSector)boot_partition*1024*1024 / ped_dev->sector_size);
   pedsector_root  = ((PedSector)root_partition*1024*1024 / ped_dev->sector_size);
 
 #if defined(__i386__) || defined(__x86_64__)
-  strcpy(partition_label[0], "/boot");
-  strcpy(partition_label[1], "/");
-  strcpy(partition_label[2], "/var/log");
-
   /* create a new partition table */
   if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("msdos"))) == NULL \
)  {
@@ -189,12 +272,6 @@
 #endif /* End of i386/x86_64 partitioning block */
 
 #if defined(__powerpc__) || defined(__powerpc64__)
-  strcpy(partition_label[0], "skip");
-  strcpy(partition_label[1], "skip");
-  strcpy(partition_label[2], "/boot");
-  strcpy(partition_label[3], "/");
-  strcpy(partition_label[4], "/var/log");
-
   /* create a new partition table */
   if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("mac"))) == NULL )
   {
@@ -265,11 +342,6 @@
 #endif /* End of ppc/ppc64 partitioning block */
 
 #if defined(__sparc__) || defined(__sparc64__)
-  strcpy(partition_label[0], "/boot");
-  strcpy(partition_label[1], "/");
-  strcpy(partition_label[2], "skip");
-  strcpy(partition_label[3], "/var/log");
-
   /* create a new partition table */
   if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("sun"))) == NULL )
   {
@@ -327,10 +399,6 @@
 #endif /* End of sparc/sparc64 partitioning block */
 
 #if defined(__alpha__)
-  strcpy(partition_label[0], "/boot");
-  strcpy(partition_label[1], "/");
-  strcpy(partition_label[2], "/var/log");
-
   /* create a new partition table */
   if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("bsd"))) == NULL )
   {
@@ -641,22 +709,28 @@
 {
   char bigstring[STRING_SIZE_LARGE];       // many modules maybe!
   int i;
+  FILE *handle;
 
   statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), \
ipcop_gettext("TR_BUILDING_INITRD"));  
   //pivot_root for initrd
   mkdir("/harddisk/initrd", S_IRWXU | S_IRWXG | S_IRWXO);
 
-  strcpy(bigstring, "/bin/chroot /harddisk /sbin/mkinitramfs --with-firmware \
--with-modules="); +  strcpy(bigstring, "/bin/chroot /harddisk /sbin/mkinitramfs \
--with-firmware --with-modules=/tmp/module-list");  
+  if ( (handle = fopen("/harddisk/tmp/module-list", "w")) == NULL )
+  {
+    /* not good */
+  }
+
   /* owes: this probably no longer necessary */
 #if !defined (__powerpc__)
-  strcat (bigstring, "ide-generic,");
+  fprintf(handle, "ide-generic\n");
 #endif
 
   /* TODO be more specific which modules to include */
-  strcat (bigstring, "ext3,");
-  strcat (bigstring, "ohci-hcd,uhci-hcd,ehci-hcd,usbhid,");
+  fprintf(handle, "ext3\njbd\n");
+  fprintf(handle, "ohci-hcd\nuhci-hcd\nehci-hcd\nusbhid\n");
 
   //add each module ...
 
@@ -665,18 +739,18 @@
   {
     if ( (hardwares[i].type == specialmodule) && hardwares[i].module[0] )
     {
-      strcat(bigstring, hardwares[i].module);
-      strcat(bigstring, ",");
+      fprintf(handle, "%s\n", hardwares[i].module);
     }
   }
 
 #if !defined(__sparc__) && !defined(__sparc64__)
-  strcat (bigstring, "pcspkr,");
+  fprintf(handle, "pcspkr\n");
 #endif
 
 #if defined(__sparc__) || defined(__sparc64__)
-  strcat (bigstring, "sparcspkr,");
+  fprintf(handle, "sparcspkr\n");
 #endif
+  fclose(handle);
 
   strcat (bigstring, " --with-kernel=" KERNEL_VERSION );
   mysystem(bigstring);


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic