2011年11月8日 星期二

Install Xen 4.0.1 on CentOS 6

Reference document: RHEL6Xen4Tutorial
According to  reference document, I wrote a shell script to install Xen4.0.1 on CentOS 6

#!/bin/bash
# Program:
#       Install-xen4.0.1.sh
# History:
# 2011/10/20    howie YU   First release

if [ $UID != "0" ]; then
  echo " You must be root to run the script or run it with sudo"
  exit 1;
fi

if [ $# -lt 1 ]; then
  echo " Usage: ./install-xen.sh   "
  echo " if src path in ~/xen/ then =xen "
  echo " The script assumes the guest being clone is a Red Hat based system"
  exit 1;
fi
installPath=$1

chkconfig --list network
yum -y update
yum -y install screen vim wget tcpdump ntp ntpdate man smartmontools links lynx ethtool xorg-x11-xauth
yum -y groupinstall "Development tools" "Additional Development" "Debugging Tools" "System administration tools" "Compatibility libraries" "Console internet tools" "Desktop Platform Development"
yum -y install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial texinfo libuuid-devel
yum -y install glibc-devel.i686

echo "Remove old virtlib....."
yum -y groupremove "Virtualization"

echo "Prepare for qeum...."
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/14/Everything/i386/os/Packages/openbios-common-1.0-2.fc12.noarch.rpm
wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/releases/14/Everything/i386/os/Packages/openbios-ppc-1.0-2.fc12.noarch.rpm
wget ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/test/16-Alpha/Fedora/x86_64/os/Packages/seabios-bin-0.6.2-2.fc16.noarch.rpm
wget ftp://bo.mirror.garr.it/pub/1/fedora/linux/development/16/x86_64/os/Packages/seabios-0.6.2-2.fc16.x86_64.rpm
wget ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/15/Everything/i386/os/Packages/gpxe-roms-qemu-1.0.1-4.fc15.noarch.rpm


rpm -ivh openbios-common-1.0-2.fc12.noarch.rpm
rpm -ivh openbios-ppc-1.0-2.fc12.noarch.rpm
rpm -e seabios
rpm -ivh seabios-bin-0.6.2-2.fc16.noarch.rpm
rpm -ivh seabios-0.6.2-2.fc16.x86_64.rpm
rpm -e gpxe-roms-qemu
rpm -ivh gpxe-roms-qemu-1.0.1-4.fc15.noarch.rpm

wget http://dl.fedoraproject.org/pub/fedora/linux/updates/13/SRPMS/qemu-0.13.0-1.fc13.src.rpm
rpm -i qemu-0.13.0-1.fc13.src.rpm
rpmbuild -bb ~/rpmbuild/SPECS/qemu.spec

rpm -ivh  ~/rpmbuild/RPMS/x86_64/qemu-common-0.13.0-1.el6.x86_64.rpm
rpm -Uvh  ~/rpmbuild/RPMS/x86_64/qemu-img-0.13.0-1.el6.x86_64.rpm
rpm -Uvh  ~/rpmbuild/RPMS/x86_64/qemu-user-0.13.0-1.el6.x86_64.rpm
rpm -Uvh  ~/rpmbuild/RPMS/x86_64/qemu-system-*
rpm -ivh  ~/rpmbuild/RPMS/x86_64/qemu-kvm-*
rpm -ivh  ~/rpmbuild/RPMS/x86_64/qemu-debuginfo-0.13.0-1.el6.x86_64.rpm
rpm -ivh  ~/rpmbuild/RPMS/x86_64/qemu-0.13.0-1.el6.x86_64.rpm

echo "start to build xen"

wget ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/14/Fedora/source/SRPMS/xen-4.0.1-6.fc14.src.rpm
rpm -i xen-4.0.1-6.fc14.src.rpm
rpmbuild -bb ~/rpmbuild/SPECS/xen.spec

rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-licenses-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-libs-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-hypervisor-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-runtime-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-doc-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-devel-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-debuginfo-4.0.1-6.el6.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/xen-4.0.1-6.el6.x86_64.rpm

echo "Prepare for libvirt install...."


yum -y install xhtml1-dtds libudev-devel libpciaccess-devel  yajl-devel libpcap-devel  libnl-devel avahi-devel  parted-devel device-mapper-devel numactl-devel  netcf-devel augeas radvd systemtap-sdt-devel gnutls-utils

wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/libvirt-0.8.7-18.el6_1.1.src.rpm
rpm -ivh libvirt-0.8.7-18.el6_1.1.src.rpm
wget http://pasik.reaktio.net/xen/patches/libvirt-spec-rhel6-enable-xen.patch
cp -a ~/rpmbuild/SPECS/libvirt.spec /root/rpmbuild/SPECS/libvirt.spec.orig
cd ~/rpmbuild/SPECS/
patch -p0 < ~/$installPath/libvirt-spec-rhel6-enable-xen.patch
cd ~/
rpmbuild -bb ~/rpmbuild/SPECS/libvirt.spec

echo "Remove old libvirt....."
yum -y erase libvirt-client

echo " reinstall libvirt......."

rpm -ivh  ~/rpmbuild/RPMS/x86_64/libvirt-client-0.8.7-18.el6.1.x86_64.rpm
rpm -ivh  ~/rpmbuild/RPMS/x86_64/libvirt-devel-0.8.7-18.el6.1.x86_64.rpm
rpm -ivh  ~/rpmbuild/RPMS/x86_64/libvirt-python-0.8.7-18.el6.1.x86_64.rpm
rpm -ivh  ~/rpmbuild/RPMS/x86_64/libvirt-debuginfo-0.8.7-18.el6.1.x86_64.rpm
rpm -ivh  ~/rpmbuild/RPMS/x86_64/libvirt-0.8.7-18.el6.1.x86_64.rpm

yum -y install virt-manager virt-top virt-viewer

#
# CentOS 6 and RHEL 6 has IGMP built into the bridge-utils. To prevent unnecessary error message, we will need to get Fedora version of bridge-utils source and rebuild it.
#
#
yum -y install  libsysfs-devel

wget ftp://ftp.icm.edu.pl/vol/rzm2/linux-fedora-secondary/development/15/source/SRPMS/bridge-utils-1.2-9.fc13.src.rpm
rpm -i bridge-utils-1.2-9.fc13.src.rpm
rpmbuild -bb ~/rpmbuild/SPECS/bridge-utils.spec

rpm -ivh --force ~/rpmbuild/RPMS/x86_64/bridge-utils-1.2-9.el6.x86_64.rpm


echo "prepare for kernel build "
yum -y install xmlto asciidoc newt-devel perl-ExtUtils-Embed


rpm -ivh kernel-2.6.32-131.12.1.el6.xendom0.src.rpm
rngd -r /dev/urandom
rpmbuild -bb --with baseonly --with firmware --without debuginfo --target=`uname -m`  ~/rpmbuild/SPECS/kernel.spec

rpm -Uvh ~/rpmbuild/RPMS/x86_64/kernel-firmware-2.6.32-131.12.1.el6.xendom0.x86_64.rpm
rpm -Uvh ~/rpmbuild/RPMS/x86_64/kernel-headers-2.6.32-131.12.1.el6.xendom0.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/kernel-devel-2.6.32-131.12.1.el6.xendom0.x86_64.rpm
rpm -ivh ~/rpmbuild/RPMS/x86_64/kernel-2.6.32-131.12.1.el6.xendom0.x86_64.rpm

chkconfig ksm off
chkconfig ksmtuned off

#
# title CentOS (2.6.18-128.1.10.el5)
# root (hd0,0)
# kernel /boot/vmlinuz-2.6.18-128.1.10.el5 ro root=LABEL=/ console=ttyS0
# initrd /boot/initrd-2.6.18-128.1.10.el5.img
#
#
#
echo "ttyS0" >> /etc/securetty

echo "Finish pleas check /etc/grub.conf"
echo " kernel /xen.gz dom0_mem=4096M console=ttyS0 loglvl=all guest_loglvl=all"
echo "module max_loop=256 earlyprintk=xen"

2011年5月29日 星期日

Development engines for iPad

最近因為工作的關係,"準備"開始要研究如何開發iOS app,無奈要開發iOS最大的進入門檻就是要買一台mac,而且要學object C,但是本人就是懶,而且向來都是找阻力最小的地方鑽,所以在上網搜尋有沒有在windows 上開發iOs的solution。

於是就找到了這篇文章 Sticky suggestion - development engines for iPad

Airplay SDK

A cross platform development environment that allows you to use straight C++ to develop iPhone, iPad, Android and PSP apps. Works in Xcode on the Mac but allows you to avoid using Objective C. The PC version allows you to create iOS apps without needing a Mac! I really have to wonder why anyone would use the straight Apple Xcode SDK with an option like this. Even if you like the Xcode environment you can be cross platform with the same codebase using Airplay. Free for iOS if you make less than $100K/yr. I know someone who has been using this and he swears by it.


這個主要是以C++開發,而且要錢,先暫時不考慮

DragonFire SDK
C and C++ development for iPhone and iPad. Runs in Windows or Mac and can create iOS apps with the Windows version! This sends your code to their server to build the app on an actual Mac and then sends the app back to you. Looks like you still need to be a registered developer to actually run it on your iDevice. However, they do allow you to publish free apps through them without having to register with Apple. I assume you would only be able to run it in the simulator to test it in that case.



這個是用C and C++ 開發,範例看起來比較多,可以考慮看看

Corona
Corona is a simulator and compiler for iPhone, Android and iPad apps. It uses the LUA scripting language and includes a physics engine, sprite animation and hooks into the regular iOS stuff. Appears to be well supported, has an active forum and regular releases. It was used by that 14 year old kid who created the #1 physics puzzler. Free to use until you publish something and then the fees are quite reasonable. No royalties. [update: I have been using it and it's pretty solid. Very high level and forgiving for those of us who don't want to manage every last spec of memory. I was able to get something up and running very quickly and it's the easiest by far for actually getting your app on the iPad/iPhone. Good example code on their site and an active code exchange community.]



這個framework 是使用他自己的語言corona,但是看起來還蠻容易理解的,所以列入考慮


Appcelerator Titanium
Cross platform development environment using web technologies like Javascript, PHP, HTML5 and CSS3. Seems to be targeted at web developers. Lots of solid looking apps built with it. Appears to have pretty good access to low level functionality like GPS and camera.



目前列為優先研究對象的就是這個framework啦,因為他是用javascript和HTML5去撰寫,然後再compile成native code,他大部分的lib都是免費,只有一些特別的lib和效果要收錢,所以目前就已這個作為優先的研究對象吧