Compiling kernel 2.4.29, recreate live-CD on other computer

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
Staffan
Posts: 12
Joined: Wed 14 Sep 2005, 07:41
Location: Sweden

Compiling kernel 2.4.29, recreate live-CD on other computer

#1 Post by Staffan »

Hello,

perhaps this is of less interest to most people, but I found that I needed to re-compile the kernel for the live-CD and also add some files. This I wanted to do on a separate computer, but I wasn't successful in finding any Howto so I wrote down what I did and include it here.
All disclaimers apply and please beware that there may be errors.
I also attach the files I needed, that weren't directly available from the Puppy homepage. They are compressed to save space and you should especifally uncompress unionfs.o.gz if you plan on using it.

Regards,
Staffan

===================================================
Steps for recompiling the kernel of the live Puppy CD and generating a
new iso-image


Prerequisites:

There should exist a suitable location for the editing and where to
store the relevant files. It is here assumed that you have a directory
~/puppyRemaster in which all files that are needed are stored. It is
also assumed that it contains the subdirectory
~/puppyRemaster/isolinux-builds.

The following files should be available:
www.kernel.org
linux-2.4.29.tar
www.goosee.com/puppy/development/compilekernel.htm:
linux-2.4.29-ntfs-2.1.6b.patch
squashfs2.1-patch-k2.4.26

unionfs-1.0.11.tar.gz _or_ unionfs.o.gz
updatemodules.sh

The live-CD should be available. Alternatively, it is sufficient to
have the iso-image and mount it at a suitable location in order to
copy the files.

1. Mount the CD or iso-image and copy the contents to a working directory

mount /dev/cdrom /mnt/cdrom
//
if only the iso-image is available, located at
~puppyRemaster/puppy-1.0.4-mozilla.iso, it is possible to mount it
instead of the CD as:
mount ~puppyRemaster/puppy-1.0.4-mozilla.iso /mnt/cdrom -o loop
//

