Skip to contentSkip to conversation

create-sdcard: use parted instead of sfdisk

PATCH Superseded Jacob Stiffler 2 participants 3 messages May 5, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 create-sdcard: use parted instead of sfdisk

* The options for sfdisk since version 2.26
* Ubuntu 16.04 contains sfdisk version 2.27.1
* In order to retain compatibility from Ubuntu 12.04 through 16.04,i use parted instead.

---
 create-sdcard.sh | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
create-sdcard.sh +9 -12
index 46ed5ae..edf57b0 100644
@@ -501,13 +501,12 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
 
 echo DISK SIZE - $SIZE bytes
 
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
+parted -s $DRIVE set 1 boot on
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 310
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 310 -2
 
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,300,,-
-310,,,-
-EOF
 
 cat << EOM
 
@@ -560,12 +559,10 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
 
 echo DISK SIZE - $SIZE bytes
 
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
-
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,,,-
-EOF
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
+parted -s $DRIVE set 1 boot on
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 -2
 
 cat << EOM
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 1 line · Jacob Stiffler

* The options for sfdisk since version 2.26

Truncated sentence?

Quoted 56 lines

* Ubuntu 16.04 contains sfdisk version 2.27.1
* In order to retain compatibility from Ubuntu 12.04 through 16.04,i use parted instead.

---
 create-sdcard.sh | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
create-sdcard.sh +9 -12
index 46ed5ae..edf57b0 100644
@@ -501,13 +501,12 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
 
 echo DISK SIZE - $SIZE bytes
 
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
+parted -s $DRIVE set 1 boot on
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 310
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 310 -2
 
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,300,,-
-310,,,-
-EOF
 
 cat << EOM
 
@@ -560,12 +559,10 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
 
 echo DISK SIZE - $SIZE bytes
 
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
-
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,,,-
-EOF
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
+parted -s $DRIVE set 1 boot on
+parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 -2
 
 cat << EOM
 
Signature · 6 lines
1.9.1

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Dmytriyenko, Denys
Sent: Thursday, May 05, 2016 2:43 PM
To: Stiffler, Jacob
Cc: [email protected]
Subject: Re: [meta-arago] [tisdk-setup-scripts][PATCH] create-sdcard: use parted instead of sfdisk

Quoted 5 lines
Quoted 1 line · Jacob Stiffler

* The options for sfdisk since version 2.26

Truncated sentence?

Yeah, I'll send out a v2.

Quoted 58 lines
Quoted 58 lines

* Ubuntu 16.04 contains sfdisk version 2.27.1
* In order to retain compatibility from Ubuntu 12.04 through 16.04,i use parted instead.

---
 create-sdcard.sh | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
create-sdcard.sh index renamed from create-sdcard.sh +0 -0

46ed5ae..edf57b0 100644

create-sdcard.sh +0 -0
@@ -501,13 +501,12 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print

$5}'`

echo DISK SIZE - $SIZE bytes

create-sdcard.sh +4 -6
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9 parted -s
+$DRIVE set 1 boot on parted -s $DRIVE unit cyl mkpart primary ext2 --
+9 310 parted -s $DRIVE unit cyl mkpart primary ext2 -- 310 -2
 
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,300,,-
-310,,,-
-EOF
 
 cat << EOM
@@ -560,12 +559,10 @@ SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print

$5}'`

echo DISK SIZE - $SIZE bytes

create-sdcard.sh +4 -7
-CYLINDERS=`echo $SIZE/255/63/512 | bc`
-
-sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
-,9,0x0C,*
-10,,,-
-EOF
+parted -s $DRIVE mklabel msdos
+parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9 parted -s
+$DRIVE set 1 boot on parted -s $DRIVE unit cyl mkpart primary ext2 --
+9 -2
 
 cat << EOM
 
--

1.9.1

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago