=== modified file 'linaro-android-media-create'
@@ -102,11 +102,11 @@
DATA_DISK = os.path.join(TMP_DIR, 'userdata-disc')
SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc')
- board_config = android_board_configs[args.board]
+ board_config = android_board_configs[args.dev]
board_config.add_boot_args(args.extra_boot_args)
board_config.add_boot_args_from_file(args.extra_boot_args_file)
- if args.board == 'iMX53':
+ if args.dev == 'iMX53':
# XXX: remove this and the corresponding entry in android_board_configs
print "DEPRECATION WARNING: iMX53 is deprecated, please use mx53loco."
=== modified file 'linaro-media-create'
@@ -129,9 +129,9 @@
print >> sys.stderr, "\nError:", e.value
sys.exit(1)
- board_config = board_configs[args.board]
- board_config.set_metadata(args.hwpacks)
- board_config.set_board(args.board)
+ board_config = board_configs[args.dev]
+ board_config.set_metadata(args.hwpacks, args.bootloader, args.dev)
+ board_config.set_board(args.dev)
board_config.add_boot_args(args.extra_boot_args)
board_config.add_boot_args_from_file(args.extra_boot_args_file)
@@ -141,7 +141,7 @@
if not board_config.supports_writing_to_mmc:
print ("The board '%s' does not support the --mmc option. "
"Please use --image_file to create an image file for this "
- "board." % args.board)
+ "board." % args.dev)
sys.exit(1)
if not confirm_device_selection_and_ensure_it_is_ready(
args.device, args.nocheck_mmc):
=== modified file 'linaro_image_tools/hwpack/config.py'
@@ -215,7 +215,7 @@
self._validate_mmc_id()
self._validate_extra_boot_options()
self._validate_boot_script()
- self._validate_uboot_in_boot_part()
+ self._validate_bootloader_file_in_boot_part()
self._validate_uboot_dd()
self._validate_spl_in_boot_part()
self._validate_spl_dd()
@@ -289,7 +289,7 @@
return self._get_option(BOARDS_FIELD)
@property
- def uboot_in_boot_part(self):
+ def bootloader_file_in_boot_part(self):
"""Whether uboot binary should be put in the boot partition. A str."""
return self._get_bootloader_option(self.UBOOT_IN_BOOT_PART_KEY)
@@ -993,11 +993,11 @@
return False
return string.lower(value) in ['yes', 'no']
- def _validate_uboot_in_boot_part(self):
- if not self._validate_bool(self.uboot_in_boot_part):
+ def _validate_bootloader_file_in_boot_part(self):
+ if not self._validate_bool(self.bootloader_file_in_boot_part):
raise HwpackConfigError(
"Invalid value for u_boot_in_boot_part: %s"
- % self.uboot_in_boot_part)
+ % self.bootloader_file_in_boot_part)
def _validate_spl_in_boot_part(self):
spl_in_boot_part = self.spl_in_boot_part
=== modified file 'linaro_image_tools/hwpack/hardwarepack.py'
@@ -122,7 +122,8 @@
partition_layout=None, mmc_id=None, boot_min_size=None,
root_min_size=None, loader_min_size=None, vmlinuz=None,
initrd=None, dtb_addr=None, extra_boot_options=None,
- env_dd=None, boot_script=None, uboot_in_boot_part=None,
+ env_dd=None, boot_script=None,
+ bootloader_file_in_boot_part=None,
uboot_dd=None, spl_in_boot_part=None, spl_dd=None,
extra_serial_opts=None, loader_start=None,
snowball_startup_files_config=None,
@@ -152,7 +153,7 @@
self.dtb_addr = dtb_addr
self.extra_boot_options = extra_boot_options
self.boot_script = boot_script
- self.uboot_in_boot_part = uboot_in_boot_part
+ self.bootloader_file_in_boot_part = bootloader_file_in_boot_part
self.uboot_dd = uboot_dd
self.spl_in_boot_part = spl_in_boot_part
self.spl_dd = spl_dd
@@ -226,7 +227,8 @@
spl_dd=config.spl_dd,
spl_in_boot_part=config.spl_in_boot_part,
uboot_dd=config.uboot_dd,
- uboot_in_boot_part=config.uboot_in_boot_part,
+ bootloader_file_in_boot_part=config.
+ bootloader_file_in_boot_part,
vmlinuz=config.vmlinuz,
wired_interfaces=config.wired_interfaces,
wireless_interfaces=config.wireless_interfaces,
@@ -387,8 +389,9 @@
metadata += "EXTRA_BOOT_OPTIONS=%s\n" % self.extra_boot_options
if self.boot_script is not None:
metadata += "BOOT_SCRIPT=%s\n" % self.boot_script
- if self.uboot_in_boot_part is not None:
- metadata += "U_BOOT_IN_BOOT_PART=%s\n" % self.uboot_in_boot_part
+ if self.bootloader_file_in_boot_part is not None:
+ metadata += ("U_BOOT_IN_BOOT_PART=%s\n" %
+ self.bootloader_file_in_boot_part)
if self.spl_in_boot_part is not None:
metadata += "SPL_IN_BOOT_PART=%s\n" % self.spl_in_boot_part
if self.uboot_dd is not None:
=== modified file 'linaro_image_tools/hwpack/tests/test_config.py'
@@ -514,7 +514,7 @@
config = self.get_config(self.valid_complete_v2 + self.valid_end)
config.validate()
self.assertEqual("Yes",
- config.uboot_in_boot_part)
+ config.bootloader_file_in_boot_part)
def test_spl_package(self):
config = self.get_config(self.valid_complete_v2 + self.valid_end)
=== modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py'
@@ -280,7 +280,7 @@
" in_boot_part: Nope\n")
self.assertValidationError(
"Invalid value for u_boot_in_boot_part: Nope",
- config._validate_uboot_in_boot_part)
+ config._validate_bootloader_file_in_boot_part)
def test_find_board_specific_variable(self):
config = self.get_config(
@@ -294,8 +294,8 @@
config.set_bootloader("u_boot")
config.set_board("panda")
- config._validate_uboot_in_boot_part()
- self.assertEqual(config.uboot_in_boot_part, "yes")
+ config._validate_bootloader_file_in_boot_part()
+ self.assertEqual(config.bootloader_file_in_boot_part, "yes")
def test_board_specific_overwrites_global(self):
config = self.get_config(
@@ -312,8 +312,8 @@
config.set_bootloader("u_boot")
config.set_board("panda")
- config._validate_uboot_in_boot_part()
- self.assertEqual(config.uboot_in_boot_part, "yes")
+ config._validate_bootloader_file_in_boot_part()
+ self.assertEqual(config.bootloader_file_in_boot_part, "yes")
def test_validate_serial_tty(self):
config = self.get_config(self.valid_start_v3 + "serial_tty: tty\n")
@@ -504,7 +504,7 @@
config = self.get_config(self.valid_complete_v3 + self.valid_end)
config.validate()
self.assertEqual("yes",
- config.uboot_in_boot_part)
+ config.bootloader_file_in_boot_part)
def test_spl_package(self):
config = self.get_config(self.valid_complete_v3 + self.valid_end)
=== modified file 'linaro_image_tools/media_create/__init__.py'
@@ -96,7 +96,7 @@
help=('Read the hardware pack and print information about the '
'supported boards and bootloaders.'))
parser.add_argument(
- '--dev', dest='board', choices=KNOWN_BOARDS,
+ '--dev', dest='dev', choices=KNOWN_BOARDS,
help='Generate an SD card or image for the given board.')
parser.add_argument(
'--rootfs', default='ext4', choices=['ext2', 'ext3', 'ext4', 'btrfs'],
@@ -165,6 +165,10 @@
action='store_true',
help=('Assume yes to the question "Are you 100%% sure, '
'on selecting [mmc]"'))
+ parser.add_argument(
+ '--bootloader',
+ help="Select a bootloader from a hardware pack that contains more than"
+ "one.")
add_common_options(parser)
return parser
@@ -184,7 +188,7 @@
help=('The image size, specified in mega/giga bytes (e.g. 3000M or '
'3G); use with --image_file only'))
parser.add_argument(
- '--dev', required=True, dest='board', choices=ANDROID_KNOWN_BOARDS,
+ '--dev', required=True, dest='dev', choices=ANDROID_KNOWN_BOARDS,
help='Generate an SD card or image for the given board.')
parser.add_argument(
'--boot-label', '--boot_label', default='boot',
=== modified file 'linaro_image_tools/media_create/boards.py'
@@ -123,9 +123,11 @@
hwpack_tarfiles = []
tempdir = None
- def __init__(self, hwpacks):
+ def __init__(self, hwpacks, bootloader=None, board=None):
self.hwpacks = hwpacks
self.hwpack_tarfiles = []
+ self.bootloader = bootloader
+ self.board = board
class FakeSecHead(object):
""" Add a fake section header to the metadata file.
@@ -169,7 +171,8 @@
if re.search("=", lines[0]) and not re.search(":", lines[0]):
# Probably V2 hardware pack without [hwpack] on the first line
lines = ["[hwpack]\n"] + lines
- parser = Config(StringIO("".join(lines)))
+ parser = Config(StringIO("".join(lines)), self.bootloader,
+ self.board)
try:
new_data = parser.get_option(field)
if new_data is not None:
@@ -213,7 +216,7 @@
# These attributes may not need to be redefined on some subclasses.
uboot_flavor = None
# whether to copy u-boot to the boot partition
- uboot_in_boot_part = False
+ bootloader_file_in_boot_part = False
uboot_dd = False
spl_in_boot_part = False
spl_dd = False
@@ -299,8 +302,9 @@
cls.board = board
@classmethod
- def set_metadata(cls, hwpacks):
- cls.hardwarepack_handler = HardwarepackHandler(hwpacks)
+ def set_metadata(cls, hwpacks, bootloader=None, board=None):
+ cls.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader,
+ board)
with cls.hardwarepack_handler:
cls.hwpack_format = cls.hardwarepack_handler.get_format()
if (cls.hwpack_format == cls.hardwarepack_handler.FORMAT_1):
@@ -380,13 +384,14 @@
align_up(int(loader_min_size) * 1024 ** 2,
SECTOR_SIZE) / SECTOR_SIZE)
- uboot_in_boot_part = cls.get_metadata_field('uboot_in_boot_part')
- if uboot_in_boot_part is None:
- cls.uboot_in_boot_part = False
- elif string.lower(uboot_in_boot_part) == 'yes':
- cls.uboot_in_boot_part = True
- elif string.lower(uboot_in_boot_part) == 'no':
- cls.uboot_in_boot_part = False
+ bootloader_file_in_boot_part = cls.get_metadata_field(
+ 'bootloader_file_in_boot_part')
+ if bootloader_file_in_boot_part is None:
+ cls.bootloader_file_in_boot_part = False
+ elif string.lower(bootloader_file_in_boot_part) == 'yes':
+ cls.bootloader_file_in_boot_part = True
+ elif string.lower(bootloader_file_in_boot_part) == 'no':
+ cls.bootloader_file_in_boot_part = False
spl_in_boot_part = cls.get_metadata_field('spl_in_boot_part')
if spl_in_boot_part is None:
cls.spl_in_boot_part = False
@@ -767,7 +772,7 @@
uboot_parts_dir = os.path.join(chroot_dir, parts_dir)
cmd_runner.run(['mkdir', '-p', boot_disk]).wait()
with partition_mounted(boot_partition, boot_disk):
- if cls.uboot_in_boot_part:
+ if cls.bootloader_file_in_boot_part:
with cls.hardwarepack_handler:
# <legacy v1 support>
if cls.uboot_flavor is not None:
@@ -855,7 +860,7 @@
class OmapConfig(BoardConfig):
kernel_flavors = ['linaro-omap4', 'linaro-lt-omap', 'linaro-omap', 'omap4']
- uboot_in_boot_part = True
+ bootloader_file_in_boot_part = True
# XXX: Here we define these things as dynamic properties because our
# temporary hack to fix bug 697824 relies on changing the board's
@@ -978,7 +983,7 @@
class IgepConfig(BeagleConfig):
- uboot_in_boot_part = False
+ bootloader_file_in_boot_part = False
uboot_flavor = None
dtb_name = 'isee-igep-v2.dtb'
@@ -1327,7 +1332,7 @@
class VexpressConfig(BoardConfig):
uboot_flavor = 'ca9x4_ct_vxp'
- uboot_in_boot_part = True
+ bootloader_file_in_boot_part = True
serial_tty = 'ttyAMA0'
_extra_serial_opts = 'console=tty0 console=%s,38400n8'
_live_serial_opts = 'serialtty=%s'
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
@@ -142,6 +142,53 @@
self.metadata = (
"NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\nORIGIN=linaro\n")
+ def test_hardwarepack_bootloaders(self):
+ metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: "
+ "armel\norigin: linaro\n")
+ metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: "
+ "b_file\n")
+ data = '3.0'
+ format = "%s\n" % data
+ tarball = self.add_to_tarball(
+ [('FORMAT', format), ('metadata', metadata)])
+ hp = HardwarepackHandler([tarball], bootloader='u_boot')
+ with hp:
+ self.assertEquals(hp.get_field('u_boot_file')[0], 'a_file')
+
+ def test_hardwarepack_boards(self):
+ metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: "
+ "armel\norigin: linaro\n")
+ metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: "
+ "b_file\n")
+ metadata += ("boards:\n panda:\n bootloaders:\n u_boot:\n "
+ "file: panda_file")
+ data = '3.0'
+ format = "%s\n" % data
+ tarball = self.add_to_tarball(
+ [('FORMAT', format), ('metadata', metadata)])
+ hp = HardwarepackHandler([tarball], board='panda')
+ with hp:
+ self.assertEquals(hp.get_field('u_boot_file')[0], 'panda_file')
+
+ def test_hardwarepack_boards_and_bootloaders(self):
+ metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: "
+ "armel\norigin: linaro\n")
+ metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: "
+ "b_file\n")
+ metadata += ("boards:\n panda:\n bootloaders:\n u_boot:\n "
+ "file: panda_file\n uefi:\n file: "
+ "uefi_panda_file\n")
+ metadata += (" panda-lt:\n bootloaders:\n u_boot:\n "
+ "file: panda_lt_file")
+ data = '3.0'
+ format = "%s\n" % data
+ tarball = self.add_to_tarball(
+ [('FORMAT', format), ('metadata', metadata)])
+ hp = HardwarepackHandler([tarball], board='panda', bootloader='uefi')
+ with hp:
+ self.assertEquals(hp.get_field('u_boot_file')[0],
+ 'uefi_panda_file')
+
def add_to_tarball(self, files, tarball=None):
if tarball is None:
tarball = self.tarball_fixture.get_tarball()
@@ -2880,10 +2927,10 @@
self.expected_calls, self.popen_fixture.mock.commands_executed)
self.assertEquals(self.expected_args, self.saved_args)
- def test_populate_boot_uboot_in_boot_part(self):
+ def test_populate_boot_bootloader_file_in_boot_part(self):
self.prepare_config(boards.BoardConfig)
self.config.uboot_flavor = "uboot_flavor"
- self.config.uboot_in_boot_part = True
+ self.config.bootloader_file_in_boot_part = True
self.call_populate_boot(self.config)
expected_calls = self.expected_calls[:]
expected_calls.insert(2,
@@ -2893,9 +2940,19 @@
expected_calls, self.popen_fixture.mock.commands_executed)
self.assertEquals(self.expected_args, self.saved_args)
+ def test_populate_boot_bootloader_file_in_boot_part_false(self):
+ self.prepare_config(boards.BoardConfig)
+ self.config.uboot_flavor = "uboot_flavor"
+ self.config.bootloader_file_in_boot_part = False
+ self.call_populate_boot(self.config)
+ expected_calls = self.expected_calls[:]
+ self.assertEquals(
+ expected_calls, self.popen_fixture.mock.commands_executed)
+ self.assertEquals(self.expected_args, self.saved_args)
+
def test_populate_boot_no_uboot_flavor(self):
self.prepare_config(boards.BoardConfig)
- self.config.uboot_in_boot_part = True
+ self.config.bootloader_file_in_boot_part = True
self.assertRaises(
AssertionError, self.call_populate_boot, self.config)