ok

19/12/10

Installation of deb kernel in Debian chroot environment

Installation of deb kernel in Debian chroot environment
Here are simple steps on how to install custom build or existing Debian kernel within a chroot environment. In this example we do not install a new version of Debian in chroot environment but we use the existing installation. Let's create directory for a chroot environment:

1. Make directory

# mkdir -p /mnt/chroot
First we need to mount a partition with existing Debian installation. In our case a / partition of existing installation is /dev/hdb1 .
# mount  /dev/hdb1 /mnt/chroot
Next we need to bind hardware with new chroot environment. The next commands will make sure that connected hardware works otherwise update-grub may not function properly.

2. Mount

# mount -o bind /proc /mnt/chroot/proc
# mount -o bind /proc /mnt/chroot/dev
Now we are ready to enter chroot environment
chroot
# chroot /mnt/chroot

3. Install kernel

let's install kernel:
/# dpkg -i linux-image-2.6.26-2-486_2.6.26-21lenny4_i386.deb
Selecting previously deselected package linux-image-2.6.26-2-486.
(Reading database ... 12686 files and directories currently installed.)
Unpacking linux-image-2.6.26-2-486 (from linux-image-2.6.26-2-486_2.6.26-21lenny4_i386.deb) ...
Done.
Setting up linux-image-2.6.26-2-486 (2.6.26-21lenny4) ...
Running depmod.
Running mkinitramfs-kpkg.
Running postinst hook script update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.26-2-686
Found kernel: /boot/vmlinuz-2.6.26-2-486
Updating /boot/grub/menu.lst ... done
Good luck. 

0 comments: