Merge lp:~milo/linaro-image-tools/bug1057639 into lp:linaro-image-tools/11.11

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 568
Proposed branch: lp:~milo/linaro-image-tools/bug1057639
Merge into: lp:linaro-image-tools/11.11
Diff against target: 120 lines (+39/-10)
4 files modified
linaro-media-create (+8/-8)
linaro_image_tools/hwpack/hwpack_fields.py (+5/-0)
linaro_image_tools/media_create/__init__.py (+6/-2)
linaro_image_tools/media_create/boards.py (+20/-0)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/bug1057639
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Linaro Infrastructure Pending
Review via email: mp+127270@code.launchpad.net

Description of the change

Branch adds default value for bootloader option when none is passed on the command line.
Default bootloader is set to 'u_boot'. A warning will be printed on the command line when no bootloader is specified.

To post a comment you must log in.
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Good approach on issuing a warning in case explicit value is not provided (I assume we want user to know what bootloader they will use by specifying it themselves). Also assume that moving logging configuration section around was necessary.

review: Approve
571. By Milo Casagrande

Added default bootloader to option help.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro-media-create'
--- linaro-media-create 2012-08-09 23:00:50 +0000
+++ linaro-media-create 2012-10-01 13:47:22 +0000
@@ -106,6 +106,14 @@
106 parser = get_args_parser()106 parser = get_args_parser()
107 args = parser.parse_args()107 args = parser.parse_args()
108108
109 ch = logging.StreamHandler()
110 ch.setLevel(logging.INFO)
111 formatter = logging.Formatter("%(message)s")
112 ch.setFormatter(formatter)
113 logger = logging.getLogger("linaro_image_tools")
114 logger.setLevel(logging.INFO)
115 logger.addHandler(ch)
116
109 try:117 try:
110 additional_option_checks(args)118 additional_option_checks(args)
111 except IncompatibleOptions as e:119 except IncompatibleOptions as e:
@@ -154,14 +162,6 @@
154 # All good, move on.162 # All good, move on.
155 pass163 pass
156164
157 ch = logging.StreamHandler()
158 ch.setLevel(logging.INFO)
159 formatter = logging.Formatter("%(message)s")
160 ch.setFormatter(formatter)
161 logger = logging.getLogger("linaro_image_tools")
162 logger.setLevel(logging.INFO)
163 logger.addHandler(ch)
164
165 # If --help was specified this won't execute.165 # If --help was specified this won't execute.
166 # Create temp dir and initialize rest of path vars.166 # Create temp dir and initialize rest of path vars.
167 TMP_DIR = tempfile.mkdtemp()167 TMP_DIR = tempfile.mkdtemp()
168168
=== modified file 'linaro_image_tools/hwpack/hwpack_fields.py'
--- linaro_image_tools/hwpack/hwpack_fields.py 2012-09-24 09:07:37 +0000
+++ linaro_image_tools/hwpack/hwpack_fields.py 2012-10-01 13:47:22 +0000
@@ -91,6 +91,11 @@
91 'bootfs_rootfs',91 'bootfs_rootfs',
92 'reserved_bootfs_rootfs', ]92 'reserved_bootfs_rootfs', ]
9393
94# Supported bootloaders
95U_BOOT = 'u_boot'
96UEFI = 'uefi'
97DEFAULT_BOOTLOADER = U_BOOT
98
94# Define where fields are valid, so we can test them.99# Define where fields are valid, so we can test them.
95# If a key has a value None, this indicates there is either a value or100# If a key has a value None, this indicates there is either a value or
96# list of values that can be associated with it.101# list of values that can be associated with it.
97102
=== modified file 'linaro_image_tools/media_create/__init__.py'
--- linaro_image_tools/media_create/__init__.py 2012-07-26 08:48:15 +0000
+++ linaro_image_tools/media_create/__init__.py 2012-10-01 13:47:22 +0000
@@ -26,6 +26,9 @@
26from linaro_image_tools.media_create.android_boards import (26from linaro_image_tools.media_create.android_boards import (
27 android_board_configs)27 android_board_configs)
28from linaro_image_tools.__version__ import __version__28from linaro_image_tools.__version__ import __version__
29from linaro_image_tools.hwpack.hwpack_fields import (
30 DEFAULT_BOOTLOADER
31)
2932
3033
31KNOWN_BOARDS = board_configs.keys()34KNOWN_BOARDS = board_configs.keys()
@@ -167,8 +170,9 @@
167 'on selecting [mmc]"'))170 'on selecting [mmc]"'))
168 parser.add_argument(171 parser.add_argument(
169 '--bootloader',172 '--bootloader',
170 help="Select a bootloader from a hardware pack that contains more than"173 help="Select a bootloader from a hardware pack that contains more "
171 "one.")174 "than one. If not specified, it will default to '%s'." %
175 DEFAULT_BOOTLOADER)
172176
173 add_common_options(parser)177 add_common_options(parser)
174 return parser178 return parser
175179
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2012-09-12 10:51:00 +0000
+++ linaro_image_tools/media_create/boards.py 2012-10-01 13:47:22 +0000
@@ -47,6 +47,10 @@
47 partition_mounted, SECTOR_SIZE, register_loopback)47 partition_mounted, SECTOR_SIZE, register_loopback)
48from StringIO import StringIO48from StringIO import StringIO
4949
50from linaro_image_tools.hwpack.hwpack_fields import (
51 DEFAULT_BOOTLOADER,
52)
53
50KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s'54KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s'
51INITRD_GLOB = 'initrd.img-*-%(kernel_flavor)s'55INITRD_GLOB = 'initrd.img-*-%(kernel_flavor)s'
52DTB_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)s'56DTB_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)s'
@@ -438,6 +442,14 @@
438442
439 hardwarepack_handler = None443 hardwarepack_handler = None
440444
445 @staticmethod
446 def _get_logger():
447 """
448 Gets the logger instance.
449 :return: The logger instance
450 """
451 return logging.getLogger('linaro_image_tools')
452
441 @classmethod453 @classmethod
442 def get_metadata_field(cls, field_name):454 def get_metadata_field(cls, field_name):
443 """ Return the metadata value for field_name if it can be found.455 """ Return the metadata value for field_name if it can be found.
@@ -451,6 +463,14 @@
451463
452 @classmethod464 @classmethod
453 def set_metadata(cls, hwpacks, bootloader=None, board=None):465 def set_metadata(cls, hwpacks, bootloader=None, board=None):
466 # If not bootloader is specified, we use the default one.
467 logger = cls._get_logger()
468 if not bootloader:
469 logger.warning('WARNING: no bootloader specified on the command '
470 'line. Defaulting to \'%s\'.' % DEFAULT_BOOTLOADER)
471 logger.warning('WARNING: specify another bootloader if this is '
472 'not the correct one to use.')
473 bootloader = DEFAULT_BOOTLOADER
454 cls.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader,474 cls.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader,
455 board)475 board)
456 with cls.hardwarepack_handler:476 with cls.hardwarepack_handler:

Subscribers

People subscribed via source and target branches