]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/paks/linux-pae/install.sh
initrd: add early microcode load
[ipfire-2.x.git] / src / paks / linux-pae / install.sh
index 3d59d70c00c3aacdd4042f7736e8007ef966704a..fd71621d5752430293127c70c2a280a0dbcf2053 100644 (file)
 # along with IPFire; if not, write to the Free Software                    #
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
 #                                                                          #
-# Copyright (C) 2007-2014 IPFire-Team <info@ipfire.org>.                   #
+# Copyright (C) 2007-2016 IPFire-Team <info@ipfire.org>.                   #
 #                                                                          #
 ############################################################################
 #
 . /opt/pakfire/lib/functions.sh
-extract_files
-#
-KVER=xxxKVERxxx
-ROOT=`mount | grep " / " | cut -d" " -f1`
-ROOTUUID=`blkid -c /dev/null -sUUID $ROOT | cut -d'"' -f2`
-if [ ! -z $ROOTUUID ]; then
-       ROOT="UUID=$ROOTUUID"
-fi
 
-if [ -f /boot/grub/grub.conf ]; then
-MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1`
-# Nur den letzten Parameter verwenden
-echo $MOUNT > /dev/null
-MOUNT=$_
-if [ ! $MOUNT == "rw" ]; then
-       MOUNT="ro"
-fi
 
-ENTRY=`grep "savedefault" /boot/grub/grub.conf | tail -n 1`
-# Nur den letzten Parameter verwenden
-echo $ENTRY > /dev/null
-let ENTRY=$_+1
+function find_partition() {
+       local mountpoint="${1}"
 
-#Check if the system use serial console...
-if [ "$(grep "^serial" /boot/grub/grub.conf)" == "" ]; then
-       console=""
-else
-       console=" console=ttyS0,115200n8"
-fi
+       local root
+       local dev mp fs flags rest
+       while read -r dev mp fs flags rest; do
+               # Skip unwanted entries
+               [ "${dev}" = "rootfs" ] && continue
 
-#
-# backup grub.conf
-#
-cp /boot/grub/grub.conf /boot/grub/grub-backup-$KVER-pae_install.conf
-#
-# Add new Entry to grub.conf
-#
-echo "" >> /boot/grub/grub.conf
-echo "title IPFire (PAE-Kernel)" >> /boot/grub/grub.conf
-echo "  kernel /vmlinuz-$KVER-ipfire-pae root=$ROOT panic=10$console $MOUNT" >> /boot/grub/grub.conf
-echo "  initrd /ipfirerd-$KVER-pae.img" >> /boot/grub/grub.conf
-echo "  savedefault $ENTRY" >> /boot/grub/grub.conf
+               if [ "${mp}" = "${mountpoint}" ] && [ -b "${dev}" ]; then
+                       root="$(basename "${dev}")"
+                       break
+               fi
+       done < /proc/mounts
+       echo ${root}
+       return 0
+}
+
+if [ "$(grep "^flags.* pae " /proc/cpuinfo)" == "" ]; then
+       rm -f /opt/pakfire/db/installed/meta-linux-pae
+       /usr/bin/logger -p syslog.emerg -i pakfire \
+               "linux-pae: no pae support found, aborted!"
+       exit 1
 fi
 
+extract_files
+#
+KVER=xxxKVERxxx
+ROOT=`find_partition /`
 #
 # Create new module depency
 #
@@ -73,15 +60,28 @@ depmod -a $KVER-ipfire-pae
 #
 # Made initramdisk
 #
-/usr/bin/dracut --force --xz /boot/initramfs-$KVER-ipfire-pae.img $KVER-ipfire-pae  
+/usr/bin/dracut --force --early-microcode --xz /boot/initramfs-$KVER-ipfire-pae.img $KVER-ipfire-pae  
 
-#
-# Update grub2 config
-#
-grub-mkconfig > /boot/grub/grub.cfg
-
-# request a reboot if pae is supported
-if [ ! "$(grep "^flags.* pae " /proc/cpuinfo)" == "" ]; then
-       touch /var/run/need_reboot
+if [ -e /boot/grub/grub.cfg ]; then
+       #
+       # Update grub2 config
+       #
+       grub-mkconfig > /boot/grub/grub.cfg
+else
+       #
+       # xen pv with pygrub need grub.conf / menu.lst
+       #
+       echo "timeout 10"                          > /boot/grub/grub.conf
+       echo "default 0"                          >> /boot/grub/grub.conf
+       echo "title IPFire (pae-kernel)"          >> /boot/grub/grub.conf
+       echo "  root (hd0)"                       >> /boot/grub/grub.conf
+       echo "  kernel /vmlinuz-$KVER-ipfire-pae root=/dev/$ROOT rootdelay=10 panic=10 console=hvc0" \
+                                                 >> /boot/grub/grub.conf
+       echo "  initrd /initramfs-$KVER-ipfire-pae.img" >> /boot/grub/grub.conf
+       echo "# savedefault 0"                    >> /boot/grub/grub.conf
+       ln -s grub.conf $MNThdd/boot/grub/menu.lst
 fi
+
+# request a reboot
+touch /var/run/need_reboot
 sync && sync
\ No newline at end of file