Create XEN Endian Firewall Domain (old)

#!/bin/sh
 
# filename: createXenImageEndian.sh
 
# download endian
wget http://downloads.sourceforge.net/efw/EFW-COMMUNITY-2.1.2-200707101220.iso -P /tmp
 
# lvm version
losetup /dev/loop0 /tmp/EFW-COMMUNITY-2.1.2-200707101220.iso
 
# create image for endian
mkdir -p /home/xen/domains/fw
dd if=/dev/zero of=/home/xen/domains/fw/disc.img bs=1G count=4
 
# creae endian installation config
cat <<EOF> /etc/xen/fw-inst
kernel='/usr/lib/xen-ioemu-3.1/boot/hvmloader'
builder='hvm'
memory='128'
name='fw-inst'
device_model='/usr/lib/xen-ioemu-3.1/bin/qemu-dm'
boot='d'
disk=['file:/home/xen/domains/fw/disc.img,ioemu:hda,w','file:/tmp/EFW-COMMUNITY-2.1.2-200707101220.iso,hdc:cdrom,r']
vnc=1
vncpasswd='fw-inst'
vif=['type=ioemu,bridge=xenbr0']
on_reboot ='destroy'
vnclisten='0.0.0.0'
EOF
 
# install
xm create fw-inst
 
# connect with vnc to endian installation
vncviewer YOUR_XEN_SERVER_IP # pass: "fw-inst", type "xen" as bootparameter to start the XEN installation
 
# clean up
rm /tmp/EFW-COMMUNITY-2.1.2-200707101220.iso
rm /etc/xen/fw-inst
 
# copy kernel and initrd from image
lomount -diskimage /home/xen/domains/fw/disc.img -partition 1 /mnt
cp /mnt/initrd-2.6.9-55.EL.endian19-xenU.img /mnt/vmlinuz-2.6.9-55.EL.endian19-xenU /home/xen/domains/fw/
umount /mnt
 
# create xen config for endian
cat <<EOF> /etc/xen/fw
kernel='/home/xen/domains/fw/vmlinuz-2.6.9-55.EL.endian19-xenU'
ramdisk='/home/xen/domains/fw/initrd-2.6.9-55.EL.endian19-xenU.img'
memory='128'
root='/dev/hda3 ro'
disk=['file:/home/xen/domains/fw/disc.img,ioemu:hda,w']
name='fw'
vif=['bridge=xenbr0,mac=00:00:00:00:00:11','bridge=xenbr1,mac=00:00:00:00:00:99']
EOF
 
# add endian to xen autostart
ln -s /etc/xen/fw /etc/xen/auto/
 
# start endian
xm create fw
 
### old 
#
# cp -a /tmp/2.6.18-53.1.4.endian7xen/ /mnt/lib/modules/
umount /mnt
 
#wget http://downloads.sourceforge.net/efw/EFW-COMMUNITY-2.1.2-200707101220.iso -P /tmp
#wget http://dl.sourceforge.net/sourceforge/efw/EFW-COMMUNITY-2.2-rc2-200807241531.iso -P /tmp
 
#dd if=/dev/zero of=/dev/vg01/fw-disk
 
 
### , type "xen" as bootparameter to start the XEN installation
# endian 2.1.2
lomount -diskimage /dev/vg01/fw-disk -partition 1 /mnt
cp /mnt/initrd-2.6.9-55.EL.endian19-xenU.img /mnt/vmlinuz-2.6.9-55.EL.endian19-xenU /boot/
umount /mnt
 
cat <<EOF> /etc/xen/fw
kernel='/boot/vmlinuz-2.6.9-55.EL.endian19-xenU'
ramdisk='/boot/initrd-2.6.9-55.EL.endian19-xenU.img'
memory='128'
root='/dev/hda3 ro'
disk=['phy:/dev/vg01/fw-disk,ioemu:hda,w']
name='fw'
vif=['bridge=xenbr0,mac=00:00:00:00:00:11']
#,'bridge=xenbr1,mac=00:00:00:00:00:99'
EOF
 
 
 
 
 
 
# test kernel 2.6.21 #
apt-get install alien
alien /home/pako/Desktop/kernel-xen-2.6.21.7-2.neobiker.efw22.i686.rpm 
dpkg -x kernel-xen_2.6.21.7-3_i386.deb /tmp
scp xen.gz-2.6.21.7-2.neobiker.efw22  root@192.168.1.111:/boot
scp vmlinuz-2.6.21.7-2.neobiker.efw22xen root@192.168.1.111:/boot
 
 
 
 
### LINKS ###
# http://www.ctserver.org/ftopic1510.html
# http://www.ctserver.org/ftopic1538.html