]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
xen-image: replace image by a download and image buildskript.
authorArne Fitzenreiter <arne_f@ipfire.org>
Wed, 11 Sep 2013 22:53:27 +0000 (00:53 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Wed, 11 Sep 2013 22:53:27 +0000 (00:53 +0200)
This skript download the iso and pae-kernel and build the image.

config/xen-image/README
config/xen-image/ipfire.cfg
config/xen-image/xen-image-maker.sh [new file with mode: 0644]
lfs/xen-image

index 49c1192f8738dcef44a53a8ba8767a875501fecf..3813572e00287031349e7abb0d67c46125a99ca4 100644 (file)
@@ -1,7 +1,9 @@
-Howto install Ipfire as a paravirtualized DomU:
+How to install Ipfire as a Xen DomU:
+
+- run xen-image-maker.sh to download and build the xen-images.
+  you need to be root because the skript do some loop mounts.
+  The script need wget and gpg for download and decode ipfire packages.
 
-- download image
-- extract the downloaded file, be careful, you need at least 2gb
 - edit the file ipfire.cfg
 - start ipfire:  "xm create ipfire.cfg"
 - if you get no errormessage go to console: "xm console ipfire-xen"
@@ -16,8 +18,3 @@ 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 full tested yet                      +
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index eeb35c9f21b135234c5c3ae55d7e86947874b7e6..594c82a5f9c3fcf844662069e4369ec847fa9986 100644 (file)
@@ -1,6 +1,6 @@
 bootloader = '/usr/bin/pygrub'
 
-memory = 128
+memory = 256
 name = "ipfire-xen"
 
 acpi=1
diff --git a/config/xen-image/xen-image-maker.sh b/config/xen-image/xen-image-maker.sh
new file mode 100644 (file)
index 0000000..038b578
--- /dev/null
@@ -0,0 +1,194 @@
+#/bin/bash
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2013  Arne Fitzenreiter  <arne_f@ipfire.org>             #
+#                                                                             #
+# 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/>.       #
+#                                                                             #
+###############################################################################
+
+SNAME=xxxSNAMExxx
+VERSION=xxxVERSIONxxx
+CORE=xxxCORExxx
+
+KERN_TYPE=pae
+KVER=xxxKVERxxx
+KERN_PACK=xxxKERN_PACKxxx
+KRNDOWN=http://mirror0.ipfire.org/pakfire2/$VERSION/paks
+
+###############################################################################
+# If you really want to use  outdated legacy kernel uncomment this lines. #####
+# Not recommended!!! ##########################################################
+######################
+#KERN_TYPE=xen
+#KVER=2.6.32.61
+#KERN_PACK=27
+#KRNDOWN=http://mirror0.ipfire.org/pakfire2/2.13/paks
+###############################################################################
+
+SIZEboot=30
+SIZEswap=512
+SIZEroot=512
+SIZEvar=950
+
+##############################################################################
+
+SOURCEISO=$SNAME-$VERSION.i586-full-core$CORE.iso
+HTTPDIR=http://download.ipfire.org/releases/ipfire-2.x/$VERSION-core$CORE
+
+TMPDIR=./ipfire-tmp
+ISODIR=$TMPDIR/iso
+MNThdd=$TMPDIR/harddisk
+
+IMGboot=./$SNAME-boot.img
+IMGswap=./$SNAME-swap.img
+IMGroot=./$SNAME-root.img
+IMGvar=./$SNAME-var.img
+
+KERNEL=linux-$KERN_TYPE-$KVER-$KERN_PACK.ipfire
+
+rm -rf $TMPDIR && mkdir -p $MNThdd && mkdir -p $ISODIR
+echo --------------------------------------------------------
+echo - Download $SOURCEISO ...
+echo --------------------------------------------------------
+wget $HTTPDIR/$SOURCEISO -O $TMPDIR/$SOURCEISO
+mount -o loop $TMPDIR/$SOURCEISO $ISODIR
+
+echo --------------------------------------------------------
+echo - Download $KERNEL ...
+echo --------------------------------------------------------
+wget $KRNDOWN/$KERNEL -O $TMPDIR/$KERNEL.gpg
+gpg -d $TMPDIR/$KERNEL.gpg > $TMPDIR/$KERNEL
+
+echo --------------------------------------------------------
+echo - Create Images ...
+echo --------------------------------------------------------
+
+#Create bootimage
+dd bs=1M if=/dev/zero of=$IMGboot count=$SIZEboot
+mkfs.ext2 -F $IMGboot
+
+#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.ext4 -F $IMGroot
+
+#Create varimage
+dd bs=1M if=/dev/zero of=$IMGvar count=$SIZEvar
+mkfs.ext4 -F $IMGvar
+
+echo --------------------------------------------------------
+echo - Intall IPFire to the Images ...
+echo --------------------------------------------------------
+
+# Mount Images
+mount -o loop $IMGroot $MNThdd
+mkdir $MNThdd/boot
+mkdir $MNThdd/var
+mkdir $MNThdd/var/log
+mount -o loop $IMGboot $MNThdd/boot
+mount -o loop $IMGvar $MNThdd/var
+
+# Install IPFire without kernel modules
+tar -C $MNThdd/ -xvf $ISODIR/$SNAME-$VERSION.tlz --lzma \
+       --exclude=lib/modules* --exclude=boot*
+
+#Install Kernel
+tar -C $MNThdd/opt/pakfire/tmp -xvf $TMPDIR/$KERNEL
+chroot $MNThdd /opt/pakfire/tmp/install.sh
+rm -rf $MNThdd/opt/pakfire/tmp/*
+
+#Create grub menuentry for pygrub
+mkdir $MNThdd/boot/grub
+echo "timeout 10"                          > $MNThdd/boot/grub/grub.conf
+echo "default 0"                          >> $MNThdd/boot/grub/grub.conf
+echo "title IPFire ($KERN_TYPE-kernel)"   >> $MNThdd/boot/grub/grub.conf
+echo "  kernel /vmlinuz-$KVER-ipfire-xen root=/dev/xvda3 rootdelay=10 panic=10 console=xvc0 ro" \
+                                         >> $MNThdd/boot/grub/grub.conf
+echo "  initrd /ipfirerd-$KVER-$KERN_TYPE.img" >> $MNThdd/boot/grub/grub.conf
+echo "# savedefault 0" >> $MNThdd/boot/grub/grub.conf
+
+ln -s grub.conf $MNThdd/boot/grub/menu.lst
+
+#create the meta-info of linux-kernel package
+echo ""                       >  $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
+echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
+echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
+echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
+echo ""                       >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
+echo ""                       >  $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+echo ""                       >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+
+#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-$KERN_TYPE/modules.dep
+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|/dev/xvda1|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE2|/dev/xvda2|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE3|/dev/xvda3|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE4|/dev/xvda4|g" $MNThdd/etc/fstab
+
+sed -i -e "s|FSTYPE|ext4|g" $MNThdd/etc/fstab
+
+#Remove root / fstab check
+rm -rf $MNThdd/etc/rc.d/rcsysinit.d/S19checkfstab
+#Remove console init
+rm -rf $MNThdd/etc/rc.d/rcsysinit.d/S70console
+
+#Add xvc0 to securetty
+echo xvc0 >> $MNThdd/etc/securetty
+
+#Add getty for xvc0
+echo "#Enable login for XEN" >> $MNThdd/etc/inittab
+echo "8:2345:respawn:/sbin/agetty xvc0 9600" >> $MNThdd/etc/inittab
+
+#Disable some initskripts
+echo "#!/bin/sh" > $MNThdd/etc/rc.d/init.d/setclock
+echo "#!/bin/sh" > $MNThdd/etc/rc.d/init.d/keymap
+
+#Remove autoload of acpi modules
+sed -i -e "s|^ac|#ac|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^battery|#battery|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^button|#button|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^fan|#fan|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^processor|#processor|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^thermal|#thermal|g" $MNThdd/etc/sysconfig/modules
+sed -i -e "s|^video|#video|g" $MNThdd/etc/sysconfig/modules
+
+# Unmount
+umount $MNThdd/proc
+umount $MNThdd/dev
+umount $MNThdd/sys
+umount $MNThdd/var
+umount $MNThdd/boot
+umount $MNThdd
+
+umount $ISODIR
+rm -rf ./ipfire-tmp
+echo --------------------------------------------------------
+echo - Done.
+echo --------------------------------------------------------
index 1c2624e2e705e391cd629568e24da699279abb4a..94294cf52718198b9fef45056d9fccee11284bbf 100644 (file)
@@ -1,7 +1,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2012  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2013  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # 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        #
@@ -29,7 +29,7 @@ VER = ipfire
 THISAPP    = xen-image
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
-KVER2 = `grep "^VER " $(DIR_SRC)/lfs/linux2 | sed "s| ||g" | cut -d"=" -f2`
+KERN_PACK = `grep "^PAK_VER " $(DIR_SRC)/lfs/linux | sed "s| ||g" | cut -d"=" -f2`
 
 ###############################################################################
 # Top-level Rules
@@ -46,145 +46,21 @@ md5 :
 ###############################################################################
 # Installation Details
 ###############################################################################
-IMGinst  := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-full-core$(CORE).tar.bz2
-MNThdd   := /install/harddisk
-
-IMGboot  := /install/images/$(SNAME)/$(SNAME)-boot.img
-IMGswap  := /install/images/$(SNAME)/$(SNAME)-swap.img
-IMGroot  := /install/images/$(SNAME)/$(SNAME)-root.img
-IMGvar   := /install/images/$(SNAME)/$(SNAME)-var.img
-
-SIZEboot := 30
-SIZEswap := 512
-SIZEroot := 512
-SIZEvar  := 950
+IMGinst  := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-downloader-core$(CORE).tar.bz2
 
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
-       rm -rf $(MNThdd) $(IMGinst) $(IMGroot) && mkdir -p $(MNThdd)
-       mkdir -p /install/images/$(SNAME)   # /boot
-
-       #Create bootimage
-       dd bs=1M if=/dev/zero of=$(IMGboot) count=$(SIZEboot)
-       mkfs.ext2 -F $(IMGboot)
-
-       #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)
-
-       #Create varimage
-       dd bs=1M if=/dev/zero of=$(IMGvar) count=$(SIZEvar)
-       mkfs.ext3 -F $(IMGvar)
-
-       # Mount Images
-       mount -o loop $(IMGroot) $(MNThdd)
-       mkdir $(MNThdd)/boot
-       mkdir $(MNThdd)/var
-       mkdir $(MNThdd)/var/log
-       mount -o loop $(IMGboot) $(MNThdd)/boot
-       mount -o loop $(IMGvar) $(MNThdd)/var
-
-       # Install IPFire without kernel modules
-       tar -C $(MNThdd)/ -xvf /install/cdrom/$(SNAME)-$(VERSION).tlz --lzma \
-               --exclude=lib/modules* --exclude=boot*
-
-       #Install legacy Xen Kernel
-       tar -C $(MNThdd)/opt/pakfire/tmp -xvf /install/packages/linux-xen-$(KVER2)-*.ipfire
-       chroot $(MNThdd) /opt/pakfire/tmp/install.sh
-       rm -rf $(MNThdd)/opt/pakfire/tmp/*
-
-       #Install pae Kernel
-       tar -C $(MNThdd)/opt/pakfire/tmp -xvf /install/packages/linux-pae-$(KVER)-*.ipfire
-       chroot $(MNThdd) /opt/pakfire/tmp/install.sh
-       rm -rf $(MNThdd)/opt/pakfire/tmp/*
-
-       #Create grub menuentry for pygrub
-       mkdir $(MNThdd)/boot/grub
-       echo "timeout 10"                          > $(MNThdd)/boot/grub/grub.conf
-       echo "default 0"                          >> $(MNThdd)/boot/grub/grub.conf
-       echo "title IPFire (legacy XEN-Kernel)"   >> $(MNThdd)/boot/grub/grub.conf
-       echo "  kernel /vmlinuz-$(KVER2)-ipfire-xen root=/dev/xvda3 rootdelay=10 panic=10 console=xvc0 ro" \
-                                                 >> $(MNThdd)/boot/grub/grub.conf
-       echo "  initrd /ipfirerd-$(KVER2)-xen.img" >> $(MNThdd)/boot/grub/grub.conf
-       echo "# savedefault 0" >> $(MNThdd)/boot/grub/grub.conf
-       echo "title IPFire (PAE-Kernel)"   >> $(MNThdd)/boot/grub/grub.conf
-       echo "  kernel /vmlinuz-$(KVER)-ipfire-pae root=/dev/xvda3 rootdelay=10 panic=10 console=xvc0 ro" \
-                                                 >> $(MNThdd)/boot/grub/grub.conf
-       echo "  initrd /ipfirerd-$(KVER)-xen.img" >> $(MNThdd)/boot/grub/grub.conf
-       echo "# savedefault 1" >> $(MNThdd)/boot/grub/grub.conf
-
-       ln -s grub.conf $(MNThdd)/boot/grub/menu.lst
-
-       #Copy the meta-info of linux-xen package
-       cp -f /install/packages/meta-linux-xen $(MNThdd)/opt/pakfire/db/installed
-       cp -f /install/packages/meta-linux-xen $(MNThdd)/opt/pakfire/db/meta
-       cp -f /install/packages/meta-linux-pae $(MNThdd)/opt/pakfire/db/installed
-       cp -f /install/packages/meta-linux-pae $(MNThdd)/opt/pakfire/db/meta
-
-       #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/$(KVER2)-ipfire-xen/modules.dep
-       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|/dev/xvda1|g" $(MNThdd)/etc/fstab
-       sed -i -e "s|DEVICE2|/dev/xvda2|g" $(MNThdd)/etc/fstab
-       sed -i -e "s|DEVICE3|/dev/xvda3|g" $(MNThdd)/etc/fstab
-       sed -i -e "s|DEVICE4|/dev/xvda4|g" $(MNThdd)/etc/fstab
-
-       sed -i -e "s|FSTYPE|ext3|g" $(MNThdd)/etc/fstab
-
-       chroot $(MNThdd) /sbin/dracut --force --verbose /boot/ipfirerd-$(KVER2)-xen.img $(KVER2)-ipfire-xen
-       chroot $(MNThdd) /sbin/dracut --force --verbose /boot/ipfirerd-$(KVER)-pae.img $(KVER)-ipfire-pae
-
-       #Remove root / fstab check
-       rm -rf $(MNThdd)/etc/rc.d/rcsysinit.d/S19checkfstab
-       #Remove console init
-       rm -rf $(MNThdd)/etc/rc.d/rcsysinit.d/S70console
-
-       #Add xvc0 to securetty
-       echo xvc0 >> $(MNThdd)/etc/securetty
-
-       #Add getty for xvc0
-       echo "#Enable login for XEN" >> $(MNThdd)/etc/inittab
-       echo "8:2345:respawn:/sbin/agetty xvc0 9600" >> $(MNThdd)/etc/inittab
-
-       #Disable some initskripts
-       echo "#!/bin/sh" > $(MNThdd)/etc/rc.d/init.d/setclock
-       echo "#!/bin/sh" > $(MNThdd)/etc/rc.d/init.d/keymap
-
-       #Remove autoload of acpi modules
-       sed -i -e "s|^ac|#ac|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^battery|#battery|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^button|#button|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^fan|#fan|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^processor|#processor|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^thermal|#thermal|g" $(MNThdd)/etc/sysconfig/modules
-       sed -i -e "s|^video|#video|g" $(MNThdd)/etc/sysconfig/modules
-
+       rm -rf /install/images/$(SNAME) $(IMGinst) && mkdir -p /install/images/$(SNAME)
+       
        # Copy readme and config
        cp $(DIR_SRC)/config/xen-image/* \
                /install/images/$(SNAME)
 
-       # Unmount
-       umount $(MNThdd)/proc
-       umount $(MNThdd)/dev
-       umount $(MNThdd)/sys
-       umount $(MNThdd)/var
-       umount $(MNThdd)/boot
-       umount $(MNThdd)
-
-       # Zerofree ext3 images to get better compression
-       zerofree $(IMGboot)
-       zerofree $(IMGroot)
-       zerofree $(IMGvar)
+       # configure image downloader
+       sed -i -e "s/xxxSNAMExxx/$(SNAME)/" /install/images/$(SNAME)/xen-image-maker.sh
+       sed -i -e "s/xxxVERSIONxxx/$(VERSION)/" /install/images/$(SNAME)/xen-image-maker.sh
+       sed -i -e "s/xxxCORExxx/$(CORE)/" /install/images/$(SNAME)/xen-image-maker.sh
+       sed -i -e "s/xxxKVERxxx/$(KVER)/" /install/images/$(SNAME)/xen-image-maker.sh
+       sed -i -e "s/xxxKERN_PACKxxx/$(KERN_PACK)/" /install/images/$(SNAME)/xen-image-maker.sh
 
        # Compress Image
        cd /install/images/ && tar -cvjf $(IMGinst) $(SNAME)