From patchwork Thu Oct 4 14:00:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 11985 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 B7ACC1D50FF for ; Thu, 4 Oct 2012 14:00:34 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 42C58A18AC3 for ; Thu, 4 Oct 2012 14:00:34 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so978796iej.11 for ; Thu, 04 Oct 2012 07:00:33 -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=/DELkEZH1J0ZQzlhPPAQLLBvPrSIkkaUfZAFoWUNzE8=; b=lfsuydE5HH8pdUrzj3WGqs3Ebl5BNA6w5ktuSM0FvPhe9N88HZ4K7hBBlZg0hekhPz WzH4+SKoMdja6DA0y3+8nHqcGCP9Ba5BSKpQUJE/VEgZNYcCWK9SSUAIxvum2cms7NSt sIwmCJMF6EqYYSg3g/CMVMGaSsTOigtkNukc1dL+NfiW7ysmuAYQN3qmjVWTeZRA3E7g h5q7M9SgojBxSFptDjyBjde5bqWPnTdFnpX0r73Cz/oVY7KEpNDdhopvffdoimHfrJDN DAGlbARFE8klHHzKojQqi7GhWPOyN0NU8fFyGY2uU0RJxVTvPx0kOWBdWEMPYM7+psLm lWxQ== Received: by 10.50.150.198 with SMTP id uk6mr5316404igb.43.1349359233554; Thu, 04 Oct 2012 07:00:33 -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.50.184.232 with SMTP id ex8csp68220igc; Thu, 4 Oct 2012 07:00:32 -0700 (PDT) Received: by 10.181.13.239 with SMTP id fb15mr13163348wid.22.1349359232025; Thu, 04 Oct 2012 07:00:32 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id o11si8342905wee.32.2012.10.04.07.00.31 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Oct 2012 07:00:32 -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 1TJlyZ-0000ao-5B for ; Thu, 04 Oct 2012 14:00:31 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 1907BE025F for ; Thu, 4 Oct 2012 14:00:31 +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: 571 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 571: Changes to make extract_kpkgs to not use qemu, which allows support for OE ARMv8. Message-Id: <20121004140031.11399.50441.launchpad@ackee.canonical.com> Date: Thu, 04 Oct 2012 14:00:31 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16061"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 30204342b04891c8d87a55ed11360467ee0d531c X-Gm-Message-State: ALoCoQkL3uer4vKVe8a1R+aJGtUw57ZDs+NzctKbwf9jbJfqBhQg6em7Mzrx7UGUphqSCpNQU0zm Merge authors: Ricardo Salveti (rsalveti) Related merge proposals: https://code.launchpad.net/~rsalveti/linaro-image-tools/extract-cmd-aarch64/+merge/127977 proposed by: Ricardo Salveti (rsalveti) review: Approve - Milo Casagrande (milo) ------------------------------------------------------------ revno: 571 [merge] author: Ricardo Salveti committer: Milo Casagrande branch nick: trunk timestamp: Thu 2012-10-04 15:58:54 +0200 message: Changes to make extract_kpkgs to not use qemu, which allows support for OE ARMv8. modified: linaro-hwpack-install linaro_image_tools/media_create/chroot_utils.py linaro_image_tools/media_create/tests/test_media_create.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-hwpack-install' --- linaro-hwpack-install 2012-08-17 04:37:44 +0000 +++ linaro-hwpack-install 2012-10-04 09:12:57 +0000 @@ -53,7 +53,7 @@ exit 1 } -usage_msg="Usage: $(basename $0) [--install-latest] [--force-yes] --hwpack-version --hwpack-arch --hwpack-name HWPACK_TARBALL" +usage_msg="Usage: $(basename $0) [--install-latest] [--force-yes] [--extract-kernel-only] --hwpack-version --hwpack-arch --hwpack-name HWPACK_TARBALL" if [ $# -eq 0 ]; then die $usage_msg fi @@ -256,14 +256,17 @@ extract_kernel_packages() { echo "Extracting all kernel packages ..." + # We assume the hwpack is always available at the rootfs + ROOTFS_DIR=$(dirname $HWPACK_TARBALL) + ls ${HWPACK_DIR}/pkgs/linux-[ih]*.deb | while read pkg; do echo "Extracting package `basename $pkg`" - dpkg-deb -x ${pkg} / + dpkg-deb -x ${pkg} $ROOTFS_DIR done # manually generate modules.dep - ls /lib/modules | while read kernel; do - depmod ${kernel} || true + ls $ROOTFS_DIR/lib/modules | while read kernel; do + depmod -b $ROOTFS_DIR ${kernel} || true done; } === modified file 'linaro_image_tools/media_create/chroot_utils.py' --- linaro_image_tools/media_create/chroot_utils.py 2012-08-09 12:08:40 +0000 +++ linaro_image_tools/media_create/chroot_utils.py 2012-10-04 09:12:57 +0000 @@ -45,28 +45,33 @@ def install_hwpacks( - chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, + rootfs_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, extract_kpkgs=False, *hwpack_files): - """Install the given hwpacks onto the given chroot.""" - prepare_chroot(chroot_dir, tmp_dir) - - linaro_hwpack_install_path = find_command( - 'linaro-hwpack-install', prefer_dir=tools_dir) - # FIXME: shouldn't use chroot/usr/bin as this might conflict with installed - # packages; would be best to use some custom directory like - # chroot/linaro-image-tools/bin - copy_file(linaro_hwpack_install_path, - os.path.join(chroot_dir, 'usr', 'bin')) - - try: - mount_chroot_proc(chroot_dir) + """Install the given hwpacks onto the given rootfs.""" + + # In case we just want to extract the kernel packages, don't force qemu + # with chroot, as we could have archs without qemu support + + if not extract_kpkgs: + prepare_chroot(rootfs_dir, tmp_dir) + + linaro_hwpack_install_path = find_command( + 'linaro-hwpack-install', prefer_dir=tools_dir) + + # FIXME: shouldn't use chroot/usr/bin as this might conflict with + # installed packages; would be best to use some custom directory like + # chroot/linaro-image-tools/bin + copy_file(linaro_hwpack_install_path, + os.path.join(rootfs_dir, 'usr', 'bin')) + + mount_chroot_proc(rootfs_dir) try: # Sometimes the host will have qemu-user-static installed but # another package (i.e. scratchbox) will have mangled its config # and thus we won't be able to chroot and install the hwpack, so # we fail here and tell the user to ensure qemu-arm-static is # setup before trying again. - cmd_runner.run(['true'], as_root=True, chroot=chroot_dir).wait() + cmd_runner.run(['true'], as_root=True, chroot=rootfs_dir).wait() except: print ("Cannot proceed with hwpack installation because " "there doesn't seem to be a binfmt interpreter registered " @@ -75,26 +80,27 @@ "configured before trying again.") raise + try: for hwpack_file in hwpack_files: hwpack_verified = False if os.path.basename(hwpack_file) in verified_files: hwpack_verified = True - install_hwpack(chroot_dir, hwpack_file, extract_kpkgs, + install_hwpack(rootfs_dir, hwpack_file, extract_kpkgs, hwpack_force_yes or hwpack_verified) finally: run_local_atexit_funcs() -def install_hwpack(chroot_dir, hwpack_file, extract_kpkgs, hwpack_force_yes): - """Install an hwpack on the given chroot. +def install_hwpack(rootfs_dir, hwpack_file, extract_kpkgs, hwpack_force_yes): + """Install an hwpack on the given rootfs. - Copy the hwpack file to the chroot and run linaro-hwpack-install passing + Copy the hwpack file to the rootfs and run linaro-hwpack-install passing that hwpack file to it. If hwpack_force_yes is True, also pass --force-yes to linaro-hwpack-install. In case extract_kpkgs is True, it will not install all the packages, but just extract the kernel ones. """ hwpack_basename = os.path.basename(hwpack_file) - copy_file(hwpack_file, chroot_dir) + copy_file(hwpack_file, rootfs_dir) print "-" * 60 print "Installing (linaro-hwpack-install) %s in target rootfs." % ( hwpack_basename) @@ -111,9 +117,15 @@ '--hwpack-name', name] if hwpack_force_yes: args.append('--force-yes') + if extract_kpkgs: args.append('--extract-kernel-only') - args.append('/%s' % hwpack_basename) + args.append(os.path.join(rootfs_dir, hwpack_basename)) + chroot_dir = None + else: + args.append('/%s' % hwpack_basename) + chroot_dir = rootfs_dir + cmd_runner.run(args, as_root=True, chroot=chroot_dir).wait() print "-" * 60 === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-09-20 08:19:28 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-10-04 09:12:57 +0000 @@ -3585,11 +3585,10 @@ extract_kpkgs, force_yes) self.assertEquals( ['%s cp %s %s' % (sudo_args, hwpack_tgz_location, chroot_dir), - '%s %s %s linaro-hwpack-install --hwpack-version %s ' - '--hwpack-arch %s --hwpack-name %s --extract-kernel-only /%s' - % (sudo_args, chroot_args, chroot_dir, - hwpack_version, hwpack_architecture, hwpack_name, - hwpack_file_name)], + '%s linaro-hwpack-install --hwpack-version %s ' + '--hwpack-arch %s --hwpack-name %s --extract-kernel-only %s/%s' + % (sudo_args, hwpack_version, hwpack_architecture, hwpack_name, + chroot_dir, hwpack_file_name)], fixture.mock.commands_executed) fixture.mock.calls = []