I've done this only once and I can't tell all the steps I had to take to reduce the size at maximum. It took me over a week with different results and upgrading from already finished squash file. But the main concept is this one and with testing and adding advices from other people it could be improved.
Important information : Use only ext partition. vfat can't manage some linux file permissions and will cause errors.
In this example I will use the smallest debian-live-6.0.0-i386-standard.iso from here:
http://live.debian.net/files/oldstable/ ... so-hybrid/
Download and extract the live folder on /mnt/sda1 for example. If you can do it from puppy it will be great.
http://postimg.org/image/7zx9a64jn/
Unsquash filesystem.squashfs.
Code: Select all
unsquashfs -d /mnt/sda1/deb-6 /mnt/sda1/live/filesystem.squashfs
Add this sources to /mnt/sda1/deb-6/etc/apt/sources.list
Code: Select all
deb http://backports.debian.org/debian-backports squeeze-backports main
Code: Select all
APT::Install-Recommends "false"; APT::Install-Suggests "false";
Create folder /mnt/sda1/slim-boot and copy /mnt/sda1/deb-6/boot and /mnt/sda1/deb-6/dev folders + initrd.img and vmlinuz links as shown on the picture:
http://postimg.org/image/4b4w7i8qb/
You can remove one of the kernels as the example on the picture or not. It does not matter on this point. Just be sure to choose which kernel will be booted. It is 686 for me.
Now create squashfs from /mnt/sda1/slim-boot:
Code: Select all
mksquashfs /mnt/sda1/slim-boot /mnt/sda1/live/01-slim-boot.squashfs
I guess it is possible to include only /dev folder in 01-slim-boot.squashfs and the result will be the same.
Latest test shows this slim-boot squash file can be empty.
Next step is to create live-rw save file. 1Gb is enough. I remember I had some issues if live-rw is placed in sda1. To play safe put it on another partition. sda2 for example.
Code: Select all
dd if=/dev/zero of=/mnt/sda2/live-rw bs=1M count=1000
mkfs.ext2 /mnt/sda2/live-rw
Code: Select all
mount -o loop /mnt/sda2/live-rw /mnt/cdrom
Code: Select all
cp -frp /mnt/sda1/deb-6/* /mnt/cdrom
Code: Select all
umount /media/cdrom
It is time to remove filesystem.squashfs from /mnt/sda1/live
We already have in there 01-slim-boot.squashfs + vmlinuz and initrd.img. Now is time to reboot and enter the debian live system.
Use this grub legacy code (for kernel 686 in my example):
Code: Select all
title Debian-live
root=(hd0,0)
kernel /live/vmlinuz boot=live config persistent swapon quickreboot noprompt noautologin
initrd /live/initrd.img
boot
Then create root password:
Code: Select all
sudo passwd root
Code: Select all
sudo login
Code: Select all
apt-get update
Code: Select all
apt-get install dialog
If you are not going to change the kernel with 3.2.0-0.bpo.4-rt-686-pae don't read this section.
Code: Select all
apt-cache search linux-image-3
Code: Select all
apt-get -t squeeze-backports install linux-image-3.2.0-0.bpo.4-rt-pae firmware-linux-free
Code: Select all
dpkg --configure -a
Code: Select all
cd /boot
ls
Code: Select all
mkinitramfs -o initrd-3.2.0-0.bpo.4-rt-pae.img 3.2.0-0.bpo.4-rt-pae
You might also have to create link from /boot/initrd.img to / if it is broken but it does not matter since we will remove /boot folder at the end.
If everything went well after reboot you will have new kernel. Type to confirm:
Code: Select all
uname -r
Code: Select all
apt-get purge linux-image-2.6.32-5-486
apt-get purge linux-image-2.6.32-5-686
Code: Select all
apt-get autoremove