From patchwork Tue Dec 18 09:39:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 13638 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 092F123E21 for ; Tue, 18 Dec 2012 09:39:16 +0000 (UTC) Received: from mail-ie0-f174.google.com (mail-ie0-f174.google.com [209.85.223.174]) by fiordland.canonical.com (Postfix) with ESMTP id 654C9A1940A for ; Tue, 18 Dec 2012 09:39:15 +0000 (UTC) Received: by mail-ie0-f174.google.com with SMTP id c11so489527ieb.5 for ; Tue, 18 Dec 2012 01:39:14 -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=WBRyzwfkNw7x+xEWr+nWQeaUYN9246wV8L5XLpufofY=; b=DMQfM7wb9fqg3c+l2NgvUO1iGu1RazK8reJVxgzlPnHdm5x003sLZiEC1eg2b0XTCe uPvDItTBcKpGa/77Y1V126g6/yOk8NNf0+B4C33bEo9xPAp4xLwzRgGI1yX9Tf2HW5Wb bYbPVvWjYtygRWsBSU3NHw5pj7rJLtXqb4jPnuHpZydj8By9pdT0ck9LQpn1S1PmHU3L lN802qN1CJBLPWcWYxilpw5+kR7headCWSJjns20RVddbH+D6YC9F/2HTdp/Jm835A+L 6gUCFIDjnU9K3On4tVv2yys4oU6dBjukh7XN1PxMsdFMS52Kb365luZwjDiB5h/GGdag l4Tg== X-Received: by 10.50.161.169 with SMTP id xt9mr1738448igb.62.1355823554760; Tue, 18 Dec 2012 01:39:14 -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.50.67.148 with SMTP id n20csp129477igt; Tue, 18 Dec 2012 01:39:14 -0800 (PST) X-Received: by 10.194.19.10 with SMTP id a10mr2738605wje.45.1355823553417; Tue, 18 Dec 2012 01:39:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id l6si1415957wjy.65.2012.12.18.01.39.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 01:39:13 -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 1Tktdo-00060Z-KH for ; Tue, 18 Dec 2012 09:39:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8A1BCE294C for ; Tue, 18 Dec 2012 09:39:12 +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: 591 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 591: Added OrigenQuad board support. Message-Id: <20121218093912.30145.82381.launchpad@ackee.canonical.com> Date: Tue, 18 Dec 2012 09:39:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16372"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: c807ced83c1c26201b64898cbbe0af705d6dc0ec X-Gm-Message-State: ALoCoQkqCDiQ+WoIeTw5PYxg8OpFt4QGXOljjzXN2+azHgPO56/C9XE8l3/adiwAc2JxT1nj+es+ Merge authors: Tushar Behera (tusharbehera) Related merge proposals: https://code.launchpad.net/~tusharbehera/linaro-image-tools/origen-quad-support/+merge/139425 proposed by: Tushar Behera (tusharbehera) review: Approve - Данило Шеган (danilo) ------------------------------------------------------------ revno: 591 [merge] author: Tushar Behera committer: Milo Casagrande branch nick: trunk timestamp: Tue 2012-12-18 10:38:25 +0100 message: Added OrigenQuad board support. modified: linaro_image_tools/media_create/android_boards.py 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/android_boards.py' --- linaro_image_tools/media_create/android_boards.py 2012-12-06 04:45:51 +0000 +++ linaro_image_tools/media_create/android_boards.py 2012-12-12 09:35:49 +0000 @@ -33,6 +33,7 @@ from linaro_image_tools.media_create.boards import SnowballEmmcConfig from linaro_image_tools.media_create.boards import SMDKV310Config from linaro_image_tools.media_create.boards import OrigenConfig +from linaro_image_tools.media_create.boards import OrigenQuadConfig from linaro_image_tools.media_create.boards import VexpressConfig from linaro_image_tools.media_create.boards import ( align_up, @@ -349,6 +350,12 @@ dtb_name = None +class AndroidOrigenQuadConfig(AndroidSamsungConfig, OrigenQuadConfig): + _extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8' + android_specific_args = 'init=/init androidboot.console=ttySAC2' + dtb_name = None + + class AndroidVexpressConfig(AndroidBoardConfig, VexpressConfig): _extra_serial_opts = 'console=tty0 console=ttyAMA0,38400n8' android_specific_args = 'init=/init androidboot.console=ttyAMA0' @@ -365,6 +372,7 @@ 'iMX53': AndroidMx53LoCoConfig, 'mx6qsabrelite': AndroidMx6QSabreliteConfig, 'origen': AndroidOrigenConfig, + 'origen_quad': AndroidOrigenQuadConfig, 'vexpress': AndroidVexpressConfig, 'vexpress-a9': AndroidVexpressConfig, } === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-12-10 10:49:30 +0000 +++ linaro_image_tools/media_create/boards.py 2012-12-12 09:35:49 +0000 @@ -1453,6 +1453,7 @@ 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_file = old_spl_path # The new upstream u-boot filename has changed @@ -1463,6 +1464,10 @@ 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 + if not os.path.exists(spl_file): # missing SPL loader raise AssertionError("Couldn't find the SPL file, tried %s and %s" @@ -1533,6 +1538,22 @@ mmc_option = '0:2' +class OrigenQuadConfig(SamsungConfig): + bootloader_flavor = 'origen_quad' + serial_tty = 'ttySAC2' + _extra_serial_opts = 'console=%s,115200n8' + kernel_addr = '0x40007000' + initrd_addr = '0x42000000' + load_addr = '0x40008000' + kernel_flavors = ['origen_quad'] + boot_script = 'boot.scr' + mmc_part_offset = 1 + mmc_option = '0:2' + samsung_bl1_len = 48 + samsung_bl2_start = 49 + samsung_env_start = 1073 + + class I386Config(BoardConfig): # define serial serial_tty = 'ttyS0' @@ -1618,6 +1639,7 @@ 'overo': OveroConfig, 'smdkv310': SMDKV310Config, 'origen': OrigenConfig, + 'origen_quad': OrigenQuadConfig, 'mx6qsabrelite': BoardConfig, 'i386': I386Config, } === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-12-10 10:49:30 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-12 09:35:49 +0000 @@ -759,6 +759,26 @@ config = boards.OrigenConfig +class TestGetOrigenQuadSPL(TestCaseWithFixtures): + config = boards.OrigenQuadConfig + + 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, 'origen_quad-spl.bin') + open(spl_path, 'w').close() + self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir)) + + +class TestGetOrigenQuadUboot(TestGetSMDKUboot): + config = boards.OrigenQuadConfig + + class TestCreateToc(TestCaseWithFixtures): ''' Tests boards.SnowballEmmcConfig.create_toc()''' @@ -1223,6 +1243,27 @@ 'make_uImage', 'make_uInitrd', 'make_boot_script'] self.assertEqual(expected, self.funcs_calls) + def test_origen_quad_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.OrigenQuadConfig, + 'install_samsung_boot_loader', + mock_func_creator('install_samsung_boot_loader'))) + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda file: True)) + boards.OrigenQuadConfig.hardwarepack_handler = ( + TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) + boards.OrigenQuadConfig.hardwarepack_handler.get_format = ( + lambda: '1.0') + self.make_boot_files(boards.OrigenQuadConfig) + 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'] @@ -1358,6 +1399,14 @@ expected = ['_dd', '_dd', '_dd'] self.assertEqual(expected, self.funcs_calls) + def test_origen_quad_raw(self): + self.useFixture(MockSomethingFixture(os.path, 'getsize', + lambda file: 1)) + + self.populate_raw_partition(boards.OrigenQuadConfig) + expected = ['_dd', '_dd', '_dd'] + self.assertEqual(expected, self.funcs_calls) + def test_vexpress_a9_raw(self): self.populate_raw_partition(boards.VexpressA9Config) expected = [] @@ -1463,6 +1512,24 @@ self.assertEqual(expected_commands, fixture.mock.commands_executed) self.assertEqual(expected, self.funcs_calls) + def test_origen_quad_raw(self): + fixture = MockCmdRunnerPopenFixture() + self.useFixture(fixture) + expected_commands = [ + ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 ' + 'seek=1073'), + ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 ' + 'conv=notrunc seek=1'), + 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=49'] + self.useFixture(MockSomethingFixture(os.path, 'getsize', + lambda file: 1)) + + self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig) + expected = [] + # Test that we dd the files + self.assertEqual(expected_commands, fixture.mock.commands_executed) + self.assertEqual(expected, self.funcs_calls) + def test_vexpress_raw(self): self.populate_raw_partition(android_boards.AndroidVexpressConfig) expected = [] @@ -1600,6 +1667,11 @@ '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', board_configs['origen'].get_sfdisk_cmd()) + def test_origen_quad(self): + self.assertEquals( + '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', + board_configs['origen_quad'].get_sfdisk_cmd()) + def test_panda_android(self): self.assertEqual( '63,270272,0x0C,*\n270336,1048576,L\n1318912,524288,L\n' @@ -1612,6 +1684,12 @@ '1327104,-,E\n1327104,524288,L\n1851392,1048576,L\n2899968,,,-', android_boards.AndroidOrigenConfig.get_sfdisk_cmd()) + def test_origen_quad_android(self): + self.assertEqual( + '1,8191,0xDA\n8253,270274,0x0C,*\n278528,1048576,L\n' + '1327104,-,E\n1327104,524288,L\n1851392,1048576,L\n2899968,,,-', + android_boards.AndroidOrigenQuadConfig.get_sfdisk_cmd()) + def test_snowball_emmc_android(self): self.assertEqual( '256,7936,0xDA\n8192,262144,0x0C,*\n270336,1048576,L\n' @@ -1683,6 +1761,17 @@ '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', config.get_sfdisk_cmd()) + def test_origen_quad(self): + class config(board_configs['origen_quad']): + 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): @@ -1760,6 +1849,20 @@ 'initrd_high': '0xffffffff'} self.assertEqual(expected, boot_commands) + def test_origen_quad(self): + boot_commands = board_configs['origen_quad']._get_boot_env( + is_live=False, is_lowmem=False, consoles=[], + rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None) + expected = { + 'bootargs': 'console=ttySAC2,115200n8 root=UUID=deadbeef ' + 'rootwait ro', + 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' + 'fatload mmc 0:2 0x42000000 uInitrd; ' + 'bootm 0x40007000 0x42000000', + 'fdt_high': '0xffffffff', + 'initrd_high': '0xffffffff'} + self.assertEqual(expected, boot_commands) + def test_ux500(self): boot_commands = board_configs['ux500']._get_boot_env( is_live=False, is_lowmem=False, consoles=[], @@ -2031,6 +2134,18 @@ self.assertBootEnv( android_boards.AndroidOrigenConfig, expected) + def test_android_origen_quad(self): + expected = { + 'bootargs': 'console=tty0 console=ttySAC2,115200n8 ' + 'rootwait ro init=/init androidboot.console=ttySAC2', + 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' + 'fatload mmc 0:2 0x42000000 uInitrd; ' + 'bootm 0x40007000 0x42000000', + 'fdt_high': '0xffffffff', + 'initrd_high': '0xffffffff'} + self.assertBootEnv( + android_boards.AndroidOrigenQuadConfig, expected) + def test_android_vexpress(self): expected = { 'bootargs': 'console=tty0 console=ttyAMA0,38400n8 ' @@ -2250,6 +2365,36 @@ boards.OrigenConfig.samsung_bl2_start)] self.assertEqual(expected, fixture.mock.commands_executed) + def test_install_origen_quad_u_boot(self): + fixture = self._mock_Popen() + bootloader_flavor = boards.OrigenQuadConfig.bootloader_flavor + self.useFixture(MockSomethingFixture( + boards.OrigenQuadConfig, '_get_samsung_spl', + classmethod(lambda cls, chroot_dir: "%s/%s/SPL" % ( + chroot_dir, bootloader_flavor)))) + self.useFixture(MockSomethingFixture( + boards.OrigenQuadConfig, '_get_samsung_bootloader', + classmethod(lambda cls, chroot_dir: "%s/%s/uboot" % ( + chroot_dir, bootloader_flavor)))) + boards.OrigenQuadConfig.hardwarepack_handler = ( + TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) + boards.OrigenQuadConfig.hardwarepack_handler.get_format = ( + lambda: '1.0') + self.useFixture(MockSomethingFixture(os.path, 'getsize', + lambda file: 1)) + boards.OrigenQuadConfig.install_samsung_boot_loader( + boards.OrigenQuadConfig._get_samsung_spl("chroot_dir"), + boards.OrigenQuadConfig._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.OrigenQuadConfig.samsung_bl1_start), + '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' + 'seek=%d' % (sudo_args, bootloader_flavor, + boards.OrigenQuadConfig.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'} @@ -2477,6 +2622,27 @@ [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', HEADS, SECTORS, '', self.media.path)], sfdisk_fixture.mock.calls) + def test_create_partitions_for_origen_quad(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['origen_quad'], 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())