Merge lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs into lp:linaro-image-tools/11.11

Proposed by Mattias Backman
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 485
Merged at revision: 483
Proposed branch: lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs
Merge into: lp:linaro-image-tools/11.11
Diff against target: 202 lines (+121/-1)
5 files modified
linaro-android-media-create (+2/-0)
linaro-media-create (+2/-0)
linaro_image_tools/media_create/__init__.py (+10/-0)
linaro_image_tools/media_create/boards.py (+12/-0)
linaro_image_tools/media_create/tests/test_media_create.py (+95/-1)
To merge this branch: bzr merge lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Linaro Android Team functional Pending
Zach Pfeffer Pending
Review via email: mp+88868@code.launchpad.net

Description of the change

Hi,

This branch add two command line options for adding to the boot args.

  --extra-boot-args EXTRA_BOOT_ARGS
                        Extra boot args.
  --extra-boot-args-file EXTRA_BOOT_ARGS_FILE
                        File containing extra boot arguments.

These options are available for l-m-c and l-a-m-c.

Thanks,

Mattias

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks fine. I think I would call add_boot_args from add_boot_args_from_file so any extra checks that you put in add_boot_args are automatically picked up from add_boot_args_from_file. Not required to check in though.

review: Approve
486. By Mattias Backman

Call add_boot_args() from add_boot_args_from_file().

Revision history for this message
Mattias Backman (mabac) wrote :

On Wed, Jan 18, 2012 at 4:05 PM, James Tunnicliffe
<email address hidden> wrote:
> Review: Approve
>
> Looks fine. I think I would call add_boot_args from add_boot_args_from_file so any extra checks that you put in add_boot_args are automatically picked up from add_boot_args_from_file. Not required to check in though.

Cool, thanks. I've made that change.

linaro-android: please verify that this is works as you requested, I'd
like to merge it tomorrow if possible so it gets in the release.

> --
> https://code.launchpad.net/~mabac/linaro-image-tools/bug-913819-additional-bootargs/+merge/88868
> You are the owner of lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs.

Revision history for this message
Amit Pundir (pundiramit) wrote :

Hi Mattias,

I checked out "bzr branch lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs" and prepared sdcard image like this:

bug-913819-additional-bootargs/linaro-android-media-create --mmc /dev/sdb --dev origen --system system.tar.bz2 --userdata userdata.tar.bz2 --boot boot.tar.bz2 --extra-boot-args xyz=1

But I don't see "xyz=1" bootarg entry in boot.scr. Am I missing something?

Revision history for this message
Mattias Backman (mabac) wrote :

On Wed, Jan 18, 2012 at 9:37 PM, Amit Pundir <email address hidden> wrote:
> Hi Mattias,
>
> I checked out "bzr branch lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs" and prepared sdcard image like this:
>
> bug-913819-additional-bootargs/linaro-android-media-create --mmc /dev/sdb --dev origen --system system.tar.bz2 --userdata userdata.tar.bz2 --boot boot.tar.bz2 --extra-boot-args xyz=1
>
> But I don't see "xyz=1" bootarg entry in boot.scr. Am I missing something?

Big oops, I think I missed adding the entry point to l-a-m-c while
trying to be clever and making this generic. Hang on while I fix it.

> --
> https://code.launchpad.net/~mabac/linaro-image-tools/bug-913819-additional-bootargs/+merge/88868
> You are the owner of lp:~mabac/linaro-image-tools/bug-913819-additional-bootargs.

487. By Mattias Backman

