diff options
author | James Westby <james.westby@linaro.org> | 2011-05-26 16:23:36 -0400 |
---|---|---|
committer | James Westby <james.westby@linaro.org> | 2011-05-26 16:23:36 -0400 |
commit | 10fde0c95d5e3d120467117c5b984a1ca3413274 (patch) | |
tree | 58ae7cd917c7f85ee011dcd937fa8305c138d484 | |
parent | b1899e416a02a8a8863f023420e9e7efe8bbbed4 (diff) | |
parent | 6bd2ca37f1c251aeedd7a803bc6e193c596703c3 (diff) |
Quote the setenv arguments in boot.scr to avoid u-boot limits.
-rw-r--r-- | linaro_image_tools/media_create/boards.py | 15 | ||||
-rw-r--r-- | linaro_image_tools/media_create/tests/test_media_create.py | 10 |
2 files changed, 21 insertions, 4 deletions
diff --git a/linaro_image_tools/media_create/boards.py b/linaro_image_tools/media_create/boards.py index 865c7cb..48e6977 100644 --- a/linaro_image_tools/media_create/boards.py +++ b/linaro_image_tools/media_create/boards.py @@ -910,13 +910,20 @@ def make_dtb(img_data, boot_disk): 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() diff --git a/linaro_image_tools/media_create/tests/test_media_create.py b/linaro_image_tools/media_create/tests/test_media_create.py index 9fa3b39..5dc13c8 100644 --- a/linaro_image_tools/media_create/tests/test_media_create.py +++ b/linaro_image_tools/media_create/tests/test_media_create.py @@ -25,6 +25,7 @@ import string import subprocess import sys import tempfile +import textwrap import time import types @@ -44,6 +45,7 @@ from linaro_image_tools.media_create.boards import ( 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 @@ class TestBoards(TestCaseWithFixtures): '%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'))) |