diff options
author | Fathi Boudra <fathi.boudra@linaro.org> | 2012-12-23 14:49:02 +0200 |
---|---|---|
committer | Fathi Boudra <fathi.boudra@linaro.org> | 2012-12-23 14:49:02 +0200 |
commit | 8908dac13ed42029d2e6f4d8b6c41fc7f11bc763 (patch) | |
tree | 955041229668f3110886cea3018aae3061e8fda8 /linaro_image_tools | |
parent | 7940c230e216e8dbe5c5cb9e2be2d16e60338e1f (diff) |
Add Arndale board support
Diffstat (limited to 'linaro_image_tools')
-rw-r--r-- | linaro_image_tools/media_create/boards.py | 35 | ||||
-rw-r--r-- | linaro_image_tools/media_create/tests/test_media_create.py | 116 |
2 files changed, 145 insertions, 6 deletions
diff --git a/linaro_image_tools/media_create/boards.py b/linaro_image_tools/media_create/boards.py index aa1b2bd..6b70ed6 100644 --- a/linaro_image_tools/media_create/boards.py +++ b/linaro_image_tools/media_create/boards.py @@ -1452,21 +1452,26 @@ class SamsungConfig(BoardConfig): chroot_dir, 'usr', 'lib', 'u-boot', cls.bootloader_flavor) old_spl_path = os.path.join(spl_dir, 'v310_mmc_spl.bin') new_spl_path = os.path.join(spl_dir, 'u-boot-mmc-spl.bin') - new_new_spl_path = os.path.join(spl_dir, 'origen-spl.bin') - samsung_spl_path_4 = os.path.join(spl_dir, 'origen_quad-spl.bin') + spl_path_origen2 = os.path.join(spl_dir, 'origen-spl.bin') + spl_path_origen4 = os.path.join(spl_dir, 'origen_quad-spl.bin') + spl_path_arndale = os.path.join(spl_dir, 'smdk5250-spl.bin') spl_file = old_spl_path # The new upstream u-boot filename has changed if not os.path.exists(spl_file): spl_file = new_spl_path - # The new upstream u-boot filename has changed again + # upstream u-boot filename for Origen Dual (Exynos 4210) if not os.path.exists(spl_file): - spl_file = new_new_spl_path + spl_file = spl_path_origen2 - # upstream u-boot filename is dependent on board name + # upstream u-boot filename for Origen Quad (Exynos 4412) if not os.path.exists(spl_file): - spl_file = samsung_spl_path_4 + spl_file = spl_path_origen4 + + # upstream u-boot filename for Arndale (Exynos 5250) + if not os.path.exists(spl_file): + spl_file = spl_path_arndale if not os.path.exists(spl_file): # missing SPL loader @@ -1554,6 +1559,23 @@ class OrigenQuadConfig(SamsungConfig): samsung_env_start = 1073 +class ArndaleConfig(SamsungConfig): + bootloader_flavor = 'arndale' + serial_tty = 'ttySAC2' + _extra_serial_opts = 'console=%s,115200n8' + kernel_addr = '0x40007000' + initrd_addr = '0x42000000' + dtb_addr = '0x41f00000' + load_addr = '0x40008000' + kernel_flavors = ['arndale'] + boot_script = 'boot.scr' + mmc_part_offset = 1 + mmc_option = '0:2' + samsung_bl1_start = 17 + samsung_bl2_start = 49 + samsung_env_start = 1073 + + class I386Config(BoardConfig): # define serial serial_tty = 'ttyS0' @@ -1623,6 +1645,7 @@ class I386Config(BoardConfig): board_configs = { + 'arndale': ArndaleConfig, 'beagle': BeagleConfig, 'igep': IgepConfig, 'panda': PandaConfig, diff --git a/linaro_image_tools/media_create/tests/test_media_create.py b/linaro_image_tools/media_create/tests/test_media_create.py index a737abe..6f1eaa7 100644 --- a/linaro_image_tools/media_create/tests/test_media_create.py +++ b/linaro_image_tools/media_create/tests/test_media_create.py @@ -779,6 +779,26 @@ class TestGetOrigenQuadUboot(TestGetSMDKUboot): config = boards.OrigenQuadConfig +class TestGetArndaleSPL(TestCaseWithFixtures): + config = boards.ArndaleConfig + + def test_no_file_present(self): + tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() + self.assertRaises( + AssertionError, self.config._get_samsung_spl, tempdir) + + def test_new_file_present(self): + tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() + path = _create_uboot_dir(tempdir, self.config.bootloader_flavor) + spl_path = os.path.join(path, 'smdk5250-spl.bin') + open(spl_path, 'w').close() + self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir)) + + +class TestGetArndaleUboot(TestGetSMDKUboot): + config = boards.ArndaleConfig + + class TestCreateToc(TestCaseWithFixtures): ''' Tests boards.SnowballEmmcConfig.create_toc()''' @@ -1264,6 +1284,27 @@ class TestBootSteps(TestCaseWithFixtures): 'make_uImage', 'make_uInitrd', 'make_boot_script'] self.assertEqual(expected, self.funcs_calls) + def test_arndale_steps(self): + def mock_func_creator(name): + return classmethod( + lambda *args, **kwargs: self.funcs_calls.append(name)) + + self.useFixture(MockSomethingFixture( + linaro_image_tools.media_create.boards.ArndaleConfig, + 'install_samsung_boot_loader', + mock_func_creator('install_samsung_boot_loader'))) + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda file: True)) + boards.ArndaleConfig.hardwarepack_handler = ( + TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) + boards.ArndaleConfig.hardwarepack_handler.get_format = ( + lambda: '1.0') + self.make_boot_files(boards.ArndaleConfig) + expected = [ + 'install_samsung_boot_loader', 'make_flashable_env', '_dd', + 'make_uImage', 'make_uInitrd', 'make_boot_script'] + self.assertEqual(expected, self.funcs_calls) + def test_ux500_steps(self): self.make_boot_files(boards.Ux500Config) expected = ['make_uImage', 'make_uInitrd', 'make_boot_script'] @@ -1407,6 +1448,14 @@ class TestPopulateRawPartition(TestCaseWithFixtures): expected = ['_dd', '_dd', '_dd'] self.assertEqual(expected, self.funcs_calls) + def test_arndale_raw(self): + self.useFixture(MockSomethingFixture(os.path, 'getsize', + lambda file: 1)) + + self.populate_raw_partition(boards.ArndaleConfig) + expected = ['_dd', '_dd', '_dd'] + self.assertEqual(expected, self.funcs_calls) + def test_vexpress_a9_raw(self): self.populate_raw_partition(boards.VexpressA9Config) expected = [] @@ -1672,6 +1721,11 @@ class TestGetSfdiskCmd(TestCase): '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', board_configs['origen_quad'].get_sfdisk_cmd()) + def test_arndale(self): + self.assertEquals( + '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', + board_configs['arndale'].get_sfdisk_cmd()) + def test_panda_android(self): self.assertEqual( '63,270272,0x0C,*\n270336,1048576,L\n1318912,524288,L\n' @@ -1772,6 +1826,17 @@ class TestGetSfdiskCmdV2(TestCase): '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', config.get_sfdisk_cmd()) + def test_arndale(self): + class config(board_configs['arndale']): + partition_layout = 'reserved_bootfs_rootfs' + LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start + + boards.BoardConfig.samsung_bl1_len + + boards.BoardConfig.samsung_bl2_len + + boards.BoardConfig.samsung_env_len) + self.assertEquals( + '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', + config.get_sfdisk_cmd()) + class TestGetBootCmd(TestCase): @@ -2395,6 +2460,36 @@ class TestBoards(TestCaseWithFixtures): boards.OrigenQuadConfig.samsung_bl2_start)] self.assertEqual(expected, fixture.mock.commands_executed) + def test_install_arndale_u_boot(self): + fixture = self._mock_Popen() + bootloader_flavor = boards.ArndaleConfig.bootloader_flavor + self.useFixture(MockSomethingFixture( + boards.ArndaleConfig, '_get_samsung_spl', + classmethod(lambda cls, chroot_dir: "%s/%s/SPL" % ( + chroot_dir, bootloader_flavor)))) + self.useFixture(MockSomethingFixture( + boards.ArndaleConfig, '_get_samsung_bootloader', + classmethod(lambda cls, chroot_dir: "%s/%s/uboot" % ( + chroot_dir, bootloader_flavor)))) + boards.ArndaleConfig.hardwarepack_handler = ( + TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) + boards.ArndaleConfig.hardwarepack_handler.get_format = ( + lambda: '1.0') + self.useFixture(MockSomethingFixture(os.path, 'getsize', + lambda file: 1)) + boards.ArndaleConfig.install_samsung_boot_loader( + boards.ArndaleConfig._get_samsung_spl("chroot_dir"), + boards.ArndaleConfig._get_samsung_bootloader("chroot_dir"), + "boot_disk") + expected = [ + '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' + 'seek=%d' % (sudo_args, bootloader_flavor, + boards.ArndaleConfig.samsung_bl1_start), + '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' + 'seek=%d' % (sudo_args, bootloader_flavor, + boards.ArndaleConfig.samsung_bl2_start)] + self.assertEqual(expected, fixture.mock.commands_executed) + def test_get_plain_boot_script_contents(self): boot_env = {'bootargs': 'mybootargs', 'bootcmd': 'mybootcmd', 'initrd_high': '0xffffffff', 'fdt_high': '0xffffffff'} @@ -2643,6 +2738,27 @@ class TestCreatePartitions(TestCaseWithFixtures): [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', HEADS, SECTORS, '', self.media.path)], sfdisk_fixture.mock.calls) + def test_create_partitions_for_arndale(self): + # For this board we create a one cylinder partition at the beginning. + popen_fixture = self.useFixture(MockCmdRunnerPopenFixture()) + sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture()) + + create_partitions( + board_configs['arndale'], self.media, HEADS, SECTORS, '') + + self.assertEqual( + ['%s parted -s %s mklabel msdos' % (sudo_args, self.media.path), + '%s sfdisk -l %s' % (sudo_args, self.media.path), + 'sync', + '%s sfdisk -l %s' % (sudo_args, self.media.path)], + popen_fixture.mock.commands_executed) + # 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,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', HEADS, + SECTORS, '', self.media.path)], sfdisk_fixture.mock.calls) + def test_create_partitions_for_beagle(self): popen_fixture = self.useFixture(MockCmdRunnerPopenFixture()) sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture()) |