Skip to Content.
Sympa Menu

baslinux - [BL] Remastering BASIC Linux Floppy edition, with UPX compression

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: baslinux AT lists.ibiblio.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] Remastering BASIC Linux Floppy edition, with UPX compression
  • Date: Thu, 25 Oct 2007 20:55:26 +0200

I figured out how to customize BasicLinux 3.5 floppy edition, improve compression, add some desired packages, and increase space in RAM disk.
Sindi asked how to add ftp client, ftp server and vfat drivers to BasicLinux floppy and recompress everything. Indeed, she was right, after using upx we have additonal
space, but I suggest upx 3.0 (with upx 1.x your can not compress busybox, while upx 2.x had problem with programs linked with libc5). Even zimage can
be compressed with this version.

Tutorial follows.

Samir




#Boot on "big computer" with modern Linux and recent upx (3.01) installed. I use Debian 4. You need to have installed commands
# fdformat, upx, unzip, lilo, mkfs, mount, umount, wget. Also your computer needs about 30 megabytes free on hard disk,
# floppy drive and prepare two floppy diskettes.

#Go to your home directory, say

cd /home/sindi
su

#Create few subdirectories:

mkdir /home/sindi/fdbaslin
mkdir /home/sindi/fdbaslin/rawfloppy1
mkdir /home/sindi/fdbaslin/editingfloppy1
mkdir /home/sindi/fdbaslin/unpackedfloppy2

#Change to:

cd /home/sindi/fdbaslin

#Download Basiclinux floppy edition and place it to /home/sindi/fdbaslin

wget http://distro.ibiblio.org/pub/linux/distributions/baslinux/bl3-50fd.zip

#Unzip it:
unzip bl3-50fd.zip

#Copy the files you want to add to /home/sindi/fdbaslin

cp /home/any/ftp /home/sindi/fdbaslin
cp /home/any/ftp /home/sindi/fdbaslin

#You should have (for example) files disk1.img, disk2.tgz, ftpd, ftpd.conf, ftp, ntfs.o and vfat.o in
#the directory /home/sindi/fdbaslin

#First, let us make changes to floppy 2. Let us unpack it

cd /home/sindi/fdbaslin/unpackedfloppy2
gunzip ../disk2.tgz
tar -xvf ../disk2.tar

#Floppy 2 is unpacked. Let us try to upx compress, something

cd usr/bin

# warning no slash before usr!

upx *
cd ..
cd X11/bin
upx *

#Now, we will add modules for ntfs and vfat

mkdir /home/sindi/fdbaslin/unpackedfloppy2/lib/modules/2.2.26/fs
cd /home/sindi/fdbaslin/unpackedfloppy2/lib/modules/2.2.26/fs
cp /home/sindi/fdbaslin/ntfs.o .
cp /home/sindi/fdbaslin/vfat.o .

# You can also delete some files. For example if you do not need links you can type here

# rm /home/sindi/fdbaslin/usr/bin/lin*


#We have finished with modules, and we can add some application programs, for example ftp client (by the way, I took it from Slackware 3)

cd /home/sindi/fdbaslin/unpackedfloppy2/usr/bin
cp /home/sindi/fdbaslin/ftp .

# and why not compress it

upx ftp


#So we have finished with modification of the second floppy. Let us repack it

cd /home/sindi/fdbaslin/unpackedfloppy2
tar -cf ../disk2.tar *

# The tar file is reduced from 2926080 to in this case 2007040 bytes

#Now, gzip it

gzip ../disk2.tar
mv ../disk2.tar.gz ../disk2.tgz

#Hmm, disk2 is now 1375446 bytes, it is less than previous 1405907 even when we added two drivers and ftp # client.

#We no longer need directory unpackedfloppy2
su
cd /home/sindi/fdbaslin
rm unpackedfloppy2 -r

#Let us create second floppy
fdformat /dev/fd0
mkfs -t vfat /dev/fd0
#Repeat formating until you find prefect floppy, and if it is OK, you can copy the second disk

mount /dev/fd0 /mnt/floppy
cp disk2.tgz /mnt/floppy
umount /dev/fd0

#Congratulations, second floppy is remastered. Eject it.

echo Replace the floppy and press ctrlD
cat

#Now, let us remaster first floppy

#We wish to compress everything and add ftp server.

cd /home/sindi/fdbaslin
mount -o loop disk1.img /home/sindi/fdbaslin/rawfloppy1
cd rawfloppy1
ls

#You will see: boot.b, disk1.gz, map and zimage

#Upx can compress even Linux kernels, and therefore we can gain 50 kilobytes
cp zimage ..
upx ../zimage
mv ../zimage .

