From patchwork Wed Apr 17 10:51:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Edenhill X-Patchwork-Id: 237208 X-Patchwork-Delegate: patrickdepinguin+buildroot@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 025AD2C0158 for ; Wed, 17 Apr 2013 21:57:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 73EBCA0249; Wed, 17 Apr 2013 11:56:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W5jVAJvYgmgK; Wed, 17 Apr 2013 11:56:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 5D389A0250; Wed, 17 Apr 2013 11:56:55 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 84A498F7A4 for ; Wed, 17 Apr 2013 11:57:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CC1D18BB82 for ; Wed, 17 Apr 2013 11:56:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VHLi0p2oTKUR for ; Wed, 17 Apr 2013 11:56:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by whitealder.osuosl.org (Postfix) with ESMTPS id 0D1698B3BC for ; Wed, 17 Apr 2013 11:56:51 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id hf12so1230141vcb.21 for ; Wed, 17 Apr 2013 04:56:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-originating-ip:from:date:message-id :subject:to:content-type:x-gm-message-state; bh=rePKsqLVe1p/gbuOOx+/no5WLT3ODoy2zeQBKQizPng=; b=nF13nThyG3yxJa4dVtRPyXTAjKPd/IbADcNm1xw1HfCAGwMRaIf51LYAeY4ysOBoIi lhNIfh99YQh4QA/l5Q64ralrnh3JlfXFvREBYXgqsh9pJiWgUZRohlcZ/Ez8gaAcZ9Y8 MzLzlnkVgSNlS1JKEwRg1tv+s7Vp7/ByP0+AZ6DujURN76A1JxY8esuLtPuSbVsRwYmk AJWTgt/GHZ5qwz9/vGtqsylr4vY/wWRmz/uNhlJuvuLVTQRcsaeS9OJekNhpGN7qQfSv vGLJcSpaxRqlxFTEVQasu1pnJMdnlMlQsBN5XS5ARsZeufsCkejPOO/0iRfNXRRlGA8C 5rRQ== X-Received: by 10.220.153.69 with SMTP id j5mr4367955vcw.35.1366195890596; Wed, 17 Apr 2013 03:51:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.34.116 with HTTP; Wed, 17 Apr 2013 03:51:09 -0700 (PDT) X-Originating-IP: [212.112.188.157] From: Magnus Edenhill Date: Wed, 17 Apr 2013 12:51:09 +0200 Message-ID: To: buildroot X-Gm-Message-State: ALoCoQmczNtngazzLnyrMQoQ3DCBFtgxQvOL8VKNMqjxriuojXhbW5fO8v9jWafC0DJqhTfGFThc Subject: [Buildroot] [PATCH] [RFC] BR2_KERNEL_HEADERS_TARGET: Add support for using target kernel for toolchain kernel headers. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net This patch allows the toolchain to use the target kernel's headers instead of having to download an additional linux tree just for the toolchain. Tested with the internal toolchain. Only problem observed is that the kernel-headers..../.unpacked target is recreated on sub-sequent 'make' invocations, which recreates uclibc. But someone with more make-wizardry may be able to solve that. It also copies the linux source, which may not be strictly required, but it seemed to be the safest option for now. --- toolchain/kernel-headers/Config.in | 8 ++++++++ toolchain/kernel-headers/kernel-headers.mk | 8 ++++++++ 2 files changed, 16 insertions(+) $(LINUX_HEADERS_UNPACK_DIR)/.patched: $(LINUX_HEADERS_UNPACK_DIR)/.unpacked $(LINUX_HEADERS_DEPENDS) @@ -66,12 +70,16 @@ $(LINUX_HEADERS_DIR)/.configured: $(LINUX_HEADERS_UNPACK_DIR)/.patched ) touch $@ +ifeq ($(BR2_KERNEL_HEADERS_TARGET),y) +$(DL_DIR)/$(LINUX_HEADERS_SOURCE): linux-source linux-extract +else $(DL_DIR)/$(LINUX_HEADERS_SOURCE): ifeq ($(BR2_KERNEL_HEADERS_SNAP),y) $(error No local $@ found, cannot continue. Are you sure you wanted to enable BR2_KERNEL_HEADERS_SNAP?) endif $(Q)$(call MESSAGE,"Downloading kernel headers") $(call DOWNLOAD,$(LINUX_HEADERS_SITE:/=)/$(LINUX_HEADERS_SOURCE)) +endif kernel-headers: $(LINUX_HEADERS_DIR)/.configured diff --git a/toolchain/kernel-headers/Config.in b/toolchain/kernel-headers/Config.in index 6155ef1..dc04fd2 100644 --- a/toolchain/kernel-headers/Config.in +++ b/toolchain/kernel-headers/Config.in @@ -52,6 +52,13 @@ choice config BR2_KERNEL_HEADERS_SNAP bool "Local Linux snapshot (linux-2.6.tar.bz2)" + + config BR2_KERNEL_HEADERS_TARGET + bool "Target Linux kernel" + depends on BR2_LINUX_KERNEL + help + Use the Linux kernel specified for the target in + the Kernel menu. endchoice config BR2_DEFAULT_KERNEL_VERSION @@ -73,4 +80,5 @@ config BR2_DEFAULT_KERNEL_HEADERS default "3.7.10" if BR2_KERNEL_HEADERS_3_7 default "3.8.7" if BR2_KERNEL_HEADERS_3_8 default "2.6" if BR2_KERNEL_HEADERS_SNAP + default "target.0" if BR2_KERNEL_HEADERS_TARGET default $BR2_DEFAULT_KERNEL_VERSION if BR2_KERNEL_HEADERS_VERSION diff --git a/toolchain/kernel-headers/kernel-headers.mkb/toolchain/kernel-headers/ kernel-headers.mk index adf7bc4..731f508 100644 --- a/toolchain/kernel-headers/kernel-headers.mk +++ b/toolchain/kernel-headers/kernel-headers.mk @@ -42,8 +42,12 @@ $(LINUX_HEADERS_UNPACK_DIR)/.unpacked: $(DL_DIR)/$(LINUX_HEADERS_SOURCE) $(Q)$(call MESSAGE,"Extracting kernel headers") rm -rf $(LINUX_HEADERS_DIR) $(INSTALL) -d $(@D) +ifeq ($(BR2_KERNEL_HEADERS_TARGET),y) + rsync -au $(LINUX_DIR)/ $(@D) +else $(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | \ tar $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) - +endif touch $@