Xen On Funtoo From Scratch
From Xen
Jump to navigationJump to search
STUB - WORK IN PROGRESS
Hardware Configuration
- VGA: Nvidia GeForce 9800 GT
- CPU: Intel Core i7 3770
- Motherboard: DQ77MK
Used Software
- Dom0 OS: Funtoo GNU/Linux distro (derrived from gentoo).
- Kernel: 3.4.4
- Xen: 4.2.0-unstable rev 25099
- DomU OS: Windows XP SP3
Reference documentation
- Creating bootable USB-stick from gentoo livecd: http://www.gentoo.org/doc/en/liveusb.xml
- Funtoo installation: http://www.funtoo.org/wiki/Funtoo_Linux_Installation
- Xen 4.1 installation on gentoo: http://en.gentoo-wiki.com/wiki/Xen4.1
- Xen 4.2 installation on ubuntu: http://www.davidgis.fr/blog/index.php?2011/12/07/860-xen-%2042unstable-patches-for-vga-pass-through
- LVM installation guide on funtoo: http://www.funtoo.org/wiki/Rootfs_over_encrypted_lvm
Make bootable USB
Make partitions
# fdisk -l /dev/sdb Disk /dev/sdb: 8422 MB, 8422162432 bytes 239 heads, 47 sectors/track, 1464 cylinders, total 16449536 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0008aec7 Device Boot Start End Blocks Id System /dev/sdb1 * 2048 16449535 8223744 b W95 FAT32
Install MBR
# dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb 0+1 records in 0+1 records out 440 bytes (440 B) copied, 0.0190098 s, 23.1 kB/s
Make fat32 filesystem
# mkdosfs -F32 /dev/sdb1 mkdosfs 3.0.9 (31 Jan 2010)
Download Gentoo LiveCD iso
Go to http://www.gentoo.org/main/en/where.xml ; pick mirror you like and download install-amd64-minimal-[0-9]*.iso, for example - this one:
wget http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/install-amd64-minimal-20120621.iso
Mount gentoo LiveCD
# mkdir -p /mnt/cdrom/ # mount -o loop install-amd64-minimal-20120621.iso /mnt/cdrom/ mount: warning: /mnt/cdrom/ seems to be mounted read-only.
Mount usb stick
# mkdir -p /mnt/usb/ # mount /dev/sdb1 /mnt/usb/
Copy contents of LiveCD to usb stick
# cp -aR /mnt/cdrom/* /mnt/usb/ # mv /mnt/usb/isolinux/* /mnt/usb # mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg # rm -rf /mnt/usb/isolinux* # mv /mnt/usb/memtest86 /mnt/usb/memtest # sed -i \ -e "s:cdroot:cdroot slowusb:" \ -e "s:kernel memtest86:kernel memtest:" \ /mnt/usb/syslinux.cfg
Unmount medias
# umount /mnt/cdrom/ # umount /mnt/usb/
Install syslinux
note guide # syslinux /dev/sdb1
Boot from USB-stick
If in trouble, try following gentoo handbook
Install Funtoo
Once booted, do this:
Partition hard drive
# gdisk -l /dev/sda GPT fdisk (gdisk) version 0.8.4 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 1953525168 sectors, 931.5 GiB Logical sector size: 512 bytes Disk identifier (GUID): DDF92951-E1C2-4138-B01C-71051D08D1FB Partition table holds up to 128 entries First usable sector is 34, last usable sector is 1953525134 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 67583 32.0 MiB EF02 BIOS boot partition 2 67584 1091583 500.0 MiB 8300 Linux filesystem 3 1091584 17868799 8.0 GiB 8200 Linux swap 4 17868800 1953525134 923.0 GiB 8E00 Linux LVM
Setup LVM
# pvcreate /dev/sda4 Writing physical volume data to disk "/dev/sda4" Physical volume "/dev/sda4" successfully created # vgcreate data /dev/sda4 Volume group "data" successfully created # lvcreate -L40G -n root data Logical volume "root" created # lvcreate -L40G -n winxp data Logical volume "winxp" created
Setup Filesystems
# mkfs.ext3 /dev/sda2 # mkswap /dev/sda3 # mkfs.ext4 /dev/data/root
Mount filesystems
# mkdir /mnt/funtoo # mount /dev/data/root /mnt/funtoo/ # mkdir /mnt/funtoo/boot # mount /dev/sda2 /mnt/funtoo/boot/ # cd /mnt/funtoo/
Setup networking inside of LiveUSB OS
# /etc/init.d/dhcpcd start
Download Funtoo stage3 distribution
# wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/corei7/stage3-current.tar.xz
Unpack Funtoo distribution
# tar xJpf stage3-current.tar.xz
Chrooting
# mount --bind /dev/ /mnt/funtoo/dev/ # mount --bind /proc/ /mnt/funtoo/proc # cp /etc/resolv.conf /mnt/funtoo/etc/ # chroot /mnt/funtoo/
Syncing
# emerge --sync
Configure Funtoo
/etc/fstab
# <fs> <mountpoint> <type> <opts> <dump/pass> /dev/sda2 /boot ext3 defaults 1 2 /dev/sda3 none swap sw 0 0 /dev/data/root / ext4 noatime 0 1
/etc/localtime
# cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
/etc/make.conf
ACCEPT_KEYWORDS="~amd64" CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=corei7 -O2 -pipe" CXXFLAGS="-march=corei7 -O2 -pipe" SYNC="git://github.com/funtoo/ports-2012.git" USE="X xinerama" VIDEO_CARDS="nvidia" MAKEOPTS="10"
Install system-wide services
# echo "sys-boot/boot-update" >> /etc/portage/package.unmask # echo "sys-devel/automake" >> /etc/portage/package.unmask # emerge -av eix lvm2 grub bridge-utils vixie-cron syslog-ng logrotate =sys-boot/boot-update-1.6.2 # eix-update # rc-update add lvm default # rc-update add vixie-cron default # rc-update add syslog-ng default
Configure bootloader
# grub-install --no-floppy /dev/sda
Install initramfs
# mkdir /root/initramfs # cd /root/initramfs/ # git clone git://github.com/slashbeast/better-initramfs.git # cd better-initramfs # bootstrap/bootstrap-all # make prepare # make image # cp output/initramfs.cpio.gz /boot/
/etc/boot.cfg
boot { generate grub default "Funtoo Linux XEN" timeout 3 } "Funtoo Linux XEN" { type xen xenkernel xen.gz kernel vmlinuz[-v] initrd /initramfs.cpio.gz params += root=/dev/data/root lvm }
Update
# boot-update
Install kernel 3.4.4
# emerge -av =sys-kernels/gentoo-sources-3.4.4
- install xen 4.2-unsable
- install winxp
- integreate