diff mbox

[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
State Accepted
Headers show

Commit Message

James Westby May 26, 2011, 8:26 p.m. UTC
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 <james.westby@linaro.org>
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
diff mbox

Patch

=== 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')))