diff mbox

[Branch,~linaro-maintainers/linaro-image-tools/trunk] Rev 297: Merge lp:~lool/linaro-image-tools/chs-align; use 128 heads and 32 sectors;

Message ID 20110311001053.16744.42473.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Loïc Minier March 11, 2011, 12:10 a.m. UTC
Merge authors:
  Loïc Minier (lool)
Related merge proposals:
  https://code.launchpad.net/~lool/linaro-image-tools/chs-align/+merge/52948
  proposed by: Loïc Minier (lool)
  review: Approve - James Westby (james-w)
------------------------------------------------------------
revno: 297 [merge]
committer: Loïc Minier <lool@dooz.org>
branch nick: linaro-image-tools
timestamp: Fri 2011-03-11 01:06:13 +0100
message:
  Merge lp:~lool/linaro-image-tools/chs-align; use 128 heads and 32 sectors;
  should avoid some warnings from disk partitioning tools.
modified:
  linaro_media_create/boards.py
  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
diff mbox

Patch

=== modified file 'linaro_media_create/boards.py'
--- linaro_media_create/boards.py	2011-03-09 15:55:56 +0000
+++ linaro_media_create/boards.py	2011-03-10 23:28:21 +0000
@@ -36,8 +36,10 @@ 
 from linaro_media_create.partitions import SECTOR_SIZE
 
 # Notes:
-# * geometry is currently always 255 heads and 63 sectors due to limitations of
-#   older OMAP3 boot ROMs
+# * since we align partitions on 4 MiB by default, geometry is currently 128
+#   heads and 32 sectors (2 MiB) as to have CHS-aligned partition start/end
+#   offsets most of the time and hence avoid some warnings with disk
+#   partitioning tools
 # * apparently some OMAP3 ROMs don't tolerate vfat length of an odd number of
 #   sectors (only sizes rounded to 1 KiB seem to boot)
 # * we want partitions aligned on 4 MiB as to get the best performance and

=== modified file 'linaro_media_create/partitions.py'
--- linaro_media_create/partitions.py	2011-02-28 19:40:43 +0000
+++ linaro_media_create/partitions.py	2011-03-10 23:28:21 +0000
@@ -33,8 +33,8 @@ 
 from linaro_media_create import cmd_runner
 
 
-HEADS = 255
-SECTORS = 63
+HEADS = 128
+SECTORS = 32
 SECTOR_SIZE = 512 # bytes
 CYLINDER_SIZE = HEADS * SECTORS * SECTOR_SIZE
 DBUS_PROPERTIES = 'org.freedesktop.DBus.Properties'

=== modified file 'linaro_media_create/tests/test_media_create.py'
--- linaro_media_create/tests/test_media_create.py	2011-03-09 17:18:18 +0000
+++ linaro_media_create/tests/test_media_create.py	2011-03-10 23:28:21 +0000
@@ -743,7 +743,7 @@ 
         popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
         sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture())
 
