diff options
Diffstat (limited to 'source/a/elilo')
-rwxr-xr-x | source/a/elilo/elilo.SlackBuild | 116 | ||||
-rw-r--r-- | source/a/elilo/eliloconfig | 213 | ||||
-rw-r--r-- | source/a/elilo/setup.ll.eliloconfig | 3 | ||||
-rw-r--r-- | source/a/elilo/slack-desc | 19 |
4 files changed, 351 insertions, 0 deletions
diff --git a/source/a/elilo/elilo.SlackBuild b/source/a/elilo/elilo.SlackBuild new file mode 100755 index 00000000..ad2ffc14 --- /dev/null +++ b/source/a/elilo/elilo.SlackBuild @@ -0,0 +1,116 @@ +#!/bin/sh + +# Copyright 2013 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PKGNAM=elilo +VERSION=${VERSION:-$(echo $PKGNAM*.tar.?z* | rev | cut -f 2 -d - | rev)} +BUILD=${BUILD:-6} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf elilo +mkdir elilo +cd elilo +tar xvf $CWD/${PKGNAM}-$VERSION-all.tar.?z* || exit 1 +tar xvf elilo-${VERSION}-source.tar.gz || exit 1 +chown -R root:root . +chmod -R u+w,go+r-w,a-s . +cd elilo + +sed -i "s,/usr/lib,/usr/lib${LIBDIRSUFFIX},g" Make.defaults +sed -i "s,EFICRT0.*= /usr/lib${LIBDIRSUFFIX},EFICRT0 = /usr/lib${LIBDIRSUFFIX}/gnuefi,g" Make.defaults + +# We will build this from source. +# However, we will package the pre-built EFI binaries, since we would +# like to include both 32-bit and 64-bit x86 EFI loaders in the +# finished package. + +make || exit 1 + +# Install the files in the package directory: +mkdir -p $PKG/usr/sbin +cp tools/eliloalt $PKG/usr/sbin + +# Install eliloconfig, a simple setup script: +cp -a $CWD/eliloconfig $PKG/usr/sbin +chown root:root $PKG/usr/sbin/eliloconfig +chmod 755 $PKG/usr/sbin/eliloconfig +mkdir -p $PKG/var/log/setup +cp -a $CWD/setup.ll.eliloconfig $PKG/var/log/setup +chown root:root $PKG/var/log/setup/setup.ll.eliloconfig +chmod 755 $PKG/var/log/setup/setup.ll.eliloconfig + +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION +cp -a \ + ChangeLog LIMITATIONS README README.gnu-efi TODO docs/* \ + examples \ + $PKG/usr/doc/$PKGNAM-$VERSION + +# Since it might not be safe to strip the EFI binaries, do this now: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +cd .. + +# Install EFI bootloaders in /boot: +mkdir $PKG/boot +# The ia32 version is pretty much useless, since 32-bit UEFI is nowhere to be +# found. Maybe it would help old 32-bit Intel Macs though? +cp -a elilo*ia32.efi $PKG/boot/elilo-ia32.efi +# Itanium binary isn't needed here. +#cp -a elilo*ia64.efi $PKG/boot/elilo-ia64.efi +cp -a elilo*x86_64.efi $PKG/boot/elilo-x86_64.efi + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz + diff --git a/source/a/elilo/eliloconfig b/source/a/elilo/eliloconfig new file mode 100644 index 00000000..91f66d69 --- /dev/null +++ b/source/a/elilo/eliloconfig @@ -0,0 +1,213 @@ +#!/bin/sh +# Copyright 2013 Patrick Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# This script installs the elilo boot loader, the kernel, and optionally +# an initrd into the EFI System Partition. A boot menu entry can also be +# installed using efibootmgr. The kernel used will be whatever the symlink +# /boot/vmlinuz points to, and if /boot/initrd.gz exists, that will be +# installed as the initrd. +# +# The EFI System Partition is expected to be mounted on /boot/efi before +# running this script. + +TMP=/var/log/setup/tmp + +# Set the OS root directory (called T_PX for some unknown reason). +# If an argument is given to this script and it is a directory, it +# is taken to be the root directory. First though, we check for a +# directory named $T_PX, and that gets the first priority. +if [ ! -d "$T_PX" ]; then + if [ ! "$1" = "" ]; then + if [ -d "$1" ]; then + T_PX="$1" + fi + else + # Are we on the installer image? + if [ -r /usr/lib/setup/SeTpartitions ]; then + T_PX=/mnt + # Or, are we on a running system? + elif [ -r /etc/slackware-version ]; then + T_PX=/ + # One more installer-likely thing: + elif [ -r /usr/lib/setup/setup ]; then + T_PX=/mnt + else + # We will have to assume we're on an installed and running system. + T_PX=/ + fi + fi +fi + +# Determine the root partition (such as /dev/sda1) +ROOT_DEVICE=$2 +if [ "$ROOT_DEVICE" = "" ]; then + if [ -r $TMP/SeTrootdev ]; then + ROOT_DEVICE="$(cat $TMP/SeTrootdev)" + else + ROOT_DEVICE="$(mount | cut -f 1 -d ' ' | head -n 1)" + fi +fi + +# If the system is not running under EFI, skip running this script: +if [ ! -d /sys/firmware/efi ]; then + if [ "$T_PX" = "/" ]; then + echo "ERROR: System is not running under UEFI." + fi + exit +fi + +# If there's no vfat mounted on /boot/efi or /mnt/boot/efi, forget it: +if ! mount | grep vfat | grep -wq /boot/efi ; then + if ! mount | grep vfat | grep -wq /mnt/boot/efi ; then + if [ "$T_PX" = "/" ]; then + echo "ERROR: No EFI System Partition mounted on /boot/efi." + fi + exit + fi +fi + +# Figure out the device and partition number of the ESP: +if mount | grep vfat | grep -wq /boot/efi ; then + EFI_DEVICE=$(mount | grep vfat | grep -w /boot/efi | cut -b 1-8) + EFI_PARTITION=$(mount | grep vfat | grep -w /boot/efi | cut -f 1 -d ' ' | cut -b 9-) +else + EFI_DEVICE=$(mount | grep vfat | grep -w /mnt/boot/efi | cut -b 1-8) + EFI_PARTITION=$(mount | grep vfat | grep -w /mnt/boot/efi | cut -f 1 -d ' ' | cut -b 9-) +fi + +# There better be a kernel: +if [ ! -r $T_PX/boot/vmlinuz ]; then + if [ "$T_PX" = "/" ]; then + echo "ERROR: No kernel found at /boot/vmlinuz." + fi + exit +fi + +dialog --title "INSTALL ELILO" \ +--backtitle "ELILO (EFI Linux Loader) installation" \ +--menu "ELILO is a Linux boot loader for \ +EFI based systems. Installing ELILO will allow you to boot your Linux \ +system from the hard drive after selecting it from the UEFI boot menu. \ +Since an EFI System Partition was detected on this machine, it is \ +recommended that you install ELILO now. Please select an option:" \ +13 70 2 \ +"install" "Install ELILO on the EFI System Partition" \ +"skip" "Do not install ELILO" 2> $TMP/reply +if [ $? = 1 -o $? = 255 ]; then + exit +fi +REPLY="`cat $TMP/reply`" +rm -f $TMP/reply +if [ "$REPLY" = "skip" ]; then + exit +fi + +mkdir -p $T_PX/boot/efi/EFI/Slackware 1> /dev/null 2> /dev/null +cat << EOF > $T_PX/boot/efi/EFI/Slackware/elilo.conf +chooser=simple +delay=1 +timeout=1 +# +EOF +cp -a $T_PX/boot/elilo-x86_64.efi $T_PX/boot/efi/EFI/Slackware/elilo.efi 1> /dev/null 2> /dev/null +cp $T_PX/boot/vmlinuz $T_PX/boot/efi/EFI/Slackware 1> /dev/null 2> /dev/null +cat << EOF >> $T_PX/boot/efi/EFI/Slackware/elilo.conf +image=vmlinuz + label=vmlinuz +EOF +touch -r $T_PX/boot/vmlinuz $T_PX/boot/efi/EFI/Slackware/vmlinuz +if [ -r $T_PX/boot/initrd.gz ]; then + cp $T_PX/boot/initrd.gz $T_PX/boot/efi/EFI/Slackware 1> /dev/null 2> /dev/null + touch -r $T_PX/boot/initrd.gz $T_PX/boot/efi/EFI/Slackware/initrd.gz + cat << EOF >> $T_PX/boot/efi/EFI/Slackware/elilo.conf + initrd=initrd.gz +EOF +fi +cat << EOF >> $T_PX/boot/efi/EFI/Slackware/elilo.conf + read-only + append="root=$ROOT_DEVICE vga=normal ro" +EOF + +dialog --title "INSTALL BOOT MENU ENTRY?" \ +--backtitle "ELILO (EFI Linux Loader) installation" \ +--menu "Would you like to install \ +a boot menu entry so that you can easily select Slackware when you boot your \ +machine? WARNING: DO NOT install a boot menu entry on Apple hardware. \ +Apple computers use a different type of EFI firmware, and efibootmgr has \ +been known to damage them. On all other computers, it is recommended to add \ +a boot menu entry. Please select an option:" \ +14 70 2 \ +"install" "Install a boot menu entry" \ +"skip" "Do not install a boot menu entry" 2> $TMP/reply +if [ $? = 1 -o $? = 255 ]; then + exit +fi +REPLY="`cat $TMP/reply`" +rm -f $TMP/reply +if [ "$REPLY" = "skip" ]; then + exit +fi + +if [ ! -d /sys/firmware/efi/vars ]; then + modprobe efivars 1> /dev/null 2> /dev/null + sleep 1 # Probably not needed, but playing it safe +fi +# If it's still gone, we fail silently: +if [ ! -d /sys/firmware/efi/vars ]; then + exit +fi + +efibootmgr -v | rev | cut -f 2- | rev | grep Boot0 | grep Slackware | while read line ; do + # Reject entries that don't exactly match as not our business + if [ ! "$(echo $line | cut -f 2- -d ' ')" = "Slackware" ]; then + continue + fi + ENTRY="$(efibootmgr -v | grep "^$(echo $line | cut -b1-8)")" + dialog --title "REMOVE OLD \"Slackware\" EFI BOOT ENTRY?" \ + --backtitle "ELILO (EFI Linux Loader) installation" \ + --yesno "An old Slackware boot entry has been found in your EFI boot menu. \ +Would you like to remove this before installing the new Slackware boot \ +entry? This is recommended.\n\nOld EFI boot menu entry:\n$ENTRY" 13 70 + if [ ! $? = 0 ]; then + continue + fi + # Remove the boot entry: + efibootmgr -q -B -b $(echo $line | cut -b5-8) +done + +efibootmgr -q -c -d $EFI_DEVICE -p $EFI_PARTITION -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware" + +efibootmgr -v | rev | cut -f 2- | rev | grep Boot0 | grep Slackware | while read line ; do + # Reject entries that don't exactly match as not our business + if [ ! "$(echo $line | cut -f 2- -d ' ')" = "Slackware" ]; then + continue + fi + ENTRY="$(efibootmgr -v | grep "^$(echo $line | cut -b1-8)")" + if echo $ENTRY | grep -q -F "\EFI\Slackware\elilo.efi" ; then + dialog --title "EFI BOOT ENTRY INSTALLED" \ + --backtitle "ELILO (EFI Linux Loader) installation" \ + --msgbox "A Slackware boot entry has been installed to your EFI boot +menu.\n\nEFI boot menu entry:\n$ENTRY" 11 70 + fi +done + +# Done. diff --git a/source/a/elilo/setup.ll.eliloconfig b/source/a/elilo/setup.ll.eliloconfig new file mode 100644 index 00000000..75e56138 --- /dev/null +++ b/source/a/elilo/setup.ll.eliloconfig @@ -0,0 +1,3 @@ +#!/bin/sh +#BLURB="Set up ELILO (EFI LILO) to boot Linux from your hard drive" +sh usr/sbin/eliloconfig $* diff --git a/source/a/elilo/slack-desc b/source/a/elilo/slack-desc new file mode 100644 index 00000000..acacac07 --- /dev/null +++ b/source/a/elilo/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-----------------------------------------------------| +elilo: elilo (Linux Loader for EFI-based platforms) +elilo: +elilo: This is elilo, a boot loader originally developed by HP for IA-64 +elilo: systems. This is used to load the kernel and initial ramdisk on +elilo: machines that use UEFI. Since most UEFI implementations are 64-bit, +elilo: the 64-bit EFI binary is generally the one to use (even for loading +elilo: a 32-bit kernel). +elilo: +elilo: Homepage: http://elilo.sourceforge.net +elilo: +elilo: |