Pygrub with jailtime

From PrgmrWiki

to convert a jailtime CentOS image to use pygrub:

wget 'http://jailtime.org/lib/exe/fetch.php?cache=cache&media=download%3Acentos64%3Acentos.5-1.64.20080119.img.tar.bz2'


[lsc@boar ~]$ tar -jxvf centos.5-1.64.20080119.img.tar.bz2

[root@boar lsc]# mount -oloop centos.5-1.64.img /mnt

[root@boar mnt]# cat > etc/modprobe.conf
alias scsi_hostadapter xenblk
alias eth0 xennet

[root@boar mnt]# yum --installroot=/mnt -y install kernel-xen

[root@boar mnt]# cd boot
[root@boar boot]# ls
config-2.6.18-92.1.6.el5xen      vmlinuz-2.6.18-92.1.6.el5xen
initrd-2.6.18-92.1.6.el5xen.img  xen.gz-2.6.18-92.1.6.el5
symvers-2.6.18-92.1.6.el5xen.gz  xen-syms-2.6.18-92.1.6.el5
System.map-2.6.18-92.1.6.el5xen
[root@boar boot]# mkdir grub
[root@boar boot]# cd grub
[root@boar grub]# cat >menu.lst
title CentOS (2.6.18-92.1.6.el5xen)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-92.1.6.el5xen console=xvc0 root=/dev/sda1 ro 
        initrd /boot/initrd-2.6.18-92.1.6.el5xen.img




[root@boar mnt]# echo '1:2345:respawn:/sbin/mingetty xvc0' >> etc/inittab
[root@boar mnt]# echo "xvc0" >> etc/securetty



new config file looks something like:

bootloader = "/usr/bin/pygrub"
memory = 256
name = "centos.5-1.64"
vif = [ '' ]
#dhcp= "dhcp"
disk = ['file:/xen/centos/centos.5-1.64.img,sda1,w', 'file:/xen/centos/centos.swap,sda2,w']

then you need to make your initrd (the modprobe.conf trick will mean that mkinitrd will just work in the future, but if you are doing this on the non-xen or xen0 box it will be broken the first time...)


root@boar boot]# /sbin/mkinitrd --with xennet --fstab=/mnt/etc/fstab --preload xenblk initrd-2.6.18-92.1.6.el5xen.img 2.6.18-92.1.6.el5xen