[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#464938: d-i on i386 with 16 MiB RAM (using swap)



Package: debian-installer
Version: 20070308
Severity: wishlist
Tags: patch

d-i for i386 on floppies works currently only with
32 MiB RAM, which is unnecessarily much. (Sometimes one
needs to install Debian e.g. on 16 MiB machines.)

This number can be reduced by activating swap as soon as
possible.

Assume that the machine have a prepared swap partition.

I found how to change the d-i floppies (without increasing
its number) in order to work with 16 MiB. The changes to
apply against the current lenny's d-i floppies (which are
now almost identical to those for etch) for i386 follows:

1. We need
 ide/ide-core.ko,
 ide/ide-disk.ko and
 ide/ide-generic.ko
modules on 2nd (root) floppy (in initrd) in order to get
HDDs work. The space for it can be made by bzipping 2nd
floppy's initrd instead of gzipping it. Also the following
lines must be added to modules.dep in initrd on the 2nd
floppy:

/lib/modules/2.6.18-5-486/kernel/drivers/ide/ide-core.ko:
/lib/modules/2.6.18-5-486/kernel/drivers/ide/ide-disk.ko: /lib/modules/2.6.18-5-486/kernel/drivers/ide/ide-core.ko
/lib/modules/2.6.18-5-486/kernel/drivers/ide/ide-generic.ko: /lib/modules/2.6.18-5-486/kernel/drivers/ide/ide-core.ko

2. We need to use a bzip2 decompressor on 1st (boot) floppy
instead of zcat. We can use micro-bunzip
(http://www.landley.net/code/micro-bunzip.c (version 3.0,
which is smaller than 4.1)), with the patch in
the attachment, statically linked with klibc.

Then /bin/zcat (in initrd on 1st floppy) is useless and may
be replaced with /bin/micro-bunzip.
The file /init in initrd on 1st floppy must be changed in
order to work with micro-bunzip (the patch is in the
attachment).

3. We need to take the user the possibility to tell the
installer where the swap partition is. We can specify the
new kernel boot option (swapon= (eg. swapon=/dev/hda5)). For
that purpose, I wrote a new script for 2nd floppy which
checks that option, installs appropriate modules and
activates swap (S04swapon, in the attachment (to add in the
2nd floppy's initrd into the directory
/lib/debian-installer-startup.d,
without execution permission)).

4. We can change /lib/debian-installer-startup.d/S15lowmem
in initrd on 2nd floppy so that it takes account of swap
(patch is in the attachment).


Works fine with 16 MiB RAM, maybe also 8 MiB.

Nevertheless, d-i package seems rather complicated to me,
and I haven't found how to change it's sources in order to
produce the floppies that I described above. I would be glad
if you could make these changes to d-i or tell me what can I
do.


With regards,
Tomas "trosos" Tintera

--- init-orig   2008-02-09 19:45:04.000000000 +0100
+++ init        2008-02-09 20:31:20.000000000 +0100
@@ -209,14 +209,14 @@

        echo -n "Loading.."
        # pipe_progress adds dots to the above line while there is
-       # activity. But we must be sure to catch errors from the zcat.
+       # activity. But we must be sure to catch errors from the micro-bunzip.
        # Hard to do in a pipeline..
-       echo 0 > /tmp/zcat_failure
+       echo 0 > /tmp/bunzip_failure
        cd mnt
-       (zcat ../floppy/initrd.gz || echo 1 > /tmp/zcat_failure ) | cpio -i -V || abort "failed to extract initrd (may be out of space on ram disk)"
+       (micro-bunzip <../floppy/initrd.bz2 || echo 1 > /tmp/bunzip_failure ) | cpio -i -V || abort "failed to extract initrd (may be out of space on ram disk)"        cd ..

-       if [ "`cat /tmp/zcat_failure`" = 0 ]; then
+       if [ "`cat /tmp/bunzip_failure`" = 0 ]; then
                LOADED=1
        else
                echo "install media seems to be bad!" >&2
swapdev=""
for word in $(cat /proc/cmdline); do
	if [ "${word%%=*}" = "swapon" ]; then
		swapdev="${word#swapon=}"
	fi
done

if [ -n "$swapdev" ]; then
	echo "Trying to load generic IDE modules in order to activate swap"
	modprobe ide-disk >/dev/null 2>&1 || true
	modprobe ide-generic >/dev/null 2>&1 || true

	# Wait 30 seconds for hard disk to wake up
	echo -n "Waiting for $swapdev to be created ..."
	i=6;
	while [ $i -ge 0 ]; do
		if [ -b "$swapdev" ]; then
			echo
			swapon "$swapdev" || true
			break;
		fi
		if [ $i = 0 ]; then
			echo -e "\nCould not swap on $swapdev - not a block device." >&2
			break;
		fi
		i=$(($i - 1))
		sleep 5  # in seconds
		echo -n "."
	done
fi
--- micro-bunzip.c-orig 2007-09-30 15:11:11.000000000 +0200
+++ micro-bunzip.c      2007-09-30 15:47:58.000000000 +0200
@@ -511,5 +511,5 @@
 int main(int argc, char *argv[])
 {
        char *c=uncompressStream(0,1);
-       fprintf(stderr,"\n%s\n", c ? c : "Completed OK");
+       if (c) fprintf (stderr, "%s\n", c);
 }
--- S15lowmem-orig 2008-02-09 19:11:45.000000000 +0100
+++ S15lowmem      2007-09-29 18:44:51.000000000 +0200
@@ -4,7 +4,11 @@
 if [ "$ram" = "" ]; then
        echo "Cannot determine system memory, skipping lowmem probe" >&2
 else
-       ram=$(expr "$ram" / 1024) # convert to megabytes
+       swap=$(grep ^SwapTotal: /proc/meminfo | { read x y z; echo $y; }) || true
+       if [ "$swap" = "" ]; then
+               swap=0
+       fi
+       ram=$(expr \( "$ram" + "$swap" \) / 1024) # convert to megabytes

        # Set level1 to the minimum amount of memory that will support an
        # install not in lowmem mode. (This is the max memory footprint of

Reply to: