Revision: 7590
          http://sourceforge.net/p/ipcop/svn/7590
Author:   owes
Date:     2014-06-08 09:11:57 +0000 (Sun, 08 Jun 2014)
Log Message:
-----------
Change partitioning to use sfdisk instead of parted.
There seem to exist BIOS that do not like parted partitions in some 
size/combination/whatever, sfdisk works OK. Add option to re-enable parted 
manually.

Modified Paths:
--------------
    ipcop/trunk/config/rootfiles/common/util-linux
    ipcop/trunk/src/installer/arch_defs.h
    ipcop/trunk/src/installer/installer.c
    ipcop/trunk/src/installer/partition.c
    ipcop/trunk/src/scripts/disk-partition.sh
    ipcop/trunk/updates/2.1.6/ROOTFILES.i486-2.1.6

Modified: ipcop/trunk/config/rootfiles/common/util-linux
===================================================================
--- ipcop/trunk/config/rootfiles/common/util-linux      2014-06-08 09:06:59 UTC 
(rev 7589)
+++ ipcop/trunk/config/rootfiles/common/util-linux      2014-06-08 09:11:57 UTC 
(rev 7590)
@@ -34,7 +34,7 @@
 sbin/mkswap
 #sbin/pivot_root
 #sbin/raw
-#sbin/sfdisk
+sbin/sfdisk
 sbin/sulogin
 #sbin/swaplabel
 sbin/swapoff

Modified: ipcop/trunk/src/installer/arch_defs.h
===================================================================
--- ipcop/trunk/src/installer/arch_defs.h       2014-06-08 09:06:59 UTC (rev 
7589)
+++ ipcop/trunk/src/installer/arch_defs.h       2014-06-08 09:11:57 UTC (rev 
7590)
@@ -124,6 +124,7 @@
 #define PART_OPTIONS_MANUAL     0x0001
 #define PART_OPTIONS_NO_MBR     0x0002
 #define PART_OPTIONS_NO_DMA     0x0004
+#define PART_OPTIONS_PARTED     0x0008
 
 #define PART_OPTIONS_USER_SIZE  0x8000
 

Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c       2014-06-08 09:06:59 UTC (rev 
7589)
+++ ipcop/trunk/src/installer/installer.c       2014-06-08 09:11:57 UTC (rev 
7590)
@@ -23,6 +23,7 @@
  *   nopcmcia       - Skip PCMCIA hardware detection (do we still need this ?)
  *   nousb          - Skip USB hardware detection (do we still need this ?)
  *   noscsi         - Skip SCSI hardware detection (not implemented at the 
moment !)
+ *   parted         - Run parted instead of sfdisk
  *   partition      - Manual partitioning, use with care!
  *   nodma          - Disable DMA for IDE
  *   nombr          - Do not write MBR to disk
@@ -914,6 +915,10 @@
         noscsi = 1;
         fprintf(flog, "Skip SCSI detection\n");
     }
+    if (find_kv(kv, "parted") != NULL) {
+        part_options |= PART_OPTIONS_PARTED;
+        fprintf(flog, "Use parted\n");
+    }
     if (find_kv(kv, "partition") != NULL) {
         part_options |= PART_OPTIONS_MANUAL;
         fprintf(flog, "Manual partitioning\n");

Modified: ipcop/trunk/src/installer/partition.c
===================================================================
--- ipcop/trunk/src/installer/partition.c       2014-06-08 09:06:59 UTC (rev 
7589)
+++ ipcop/trunk/src/installer/partition.c       2014-06-08 09:11:57 UTC (rev 
7590)
@@ -191,7 +191,12 @@
 
     /* define all label and mountpoints for the architectures we support */
 #if defined(__i386__) || defined(__x86_64__)
-    strcpy(arch, "x86");
+    if (part_options & PART_OPTIONS_PARTED) {
+        strcpy(arch, "x86_parted");
+    }
+    else {
+        strcpy(arch, "x86");
+    }
     partition_index[PART_INDEX_ROOT] = 0;
     partition_index[PART_INDEX_VARLOG] = 1;
 #endif

Modified: ipcop/trunk/src/scripts/disk-partition.sh
===================================================================
--- ipcop/trunk/src/scripts/disk-partition.sh   2014-06-08 09:06:59 UTC (rev 
7589)
+++ ipcop/trunk/src/scripts/disk-partition.sh   2014-06-08 09:11:57 UTC (rev 
7590)
@@ -45,7 +45,7 @@
 
     # OWES: ped_device_get fails after this on some CF card/adapter.
     # Using nodma install parameter helps. */
-    if ( ! /bin/dd if=/dev/zero of=$dev bs=512 count=1 ); then
+    if ( ! /bin/dd if=/dev/zero of=$dev bs=512 count=2048 ); then
         echo "Fail: erase partition table, maybe dma issue"
         exit 1
     else
@@ -104,6 +104,21 @@
 # generally sector 0 contain the partition table, so first partition start 
after
 case "$arch" in
     x86)
+        size=$((${disk_size}-1-${root_size}-1))
+        echo ${root_size} ${size} ${disk_size} 
+        if [ $raid = "yes" ]; then
+            /sbin/sfdisk -fuM $dev << EOF
+1,${root_size},fd,*
+,${size},fd
+EOF
+        else
+            /sbin/sfdisk -fuM $dev << EOF
+1,${root_size},83,*
+,${size},83
+EOF
+        fi
+        ;;
+    x86_parted)
         parted_call "$dev mklabel msdos"
         parted_call "$dev mkpart primary 1MiB ${root_size}MiB"
         parted_call "$dev mkpart primary $((${root_size}+1))MiB 
${disk_size}MiB"

Modified: ipcop/trunk/updates/2.1.6/ROOTFILES.i486-2.1.6
===================================================================
--- ipcop/trunk/updates/2.1.6/ROOTFILES.i486-2.1.6      2014-06-08 09:06:59 UTC 
(rev 7589)
+++ ipcop/trunk/updates/2.1.6/ROOTFILES.i486-2.1.6      2014-06-08 09:11:57 UTC 
(rev 7590)
@@ -325,6 +325,7 @@
 /sbin/hwclock
 /sbin/losetup
 /sbin/mkswap
+/sbin/sfdisk
 /sbin/sulogin
 /sbin/swapoff
 /sbin/swapon

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


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to