From patchwork Thu Dec 27 14:26:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 13721 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0F11F23E06 for ; Thu, 27 Dec 2012 14:26:20 +0000 (UTC) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by fiordland.canonical.com (Postfix) with ESMTP id A2A5DA1968A for ; Thu, 27 Dec 2012 14:26:19 +0000 (UTC) Received: by mail-vb0-f44.google.com with SMTP id fc26so10034383vbb.3 for ; Thu, 27 Dec 2012 06:26:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=MWg61y+dfuKRe8amqggHAuyuZX2N4Bddkf0RIzERBVI=; b=bBCf3c9LAlePpmG3kouiaGfSRVvSKZUaxp/qbA6EbS6m+fOm56WEGizqAR2JiSjHhy hedjtMteeZJu9X4xey+rbxcwWcuuKX0IRma4pDvF2GPyFNt0tnxtbJ3xYG3zy0XSb6UK tqVAQQJf6d4s2q4LZrGtSnscpwWZYNjXtF/GaRb4BFuWoqfe2iIZ83b5v/a0xgmY/cJ5 10JWqCqEFRWgdSL+pbidtcKeR0pfimHH6j6k45IWqkuI6qLP4/nlo16SWGVHeXwRnTu2 dtBsPW3obYjMDeOJvax8sOB9DUGC2pVexv+PE51iw3LkVT+UqjAHb+oyky5LSPLA3iQd eucw== X-Received: by 10.220.157.9 with SMTP id z9mr46915085vcw.45.1356618379064; Thu, 27 Dec 2012 06:26:19 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.214.195 with SMTP id oc3csp19571vec; Thu, 27 Dec 2012 06:26:18 -0800 (PST) X-Received: by 10.180.19.99 with SMTP id d3mr47612162wie.4.1356618377937; Thu, 27 Dec 2012 06:26:17 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e9si45067544wiz.21.2012.12.27.06.26.16 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Dec 2012 06:26:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1ToEPX-00047M-7Q for ; Thu, 27 Dec 2012 14:26:15 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 1B29DE050C for ; Thu, 27 Dec 2012 14:26:15 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 595 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 595: Added Arndale board support. Message-Id: <20121227142615.12196.93867.launchpad@ackee.canonical.com> Date: Thu, 27 Dec 2012 14:26:15 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16378"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 25edef16660f22aa996ea080423134e1bce24978 X-Gm-Message-State: ALoCoQlDWsm+Cg0dvL1fRFmD9X95+Fvi/1q12Gbk46UH4KLX/dorxqyLvGhbRRSwWrO9A5F6GyQc Merge authors: Fathi Boudra (fboudra) Related merge proposals: https://code.launchpad.net/~fboudra/linaro-image-tools/add-arndale-board-support/+merge/141180 proposed by: Fathi Boudra (fboudra) review: Approve - Milo Casagrande (milo) ------------------------------------------------------------ revno: 595 [merge] author: Fathi Boudra committer: Milo Casagrande branch nick: trunk timestamp: Thu 2012-12-27 15:25:36 +0100 message: Added Arndale board support. modified: linaro_image_tools/media_create/boards.py linaro_image_tools/media_create/tests/test_media_create.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/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-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-12-12 09:35:49 +0000 +++ linaro_image_tools/media_create/boards.py 2012-12-23 12:49:02 +0000 @@ -1452,21 +1452,26 @@ 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 - if not os.path.exists(spl_file): - spl_file = new_new_spl_path - - # upstream u-boot filename is dependent on board name - if not os.path.exists(spl_file): - spl_file = samsung_spl_path_4 + # upstream u-boot filename for Origen Dual (Exynos 4210) + if not os.path.exists(spl_file): + spl_file = spl_path_origen2 + + # upstream u-boot filename for Origen Quad (Exynos 4412) + if not os.path.exists(spl_file): + 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 @@ 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 @@ board_configs = { + 'arndale': ArndaleConfig, 'beagle': BeagleConfig, 'igep': IgepConfig, 'panda': PandaConfig, === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-12-12 09:35:49 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-23 12:49:02 +0000 @@ -779,6 +779,26 @@ 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 @@ '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 @@ 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 @@ '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 @@ '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 @@ 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 @@ [('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())