-        create_partitions(boards.Mx5Config, self.media, 255, 63, '')
+        create_partitions(boards.Mx5Config, self.media, 128, 32, '')
 
         self.assertEqual(
             ['%s parted -s %s mklabel msdos' % (sudo_args, self.media.path),
@@ -753,7 +753,7 @@ 
         # every time we run sfdisk it actually repartitions the device,
         # erasing any partitions created previously.
         self.assertEqual(
-            [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', 255, 63, '',
+            [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', 128, 32, '',
               self.media.path)],
             sfdisk_fixture.mock.calls)
 
@@ -763,7 +763,7 @@ 
         sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture())
 
         create_partitions(
-            board_configs['smdkv310'], self.media, 255, 63, '')
+            board_configs['smdkv310'], self.media, 128, 32, '')
 
         self.assertEqual(
             ['%s parted -s %s mklabel msdos' % (sudo_args, self.media.path),
@@ -773,7 +773,7 @@ 
         # every time we run sfdisk it actually repartitions the device,
         # erasing any partitions created previously.
         self.assertEqual(
-            [('1,221183,0xDA\n221184,106496,0x0C,*\n327680,,,-', 255, 63, '',
+            [('1,221183,0xDA\n221184,106496,0x0C,*\n327680,,,-', 128, 32, '',
               self.media.path)], sfdisk_fixture.mock.calls)
 
     def test_create_partitions_for_beagle(self):
@@ -781,14 +781,14 @@ 
         sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture())
 
         create_partitions(
-            board_configs['beagle'], self.media, 255, 63, '')
+            board_configs['beagle'], self.media, 128, 32, '')
 
         self.assertEqual(
             ['%s parted -s %s mklabel msdos' % (sudo_args, self.media.path),
              'sync'],
             popen_fixture.mock.commands_executed)
         self.assertEqual(
-            [('63,106432,0x0C,*\n106496,,,-', 255, 63, '', self.media.path)],
+            [('63,106432,0x0C,*\n106496,,,-', 128, 32, '', self.media.path)],
             sfdisk_fixture.mock.calls)
 
     def test_create_partitions_with_img_file(self):
@@ -797,7 +797,7 @@ 
 
         tmpfile = self.createTempFileAsFixture()
         create_partitions(
-            board_configs['beagle'], Media(tmpfile), 255, 63, '')
+            board_configs['beagle'], Media(tmpfile), 128, 32, '')
 
         # Unlike the test for partitioning of a regular block device, in this
         # case parted was not called as there's no existing partition table
@@ -805,7 +805,7 @@ 
         self.assertEqual(['sync'], popen_fixture.mock.commands_executed)
 
         self.assertEqual(
-            [('63,106432,0x0C,*\n106496,,,-', 255, 63, '', tmpfile)],
+            [('63,106432,0x0C,*\n106496,,,-', 128, 32, '', tmpfile)],
             sfdisk_fixture.mock.calls)
 
     def test_run_sfdisk_commands(self):
@@ -815,7 +815,7 @@ 
             stdout=subprocess.PIPE)
         proc.communicate()
         stdout, stderr = run_sfdisk_commands(
-            '2,16063,0xDA', 255, 63, '', tmpfile, as_root=False,
+            '2,16063,0xDA', 128, 32, '', tmpfile, as_root=False,
             stderr=subprocess.PIPE)
         self.assertIn('Successfully wrote the new partition table', stdout)
 
@@ -824,7 +824,7 @@ 
         self.assertRaises(
             cmd_runner.SubcommandNonZeroReturnValue,
             run_sfdisk_commands,
-            ',1,0xDA', 255, 63, '', tmpfile, as_root=False,
+            ',1,0xDA', 128, 32, '', tmpfile, as_root=False,
             stderr=subprocess.PIPE)
 
 
@@ -902,7 +902,7 @@ 
             stdout=subprocess.PIPE)
         proc.communicate()
         stdout, stderr = run_sfdisk_commands(
-            sfdisk_commands, 255, 63, '', tmpfile, as_root=False,
+            sfdisk_commands, 128, 32, '', tmpfile, as_root=False,
             # Throw away stderr as sfdisk complains a lot when operating on a
             # qemu image.
             stderr=subprocess.PIPE)
@@ -982,7 +982,7 @@ 
              # This is the call that would create a 2 GiB image file.
             ['qemu-img create -f raw %s 2147483648' % tmpfile,
              # This call would partition the image file.
-             '%s sfdisk --force -D -uS -H 255 -S 63 -C 261 %s' % (
+             '%s sfdisk --force -D -uS -H 128 -S 32 -C 1024 %s' % (
                  sudo_args, tmpfile),
              # Make sure changes are written to disk.
              'sync',
@@ -1009,7 +1009,7 @@ 
             True, True, True)
         self.assertEqual(
             ['%s parted -s %s mklabel msdos' % (sudo_args, tmpfile),
-             '%s sfdisk --force -D -uS -H 255 -S 63 %s' % (
+             '%s sfdisk --force -D -uS -H 128 -S 32 %s' % (
                  sudo_args, tmpfile),
              'sync',
              # Since the partitions are mounted, setup_partitions will umount