xen: fix image build and kernel package for xen.

This commit is contained in:
Arne Fitzenreiter
2015-02-18 20:51:15 +01:00
parent 027825e99e
commit 741fa41c6c
6 changed files with 118 additions and 75 deletions

View File

@@ -24,6 +24,37 @@
. /opt/pakfire/lib/functions.sh
/usr/local/bin/backupctrl exclude >/dev/null 2>&1
function find_device() {
local mountpoint="${1}"
local root
local dev mp fs flags rest
while read -r dev mp fs flags rest; do
# Skip unwanted entries
[ "${dev}" = "rootfs" ] && continue
if [ "${mp}" = "${mountpoint}" ] && [ -b "${dev}" ]; then
root="$(basename "${dev}")"
break
fi
done < /proc/mounts
# Get the actual device from the partition that holds /
while [ -n "${root}" ]; do
if [ -e "/sys/block/${root}" ]; then
echo "${root}"
return 0
fi
# Remove last character
root="${root::-1}"
done
return 1
}
#
# Remove old core updates from pakfire cache to save space...
core=86
@@ -165,23 +196,29 @@ fi
case "$(uname -m)" in
i?86)
#
# Update to GRUB2
#
echo
echo Update grub configuration ...
if grep -qE "^serial" /boot/old-grub-config; then
sed -i /etc/default/grub \
-e "s|panic=10|& console=ttyS0,115200n8|g"
echo "GRUB_TERMINAL=\"serial\"" >> /etc/default/grub
echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc/default/grub
fi
case "$(find_device "/")" in
xvd* )
echo Skip bootloader update on xen.
;;
* )
#
# Update to GRUB2
#
echo
echo Update grub configuration ...
if grep -qE "^serial" /boot/old-grub-config; then
sed -i /etc/default/grub \
-e "s|panic=10|& console=ttyS0,115200n8|g"
echo "GRUB_TERMINAL=\"serial\"" >> /etc/default/grub
echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc/default/grub
fi
if ! /usr/local/bin/update-bootloader; then
logger -p syslog.emerg -t ipfire \
"Could not update the bootloader!"
fi
;;
if ! /usr/local/bin/update-bootloader; then
logger -p syslog.emerg -t ipfire \
"Could not update the bootloader!"
fi
;;
esac
esac
# Force (re)install pae kernel if pae is supported

View File

@@ -20,6 +20,6 @@ other usefull commands from the Dom0:
- look what is going on: "xm top" or "xm list"
This script can also build a Citrix XenCenter xva image. (Need xz-aware
xen version. Tested with Citrix Xen Server 6.2.5 beta)
xen version. Tested with Citrix Xen Server 6.5)
- run "XEN_IMG_TYPE=xva bash xen-image-maker.sh" to build an xva image.
- import the vm with "xe vm-import file=ipfire.xva"
- import the vm with "xe vm-import filename=ipfire.xva"

View File

@@ -116,7 +116,7 @@ mount -o loop $IMGboot $MNThdd/boot
mount -o loop $IMGvar $MNThdd/var
# Install IPFire without kernel modules
xz -d < $ISODIR/$SNAME-$VERSION.tlz > $TMPDIR/$SNAME-$VERSION.tar
xz -d < $ISODIR/distro.img > $TMPDIR/$SNAME-$VERSION.tar
tar -C $MNThdd/ -xvf $TMPDIR/$SNAME-$VERSION.tar \
--exclude=lib/modules* --exclude=boot* --numeric-owner
@@ -130,9 +130,9 @@ 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-$KERN_TYPE root=/dev/$P3 rootdelay=10 panic=10 console=$CONSOLE ro" \
echo " kernel /vmlinuz-$KVER-ipfire-$KERN_TYPE root=/dev/$P3 rootdelay=10 panic=10 console=$CONSOLE" \
>> $MNThdd/boot/grub/grub.conf
echo " initrd /ipfirerd-$KVER-$KERN_TYPE.img" >> $MNThdd/boot/grub/grub.conf
echo " initrd /initramfs-$KVER-ipfire-$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
@@ -159,12 +159,13 @@ 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/$P1|g" $MNThdd/etc/fstab
sed -i -e "s|DEVICE2|/dev/$P2|g" $MNThdd/etc/fstab
sed -i -e "s|DEVICE3|/dev/$P3|g" $MNThdd/etc/fstab
sed -i -e "s|DEVICE4|/dev/$P4|g" $MNThdd/etc/fstab
sed -i -e "s|FSTYPE|$FSTYPE|g" $MNThdd/etc/fstab
# create fstab
echo "/dev/$P1 /boot auto defaults 1 3" > $MNThdd/etc/fstab
echo "/dev/$P2 swap swap defaults 0 0" >> $MNThdd/etc/fstab
echo "/dev/$P3 / auto defaults 1 1" >> $MNThdd/etc/fstab
echo "/dev/$P4 /var auto defaults 1 2" >> $MNThdd/etc/fstab
#Remove root / fstab check
rm -rf $MNThdd/etc/rc.d/rcsysinit.d/S19checkfstab