lkml.org 
[lkml]   [1996]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectAnother simple way to cut the kernel sources down to size
As the kernel sources have become rather large, there has been an interest
in ways for the end-user to trim the kernel sources down. Recently, I saw
a script that prunes the source tree based on the contents of .config and
on user input. The script I present is even simpler than that, and I
expect some users may want to use a combination of these two simple
techniques to gain a nice savings in disk space (yes, disk space is cheap,
but that is no argument for throwing away money). The ideal is probably a
diced kernel [ no flames, please! ], but if Linus and the others aren't
interested in doing that, I say:

a) It's not a big deal anyway, and
b) Linux users are (generally) not dummies, and can do this kind
of thing themselves.

#! /bin/sh

# ksrc_gzip v1.0 by Adam McKee <Adam.McKee@usask.ca>
#
# This is a quick-and-dirty shell script to save some disk space by compressing
# the kernel sources. The directories/files needed for development are left
# intact. This script takes no arguments -- it knows what you want it to do
# based on whether or not the kernel sources are compressed.
#
# ASSUMPTIONS:
#
# - /usr/src/linux -> /usr/src/linux-${VERSION}
# i.e. /usr/src/linux -> /usr/src/linux-2.0.0
#
# - /usr/src/linux/include/asm -> /usr/src/linux/include/asm-${ARCH}
# i.e. /usr/src/linux/include/asm -> /usr/src/linux/include/asm-i386
#
# - The script is run with uid=euid=root, gid=egid=root.
#
# If any of these assumptions are invalid, make them valid before running the
# script :)

V=`ls -l /usr/src/linux` ; V=${V#* -> *-}
SRC=/usr/src/linux-${V}
TMP=${SRC}.$
ZIP=${SRC}.tar.gz

umask 022
if [ -f $ZIP ]; then
pushd / > /dev/null
rm -rf $SRC
tar xzf $ZIP
rm -f $ZIP
popd > /dev/null
else
tar czf $ZIP $SRC
mv $SRC $TMP
mkdir $SRC
mkdir ${SRC}/include
cp -Rp ${TMP}/include/asm ${SRC}/include
cp -Rdp ${TMP}/include/linux ${SRC}/include
rm -rf $TMP
fi



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