]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Add xen-image build
authorArne Fitzenreiter <arne_f@ipfire.org>
Fri, 7 Aug 2009 22:33:33 +0000 (00:33 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Fri, 7 Aug 2009 22:33:33 +0000 (00:33 +0200)
config/rootfiles/packages/xen
config/xen-image/README [new file with mode: 0644]
config/xen-image/ipfire.cfg [new file with mode: 0644]
lfs/xen-image [new file with mode: 0644]
make.sh

index c807f233c635161d0f2f106050e079b171709047..2ecc82d503d1228f801de10bac9b5ca172226262 100644 (file)
@@ -46,7 +46,7 @@ etc/xen/xend-pci-permissive.sxp
 etc/xen/xend-pci-quirks.sxp
 etc/xen/xm-config.xml
 etc/xen/xmexample.hvm
-etc/xen/xmexample.hvm-dm
+#etc/xen/xmexample.hvm-dm
 etc/xen/xmexample.hvm-stubdom
 etc/xen/xmexample.nbd
 etc/xen/xmexample.pv-grub
diff --git a/config/xen-image/README b/config/xen-image/README
new file mode 100644 (file)
index 0000000..9a9c2f5
--- /dev/null
@@ -0,0 +1,25 @@
+Howto install Ipfire as a paravirtualized DomU:
+
+- download image
+- extract the downloaded file, be careful, you need at least 4gb
+- edit the file ipfire.cfg
+- start ipfire:  "xm create -c ipfire.cfg"
+- go to console: "xm console ipfire-xen"
+- after booting, the setup will started to do basic settings and reboot
+
+This setup is for 2 interfaces (green and red). if you want more, like orange and blue, edit the ipfire.cfg and execute "setup" to adjust yout config.
+
+other usefull commands from the Dom0:
+- shutdown the fire: "xm shutdown ipfire-xen"
+- reset the fire: "xm destroy ipfire-xen"
+- look what is going on: "xm top" or "xm list"
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is image is build with the normal build environment and not tested yet +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Todo:
+- prevent loading some modules like ac, battery and so on
+- remove setclock initscript
+- remove keymap initscript
+- add hvc0 to /etc/securetty
diff --git a/config/xen-image/ipfire.cfg b/config/xen-image/ipfire.cfg
new file mode 100644 (file)
index 0000000..cc1ac44
--- /dev/null
@@ -0,0 +1,25 @@
+kernel = "/mnt/test/boot/vmlinuz-KVER-ipfire-xen"    #### change path
+ramdisk ="/mnt/test/boot/ipfirerd-KVER-xen.img"      #### change path
+
+memory = 128
+name = "ipfire-xen"
+
+acpi=1
+apic=1
+
+### network: do not change the mac adresses and never use your real mac adresse of your hardware here!! ###
+vif         = [
+                  'mac=00:17:3E:BE:A1:1A, bridge=xenbrI',      ## Green
+                  'mac=00:17:3E:BE:A1:1B, bridge=xenbrE',      ## Red
+#                  'mac=00:17:3E:BE:A1:1C, bridge=xenbrW',     ## Blue (currently disabled, uncomment it if neede)
+#                  'mac=00:17:3E:BE:A1:1D, bridge=xenbrD'      ## Orange (currently disabled, uncomment it if neede)
+              ]
+
+
+disk = [
+               'file:/mnt/test/ipfire.img,xvda1,w', 
+               'file:/mnt/test/swap.img,xvdb1,w'
+       ] #### Change path
+
+root = "/dev/xvda1"
+extra =  'xencons=tty console=hvc0 clocksource=jiffies'
diff --git a/lfs/xen-image b/lfs/xen-image
new file mode 100644 (file)
index 0000000..4da844c
--- /dev/null
@@ -0,0 +1,136 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER = ipfire
+
+THISAPP    = xen-image
+TARGET     = $(DIR_INFO)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+install : $(TARGET)
+
+check :
+
+download :
+
+md5 :
+
+###############################################################################
+# Installation Details
+###############################################################################
+IMGinst  := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-$(ED)-core$(CORE).tar.bz2
+MNThdd   := /install/harddisk
+
+IMGroot  := /install/images/$(SNAME)/$(SNAME).img
+IMGswap  := /install/images/$(SNAME)/swap.img
+SIZEroot := 1024
+SIZEswap := 512
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       rm -rf $(MNThdd) $(IMGinst) $(IMGroot) && mkdir -p $(MNThdd)
+       mkdir -p /install/images/$(SNAME)/boot
+
+       #Create swapimage
+       dd bs=1M if=/dev/zero of=$(IMGswap) count=$(SIZEswap)
+       mkswap $(IMGswap)
+
+       #Create rootimage
+       dd bs=1M if=/dev/zero of=$(IMGroot) count=$(SIZEroot)
+       mkfs.ext3 -F $(IMGroot)
+
+       # Mount Images (ext3 mount create a inaccessible ".journal"
+       mount -o loop -t ext2 $(IMGroot) $(MNThdd)
+       mkdir $(MNThdd)/boot
+       mkdir $(MNThdd)/var
+       mkdir $(MNThdd)/var/log
+
+       # Install IPFire without kernel modules
+       tar -C $(MNThdd)/ -xvjf /install/cdrom/$(SNAME)-$(VERSION).tbz2 \
+               --exclude=lib/modules* --exclude=boot*
+
+       #Install Xen Kernel
+       tar -C $(MNThdd)/opt/pakfire/tmp -xvf /install/packages/linux-xen-$(KVER)-*.ipfire
+       chroot $(MNThdd) /opt/pakfire/tmp/install.sh
+       rm -rf $(MNThdd)/opt/pakfire/tmp/*
+
+       #Set default configuration
+       echo "LANGUAGE=en" >> $(MNThdd)/var/ipfire/main/settings
+       echo "HOSTNAME=$(SNAME)" >> $(MNThdd)/var/ipfire/main/settings
+       echo "THEME=ipfire" >> $(MNThdd)/var/ipfire/main/settings
+       touch $(MNThdd)/lib/modules/$(KVER)-ipfire-xen/modules.dep
+       mv $(MNThdd)/bin/uname.bak $(MNThdd)/bin/uname
+       mkdir $(MNThdd)/proc
+       mount --bind /proc $(MNThdd)/proc
+       mount --bind /dev  $(MNThdd)/dev
+       mount --bind /sys  $(MNThdd)/sys
+       chroot $(MNThdd) /usr/bin/perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
+       sed -i -e "s|DEVICE1|#boot-disabled|g" $(MNThdd)/etc/fstab
+       sed -i -e "s|DEVICE2|/dev/xvdb1|g" $(MNThdd)/etc/fstab
+       sed -i -e "s|DEVICE3|/dev/xvda1|g" $(MNThdd)/etc/fstab
+       sed -i -e "s|DEVICE4|#var-disabled|g" $(MNThdd)/etc/fstab
+
+       sed -i -e "s|FSTYPE|ext3|g" $(MNThdd)/etc/fstab
+       cp -f $(MNThdd)/etc/mkinitcpio.conf $(MNThdd)/etc/mkinitcpio.conf.org
+       sed -i -e "s| autodetect | |g" $(MNThdd)/etc/mkinitcpio.conf
+
+       #Remove File System modules because they are included to kernel
+       sed -i -e "s|reiser4 reiserfs ext3| |g" $(MNThdd)/etc/mkinitcpio.conf
+
+       chroot $(MNThdd) /sbin/mkinitcpio -g /boot/ipfirerd-$(KVER)-xen.img -k $(KVER)-ipfire-xen
+       cp -f $(MNThdd)/etc/mkinitcpio.conf.org $(MNThdd)/etc/mkinitcpio.conf
+
+       # Create a script for rebuild-initrd and setup
+       echo "#!/bin/bash"                                   > $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+       echo "/usr/local/sbin/setup /dev/null INSTALL"      >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+       echo "rm -f /etc/rc.d/rcsysinit.d/S75firstsetup \\" >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+       echo "&& /sbin/reboot"                              >> $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+       chmod +x $(MNThdd)/etc/rc.d/rcsysinit.d/S75firstsetup
+
+       #Remove root / fstab check
+       rm -rf $(MNThdd)/etc/rc.d/rcsysinit.d/S19checkfstab
+
+       #Copy initramdisk, kernel and config
+       cp -f $(MNThdd)/boot/ipfirerd-$(KVER)-xen.img \
+               /install/images/$(SNAME)/boot
+       cp -f $(MNThdd)/boot/vmlinuz-$(KVER)-ipfire-xen \
+               /install/images/$(SNAME)/boot
+       cp $(DIR_SRC)/config/xen-image/* \
+               /install/images/$(SNAME)
+       sed -i -e "s|KVER|$(KVER)|g" /install/images/$(SNAME)/ipfire.cfg
+
+       # Unmount
+       umount $(MNThdd)/proc
+       umount $(MNThdd)/dev
+       umount $(MNThdd)/sys
+       umount $(MNThdd)
+
+       # Compress Image
+       cd /install/images/ && tar -cvjf $(IMGinst) $(SNAME)
+
+       rm -rf $(MNThdd) /install/images/$(SNAME)
diff --git a/make.sh b/make.sh
index ab5a40fa807887e25d4214bc0ea81664d2b51c68..1b78d786df9acb821b9fbaf5f4c1d87c9a1b42cd 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -701,7 +701,7 @@ buildpackages() {
 
   # Create images for install
        ipfiremake cdrom ED=$IPFVER
-       
+
   # Check if there is a loop device for building in virtual environments
   if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then
        ipfiremake usb-stick ED=$IPFVER
@@ -712,6 +712,14 @@ buildpackages() {
 
   ipfirepackages
 
+  # Check if there is a loop device for building in virtual environments
+  if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then
+        cp -f $BASEDIR/packages/linux-xen-*.ipfire $LFS/install/packages/
+       ipfiremake xen-image ED=$IPFVER
+       rm -rf $LFS/install/packages/linux-xen-*.ipfire
+  fi
+  mv $LFS/install/images/*.bz2 $BASEDIR >> $LOGFILE 2>&1
+
   # Cleanup
   stdumount
   rm -rf $BASEDIR/build/tmp/*