From patchwork Thu May 26 20:26:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Westby X-Patchwork-Id: 1650 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:53:49 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.230 with SMTP id dz6cs47963vdc; Thu, 26 May 2011 13:26:40 -0700 (PDT) Received: by 10.216.82.77 with SMTP id n55mr1264226wee.52.1306441598909; Thu, 26 May 2011 13:26:38 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id x61si2134513wec.13.2011.05.26.13.26.38; Thu, 26 May 2011 13:26:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QPh8e-0002Fu-D8 for ; Thu, 26 May 2011 20:26:36 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 1805F2E8963 for ; Thu, 26 May 2011 20:26:25 +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: 352 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 352: Quote the setenv arguments in boot.scr to avoid u-boot limits. Message-Id: <20110526202625.26382.28051.launchpad@loganberry.canonical.com> Date: Thu, 26 May 2011 20:26:25 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13117"; Instance="initZopeless config overlay" X-Launchpad-Hash: 11f926c870c534886c6ed7b5080834febc8f7b57 Merge authors: James Westby (james-w) Related merge proposals: https://code.launchpad.net/~james-w/linaro-image-tools/fix-panda/+merge/62552 proposed by: James Westby (james-w) review: Approve - Guilherme Salgado (salgado) ------------------------------------------------------------ revno: 352 [merge] committer: James Westby branch nick: trunk timestamp: Thu 2011-05-26 16:23:36 -0400 message: Quote the setenv arguments in boot.scr to avoid u-boot limits. 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 2011-05-24 02:22:47 +0000 +++ linaro_image_tools/media_create/boards.py 2011-05-26 20:19:23 +0000 @@ -910,13 +910,20 @@ return img -def make_boot_script(boot_env, boot_script_path): - boot_script_data = ( - "setenv bootcmd '%(bootcmd)s'\n" - "setenv bootargs %(bootargs)s\n" +def get_plain_boot_script_contents(boot_env): + # We use double quotes to avoid u-boot argument limits + # while retaining the ability to expand variables. See + # https://bugs.launchpad.net/linaro-image-tools/+bug/788765 + # for more. + return ( + 'setenv bootcmd "%(bootcmd)s"\n' + 'setenv bootargs "%(bootargs)s"\n' "boot" % boot_env) + +def make_boot_script(boot_env, boot_script_path): + boot_script_data = get_plain_boot_script_contents(boot_env) # Need to save the boot script data into a file that will be passed to # mkimage. _, tmpfile = tempfile.mkstemp() === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2011-05-24 02:22:47 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2011-05-26 20:02:13 +0000 @@ -25,6 +25,7 @@ import subprocess import sys import tempfile +import textwrap import time import types @@ -44,6 +45,7 @@ align_up, align_partition, board_configs, + get_plain_boot_script_contents, make_flashable_env, install_mx5_boot_loader, install_omap_boot_loader, @@ -626,6 +628,14 @@ '%s cp -v chroot_dir/MLO boot_disk' % sudo_args, 'sync'] self.assertEqual(expected, fixture.mock.commands_executed) + def test_get_plain_boot_script_contents(self): + boot_env = {'bootargs': 'mybootargs', 'bootcmd': 'mybootcmd'} + boot_script_data = get_plain_boot_script_contents(boot_env) + self.assertEqual(textwrap.dedent("""\ + setenv bootcmd "mybootcmd" + setenv bootargs "mybootargs" + boot"""), boot_script_data) + def test_make_boot_script(self): self.useFixture(MockSomethingFixture( tempfile, 'mkstemp', lambda: (-1, '/tmp/random-abxzr')))