summaryrefslogtreecommitdiff
path: root/scripts/poky-addptable2image
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/poky-addptable2image')
-rwxr-xr-xscripts/poky-addptable2image32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/poky-addptable2image b/scripts/poky-addptable2image
new file mode 100755
index 000000000..8602e5f08
--- /dev/null
+++ b/scripts/poky-addptable2image
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+IMAGE=$1
+IMAGEOUT=$2
+
+echo $IMAGE
+echo $IMAGEOUT
+
+size=`ls -l $IMAGE | awk '{ print $5}'`
+size2=`expr $size / 512 / 16 / 63`
+
+echo $size
+echo $size2
+
+# MBR Size = 512 * 63 bytes
+dd if=/dev/zero of=$IMAGEOUT count=63
+
+echo "x" > /tmp/fdisk.cmds
+echo "c" >> /tmp/fdisk.cmds
+echo "1024" >> /tmp/fdisk.cmds
+echo "h" >> /tmp/fdisk.cmds
+echo "16" >> /tmp/fdisk.cmds
+echo "r" >> /tmp/fdisk.cmds
+echo "n" >> /tmp/fdisk.cmds
+echo "p" >> /tmp/fdisk.cmds
+echo "1" >> /tmp/fdisk.cmds
+echo "1" >> /tmp/fdisk.cmds
+echo "$size2" >> /tmp/fdisk.cmds
+echo "w" >> /tmp/fdisk.cmds
+
+fdisk $IMAGEOUT < /tmp/fdisk.cmds
+cat $IMAGE >> $IMAGEOUT \ No newline at end of file