#We can try to remaster disk1.gz

cp disk1.gz ..
gunzip ../disk1.gz

#Now we can go inside

mount -o loop ../disk1 /home/sindi/fdbaslin/editingfloppy1
cd /home/sindi/fdbaslin/editingfloppy1
ls

#Oh, now we have access to the most of files. OK, let us upx them

cd /home/sindi/fdbaslin/editingfloppy1/bin
upx busybox
cd ../sbin
upx *
cd ../usr/bin
upx *

#Warning, I do not give warranty that upx-ed programs will work,
#if it fails repeat this step, but compress only desired.

#Of course, you can delete some programs you do not want to have on the first floppy.
#For example, if you do not need microcom

# rm /home/sindi/fdbaslin/editingfloppy1/bin/microcom

#Now, let us add ftp daemon

cd /home/sindi/fdbaslin/editingfloppy1/sbin
cp /home/sindi/fdbaslin/ftpd .
cd /home/sindi/fdbaslin/editingfloppy1/etc
cp /home/sindi/fdbaslin/ftpd.conf .

#Because we added ftp client in the second floppy we need also to update services file

echo "ftp 21/tcp" >>services

#Everything is added. And something is deleted. We need to ensure good compressability. Enter

df

# and see how many available blocks there are in /home/sindi/fdbaslin/editingfloppy1 mount.
# Say, it is 2411 blocks. We need to create big empty file

dd if=/dev/zero of=/home/sindi/fdbaslin/editingfloppy1/empty bs=1024 count=2411

#Disk is currently full. Now unmount it to flush the empty file

cd /home/sindi/fdbaslin
umount disk1

# Now, we will remount to delete the empty file.

mount -o loop disk1 /home/sindi/fdbaslin/editingfloppy1
cd editingfloppy1
rm empty
df

# The compressed image is free again. But empty sectors are zeroed ensuring good compression. Now we can unmount it again

cd /home/sindi/fdbaslin
umount disk1

# And compress

gzip disk1

# Compare the sizes

ls disk1.gz -l
ls rawfloppy1/disk1.gz -l

#If the first disk1.gz is smaller than second one, it is excellent!
# Otherwise, you must remaster first floppy from the begining and delete more files.

# Now, replace the disk1.gz to raw image

cp disk1.gz rawfloppy1

# Finalize modification of the first floppy

umount rawfloppy1

# Insert the diskette and low level format it

fdformat /dev/fd0

# If it has not bad sectors save image to floppy

dd if=disk1.img of=/dev/fd0

# First floppy is created. But, we need to update LILO Linux loader
# because we reordered the files and it needs to know where they are.
# First, we will mount the created floppy

mount /dev/fd0 /home/sindi/fdbaslin/rawfloppy1


# Create the file /home/sindi/fdbaslin/lilo-initrd.conf as follows:

echo boot=/dev/fd0 >/home/sindi/fdbaslin/lilo-initrd.conf
echo install=/home/sindi/fdbaslin/rawfloppy1/boot.b >>/home/sindi/fdbaslin/lilo-initrd.conf
echo map=/home/sindi/fdbaslin/rawfloppy1/map >>/home/sindi/fdbaslin/lilo-initrd.conf
echo delay=100 >>/home/sindi/fdbaslin/lilo-initrd.conf
echo compact >>/home/sindi/fdbaslin/lilo-initrd.conf
echo image=/home/sindi/fdbaslin/rawfloppy1/zimage >>/home/sindi/fdbaslin/lilo-initrd.conf
echo " label=linux" >>/home/sindi/fdbaslin/lilo-initrd.conf
echo " root=/dev/ram0" >>/home/sindi/fdbaslin/lilo-initrd.conf
echo " initrd=/home/sindi/fdbaslin/rawfloppy1/disk1.gz" >>/home/sindi/fdbaslin/lilo-initrd.conf

# Now, update LILO on the floppy

lilo -C /home/sindi/fdbaslin/lilo-initrd.conf

# Finally unmount the LILO diskette:

umount /dev/fd0

# And, if you wish to keep the image file

cd /home/sindi/fdbaslin
dd if=/dev/fd0 of=disk1.img

# Cleaning up

rm /home/sindi/fdbaslin/rawfloppy1 -r
rm /home/sindi/fdbaslin/editingfloppy1 -r
rm /home/sindi/fdbaslin/unpackedfloppy2 -r
rm /home/sindi/fdbaslin/disk1
rm /home/sindi/fdbaslin/lilo-initrd.conf

# Reboot the computer and try changed BasicLinux



































Archive powered by MHonArc 2.6.24.

Top of Page