X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=lfs%2Fxen-image;h=3bfeb11c516650e097b83ce62011f7f3109ceb68;hp=98cdb35ccd2fcc1ec61197d67006c1d596864f02;hb=fdecb9072113b24770af1ce38e0e28bfae029005;hpb=7f8044b6ddaf7f30c4ca3a7c280cbf3b6a910818 diff --git a/lfs/xen-image b/lfs/xen-image index 98cdb35ccd..3bfeb11c51 100644 --- a/lfs/xen-image +++ b/lfs/xen-image @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# Copyright (C) 2007-2012 IPFire Team # # # # 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,6 +29,8 @@ VER = ipfire THISAPP = xen-image TARGET = $(DIR_INFO)/$(THISAPP) +KVER = `grep "^VER " $(DIR_SRC)/lfs/linux2 | sed "s| ||g" | cut -d"=" -f2` + ############################################################################### # Top-level Rules ############################################################################### @@ -44,7 +46,7 @@ md5 : ############################################################################### # Installation Details ############################################################################### -IMGinst := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-$(ED)-core$(CORE).tar.bz2 +IMGinst := /install/images/$(SNAME)-$(VERSION).xen.$(MACHINE)-full-core$(CORE).tar.bz2 MNThdd := /install/harddisk IMGboot := /install/images/$(SNAME)/$(SNAME)-boot.img @@ -55,7 +57,7 @@ IMGvar := /install/images/$(SNAME)/$(SNAME)-var.img SIZEboot := 30 SIZEswap := 512 SIZEroot := 512 -SIZEvar := 1024 +SIZEvar := 950 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) rm -rf $(MNThdd) $(IMGinst) $(IMGroot) && mkdir -p $(MNThdd) @@ -63,7 +65,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) #Create bootimage dd bs=1M if=/dev/zero of=$(IMGboot) count=$(SIZEboot) - mkfs.ext3 -F $(IMGboot) + mkfs.ext2 -F $(IMGboot) #Create swapimage dd bs=1M if=/dev/zero of=$(IMGswap) count=$(SIZEswap) @@ -86,7 +88,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) mount -o loop $(IMGvar) $(MNThdd)/var # Install IPFire without kernel modules - tar -C $(MNThdd)/ -xvjf /install/cdrom/$(SNAME)-$(VERSION).tbz2 \ + tar -C $(MNThdd)/ -xvf /install/cdrom/$(SNAME)-$(VERSION).tlz --lzma \ --exclude=lib/modules* --exclude=boot* #Install Xen Kernel @@ -115,7 +117,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) 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 @@ -127,32 +128,20 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) sed -i -e "s|DEVICE4|/dev/xvda4|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 reiser4 because it is not work with xen-kernel - sed -i -e "s|reiser4 | |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 + chroot $(MNThdd) /sbin/dracut --force --verbose /boot/ipfirerd-$(KVER)-xen.img $(KVER)-ipfire-xen #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/securetty - echo "8:2345:respawn:/sbin/agetty xvc0 9600" >> $(MNThdd)/etc/securetty + 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 @@ -167,10 +156,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) sed -i -e "s|^thermal|#thermal|g" $(MNThdd)/etc/sysconfig/modules sed -i -e "s|^video|#video|g" $(MNThdd)/etc/sysconfig/modules - #Change pakfire trunk - sed -i -e "s|$(VERSION)|$(VERSION)-xen|g" \ - $(MNThdd)/opt/pakfire/etc/pakfire.conf - #Copy initramdisk, kernel and config #cp -f $(MNThdd)/boot/ipfirerd-$(KVER)-xen.img \ # /install/images/$(SNAME)/boot @@ -188,6 +173,11 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) umount $(MNThdd)/boot umount $(MNThdd) + # Zerofree ext3 images to get better compression + zerofree $(IMGboot) + zerofree $(IMGroot) + zerofree $(IMGvar) + # Compress Image cd /install/images/ && tar -cvjf $(IMGinst) $(SNAME)