public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Reducing root filesystem
       [not found] <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>
@ 2002-04-10 14:24 ` Piotr Esden-Tempski
  2002-04-10 15:28 ` Erik Andersen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Piotr Esden-Tempski @ 2002-04-10 14:24 UTC (permalink / raw)
  To: Amol Kumar Lad; +Cc: linux-kernel

Hi,
You can try using dietlibc (http://www.fefe.de/dietlibc/) and other
tools listed on http://www.fefe.de/ . There is also a project rewriting
shell tools in assembler but I do not remember the name. This should
reduce required root space a little.

cheers Esden

On Wed, Apr 10, 2002 at 07:38:09PM +0530, Amol Kumar Lad wrote:
> Hi,
>   I am porting Linux to an embedded system. Currently my rootfilesystem is
> around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
> want to furthur reduce it to say maximum of 1.5 MB. 
> Please suggest some link/references where I can find the details to optimise
> my root filesystem
> 
> thanks
> Amol
> 
> please CC me
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
bChat2: http://bchat2.bingo-ev.de                       ___  ___  ___  _  _
bChat: http://bchat.bingo-ev.de                        | _ || _ || __|| |//
ROCK LINUX: www.rocklinux.org                          ||_|||| ||||   |  /
-Born to run kill -9 win                               |  _|||_||||__ |  \
-"Ignorance is bliss." (Matrix)                        ||\\ |_LINUX__||_|\\
GPG Public Key Block: http://www.esden.net/me/esden-key-2002-01-17.asc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reducing root filesystem
       [not found] <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>
  2002-04-10 14:24 ` Reducing root filesystem Piotr Esden-Tempski
@ 2002-04-10 15:28 ` Erik Andersen
  2002-04-11 14:08   ` Erik Mouw
  2002-04-10 15:38 ` Jan-Benedict Glaw
  2002-04-10 19:09 ` Padraig Brady
  3 siblings, 1 reply; 7+ messages in thread
From: Erik Andersen @ 2002-04-10 15:28 UTC (permalink / raw)
  To: Amol Kumar Lad; +Cc: 'linux-kernel@vger.kernel.org'

On Wed Apr 10, 2002 at 07:38:09PM +0530, Amol Kumar Lad wrote:
> Hi,
>   I am porting Linux to an embedded system. Currently my rootfilesystem is
> around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
> want to furthur reduce it to say maximum of 1.5 MB. 
> Please suggest some link/references where I can find the details to optimise
> my root filesystem

busybox and uClibc are both a good start...

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reducing root filesystem
       [not found] <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>
  2002-04-10 14:24 ` Reducing root filesystem Piotr Esden-Tempski
  2002-04-10 15:28 ` Erik Andersen
@ 2002-04-10 15:38 ` Jan-Benedict Glaw
  2002-04-10 19:09 ` Padraig Brady
  3 siblings, 0 replies; 7+ messages in thread
From: Jan-Benedict Glaw @ 2002-04-10 15:38 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 5655 bytes --]

On Wed, 2002-04-10 19:38:09 +0530, Amol Kumar Lad <amolk@ishoni.com>
wrote in message <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>:
> Hi,
>   I am porting Linux to an embedded system. Currently my rootfilesystem is
> around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
> want to furthur reduce it to say maximum of 1.5 MB. 
> Please suggest some link/references where I can find the details to optimise
> my root filesystem

I really can't help you with the root filesystem, but you can do sth
like this:


diff -Nur test-remove-me/linux-2.2.19-clean/Documentation/Configure.help linux-schlecker-2.2.19/Documentation/Configure.help
--- test-remove-me/linux-2.2.19-clean/Documentation/Configure.help	Sun Mar 25 18:37:29 2001
+++ linux-schlecker-2.2.19/Documentation/Configure.help	Mon Nov  5 12:42:46 2001
@@ -4942,6 +4942,14 @@
   important data. This is primarily of use to people trying to debug
   the middle and upper layers of the SCSI subsystem. If unsure, say N.
 
+Smaller kernel by omitting most messages
+CONFIG_NO_PRINTK
+  Enabling this option will result in a smaller kernel by removing
+  most text strings. This is only useful for emdedded systems where
+  you've got to live with <= 4MB of RAM. I386-only for now...
+
+  If unsure, say no.
+
 Fibre Channel support
 CONFIG_FC4
   This is an experimental support for storage arrays connected to
@@ -210,5 +221,6 @@
 
 #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Eleminate *most* printk()s' CONFIG_NO_PRINTK
 endmenu
 
diff -Nur test-remove-me/linux-2.2.19-clean/arch/i386/kernel/head.S linux-schlecker-2.2.19/arch/i386/kernel/head.S
--- test-remove-me/linux-2.2.19-clean/arch/i386/kernel/head.S	Sun Mar 25 18:31:45 2001
+++ linux-schlecker-2.2.19/arch/i386/kernel/head.S	Fri Nov  2 11:21:42 2001
@@ -315,7 +315,7 @@
 	movl %ax,%ds
 	movl %ax,%es
 	pushl $int_msg
-	call SYMBOL_NAME(printk)
+	call SYMBOL_NAME(real_printk)
 	popl %eax
 	popl %ds
 	popl %es
diff -Nur test-remove-me/linux-2.2.19-clean/include/asm-i386/system.h linux-schlecker-2.2.19/include/asm-i386/system.h
--- test-remove-me/linux-2.2.19-clean/include/asm-i386/system.h	Sun Mar 25 18:31:05 2001
+++ linux-schlecker-2.2.19/include/asm-i386/system.h	Mon Dec 17 14:32:03 2001
@@ -135,21 +135,15 @@
 	switch (size) {
 		case 1:
 			__asm__("xchgb %b0,%1"
-				:"=q" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+					:"+q" (x),"=m" (*__xg(ptr)));
 			break;
 		case 2:
 			__asm__("xchgw %w0,%1"
-				:"=r" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+					:"+r" (x),"=m" (*__xg(ptr)));
 			break;
 		case 4:
 			__asm__("xchgl %0,%1"
-				:"=r" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+					:"+r" (x), "=m" (*__xg(ptr)));
 			break;
 	}
 	return x;
diff -Nur test-remove-me/linux-2.2.19-clean/include/linux/kernel.h linux-schlecker-2.2.19/include/linux/kernel.h
--- test-remove-me/linux-2.2.19-clean/include/linux/kernel.h	Sun Mar 25 18:31:03 2001
+++ linux-schlecker-2.2.19/include/linux/kernel.h	Fri Dec 14 14:53:14 2001
@@ -9,6 +9,7 @@
 
 #include <stdarg.h>
 #include <linux/linkage.h>
+#include <linux/config.h>
 
 /* Optimization barrier */
 /* The "volatile" is due to gcc bugs */
@@ -54,8 +55,16 @@
 
 extern int session_of_pgrp(int pgrp);
 
-asmlinkage int printk(const char * fmt, ...)
+asmlinkage int real_printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
+
+#ifdef CONFIG_NO_PRINTK
+#	define printk(format, arg...) do {} while(0)
+#else
+#	define printk(format, arg...) real_printk(format, ## arg)
+#endif /* CONFIG_NO_PRINTK */
+
+#define oops_printk(format, arg...) real_printk(format, ## arg)
 
 #if DEBUG
 #define pr_debug(fmt,arg...) \
diff -Nur test-remove-me/linux-2.2.19-clean/kernel/ksyms.c linux-schlecker-2.2.19/kernel/ksyms.c
--- test-remove-me/linux-2.2.19-clean/kernel/ksyms.c	Sun Mar 25 18:31:02 2001
+++ linux-schlecker-2.2.19/kernel/ksyms.c	Fri Dec 14 15:24:52 2001
@@ -357,7 +357,7 @@
 
 /* misc */
 EXPORT_SYMBOL(panic);
-EXPORT_SYMBOL(printk);
+EXPORT_SYMBOL(real_printk);
 EXPORT_SYMBOL(sprintf);
 EXPORT_SYMBOL(vsprintf);
 EXPORT_SYMBOL(kdevname);
diff -Nur test-remove-me/linux-2.2.19-clean/kernel/printk.c linux-schlecker-2.2.19/kernel/printk.c
--- test-remove-me/linux-2.2.19-clean/kernel/printk.c	Sun Mar 25 18:31:02 2001
+++ linux-schlecker-2.2.19/kernel/printk.c	Fri Dec 14 14:52:50 2001
@@ -249,7 +249,7 @@
 	return do_syslog(type, buf, len);
 }
 
-asmlinkage int printk(const char *fmt, ...)
+asmlinkage int real_printk(const char *fmt, ...)
 {
 	va_list args;
 	int i;




This is for i386, but it can be implemented like this for other
architectures. Please note:

	- The patch to system.h is only neccessary because gcc will
	  magically miscompile the code if there's no printk()
	  resulting (at least) in a broken DMA (de)registering
	  functions rendering the floppy.o module useless. Maybe
	  you don't need this patch. It was _not_ developed by
	  me but send by Momchil Velikov <velco@fadata.bg>.
	- In 2.4.x, EXPORT_SYMBOL((real)printk) is not in
	  kernel/ksyms.c, but in kernel/printk.c
	- BigFatWarning: It shouldn't be, but there might
	  be code fragments that do more than only printing
	  in a printk call (like 'printk(KERN_ERR "%d\n", a=func(a))')
	  Things like this _will_ break!!!

MfG, JBG

-- 
Jan-Benedict Glaw   .   jbglaw@lug-owl.de   .   +49-172-7608481
	 -- New APT-Proxy written in shell script --
	   http://lug-owl.de/~jbglaw/software/ap2/

[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Reducing root filesystem
@ 2002-04-10 16:36 Kerl, John
  0 siblings, 0 replies; 7+ messages in thread
From: Kerl, John @ 2002-04-10 16:36 UTC (permalink / raw)
  To: 'Amol Kumar Lad'; +Cc: 'linux-kernel@vger.kernel.org'

For my boards, I have about a 5 MB RAM disk, at least half of
which is libraries, much of which I know is library routines
which my embedded system never calls.  If I were tight on space,
here is where I would trim.

I don't know if you're doing PowerPC or some other processor,
but nonetheless you might check out 

http://penguinppc.org/embedded/howto/PowerPC-Embedded-HOWTO.html

and especially section 12:

http://penguinppc.org/embedded/howto/library.html

for some pointers to small C libraries.


-----Original Message-----
From: Amol Kumar Lad [mailto:amolk@ishoni.com]
Sent: Wednesday, April 10, 2002 7:08 AM
To: 'linux-kernel@vger.kernel.org'
Subject: Reducing root filesystem


Hi,
  I am porting Linux to an embedded system. Currently my rootfilesystem is
around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
want to furthur reduce it to say maximum of 1.5 MB. 
Please suggest some link/references where I can find the details to optimise
my root filesystem

thanks
Amol

please CC me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reducing root filesystem
       [not found] <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>
                   ` (2 preceding siblings ...)
  2002-04-10 15:38 ` Jan-Benedict Glaw
@ 2002-04-10 19:09 ` Padraig Brady
  2002-04-11  1:59   ` Miles Bader
  3 siblings, 1 reply; 7+ messages in thread
From: Padraig Brady @ 2002-04-10 19:09 UTC (permalink / raw)
  To: Amol Kumar Lad; +Cc: 'linux-kernel@vger.kernel.org'

Amol Kumar Lad wrote:
> Hi,
>   I am porting Linux to an embedded system. Currently my rootfilesystem is
> around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
> want to furthur reduce it to say maximum of 1.5 MB. 
> Please suggest some link/references where I can find the details to optimise
> my root filesystem
> 
> thanks
> Amol
> 
> please CC me

Obviously it depends what logic you want in your root partition,
but without too much effort we've created the following minimal
system that can do web downloads and write flash cards, and is
generally very configurable with shell scripting etc.
Note we used dietlibc for our binary. Note also when we did
this buysbox was not compatible with dietlibc.

       5 /boot/message
      10 /etc/hosts.allow
      12 /etc/host.conf
      24 /lib/modules/2.4.16-9afo/modules.pnpbiosmap
      29 /lib/modules/2.4.16-9afo/modules.parportmap
      31 /lib/modules/2.4.16-9afo/modules.generic_string
      51 /bin/runlcdd
      73 /lib/modules/2.4.16-9afo/modules.ieee1394map
      81 /lib/modules/2.4.16-9afo/modules.isapnpmap
      81 /etc/sysconfig/network-scripts/ifcfg-eth1
      99 /lib/modules/2.4.16-9afo/modules.pcimap
     101 /etc/fstab
     103 /etc/passwd
     108 /etc/group
     120 /etc/issue
     125 /etc/sysconfig/network-scripts/ifcfg-lo
     127 /etc/hosts
     134 /etc/shells
     189 /lib/modules/2.4.16-9afo/modules.usbmap
     192 /etc/suauth
     238 /etc/nsswitch.conf
     281 /bin/rescue.ash
     396 /etc/inittab
     538 /etc/profile
     595 /etc/protocols
     976 /etc/init.d/rc
    6008 /boot/boot-text.b
   16406 /bin/afrescue
   20480 /boot/map
  102273 /lib/modules/e100.o
  674931 /boot/bzImage
  717992 /bin/busybox
--------
1542809
========

So to get this even smaller:

1. Get busybox working with dietlibc/uclibc (this probably already done)
2. use something like UPX to "transparently" compress executables.
3. use e2compr to transparently compress the whole filesystem
    (gzip/bzip2 available). dri@sxb.bsf.alcatel.fr has a patch for this.

Padraig.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reducing root filesystem
  2002-04-10 19:09 ` Padraig Brady
@ 2002-04-11  1:59   ` Miles Bader
  0 siblings, 0 replies; 7+ messages in thread
From: Miles Bader @ 2002-04-11  1:59 UTC (permalink / raw)
  To: Padraig Brady; +Cc: Amol Kumar Lad, 'linux-kernel@vger.kernel.org'

Padraig Brady <padraig@antefacto.com> writes:
> 1. Get busybox working with dietlibc/uclibc (this probably already done)

busybox works fine with uclibc (you'd hope so, since they have the same
author!).

-Miles
-- 
Run away!  Run away!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reducing root filesystem
  2002-04-10 15:28 ` Erik Andersen
@ 2002-04-11 14:08   ` Erik Mouw
  0 siblings, 0 replies; 7+ messages in thread
From: Erik Mouw @ 2002-04-11 14:08 UTC (permalink / raw)
  To: Erik Andersen, Amol Kumar Lad,
	'linux-kernel@vger.kernel.org'

On Wed, Apr 10, 2002 at 09:28:13AM -0600, Erik Andersen wrote:
> On Wed Apr 10, 2002 at 07:38:09PM +0530, Amol Kumar Lad wrote:
> >   I am porting Linux to an embedded system. Currently my rootfilesystem is
> > around 2.5 MB (after keeping it to minimal and adding tools like busybox). I
> > want to furthur reduce it to say maximum of 1.5 MB. 
> > Please suggest some link/references where I can find the details to optimise
> > my root filesystem
> 
> busybox and uClibc are both a good start...

Yup. Busybox+tinylogin with glibc makes a 900kB (compressed) ramdisk on
StrongARM. I think I can make this a lot smaller when I use uClibc.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands  Phone: +31-15-2783635
Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-04-11 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7CFD7CA8510CD6118F950002A519EA3001067D06@leonoid.in.ishoni.com>
2002-04-10 14:24 ` Reducing root filesystem Piotr Esden-Tempski
2002-04-10 15:28 ` Erik Andersen
2002-04-11 14:08   ` Erik Mouw
2002-04-10 15:38 ` Jan-Benedict Glaw
2002-04-10 19:09 ` Padraig Brady
2002-04-11  1:59   ` Miles Bader
2002-04-10 16:36 Kerl, John

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox