lkml.org 
[lkml]   [1996]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectHeres how to reduce kernel source size
Date
Every now and then I have seen posts asking about how to make the kernel
source smaller, either by breaking it up into modules or by having an
option to remove un-needed source. I have a way to do this that requires
almost no changes to anything, and I thought I would post it here so
that anyone who is low on disk space can try it out. Here is what to
do:

1) Run make config
2) Run make dep
3) Now gzip all the .c files using the command:
find . -name \*.c -print | xargs gzip
4) Add the following rule to the Rules.make file:

#
# Common rules
#

%.c: %.c.gz
gunzip $<

Make sure you use a TAB character in front of the gunzip command,
not spaces!!!

5) Run make zImage |& tee log

This will build you a kernel, gunzipping all the files that are needed.
The unnecessary files will remain gzipped. You can either leave them like
this, or remove them with the command:

find . -name \*.c.gz -print | xargs rm -f

I have just tested this to cross compile a Linux/Alpha kernel. I have not
tried to compile a Linux/x86 kernel like this, but the only problem I can
see is if there is a Makefile under arch/i386 which does not include
Rules.make. In this case you can gunzip the necessary files by hand.
You should be able to figure out what they are from the log file produced
in step 5 above.

Jim

PS For some reason the rule:

%.c: %.gz
gunzip $<

does not work. Does anyone know why?


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.031 / U:20.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site