Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2012 07:05:41 -0700 (PDT)
From:      Jack Mc Lauren <jack.mclauren@yahoo.com>
To:        "freebsd-embedded@freebsd.org" <freebsd-embedded@freebsd.org>
Subject:   GENERIC kernel configuraion
Message-ID:  <1351605941.79450.YahooMailNeo@web126002.mail.ne1.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hello

Does customizing (commenting unused devices in GENERIC) kernel in /usr/src/amd64/conf cause nanobsd image get lighter ??
From owner-freebsd-embedded@FreeBSD.ORG  Tue Oct 30 14:50:35 2012
Return-Path: <owner-freebsd-embedded@FreeBSD.ORG>
Delivered-To: freebsd-embedded@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
 by hub.freebsd.org (Postfix) with ESMTP id 973AAB17
 for <freebsd-embedded@freebsd.org>; Tue, 30 Oct 2012 14:50:35 +0000 (UTC)
 (envelope-from freebsd@psconsult.nl)
Received: from mx1.psconsult.nl (unknown [IPv6:2001:7b8:30f:e0::5059:ee8a])
 by mx1.freebsd.org (Postfix) with ESMTP id 45D878FC0C
 for <freebsd-embedded@freebsd.org>; Tue, 30 Oct 2012 14:50:32 +0000 (UTC)
Received: from mx1.psconsult.nl (mx1.hvnu.psconsult.nl [46.44.189.154])
 by mx1.psconsult.nl (8.14.5/8.14.4) with ESMTP id q9UEoOMX017534
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <freebsd-embedded@freebsd.org>; Tue, 30 Oct 2012 15:50:29 +0100 (CET)
 (envelope-from freebsd@psconsult.nl)
Received: (from paul@localhost)
 by mx1.psconsult.nl (8.14.5/8.14.4/Submit) id q9UEoOFc017533
 for freebsd-embedded@freebsd.org; Tue, 30 Oct 2012 15:50:24 +0100 (CET)
 (envelope-from freebsd@psconsult.nl)
X-Authentication-Warning: mx1.psconsult.nl: paul set sender to
 freebsd@psconsult.nl using -f
Date: Tue, 30 Oct 2012 15:50:24 +0100
From: Paul Schenkeveld <freebsd@psconsult.nl>
To: freebsd-embedded@freebsd.org
Subject: Re: GENERIC kernel configuraion
Message-ID: <20121030145024.GA16785@psconsult.nl>
References: <1351605941.79450.YahooMailNeo@web126002.mail.ne1.yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1351605941.79450.YahooMailNeo@web126002.mail.ne1.yahoo.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-BeenThere: freebsd-embedded@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Dedicated and Embedded Systems <freebsd-embedded.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-embedded>, 
 <mailto:freebsd-embedded-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-embedded>;
List-Post: <mailto:freebsd-embedded@freebsd.org>
List-Help: <mailto:freebsd-embedded-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-embedded>, 
 <mailto:freebsd-embedded-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Oct 2012 14:50:35 -0000

On Tue, Oct 30, 2012 at 07:05:41AM -0700, Jack Mc Lauren wrote:
> Hello
> 
> Does customizing (commenting unused devices in GENERIC) kernel in /usr/src/amd64/conf cause nanobsd image get lighter ??

Here are two amd64 NanoBSD kernels I've archived:

       # ls -ls kernel1 kernel2
       15 -r-xr-xr-x  1 root  wheel  15572950 Apr  9  2012 kernel1
	7 -r-xr-xr-x  1 root  wheel   6921921 Jul 25 11:27 kernel1
       # size kernel1 kernel2
	   text    data     bss      dec     hex filename
       12011364 1331748 1137248 14480360  dcf3e8 kernel1
        5155629  513459  637256  6306344  603a28 kernel2

The first one is FreeBSD 9.0, the second one FreeBSD 8.3 but 9.0 is not
twice as big as 8.3.  So yes, trimming /usr/src/amd64/conf can make a
big difference!

If memory is your constraint, trim the kernel as much as possible, don't
forget to strip things like SCTP, NFS*, INET6, MAC etc. if you don't
need them and leave "makeoptions DEBUG=-g" out too.

If it's the size of your flash image you worry about, put in a line like

    makeoptions      MODULES_OVERRIDE=""

to not build/install kernel modules or include only those that you really
need.  /boot/kernel takes almost 50% of the space in a NanoBSD image with
a generic kernel and all modules built.

Another thing that can save a lot of space on your flash image is tuning
CONF_WORLD, CONF_BUILD and CONF_INSTALL (see src/tools/build/options/ for
an explanation of each option).  This may take several iterations before
you get it right though because sometimes it's not immediately visible
which options are required by other ones (eg. if you build with INET6
enabled, you appear to need KVM and KVM_SUPPORT too).

HTH

Paul Schenkeveld



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1351605941.79450.YahooMailNeo>