From patchwork Tue Apr 17 17:16:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Tunnicliffe X-Patchwork-Id: 7907 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C8E6D23E13 for ; Tue, 17 Apr 2012 17:16:19 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 651EBA1805A for ; Tue, 17 Apr 2012 17:16:19 +0000 (UTC) Received: by iage36 with SMTP id e36so12569690iag.11 for ; Tue, 17 Apr 2012 10:16:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=sVwhwVkluwhNGAb4H5mdjTp1F7KnGF8STLpS++E6uWQ=; b=NNhdbo3ZraNcEAm9ia2NEmBE+L7WsQ5Kpe1SbniG1GwcopVbtkTYLzwwr2/YkuKsQA J22TQx2sbPRGcuA99QdizuffWSxYil34pkUK1hD77U7iZgQ/1iNDrE5U3Iy9nTL6dLy2 7u+QbF2lcdIY9m6e95Aeetfzs/H3+EajzQOCVlCnPyCLzDWAX/LkCRltzuQ3+h1ZqImi hjPM3OuiUsb5EhxB+fQKfZO3TsfviPN3T8uWdyRQBu2CD14feCrf/UX2yNCBpYZubaZv 0WYynqKsVvqLsK8Duk5/dGcfWh6LmyUCyge4EhIA+FUKLaremU3oqaPAoFOVfc9eQA2o 9LSg== Received: by 10.50.41.201 with SMTP id h9mr10593005igl.19.1334682978428; Tue, 17 Apr 2012 10:16:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp162409ibt; Tue, 17 Apr 2012 10:16:17 -0700 (PDT) Received: by 10.180.80.9 with SMTP id n9mr30409461wix.4.1334682977303; Tue, 17 Apr 2012 10:16:17 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id v54si22738274wec.28.2012.04.17.10.16.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Apr 2012 10:16:17 -0700 (PDT) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1SKC0m-0006Uq-PV for ; Tue, 17 Apr 2012 17:16:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B68B7E14AF for ; Tue, 17 Apr 2012 17:16:16 +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: 507 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 507: Merging in lp:~abnerf/linaro-image-tools/linaro-image-tools Message-Id: <20120417171616.8191.33745.launchpad@ackee.canonical.com> Date: Tue, 17 Apr 2012 17:16:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15099"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 8206ce0dfe006f8bb82c36f2d13958dc026011b7 X-Gm-Message-State: ALoCoQnkCVkeEz3lgJHriUsszsSDbsRmcCzDK5k6jlR0A1o9yqxyDl6P/L9SCH2/H9gowr5EuPU6 Merge authors: Abner Silva Luis Araujo (luis-araujo) Related merge proposals: https://code.launchpad.net/~abnerf/linaro-image-tools/linaro-image-tools/+merge/102354 proposed by: Abner Silva (abnerf) review: Approve - James Tunnicliffe (dooferlad) ------------------------------------------------------------ revno: 507 [merge] committer: James Tunnicliffe branch nick: trunk timestamp: Tue 2012-04-17 18:14:43 +0100 message: Merging in lp:~abnerf/linaro-image-tools/linaro-image-tools modified: 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_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-02-21 07:52:13 +0000 +++ linaro_image_tools/media_create/boards.py 2012-04-17 16:22:09 +0000 @@ -37,10 +37,12 @@ import string import logging +from parted import Device + from linaro_image_tools import cmd_runner from linaro_image_tools.media_create.partitions import ( - partition_mounted, SECTOR_SIZE) + partition_mounted, SECTOR_SIZE, register_loopback) KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s' @@ -1472,6 +1474,67 @@ mmc_part_offset = 1 mmc_option = '0:2' +class I386Config(BoardConfig): + # define serial + serial_tty = 'ttyS0' + _extra_serial_opts = 'console=tty0 console=%s,115200n8' + _live_serial_opts = 'serialtty=%s' + + # define kernel image + kernel_flavors = ['generic'] + + # define bootloader + BOOTLOADER_CMD = 'grub-install' + BOOTLOADER_CFG_FILE = 'grub/grub.cfg' + BOOTLOADER_CFG = """ + set timeout=3 + set default='0' + menuentry 'core' { + linux /%s root=LABEL=rootfs ro %s + initrd /%s + }""" + + @classproperty + def live_serial_opts(cls): + return cls._live_serial_opts % cls.serial_tty + + @classproperty + def extra_serial_opts(cls): + return cls._extra_serial_opts % cls.serial_tty + + @classmethod + def _make_boot_files(cls, boot_env, chroot_dir, boot_dir, + boot_device_or_file, k_img_data, i_img_data, + d_img_data): + # XXX: delete this method when hwpacks V1 can die + assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 + + # copy image and init into boot partition + cmd_runner.run(['cp', k_img_data, boot_dir], as_root=True).wait() + cmd_runner.run(['cp', i_img_data, boot_dir], as_root=True).wait() + + # create a loop device with the whole image + device = Device(boot_device_or_file) + img_size = device.getLength() * SECTOR_SIZE + img_loop = register_loopback(boot_device_or_file, 0, img_size) + + # install bootloader + cmd_runner.run([cls.BOOTLOADER_CMD, '--boot-directory=%s' % boot_dir, + '--modules', 'part_msdos', img_loop], + as_root=True).wait() + + # generate loader config file + loader_config = cls.BOOTLOADER_CFG % (os.path.basename(k_img_data), + cls.extra_serial_opts, os.path.basename(i_img_data)) + + _, tmpfile = tempfile.mkstemp() + atexit.register(os.unlink, tmpfile) + with open(tmpfile, 'w') as fd: + fd.write(loader_config) + + cmd_runner.run(['cp', tmpfile, os.path.join(boot_dir, + cls.BOOTLOADER_CFG_FILE)], as_root=True).wait() + board_configs = { 'beagle': BeagleConfig, @@ -1490,6 +1553,7 @@ 'smdkv310': SMDKV310Config, 'origen': OrigenConfig, 'mx6qsabrelite': BoardConfig, + 'i386': I386Config, }