Reducing root filesystem

Reducing root filesystem

Post by Amol Kumar La » Thu, 11 Apr 2002 23:10:17



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

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Piotr Esden-Tempsk » Fri, 12 Apr 2002 00:20:11


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


> 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

> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Erik Anderse » Fri, 12 Apr 2002 00:30:17



Quote:> 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--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Jan-Benedict Gla » Fri, 12 Apr 2002 00:50:06




Quote:> 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

   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

 #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

        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

        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

 #include <stdarg.h>
 #include <linux/linkage.h>
+#include <linux/config.h>

 /* Optimization barrier */

 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

 /* 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

        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

        - 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

--

         -- New APT-Proxy written in shell script --
           http://lug-owl.de/~jbglaw/software/ap2/

  application_pgp-signature_part
< 1K Download
 
 
 

Reducing root filesystem

Post by Kerl, Joh » Fri, 12 Apr 2002 01:40:16


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-----

Sent: Wednesday, April 10, 2002 7:08 AM

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

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Padraig Brad » Fri, 12 Apr 2002 04:20:07



> 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

Padraig.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Miles Bade » Fri, 12 Apr 2002 11:10:09



> 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!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Reducing root filesystem

Post by Erik Mou » Fri, 12 Apr 2002 23:20:05




> >   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

WWW: http://www-ict.its.tudelft.nl/~erik/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. reducing filesystem minfree on big filesystems

Does anyone have any opinions on the suggestion that it is safe to
reduce minfree to 5% on large (>1Gb) filesystems without any
performance degradation. This is based on the supposition that the
original BSD filesystem design was based on large filesystems of about
400-500Mb & that with modern disks of >1Gb maintaining the 10% free is
overcautious.

Barrie
--
Barrie Spence                   Sanity Clause? There is no Sanity Clause

2. Accurate LinucPPC2000 Install instructions?

3. How can I separate root filesystem and /usr filesystem

4. Apache Bug Help!

5. Reducing an AIX filesystem /tmp

6. With ppp-2.2.0e, Linux 1.2.13 not compiling

7. reducing filesystem in AIX

8. HELP!!! Problems w/ loadlin and monkey linux....

9. root vs.non-root filesystem space

10. how can reduce the size of the /, /usr and /tmp filesystems ?

11. Reducing filesystem size

12. Reducing /usr filesystem on 4.2.1

13. How to reduce filesystem size.