=== modified file 'linaro-media-create'
@@ -106,6 +106,14 @@
parser = get_args_parser()
args = parser.parse_args()
+ ch = logging.StreamHandler()
+ ch.setLevel(logging.INFO)
+ formatter = logging.Formatter("%(message)s")
+ ch.setFormatter(formatter)
+ logger = logging.getLogger("linaro_image_tools")
+ logger.setLevel(logging.INFO)
+ logger.addHandler(ch)
+
try:
additional_option_checks(args)
except IncompatibleOptions as e:
@@ -154,14 +162,6 @@
# All good, move on.
pass
- ch = logging.StreamHandler()
- ch.setLevel(logging.INFO)
- formatter = logging.Formatter("%(message)s")
- ch.setFormatter(formatter)
- logger = logging.getLogger("linaro_image_tools")
- logger.setLevel(logging.INFO)
- logger.addHandler(ch)
-
# If --help was specified this won't execute.
# Create temp dir and initialize rest of path vars.
TMP_DIR = tempfile.mkdtemp()
=== modified file 'linaro_image_tools/hwpack/hwpack_fields.py'
@@ -91,6 +91,11 @@
'bootfs_rootfs',
'reserved_bootfs_rootfs', ]
+# Supported bootloaders
+U_BOOT = 'u_boot'
+UEFI = 'uefi'
+DEFAULT_BOOTLOADER = U_BOOT
+
# Define where fields are valid, so we can test them.
# If a key has a value None, this indicates there is either a value or
# list of values that can be associated with it.
=== modified file 'linaro_image_tools/media_create/__init__.py'
@@ -26,6 +26,9 @@
from linaro_image_tools.media_create.android_boards import (
android_board_configs)
from linaro_image_tools.__version__ import __version__
+from linaro_image_tools.hwpack.hwpack_fields import (
+ DEFAULT_BOOTLOADER
+)
KNOWN_BOARDS = board_configs.keys()
@@ -167,8 +170,9 @@
'on selecting [mmc]"'))
parser.add_argument(
'--bootloader',
- help="Select a bootloader from a hardware pack that contains more than"
- "one.")
+ help="Select a bootloader from a hardware pack that contains more "
+ "than one. If not specified, it will default to '%s'." %
+ DEFAULT_BOOTLOADER)
add_common_options(parser)
return parser
=== modified file 'linaro_image_tools/media_create/boards.py'
@@ -47,6 +47,10 @@
partition_mounted, SECTOR_SIZE, register_loopback)
from StringIO import StringIO
+from linaro_image_tools.hwpack.hwpack_fields import (
+ DEFAULT_BOOTLOADER,
+)
+
KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s'
INITRD_GLOB = 'initrd.img-*-%(kernel_flavor)s'
DTB_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)s'
@@ -438,6 +442,14 @@
hardwarepack_handler = None
+ @staticmethod
+ def _get_logger():
+ """
+ Gets the logger instance.
+ :return: The logger instance
+ """
+ return logging.getLogger('linaro_image_tools')
+
@classmethod
def get_metadata_field(cls, field_name):
""" Return the metadata value for field_name if it can be found.
@@ -451,6 +463,14 @@
@classmethod
def set_metadata(cls, hwpacks, bootloader=None, board=None):
+ # If not bootloader is specified, we use the default one.
+ logger = cls._get_logger()
+ if not bootloader:
+ logger.warning('WARNING: no bootloader specified on the command '
+ 'line. Defaulting to \'%s\'.' % DEFAULT_BOOTLOADER)
+ logger.warning('WARNING: specify another bootloader if this is '
+ 'not the correct one to use.')
+ bootloader = DEFAULT_BOOTLOADER
cls.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader,
board)
with cls.hardwarepack_handler: