Linux-kernel mailing list archive 1999-34,: Slimmed down distribution - use wget to fetch .c files

# Slimmed down distribution - use wget to fetch .c files

David N. Welton (davidw@linuxcare.com)
Mon, 23 Aug 1999 12:52:00 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Chuck Lever: "review of i_op->readpage error handling"
- Previous message: Bill Rugolsky Jr.: "RPC: sendmsg returned error 101"

[ please cc replies to me ]

Hello, I was contemplating a way to only install those .c files which
are necessary for your particular compilation.

This would be useful for those who don't wish to download the whole
kernel, with all its various architectures and drivers, for their
single box at home. There is a potential to save download costs for
those users who pay per minute connection charges.

Basically, I replace a lot of .c files with empty ".w" files, and
create a rule that uses wget to create .c files from them. I realize
that this may cause some troubles with make dep, but I haven't
encountered any so far. A possible way around this is to include the
relevant pieces from the .c files in their corresponding .w files
(includes, etc..).

Further improvements might include:

gzipping the files on the server side, getting the $@.gz in the
makefile and then uncompressing it

writing a small daemon that uses http/1.1 to create a persistant
connection.

create a list of all the necessary files and get them at once, using
http/1.1

My slimmed down kernel source tree is available from:

http://static.linuxcare.com/kernel/linux-2.2.10-slim.tar.gz

For a size comparison:
-rw-r--r-- 1 davidw www-data 4862207 Aug 23 12:50 linux-2.2.10-slim.tar.gz
-rw-rw-r-- 1 davidw davidw 13902979 Jun 16 09:36 linux-2.2.10.tar.gz

Anyway, without further ado, here is my patch, which is actually
rather small:

-------------------- cut here ---------------
diff -r -u -N clean-linux/Rules.make linux/Rules.make
--- clean-linux/Rules.make Fri Dec 18 14:01:48 1998
+++ linux/Rules.make Mon Aug 23 12:38:53 1999
@@ -43,6 +43,7 @@
#
# Common rules
#
+include $(TOPDIR)/wget.make
%.s: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@
diff -r -u -N clean-linux/arch/i386/boot/Makefile linux/arch/i386/boot/Makefile
--- clean-linux/arch/i386/boot/Makefile Sat Jan 2 10:27:52 1999
+++ linux/arch/i386/boot/Makefile Mon Aug 23 12:38:53 1999
@@ -7,6 +7,7 @@
#
# Copyright (C) 1994 by Linus Torvalds
#
+include $(TOPDIR)/wget.make
AS86 =$(CROSS_COMPILE)as86 -0 -a
LD86 =$(CROSS_COMPILE)ld86 -0
diff -r -u -N clean-linux/arch/i386/boot/compressed/Makefile linux/arch/i386/boot/compressed/Makefile
--- clean-linux/arch/i386/boot/compressed/Makefile Mon Jul 20 10:05:15 1998
+++ linux/arch/i386/boot/compressed/Makefile Mon Aug 23 12:38:53 1999
@@ -3,6 +3,7 @@
#
# create a compressed vmlinux image from the original vmlinux
#
+include $(TOPDIR)/wget.make
HEAD = head.o
SYSTEM = $(TOPDIR)/vmlinux
diff -r -u -N clean-linux/kernel/Makefile linux/kernel/Makefile
--- clean-linux/kernel/Makefile Wed May 6 11:01:46 1998
+++ linux/kernel/Makefile Mon Aug 23 12:38:53 1999
@@ -7,6 +7,8 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
+include ../wget.make
+
.S.s:
$(CPP) -traditional $< -o $*.s
diff -r -u -N clean-linux/scripts/ctow.sh linux/scripts/ctow.sh
--- clean-linux/scripts/ctow.sh Wed Dec 31 16:00:00 1969
+++ linux/scripts/ctow.sh Mon Aug 23 12:38:53 1999
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Turns .c files into .w files
+
+DIRS="arch
+drivers
+fs
+ipc
+net"
+
+for d in $DIRS; do
+ for cf in `find $d -name "*.c"` ; do
+ wf=`dirname $cf`/`basename $cf .c`.w
+ echo $wf
+ touch $wf
+ rm $cf
+ done
+done
diff -r -u -N clean-linux/wget.make linux/wget.make
--- clean-linux/wget.make Wed Dec 31 16:00:00 1969
+++ linux/wget.make Mon Aug 23 12:39:10 1999
@@ -0,0 +1,5 @@
+WGETHOST=static.linuxcare.com
+THIS_SUBDIR:=$(shell echo $(CURDIR)|sed 's|$(TOPDIR)||')
+
+%.c: %.w
+ wget http://$(WGETHOST)/linux/$(KERNELRELEASE)/$(THIS_SUBDIR)/$@ -O $@

The "ctow.sh" is what actually transforms the files from a clean
source tree.

Thanks,

    --
    David N. Welton, Developer, Linuxcare, Inc.
    415.354.4878 x241 tel, 415.701.7457 fax
    dwelton@linuxcare.com, http://www.linuxcare.com/
    Linuxcare. At the center of Linux.

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

- Next message: Chuck Lever: "review of i_op->readpage error handling"
- Previous message: Bill Rugolsky Jr.: "RPC: sendmsg returned error 101"