]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/blob - scripts/runqemu-addptable2image
python3: move dataclasses to python3-core
[thirdparty/openembedded/openembedded-core.git] / scripts / runqemu-addptable2image
1 #!/bin/sh
2
3 # Add a partition table to an ext2 image file
4 #
5 # Copyright (C) 2006-2007 OpenedHand Ltd.
6 #
7 # SPDX-License-Identifier: GPL-2.0-or-later
8 #
9
10 IMAGE=$1
11 IMAGEOUT=$2
12
13 echo $IMAGE
14 echo $IMAGEOUT
15
16 size=`ls -l $IMAGE | awk '{ print $5}'`
17 size2=`expr $size / 512 / 16 / 63`
18
19 echo $size
20 echo $size2
21
22 # MBR Size = 512 * 63 bytes
23 dd if=/dev/zero of=$IMAGEOUT count=63
24
25 echo "x" > /tmp/fdisk.cmds
26 echo "c" >> /tmp/fdisk.cmds
27 echo "1024" >> /tmp/fdisk.cmds
28 echo "h" >> /tmp/fdisk.cmds
29 echo "16" >> /tmp/fdisk.cmds
30 echo "r" >> /tmp/fdisk.cmds
31 echo "n" >> /tmp/fdisk.cmds
32 echo "p" >> /tmp/fdisk.cmds
33 echo "1" >> /tmp/fdisk.cmds
34 echo "1" >> /tmp/fdisk.cmds
35 echo "$size2" >> /tmp/fdisk.cmds
36 echo "w" >> /tmp/fdisk.cmds
37
38 /sbin/fdisk $IMAGEOUT < /tmp/fdisk.cmds
39 cat $IMAGE >> $IMAGEOUT