From owner-freebsd-questions@FreeBSD.ORG Fri Apr 10 02:49:41 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09D61739 for ; Fri, 10 Apr 2015 02:49:41 +0000 (UTC) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD1DF3A4 for ; Fri, 10 Apr 2015 02:49:40 +0000 (UTC) Received: from r56.edvax.de (port-92-195-131-196.dynamic.qsc.de [92.195.131.196]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 3F69B277D5; Fri, 10 Apr 2015 04:49:36 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t3A2naPS004092; Fri, 10 Apr 2015 04:49:36 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Fri, 10 Apr 2015 04:49:35 +0200 From: Polytropon To: Pratik Singhal Subject: Re: Compilation taking too long time Message-Id: <20150410044935.5041ae3a.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2015 02:49:41 -0000 On Fri, 10 Apr 2015 01:08:25 +0530, Pratik Singhal wrote: > Whenever I make a small change in the kernel, say apply a patch which only > affects 1 or 2 files and compile the kernel using the command :- > > > make KERNCONF=config_file buildkernel > > It takes a lot of time (around 1 hour) and starts rebuilding the whole > kernel instead of just building the relevant files. > > > I have checked the freeBSD handbook and checked the targets in Makefile , > but none of them provide information about this situation. Check the comment headers of /usr/src/Makefile and /usr/src/Makefile.inc1, as well as "man src.conf". > How, can I make sure that only the relevant files are built and not the > whole kernel again and again ? Building an operating system kernel is a complex task. It's usually not as easy as "just compile this one file into machine code, then magically splice it into the whole process that creates the kernel". ;-) In fact, running a _clean_ building process (when a source file has changed) is something quite typical and intended. The make utility, aided by several Makefiles across the source tree, decides what to do. Interfering with this logic can lead to a nonfunctional kernel, even if you say that just "1 or 2 files" are affecte by a change. The make utility is meant to deal with the decisions that those changes imply. Doing things like "resume an interrupted build process" or "cope with a small change" are therefore hard to achieve. However, it's possible to build parts of the kernel (and especially kernel modules) by running "make" in their respective subdirectories. Of course this does not lead to a fully-functional kernel, but in case you just want to rebuild a module, this approach might work. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...