=== modified file 'linaro_media_create/boards.py'
@@ -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'
@@ -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'
@@ -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