Add the new code to l-a-m-c as well.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro-android-media-create'
--- linaro-android-media-create 2011-10-05 09:19:03 +0000
+++ linaro-android-media-create 2012-01-19 09:46:07 +0000
@@ -105,6 +105,8 @@
105 SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc')105 SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc')
106106
107 board_config = android_board_configs[args.board]107 board_config = android_board_configs[args.board]
108 board_config.add_boot_args(args.extra_boot_args)
109 board_config.add_boot_args_from_file(args.extra_boot_args_file)
108110
109 if args.board == 'iMX53':111 if args.board == 'iMX53':
110 # XXX: remove this and the corresponding entry in android_board_configs112 # XXX: remove this and the corresponding entry in android_board_configs
111113
=== modified file 'linaro-media-create'
--- linaro-media-create 2011-10-19 12:19:33 +0000
+++ linaro-media-create 2012-01-19 09:46:07 +0000
@@ -119,6 +119,8 @@
119 board_config = board_configs[args.board]119 board_config = board_configs[args.board]
120 board_config.set_metadata(args.hwpacks)120 board_config.set_metadata(args.hwpacks)
121 board_config.set_board(args.board)121 board_config.set_board(args.board)
122 board_config.add_boot_args(args.extra_boot_args)
123 board_config.add_boot_args_from_file(args.extra_boot_args_file)
122124
123 ensure_required_commands(args)125 ensure_required_commands(args)
124126
125127
=== modified file 'linaro_image_tools/media_create/__init__.py'
--- linaro_image_tools/media_create/__init__.py 2011-10-19 14:18:52 +0000
+++ linaro_image_tools/media_create/__init__.py 2012-01-19 09:46:07 +0000
@@ -66,6 +66,14 @@
66 qemu_version = "Cannot find %s." % qemu_path66 qemu_version = "Cannot find %s." % qemu_path
67 return "%s\n: %s" % (__version__, qemu_version)67 return "%s\n: %s" % (__version__, qemu_version)
6868
69def add_common_options(parser):
70 parser.add_argument(
71 '--extra-boot-args', dest='extra_boot_args', required=False,
72 help='Extra boot args.')
73 parser.add_argument(
74 '--extra-boot-args-file', dest='extra_boot_args_file',
75 required=False, help=('File containing extra boot arguments.'))
76
69def get_args_parser():77def get_args_parser():
70 """Get the ArgumentParser for the arguments given on the command line."""78 """Get the ArgumentParser for the arguments given on the command line."""
71 parser = argparse.ArgumentParser(version='%(prog)s ' + get_version())79 parser = argparse.ArgumentParser(version='%(prog)s ' + get_version())
@@ -145,6 +153,7 @@
145 action='store_true',153 action='store_true',
146 help='Assume yes to the question "Are you 100%% sure, on selecting [mmc]"')154 help='Assume yes to the question "Are you 100%% sure, on selecting [mmc]"')
147 155
156 add_common_options(parser)
148 return parser157 return parser
149158
150def get_android_args_parser():159def get_android_args_parser():
@@ -188,4 +197,5 @@
188 '--align-boot-part', dest='should_align_boot_part',197 '--align-boot-part', dest='should_align_boot_part',
189 action='store_true',198 action='store_true',
190 help='Align boot partition too (might break older x-loaders).')199 help='Align boot partition too (might break older x-loaders).')
200 add_common_options(parser)
191 return parser201 return parser
192202
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2011-12-14 13:01:43 +0000
+++ linaro_image_tools/media_create/boards.py 2012-01-19 09:46:07 +0000
@@ -207,6 +207,7 @@
207 mmc_part_offset = 0207 mmc_part_offset = 0
208 uimage_path = ''208 uimage_path = ''
209 fat_size = 32209 fat_size = 32
210 extra_serial_opts = ''
210 _extra_serial_opts = ''211 _extra_serial_opts = ''
211 _live_serial_opts = ''212 _live_serial_opts = ''
212 extra_boot_args_options = None213 extra_boot_args_options = None
@@ -574,6 +575,17 @@
574 return boot_script575 return boot_script
575576
576 @classmethod577 @classmethod
578 def add_boot_args(cls, extra_args):
579 if extra_args is not None:
580 cls.extra_boot_args_options += ' %s' % extra_args
581
582 @classmethod
583 def add_boot_args_from_file(cls, path):
584 if path is not None:
585 with open(path, 'r') as boot_args_file:
586 cls.add_boot_args(boot_args_file.read().strip())
587
588 @classmethod
577 def _get_bootargs(cls, is_live, is_lowmem, consoles, rootfs_uuid):589 def _get_bootargs(cls, is_live, is_lowmem, consoles, rootfs_uuid):
578 """Get the bootargs for this board.590 """Get the bootargs for this board.
579591
580592
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py 2011-12-23 10:35:27 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-01-19 09:46:07 +0000
@@ -1412,6 +1412,100 @@
1412 self.assertEqual(expected, boot_commands)1412 self.assertEqual(expected, boot_commands)
14131413
14141414
1415class TestExtraBootCmd(TestCaseWithFixtures):
1416
1417 def test_no_extra_args(self):
1418 boot_args = ''.join(
1419 random.choice(string.ascii_lowercase) for x in range(15))
1420 class config(BoardConfig):
1421 extra_boot_args_options = boot_args
1422 boot_commands = config._get_boot_env(
1423 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1424 rootfs_uuid="deadbeef", d_img_data=None)
1425 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1426 boot_args])
1427 self.assertEqual(expected, boot_commands['bootargs'])
1428
1429 def test_none_extra_args(self):
1430 boot_args = ''.join(
1431 random.choice(string.ascii_lowercase) for x in range(15))
1432 extra_args = None
1433 class config(BoardConfig):
1434 extra_boot_args_options = boot_args
1435 config.add_boot_args(extra_args)
1436 boot_commands = config._get_boot_env(
1437 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1438 rootfs_uuid="deadbeef", d_img_data=None)
1439 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1440 boot_args])
1441 self.assertEqual(expected, boot_commands['bootargs'])
1442
1443 def test_string_extra_args(self):
1444 boot_args = ''.join(
1445 random.choice(string.ascii_lowercase) for x in range(15))
1446 extra_args = ''.join(
1447 random.choice(string.ascii_lowercase) for x in range(15))
1448 class config(BoardConfig):
1449 extra_boot_args_options = boot_args
1450 config.add_boot_args(extra_args)
1451 boot_commands = config._get_boot_env(
1452 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1453 rootfs_uuid="deadbeef", d_img_data=None)
1454 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1455 boot_args, extra_args])
1456 self.assertEqual(expected, boot_commands['bootargs'])
1457
1458 def test_file_extra_args(self):
1459 boot_args = ''.join(
1460 random.choice(string.ascii_lowercase) for x in range(15))
1461 extra_args = ''.join(
1462 random.choice(string.ascii_lowercase) for x in range(15))
1463 boot_arg_path = self.createTempFileAsFixture()
1464 with open(boot_arg_path, 'w') as boot_arg_file:
1465 boot_arg_file.write(extra_args)
1466 class config(BoardConfig):
1467 extra_boot_args_options = boot_args
1468 config.add_boot_args_from_file(boot_arg_path)
1469 boot_commands = config._get_boot_env(
1470 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1471 rootfs_uuid="deadbeef", d_img_data=None)
1472 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1473 boot_args, extra_args])
1474 self.assertEqual(expected, boot_commands['bootargs'])
1475
1476 def test_none_file_extra_args(self):
1477 boot_args = ''.join(
1478 random.choice(string.ascii_lowercase) for x in range(15))
1479 boot_arg_path = None
1480 class config(BoardConfig):
1481 extra_boot_args_options = boot_args
1482 config.add_boot_args_from_file(boot_arg_path)
1483 boot_commands = config._get_boot_env(
1484 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1485 rootfs_uuid="deadbeef", d_img_data=None)
1486 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1487 boot_args])
1488 self.assertEqual(expected, boot_commands['bootargs'])
1489
1490 def test_whitespace_file_extra_args(self):
1491 boot_args = ''.join(
1492 random.choice(string.ascii_lowercase) for x in range(15))
1493 extra_args = ''.join(
1494 random.choice(string.ascii_lowercase) for x in range(15))
1495 boot_arg_path = self.createTempFileAsFixture()
1496 with open(boot_arg_path, 'w') as boot_arg_file:
1497 boot_arg_file.write('\n\n \t ' + extra_args + ' \n\n')
1498 class config(BoardConfig):
1499 extra_boot_args_options = boot_args
1500 config.add_boot_args_from_file(boot_arg_path)
1501 boot_commands = config._get_boot_env(
1502 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
1503 rootfs_uuid="deadbeef", d_img_data=None)
1504 expected = ' '.join([' console=ttyXXX root=UUID=deadbeef rootwait ro',
1505 boot_args, extra_args])
1506 self.assertEqual(expected, boot_commands['bootargs'])
1507
1508
1415class TestGetBootCmdAndroid(TestCase):1509class TestGetBootCmdAndroid(TestCase):
1416 def test_panda(self):1510 def test_panda(self):
1417 # XXX: To fix bug 697824 we have to change class attributes of our1511 # XXX: To fix bug 697824 we have to change class attributes of our
@@ -1962,7 +2056,7 @@
1962 def wait(self):2056 def wait(self):
1963 return self.returncode2057 return self.returncode
19642058
1965 fixture = self.useFixture(MockCmdRunnerPopenFixture())2059 self.useFixture(MockCmdRunnerPopenFixture())
19662060
1967 tmpfile = self.createTempFileAsFixture()2061 tmpfile = self.createTempFileAsFixture()
1968 media = Media(tmpfile)2062 media = Media(tmpfile)

Subscribers

People subscribed via source and target branches