Compiling and installing the Linux kernel

Let's download the last vanilla kernel with the below command, the portage will extract the kernel source into /usr/src/linux-x.y.z.t/ (where x.y.z.t are the version numbers), the portage will also create the symbolic link /usr/src/linux:

	# emerge vanilla-sources

Now we must apply the squashfs' patch to our kernel. Squashfs is a read-only compressed filesystem, and it will be treated ahead in this document. Below the steps required to apply, the patch, and to compile to userspace program (mksquashfs) that we will use to create a loop mountable file containing our squashed filesystem:

Now configure you kernel, i'm sure i know how to compile it. Please follow these suggestions:

Use the menuconfig target to enter into the menu:

	# make menuconfig

When i've finished to configure your kernel (don't forget the squashfs support!) let's save the configuration coping the configuration file into a backup directory:

	# cp .config /root/dot-config-linux-kernel-x.y.z.t-BACKUP

Compile the kernel, then install it on /embedded_rootfs/boot/:

	# make
	# ROOT=/embedded_rootfs make modules_install
	# cp /usr/src/linux/arch/i386/boot/bzImage /embedded_rootfs/boot/linux-x.y.z.t

Edit the /embedded_rootfs/etc/lilo.conf to configure the boot loader:

	# change hda with you drive
	boot = /dev/hda 
	
	vga = normal

	image = /boot/linux-x.y.z.t
 	
	root = /dev/hdaX 
	# where X is you root partition
	# leave X now, you will change this later
 	
	label = embedded