From patchwork Tue Dec 10 17:35:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 22226 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A22BF23908 for ; Tue, 10 Dec 2013 17:35:36 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id o6sf20552699oag.11 for ; Tue, 10 Dec 2013 09:35:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=v6gZEln7jxV+LuA3sY7uN3Z7TE+aHig9J4QXNr1Uc3s=; b=kNQRp3EfMlbnasuN1kUui6mCM3NwUjNvZPdqUHejIz9ld/oVT/d3SYqa2K7V9vqsIA /gOGnlhM9FLjwhnQM0QMWDsRdXtCPWC1/l5d3ElXYVJmC1SNyJrI8j2VEy2R8Nocv/ef RNJFkx2DUTDWBhCaT08VV3l9a2coPNZuhqchOJxyS1GfE079O1hHtyinND9idom8BDRn PXBGzo1YloPfjVj/O+jjir+ZVVfJWURNjjWbsnndkmAwLSwqg5HrAToTmIDfLgefv7uo 6YJSl0OOLYqi5cfaIYjnNHwhIPzgrfMvLAo/4fM6OhfpbtBc4wSZ3HknLEmlvq8XAgoH iNwg== X-Gm-Message-State: ALoCoQkcpA9PNw5ik+NQ5XERB8Ji5E2v4+8Eu5FUr3TVqz0zekDFZ8DgOIJkhsfMU38T/cHjFZeK X-Received: by 10.182.186.73 with SMTP id fi9mr1042424obc.48.1386696935276; Tue, 10 Dec 2013 09:35:35 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.129 with SMTP id h1ls2468813qez.15.gmail; Tue, 10 Dec 2013 09:35:35 -0800 (PST) X-Received: by 10.220.16.73 with SMTP id n9mr1424266vca.24.1386696935129; Tue, 10 Dec 2013 09:35:35 -0800 (PST) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id vq3si5336423veb.103.2013.12.10.09.35.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 09:35:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so2944441vcb.31 for ; Tue, 10 Dec 2013 09:35:34 -0800 (PST) X-Received: by 10.52.230.35 with SMTP id sv3mr1182906vdc.27.1386696934870; Tue, 10 Dec 2013 09:35:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp206224vcz; Tue, 10 Dec 2013 09:35:33 -0800 (PST) X-Received: by 10.180.171.34 with SMTP id ar2mr13041811wic.25.1386696932983; Tue, 10 Dec 2013 09:35:32 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id w3si7125169wjz.135.2013.12.10.09.35.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Dec 2013 09:35:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1VqRDY-0004En-FJ for ; Tue, 10 Dec 2013 17:35:32 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 6330DE02FF for ; Tue, 10 Dec 2013 17:35:32 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 647 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 647: Added checks for dtb_files field and command line options. Message-Id: <20131210173532.12772.86356.launchpad@ackee.canonical.com> Date: Tue, 10 Dec 2013 17:35:32 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16869"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: c803c75a5f271d0c2957dc22636f6571713f8c3d X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Georgy Redkozubov (gesha) Related merge proposals: https://code.launchpad.net/~gesha/linaro-image-tools/1235941/+merge/198406 proposed by: Georgy Redkozubov (gesha) review: Approve - Milo Casagrande (milo) ------------------------------------------------------------ revno: 647 [merge] author: Georgy Redkozubov committer: Milo Casagrande branch nick: trunk timestamp: Tue 2013-12-10 18:34:39 +0100 message: Added checks for dtb_files field and command line options. modified: linaro-media-create linaro_image_tools/media_create/__init__.py linaro_image_tools/media_create/boards.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro-media-create' --- linaro-media-create 2013-08-19 07:39:34 +0000 +++ linaro-media-create 2013-10-24 18:44:58 +0000 @@ -144,7 +144,8 @@ atexit.register(enable_automount) board_config = get_board_config(args.dev) - board_config.set_metadata(args.hwpacks, args.bootloader, args.dev) + board_config.set_metadata(args.hwpacks, args.bootloader, args.dev, + args.dtb_file) board_config.add_boot_args(args.extra_boot_args) board_config.add_boot_args_from_file(args.extra_boot_args_file) === modified file 'linaro_image_tools/media_create/__init__.py' --- linaro_image_tools/media_create/__init__.py 2013-02-17 13:53:41 +0000 +++ linaro_image_tools/media_create/__init__.py 2013-10-24 18:44:58 +0000 @@ -174,6 +174,11 @@ help="Select a bootloader from a hardware pack that contains more " "than one. If not specified, it will default to '%s'." % DEFAULT_BOOTLOADER) + parser.add_argument( + '--dtb-file', + help="Select a DTB file from a hardware pack that contains more " + "than one. If not specified, it will default to the first " + "entry in 'dtb_files' list.") add_common_options(parser) return parser === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2013-09-23 09:55:03 +0000 +++ linaro_image_tools/media_create/boards.py 2013-10-24 18:44:58 +0000 @@ -257,7 +257,8 @@ data, _ = self.hardwarepack_handler.get_field(field_name) return data - def set_metadata(self, hwpacks, bootloader=None, board=None): + def set_metadata(self, hwpacks, bootloader=None, board=None, + dtb_file=None): self.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader, board) with self.hardwarepack_handler: @@ -310,6 +311,12 @@ logger.warn("Deprecation warning: use the 'dtb_files' field " "instead of 'dtb_file'.") self.dtb_files = self.get_metadata_field(DTB_FILES_FIELD) + if dtb_file: + dtb_dict = self._find_dtb_dict(dtb_file) + if dtb_dict: + self.dtb_files = [] + self.dtb_files.append(dtb_dict) + self.extra_boot_args_options = self.get_metadata_field( EXTRA_BOOT_OPTIONS_FIELD) self.boot_script = self.get_metadata_field(BOOT_SCRIPT_FIELD) @@ -873,6 +880,25 @@ if self.dtb_file: dtb = _get_file_matching(os.path.join(path, self.dtb_file)) if not self.dtb_file or not dtb: + logger.warn("Could not find a valid dtb file from dtb_file, " + "trying dtb_files...") + + if self.dtb_files: + # Use first file from list as a default dtb file. + dtb_file = self.dtb_files[0] + if dtb_file: + if isinstance(dtb_file, dict): + for key, value in dtb_file.iteritems(): + # The name of the dtb file. + to_file = os.path.basename(key) + from_file = value + + # User specified only the directory, without renaming + # the file. + if not to_file: + to_file = os.path.basename(from_file) + dtb = _get_file_matching(os.path.join(path, from_file)) + if not self.dtb_files or not dtb: logger.warn("Could not find a valid dtb file, skipping it.") logger.info("Will use kernel=%s, initrd=%s, dtb=%s." % @@ -900,6 +926,16 @@ presence = True return presence + def _find_dtb_dict(self, dtb): + """Returns dictionary entry from dt_files containing dtb file.""" + for dtb_file in self.dtb_files: + if isinstance(dtb_file, dict): + for key, value in dtb_file.iteritems(): + # The name of the dtb file. + if dtb in key: + return dtb_file + return None + class OmapConfig(BoardConfig): def __init__(self):