cd /mnt/cdrom
cp -r /mnt/cdrom/* ~/puppyRemaster/isolinux-builds/
umount /mnt/cdrom

2. Step into the directory where you have copied the CD to
(~/puppyRemaster/isolinux-builds). Uncompress the image.gz and mount
the file image (which is an ext2 filesystem) somewhere you can
access it conveniently, e.g., /mnt/tmp. It is not necessary to use
/mnt/tmp, but it will be assumed here.

cd ~/puppyRemaster/isolinux-builds
gunzip image.gz
mount ~/puppyRemaster/isolinux-builds/image /mnt/tmp -o loop

3. The configuration file for compiling the kernel and the modules
should now be available under /mnt/tmp/lib/modules

4. Make sure the kernel source is available and that an appropriate
compiler is installed. Using gcc 2.96 seems to be working well. A
good place to put the kernel source is under /usr/src/linux-2.4.29,
but it is not necessary. In the following text, this will be the
assumed location.

5. Apply patches to the kernel as described in
http://www.goosee.com/puppy/development ... kernel.htm.

Note:
it seems like we also need to get a driver for the unionfs (file
system used by Puppy Linux). There should be two options for this:
either compile and install from source found at
http://www.fsl.cs.sunysb.edu/project-unionfs.html or use the module
already available in /mnt/tmp/lib/modules/2.4.29/fs/.

6. Make sure the kernel is 'clean' and insert the config file

cd /usr/src/linux-2.4.29/
make mrproper
cp /mnt/tmp/lib/modules/config-2july05-2.4.29-pup1.0.4 .config

7. Make sure all configurations are updates using make oldconfig

make oldconfig

8. Make the changes you wish to perform using, e.g., make menuconfig

make menuconfig

9. Run the regular compile sequence

make dep
make bzImage
make modules


10. The kernel should now be available under
/usr/src/linux-2.4.29/arch/i386/boot/bzImage. It can be copied to
~/puppyRemaster/isolinux-builds/ and replace vmlinuz.

cp /usr/src/linux-2.4.29/arch/i386/boot/bzImage ~/puppyRemaster/isolinux-builds/vmlinuz

11. Alternatively, it can be named differently, but then it is
necessary to edit the file isolinux.cfg found in the same
directory.

12. The modules are already compiled, but they have to be collected to
a proper place from where they can be copied to
/mnt/tmp/lib/modules. This is easiest done by running make
modules_install in the /usr/src/linux-2.4.29 directory and then
pick up the correct files from /lib/modules (not
/mnt/tmp/lib/modules!). This is the same place where your
currently running kernel is keeping its modules so if you are
running the kernel 2.4.29, make sure to create a backup of your
current modules!

cd /lib/modules
tar cf modules_backup_2.4.29.tar 2.4.29
cd /usr/src/linux-2.4.29/
make modules_install

13. Now move the relevant modules from /lib/modules/2.4.29 to a
temporary location before copying them to
/mnt/tmp/lib/modules. This is done using the script
updatemodules.sh, which moves the needed files to
~/puppyRemaster/final-modules/lib/modules. Note that if other
directories than the ones stated here are used, the script must be
edited. It should however suffice to modify the strings at the
start of the script. Before moving the modules, add the file
unionfs.o to ~/puppyRemaster/final-modules/lib/modules/2.4.29/fs
and then move the complete directory to /mnt/tmp/lib/modules.

If the modules for unionfs is to be built from source, now is a
good time to do that. With either module, it has to be copied into
the modules tree before collecting all modules. This order is
necessary since the script updatemodules.sh performs a depmod at
the end and then all files must be available.

Note: the files that are collected from /lib/modules are defined
in the script and they should be the same as the ones that are
found when running "find /mnt/tmp/lib/modules/ -type f -print".
However, the .gz must be removed from the name since they are not
compressed in /lib/modules (but they will be in
/mnt/tmp/lib/modules).

If additional modules should be added, just edit the script and
enter the location where they shall be _PUT_ in
/mnt/tmp/lib/modules, not where they currently are found in
/lib/modules.


// possibly compile unionfs.o and put it in ~/puppyRemaster/ //

cp ~/puppyRemaster/unionfs.o /lib/modules/2.4.29/kernel/fs/

// possibly edit updatemodules.sh here to include new modules //

updatemodules.sh
rm -fr /mnt/tmp/lib/modules/2.4.29 # <--- don't forget the /mnt/tmp!!!
cp -r ~/puppyRemaster/final-modules/lib/modules/2.4.29 /mnt/tmp/lib/modules/

14. The structure should now be complete for regenerating an
iso-image. If there are additional files to be added, e.g., to
/mnt/tmp/sbin or /mnt/tmp/bin, now is the time to do that. It is
also a convenient time to update isolinux.cfg to reflect any
changes. Finally, unmount the /mnt/tmp and compress the file "image".

//
cp whatever-file /mnt/tmp/sbin (or /mnt/tmp/bin)
//

umount /mnt/tmp
gzip ~/puppyRemaster/isolinux-builds/image

15. Create an iso-image using mkisofs

cd ~/puppyRemaster
mkisofs -o cd-puppy.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ./isolinux-builds/

16. The iso image is available. If you have an emulator like VMWare,
it is possible to test it directly. Otherwise, just burn a CD.


GOOD LUCK!
Attachments
unionfs-1.0.11.tar.gz
source for unionfs if you want to build it
(107.08 KiB) Downloaded 850 times
unionfs.o.gz
The unionfs module found in PuppyLinux-1.0.4
(55.84 KiB) Downloaded 871 times
updatemodules.sh.gz
Script for collecting the correct set of modules
(2.45 KiB) Downloaded 980 times

Staffan
Posts: 12
Joined: Wed 14 Sep 2005, 07:41
Location: Sweden

#2 Post by Staffan »

Hello,

just noticed that the link in step 5 accidentally includes a dot at the end. This should be omitted or you won't find the correct page.
I was also not able to include the HOWTO as a file earlier, I'm trying again.

Regards,
Staffan
Attachments
HOWTO.gz
(2.42 KiB) Downloaded 925 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

Many Thanks for this detailed Howto, I will try it in the next days to get the cpufreq-patch running :)

Mark

User avatar
bombayrockers
Posts: 427
Joined: Sat 24 Sep 2005, 16:47
Location: Mumbai, India
Contact:

custom kernel

#4 Post by bombayrockers »

staffan can you make a custom kernel for me patched with performance patches mentioned at http://www.plumlocosoft.com/kernel/ plus the patches required to run puppy

These performance patches for kernel 2.4.29 can be downloaded for from http://www.plumlocosoft.com/kernel/patc ... omponents/

User avatar
bombayrockers
Posts: 427
Joined: Sat 24 Sep 2005, 16:47
Location: Mumbai, India
Contact:

#5 Post by bombayrockers »

Thanks Staffan for the HOW-TO above.
_________________
Boosted Puppy Kernel (2.4.29) available
Download Here
KDE for testers available
Download Here

User avatar
bombayrockers
Posts: 427
Joined: Sat 24 Sep 2005, 16:47
Location: Mumbai, India
Contact:

#6 Post by bombayrockers »

One little thing i would like to add.

Compiling unionfs using the default makefile we get a module ~2000kb.
This size can be reduced by disabling debug imformation. To disable debug imformation read the INSTALL file in the unionfs source folder. Once debug is disabled size of unionfs module reduces to 207 Kb.

The ntfs and squashfs patches available at http://www.goosee.com/puppy/development ... kernel.htm are .gz packages and BarryK says to gunzip them before installation. However they are not actually .gz but
.patch files renamed .patch.gz. So to use them remove the .gz by renaming.

Post Reply