Merge lp:~salgado/linaro-image-tools/bug-705410 into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Approved by: Loïc Minier
Approved revision: 254
Merged at revision: 255
Proposed branch: lp:~salgado/linaro-image-tools/bug-705410
Merge into: lp:linaro-image-tools/11.11
Diff against target: 51 lines (+10/-4)
2 files modified
linaro_media_create/partitions.py (+6/-2)
linaro_media_create/tests/test_media_create.py (+4/-2)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/bug-705410
Reviewer Review Type Date Requested Status
Loïc Minier (community) Approve
Review via email: mp+47290@code.launchpad.net

Description of the change

Make sure we create an extra (non-Data) partition for mx51evk boards

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

Looks good, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_media_create/partitions.py'
2--- linaro_media_create/partitions.py 2011-01-14 16:10:16 +0000
3+++ linaro_media_create/partitions.py 2011-01-24 18:48:13 +0000
4@@ -254,6 +254,10 @@
5 as_root=True, stderr=None):
6 """Run the given commands under sfdisk.
7
8+ Every time sfdisk is invoked it will repartition the device so to create
9+ multiple partitions you should craft a list of newline-separated commands
10+ to be executed in a single sfdisk run.
11+
12 :param commands: A string of sfdisk commands; each on a separate line.
13 :return: A 2-tuple containing the subprocess' stdout and stderr.
14 """
15@@ -294,16 +298,16 @@
16 else:
17 partition_type = '0x0E'
18
19+ sfdisk_cmd = ',9,%s,*\n,,,-' % partition_type
20 if board == 'mx51evk':
21 # Create a one cylinder partition for fixed-offset bootloader data at
22 # the beginning of the image (size is one cylinder, so 8224768 bytes
23 # with the first sector for MBR).
24- run_sfdisk_commands(',1,0xDA', heads, sectors, cylinders, media.path)
25+ sfdisk_cmd = ',1,0xDA\n%s' % sfdisk_cmd
26
27 # Create a VFAT or FAT16 partition of 9 cylinders (74027520 bytes, ~70
28 # MiB), followed by a Linux-type partition containing the rest of the free
29 # space.
30- sfdisk_cmd = ',9,%s,*\n,,,-' % partition_type
31 run_sfdisk_commands(sfdisk_cmd, heads, sectors, cylinders, media.path)
32
33 # Sync and sleep to wait for the partition to settle.
34
35=== modified file 'linaro_media_create/tests/test_media_create.py'
36--- linaro_media_create/tests/test_media_create.py 2011-01-19 20:52:56 +0000
37+++ linaro_media_create/tests/test_media_create.py 2011-01-24 18:48:13 +0000
38@@ -389,9 +389,11 @@
39 [['sudo', 'parted', '-s', self.media.path, 'mklabel', 'msdos'],
40 ['sync']],
41 popen_fixture.mock.calls)
42+ # Notice that we create all partitions in a single sfdisk run because
43+ # every time we run sfdisk it actually repartitions the device,
44+ # erasing any partitions created previously.
45 self.assertEqual(
46- [(',1,0xDA', 255, 63, '', self.media.path),
47- (',9,0x0C,*\n,,,-', 255, 63, '', self.media.path)],
48+ [(',1,0xDA\n,9,0x0C,*\n,,,-', 255, 63, '', self.media.path)],
49 sfdisk_fixture.mock.calls)
50
51 def test_create_partitions_for_beagle(self):

Subscribers

People subscribed via source and target branches