From patchwork Wed Mar 20 17:49:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fathi Boudra X-Patchwork-Id: 15443 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 CE39F23E39 for ; Wed, 20 Mar 2013 17:49:13 +0000 (UTC) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by fiordland.canonical.com (Postfix) with ESMTP id 70411A18946 for ; Wed, 20 Mar 2013 17:49:13 +0000 (UTC) Received: by mail-ve0-f181.google.com with SMTP id pa12so143090veb.26 for ; Wed, 20 Mar 2013 10:49:13 -0700 (PDT) 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=m7Kzd+Ftja0QHj1xeNyO57DcIUvU3LqEUH2+FdwJ4To=; b=p31sgivj7Pm1omzLZK+WTm4PjyTBK3zYKQ7/OK1VvriKtwrUNRll0UKN6BFEc3z+XN P36s0enFodJytwzc0+AiXlOLAkt16fKbloFFivTmT4gJYulo66HSGpXBzop4prgLz/6Q 3M928Cm4W7PIIka5+fOsJla8SPSBQFiEvOJKw1CBgzgZzpsgDEh1u7pLRy5pjnlPO3Qz 1TSoxEPrUHONY1vtoaSRDkvPlQrPADf5nWFpXncigImeX4ocCxUCpvCwIqN0Gijyqu0H V8Wnr4EWiEkZuIHB7F3JXfFPuYRazS4urZ8qnLiD7yMqDRNZuaraqSAG57G5zschi5JB DR4Q== X-Received: by 10.52.20.239 with SMTP id q15mr7882027vde.73.1363801752972; Wed, 20 Mar 2013 10:49:12 -0700 (PDT) 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.233.198 with SMTP id ty6csp24385vec; Wed, 20 Mar 2013 10:49:12 -0700 (PDT) X-Received: by 10.194.172.71 with SMTP id ba7mr12225221wjc.26.1363801751793; Wed, 20 Mar 2013 10:49:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id j1si2499585wiv.66.2013.03.20.10.49.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 Mar 2013 10:49:11 -0700 (PDT) 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 1UIN8R-0004lU-BW for ; Wed, 20 Mar 2013 17:49:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 4A4BAE04EB for ; Wed, 20 Mar 2013 17:49:11 +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: 610 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 610: Fix support for Origen Quad boards (LP: #1155702): Message-Id: <20130320174911.7727.51675.launchpad@ackee.canonical.com> Date: Wed, 20 Mar 2013 17:49:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16532"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: a61381422ab28d35b758b929463acb910e9a565f X-Gm-Message-State: ALoCoQmbfce596sPPgwid6P682/Zk0OsXinIo2z1Z04+l0zvBy5Zj//Uck1k7n7u8L/FOe0AAdU9 Merge authors: Milo Casagrande (milo) Related merge proposals: https://code.launchpad.net/~milo/linaro-image-tools/bug1155702/+merge/154425 proposed by: Milo Casagrande (milo) review: Approve - Fathi Boudra (fboudra) ------------------------------------------------------------ revno: 610 [merge] committer: Fathi Boudra branch nick: linaro-image-tools timestamp: Wed 2013-03-20 19:45:39 +0200 message: Fix support for Origen Quad boards (LP: #1155702): - New binaries are needed to boot an Origen Quad board, binaries provided in the boot tarball for Android. - Fix the tests and adds another one to verify the correct exception is thrown in case of a missing file. 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 2013-02-25 09:05:41 +0000 +++ linaro_image_tools/media_create/boards.py 2013-03-20 15:58:42 +0000 @@ -137,6 +137,10 @@ cmd_runner.run(cmd, as_root=True).wait() +class BoardException(Exception): + """Class for board related exceptions.""" + + class BoardConfig(object): """The configuration used when building an image for a board.""" @@ -1541,7 +1545,6 @@ class OrigenConfig(SamsungConfig): - # TODO test def __init__(self): super(OrigenConfig, self).__init__() self.boot_script = 'boot.scr' @@ -1569,10 +1572,33 @@ self.mmc_part_offset = 1 self.samsung_bl1_len = 48 self.samsung_bl2_start = 49 - self.samsung_env_start = 1073 + self.samsung_env_start = 1599 self.serial_tty = 'ttySAC2' self._extra_serial_options = 'console=%s,115200n8' + def populate_raw_partition(self, boot_device_or_file, chroot_dir): + # Overridden method for Origen Quad board, since the bootloader + # is now composed of 4 binaries. + boot_bin_0 = {'name': 'origen_quad.bl1.bin', 'seek': 1} + boot_bin_1 = {'name': 'origen_quad-spl.bin.signed', 'seek': 31} + boot_bin_2 = {'name': 'u-boot.bin', 'seek': 63} + boot_bin_3 = {'name': 'exynos4x12.tzsw.signed.img', 'seek': 761} + boot_bins = [boot_bin_0, boot_bin_1, boot_bin_2, boot_bin_3] + + boot_partition = 'boot' + + # Zero the env so that the boot_script will get loaded + _dd("/dev/zero", boot_device_or_file, count=self.samsung_env_len, + seek=self.samsung_env_start) + + for boot_bin in boot_bins: + name = boot_bin['name'] + file_path = os.path.join(chroot_dir, boot_partition, name) + if not os.path.exists(file_path): + raise BoardException("File '%s' does not exists. Cannot " + "proceed." % name) + _dd(file_path, boot_device_or_file, seek=boot_bin['seek']) + class ArndaleConfig(SamsungConfig): def __init__(self): === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2013-02-18 13:05:58 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2013-03-20 15:59:15 +0000 @@ -1517,13 +1517,20 @@ self.assertEqual(expected, self.funcs_calls) def test_origen_quad_raw(self): - self.useFixture(MockSomethingFixture(os.path, 'getsize', - lambda file: 1)) + # Need to mock this since files do not exist here, and + # an Exception is raised. + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda exists: True)) self.populate_raw_partition(boards.OrigenQuadConfig()) - expected = ['_dd', '_dd', '_dd'] + expected = ['_dd', '_dd', '_dd', '_dd', '_dd'] self.assertEqual(expected, self.funcs_calls) + def test_origen_quad_raises(self): + board_conf = boards.OrigenQuadConfig() + self.assertRaises(boards.BoardException, + board_conf.populate_raw_partition, '', '') + def test_arndale_raw(self): self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) @@ -1641,13 +1648,20 @@ 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)) + ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 ' + 'seek=1599'), + ('sudo -E dd if=boot/origen_quad.bl1.bin of= bs=512 ' + 'conv=notrunc seek=1'), + ('sudo -E dd if=boot/origen_quad-spl.bin.signed of= bs=512 ' + 'conv=notrunc seek=31'), + ('sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc ' + 'seek=63'), + ('sudo -E dd if=boot/exynos4x12.tzsw.signed.img of= bs=512 ' + 'conv=notrunc seek=761') + ] + + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda exists: True)) self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig()) expected = []