From patchwork Sun Apr 14 19:42:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: universe II X-Patchwork-Id: 236467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 21B752C0098 for ; Mon, 15 Apr 2013 05:43:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CB2A08C7ED; Sun, 14 Apr 2013 19:43:13 +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 jFApCRa7vqTS; Sun, 14 Apr 2013 19:43:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id EB3368C7AF; Sun, 14 Apr 2013 19:43:10 +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 5700C8F74B for ; Sun, 14 Apr 2013 19:43:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 00BB88C7AF for ; Sun, 14 Apr 2013 19:43:09 +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 V43IZ+f5SrFD for ; Sun, 14 Apr 2013 19:43:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by whitealder.osuosl.org (Postfix) with ESMTP id 4183A8C786 for ; Sun, 14 Apr 2013 19:43:08 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.30]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0M6yV9-1UoVUi27iX-00wola for ; Sun, 14 Apr 2013 21:43:05 +0200 Received: (qmail invoked by alias); 14 Apr 2013 19:43:05 -0000 Received: from mnch-4d0da171.pool.mediaWays.net (EHLO [192.168.1.52]) [77.13.161.113] by mail.gmx.net (mp030) with SMTP; 14 Apr 2013 21:43:05 +0200 X-Authenticated: #10876014 X-Provags-ID: V01U2FsdGVkX1/QIJBx/I/QoABRXhxrUVOkn+184jeAGvvt3oNuyH 9swT6PhUX+tH2Z Message-ID: <516B06C0.9030207@gmx.de> Date: Sun, 14 Apr 2013 21:42:56 +0200 From: universe II User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: buildroot@busybox.net References: <5167D90B.3020601@gmx.de> In-Reply-To: <5167D90B.3020601@gmx.de> X-Y-GMX-Trusted: 0 Subject: Re: [Buildroot] Extending buildroot functionality for creating board support packages (BSP) out of buildroot tree 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 Is there interest in incorporating this feature into buildroot? I prepared a patch for it, please see attachment. Regards, Andreas On 04/12/2013 11:51 AM, universe II wrote: > Dear all, > we are using buildroot for porting an existing embedded PowerPC board > to linux. For this purpose we have to make modifications to the kernel > (adding and changing files to support custom hardware). This can > easily be done by enabling custom patches in the menuconfig. > This is a wonderful solution when the development of the kernel > modifications is done and the patches are existing but during > development this could be time consuming. The reason is that we can > not do the kernel modifcations in the kernel tree itself but in a > completely separated directory structure. This is caused by our > existing version control system and by project development requirements. > > Imagine that you made a small modification to one of the custom files > (e.g. changing a printk() statement) and you want to re-build the > kernel. You have to develop a script which takes a virgin kernel, > extracts the gz file, makes a copy of the tree, modifies the files in > the copy and then creates the patch and copies this patch to the > buildroot tree. Even on a fast hardware this takes some time and you > have to do it for every change. > > I spent some time this morning to evaluate if there could be a more > elegant solution. Here is what I've done: > 1) In linux/Config.in: Add a new entry to the kernel menuconfig which > allows to enter a script name or a directory name (similar to the > custom patch option) > 2) In linux/linux.mk: After unpacking the kernel and applying the > patches (if any) the given script or all scripts in the given > directory are executed. > > This allows me to make modification to the unpacked kernel tree > without the need to create patch files but also opens up flexibility > for other functionality which may arise in the future. > > Let me know what you think about this. If you are interested in > incorporating these changes into the official buildroot suite, l can > provide the changes I made. > > Regards, > Andreas > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot diff -Naur linux_org/Config.in linux/Config.in --- linux_org/Config.in 2013-02-28 22:48:28.000000000 +0100 +++ linux/Config.in 2013-04-12 11:06:18.985657337 +0200 @@ -95,6 +95,17 @@ matching linux-*.patch in the directory will be applied. # +# Pre-compile script +# + +config BR2_LINUX_KERNEL_PRE_COMPILE_SCRIPT + string "Pre-compile script(s)" + help + A name of a script or the name of a directory containing one or + more scripts to be executed before kernel compilation + and after application of patches (if any). + +# # Configuration selection # diff -Naur linux_org/linux.mk linux/linux.mk --- linux_org/linux.mk 2013-02-28 22:48:28.000000000 +0100 +++ linux/linux.mk 2013-04-12 12:44:35.539272633 +0200 @@ -32,6 +32,7 @@ endif LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_PRE_SCRIPTS = $(call qstrip,$(BR2_LINUX_KERNEL_PRE_COMPILE_SCRIPT)) LINUX_INSTALL_IMAGES = YES LINUX_DEPENDENCIES += host-module-init-tools @@ -149,6 +150,21 @@ LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES +define LINUX_PRE_COMPILE_SCRIPT + if test -d $(LINUX_PRE_SCRIPTS); then \ + for s in `ls -1 $(LINUX_PRE_SCRIPTS)`; do \ + echo "Calling script $(LINUX_PRE_SCRIPTS)/$$s"; \ + $(LINUX_PRE_SCRIPTS)/$$s; \ + done \ + else \ + echo "Calling script $$s"; \ + $$s; \ + fi +endef + +LINUX_POST_PATCH_HOOKS += LINUX_PRE_COMPILE_SCRIPT + + ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y)