From: Matt Mackall <mpm@selenic.com>
To: Willy Tarreau <willy@w.ods.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [ANNOUNCE] 2.6.0-tiny1 tree for small systems
Date: Wed, 31 Dec 2003 19:46:55 -0600 [thread overview]
Message-ID: <20040101014655.GD18208@waste.org> (raw)
In-Reply-To: <20031228103500.GA29298@alpha.home.local>
On Sun, Dec 28, 2003 at 11:35:00AM +0100, Willy Tarreau wrote:
> On Sat, Dec 27, 2003 at 03:56:06PM -0600, Matt Mackall wrote:
> > This is the second release of the -tiny kernel tree. The aim of this
> > tree is to collect patches that reduce kernel disk and memory
> > footprint as well as tools for working on small systems. Target users
> > are things like embedded systems, small or legacy desktop folks, and
> > handhelds.
>
> Hi Matt,
>
> This looks very interesting. I could produce a small "bloated" kernel
> which I use for kexec and remote recovery on a VIA C3-based system :
>
> text data bss dec hex filename
> 1328734 118955 52016 1499705 16e239 vmlinux
>
> This was with gcc-3.3.1 which is more efficient than its predecessors
> on -Os.
>
> I changed -march=c3 to -march=i386, which generally gives me better
> numbers :
>
> text data bss dec hex filename
> 1287578 118955 52016 1458549 164175 vmlinux
>
> => this is 40 kB saved. I simply changed this :
>
> +++ ./arch/i386/Makefile Sun Dec 28 11:16:10 2003
> @@ -44,7 +44,7 @@
> cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
> cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
> cflags-$(CONFIG_MWINCHIP3D) += $(call check_gcc,-march=winchip2,-march=i586)
> -cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
> +cflags-$(CONFIG_MCYRIXIII) += -march=i386 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
> cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)
>
> CFLAGS += $(cflags-y)
>
>
> So it might be interesting to have an option to drop back to the smallest
> common arch during compilation. Note that this is not the same as choosing
> i386 as the target system, since this kernel still has C3 features. Perhaps
> the simplest and most portable way would be to create a new config entry
> which would override default cflags ?
Ok, I added the ability to override the arch-default CFLAGS, but sadly
I'm unable to reproduce your space savings here with gcc 3.3.2. The
default -march=i586 seems to produce the smallest code for me.
tiny-mpm/arch/i386/Makefile | 4 ++++
tiny-mpm/init/Kconfig | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff -puN arch/i386/Makefile~tiny-cflags arch/i386/Makefile
--- tiny/arch/i386/Makefile~tiny-cflags 2003-12-31 19:02:54.000000000 -0600
+++ tiny-mpm/arch/i386/Makefile 2003-12-31 19:41:14.000000000 -0600
@@ -26,6 +26,9 @@ CFLAGS += $(call check_gcc,-mpreferred-s
align := $(subst -functions=0,,$(call check_gcc,-falign-functions=0,-malign-functions=0))
+ifdef CONFIG_TINY_CFLAGS
+cflags-y += $(CONFIG_TINY_CFLAGS_VAL)
+else
cflags-$(CONFIG_M386) += -march=i386
cflags-$(CONFIG_M486) += -march=i486
cflags-$(CONFIG_M586) += -march=i586
@@ -46,6 +49,7 @@ cflags-$(CONFIG_MWINCHIP2) += $(call che
cflags-$(CONFIG_MWINCHIP3D) += $(call check_gcc,-march=winchip2,-march=i586)
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)
+endif
CFLAGS += $(cflags-y)
diff -puN init/Kconfig~tiny-cflags init/Kconfig
--- tiny/init/Kconfig~tiny-cflags 2003-12-31 19:02:54.000000000 -0600
+++ tiny-mpm/init/Kconfig 2003-12-31 19:44:42.000000000 -0600
@@ -446,6 +446,20 @@ config OOL_THREADINFO
This simplifies the code for finding information about the current
thread. Saves about 4k on small kernels.
+config TINY_CFLAGS
+ default n
+ bool "Set compiler arch flags for small 386 code" if EMBEDDED
+ help
+ This allows user to replace the architecture CFLAGS despite the arch
+ setting in an attempt to build smaller code.
+
+config TINY_CFLAGS_VAL
+ depends TINY_CFLAGS
+ default "-march=i386"
+ string "Arch CFLAGS"
+ help
+ Enter CFLAGS to override ARCH defaults.
+
endmenu # General setup
config SLAB
_
--
Matt Mackall : http://www.selenic.com : Linux development and consulting
next prev parent reply other threads:[~2004-01-01 1:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-27 21:56 [ANNOUNCE] 2.6.0-tiny1 tree for small systems Matt Mackall
2003-12-28 10:35 ` Willy Tarreau
2004-01-01 1:46 ` Matt Mackall [this message]
2004-01-03 16:50 ` Willy TARREAU
2004-01-03 19:11 ` Matt Mackall
2003-12-28 23:54 ` Mike Fedyk
2003-12-29 0:31 ` William Lee Irwin III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040101014655.GD18208@waste.org \
--to=mpm@selenic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@w.ods.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.