Merge lp:~jcrigby/linaro-image-tools/unified-image-device-partitioning into lp:linaro-image-tools/11.11

Proposed by John Rigby
Status: Merged
Merged at revision: 28
Proposed branch: lp:~jcrigby/linaro-image-tools/unified-image-device-partitioning
Merge into: lp:linaro-image-tools/11.11
Diff against target: 117 lines (+25/-37)
1 file modified
linaro-media-create (+25/-37)
To merge this branch: bzr merge lp:~jcrigby/linaro-image-tools/unified-image-device-partitioning
Reviewer Review Type Date Requested Status
Loïc Minier (community) Approve
Review via email: mp+29101@code.launchpad.net

Description of the change

use same tool (sfdisk) for partitioning devices and imagefiles
this fixes the problem of fdisk prompting differently for some devices and is also more consistent

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :

Looks good from quick reading

review: Approve
28. By John Rigby

Create /etc/flash-kernel.conf so flash-kernel works

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro-media-create'
2--- linaro-media-create 2010-07-01 17:12:07 +0000
3+++ linaro-media-create 2010-08-05 15:15:57 +0000
4@@ -123,39 +123,20 @@
5 fi
6 }
7
8-function create_partitions_mmc {
9-
10-sudo fdisk -H 255 -S 63 ${MMC} << END
11-n
12-p
13-1
14-1
15-+64M
16-a
17-1
18-t
19-e
20-
21-
22-n
23-p
24-2
25-
26-
27-p
28-w
29-END
30-
31-}
32-
33-function create_partitions_image {
34+function create_partitions {
35+if [ "${IMAGE_FILE}" ]; then
36+partdev=${IMAGE_FILE}
37+else
38+partdev=${MMC}
39+fi
40 # Create a VFAT partition of 9 cylinders which is about 64M
41 # and a linux partition of the rest
42-sudo sfdisk -D -H $HEADS -S $SECTORS $CYLINDER_ARG $IMAGE_FILE << 'THEEND'
43+sudo sfdisk -D -H $HEADS -S $SECTORS $CYLINDER_ARG $partdev << 'THEEND'
44 ,9,0x0C,*
45 ,,,-
46 THEEND
47
48+if [ "${IMAGE_FILE}" ]; then
49 VFATOFFSET=$(($(fdisk -l -u $IMAGE_FILE | grep FAT | awk '{print $3}')*512))
50 VFATSIZE=$(($(fdisk -l -u $IMAGE_FILE | grep FAT | awk '{print $5}')*1024))
51 ROOTOFFSET=$(($(fdisk -l -u $IMAGE_FILE | grep Linux | awk '{print $2}')*512))
52@@ -164,16 +145,10 @@
53 ROOTSIZE=$((((ROOTSIZE2-ROOTSIZE1)/2)*1024))
54 MMC1=$(sudo losetup -f --show $IMAGE_FILE --offset $VFATOFFSET --sizelimit $VFATSIZE)
55 MMC2=$(sudo losetup -f --show $IMAGE_FILE --offset $ROOTOFFSET --sizelimit $ROOTSIZE)
56-}
57-
58-function create_partitions {
59-if [ "${IMAGE_FILE}" ]; then
60- create_partitions_image
61-else
62- create_partitions_mmc
63 fi
64 }
65
66+
67 function prepare_partitions {
68
69 echo ""
70@@ -270,6 +245,12 @@
71 fi
72 fi
73
74+ echo ""
75+ echo "Creating /etc/flash-kernel.conf"
76+ echo ""
77+
78+ echo "UBOOT_PART=/dev/mmcblk0p1" > ${DIR}/disk/etc/flash-kernel.conf
79+
80 cd ${DIR}/disk/
81 sync
82 sync
83@@ -348,17 +329,23 @@
84 IMAGE_SIZE=$(($IMAGE_SIZE))
85 }
86
87-function setup_image {
88- calculatesize
89+function setup_sizes {
90 HEADS=255
91 SECTORS=63
92 SECTORSIZE=512
93+ if [ "${IMAGE_FILE}" ]; then
94+ calculatesize
95 CYLINDERSIZE=$(($HEADS*$SECTORS*$SECTORSIZE))
96 CYLINDERS=$(($IMAGE_SIZE/$CYLINDERSIZE))
97 CYLINDER_ARG="-C $CYLINDERS"
98 IMAGE_SIZE=$(($CYLINDERS*$CYLINDERSIZE))
99+ else
100+ CYLINDER_ARG=""
101+ fi
102+}
103+
104+function setup_image {
105 FAT_SIZE=32
106-
107 sudo qemu-img create -f raw $IMAGE_FILE $IMAGE_SIZE
108 }
109
110@@ -498,6 +485,7 @@
111 shift
112 done
113
114+setup_sizes
115 if [ "${IMAGE_FILE}" ]; then
116 setup_image
117 fi

Subscribers

People subscribed via source and target branches