From patchwork Mon Jan 24 19:41:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guilherme Salgado X-Patchwork-Id: 20 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:39:17 -0000 Delivered-To: patches@linaro.org Received: by 10.147.124.10 with SMTP id b10cs34723yan; Mon, 24 Jan 2011 11:41:35 -0800 (PST) Received: by 10.227.127.199 with SMTP id h7mr4925242wbs.35.1295898095097; Mon, 24 Jan 2011 11:41:35 -0800 (PST) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id d3si12507143wbe.76.2011.01.24.11.41.34; Mon, 24 Jan 2011 11:41:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1PhSIA-0005XP-IA for ; Mon, 24 Jan 2011 19:41:34 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 85D8B2E93D7 for ; Mon, 24 Jan 2011 19:41:34 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-maintainers/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 255 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-maintainers/linaro-image-tools/trunk] Rev 255: Make sure we create an extra (non-Data) partition for mx51evk boards Message-Id: <20110124194134.3686.11963.launchpad@loganberry.canonical.com> Date: Mon, 24 Jan 2011 19:41:34 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="12248"; Instance="initZopeless config overlay" X-Launchpad-Hash: 8c550da90894894b72df36d077691e26c0422fc7 Merge authors: Guilherme Salgado (salgado) Related merge proposals: https://code.launchpad.net/~salgado/linaro-image-tools/bug-705410/+merge/47290 proposed by: Guilherme Salgado (salgado) review: Approve - Loïc Minier (lool) ------------------------------------------------------------ revno: 255 [merge] fixes bug(s): https://launchpad.net/bugs/705410 committer: Guilherme Salgado branch nick: trunk timestamp: Mon 2011-01-24 17:39:45 -0200 message: Make sure we create an extra (non-Data) partition for mx51evk boards modified: linaro_media_create/partitions.py linaro_media_create/tests/test_media_create.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-maintainers/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-maintainers/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro_media_create/partitions.py' --- linaro_media_create/partitions.py 2011-01-22 00:50:19 +0000 +++ linaro_media_create/partitions.py 2011-01-24 19:39:45 +0000 @@ -252,6 +252,10 @@ as_root=True, stderr=None): """Run the given commands under sfdisk. + Every time sfdisk is invoked it will repartition the device so to create + multiple partitions you should craft a list of newline-separated commands + to be executed in a single sfdisk run. + :param commands: A string of sfdisk commands; each on a separate line. :return: A 2-tuple containing the subprocess' stdout and stderr. """ @@ -292,16 +296,16 @@ else: partition_type = '0x0E' + sfdisk_cmd = ',9,%s,*\n,,,-' % partition_type if board == 'mx51evk': # Create a one cylinder partition for fixed-offset bootloader data at # the beginning of the image (size is one cylinder, so 8224768 bytes # with the first sector for MBR). - run_sfdisk_commands(',1,0xDA', heads, sectors, cylinders, media.path) + sfdisk_cmd = ',1,0xDA\n%s' % sfdisk_cmd # Create a VFAT or FAT16 partition of 9 cylinders (74027520 bytes, ~70 # MiB), followed by a Linux-type partition containing the rest of the free # space. - sfdisk_cmd = ',9,%s,*\n,,,-' % partition_type run_sfdisk_commands(sfdisk_cmd, heads, sectors, cylinders, media.path) # Sync and sleep to wait for the partition to settle. === modified file 'linaro_media_create/tests/test_media_create.py' --- linaro_media_create/tests/test_media_create.py 2011-01-22 00:50:54 +0000 +++ linaro_media_create/tests/test_media_create.py 2011-01-24 19:39:45 +0000 @@ -387,9 +387,11 @@ [['sudo', 'parted', '-s', self.media.path, 'mklabel', 'msdos'], ['sync']], popen_fixture.mock.calls) + # Notice that we create all partitions in a single sfdisk run because + # every time we run sfdisk it actually repartitions the device, + # erasing any partitions created previously. self.assertEqual( - [(',1,0xDA', 255, 63, '', self.media.path), - (',9,0x0C,*\n,,,-', 255, 63, '', self.media.path)], + [(',1,0xDA\n,9,0x0C,*\n,,,-', 255, 63, '', self.media.path)], sfdisk_fixture.mock.calls) def test_create_partitions_for_beagle(self):