From a4529611acce59fd0a116845f0e53a41cc4d38bd Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Thu, 3 Jun 2010 19:20:49 +0200 Subject: [PATCH] added extlinux bootloader support --- usr/share/archboot/installer/archboot.txt | 11 +- usr/share/archboot/installer/setup | 132 +++++++++++++++++++++- 2 files changed, 133 insertions(+), 10 deletions(-) diff --git a/usr/share/archboot/installer/archboot.txt b/usr/share/archboot/installer/archboot.txt index 677910c51..bad2fadc3 100644 --- a/usr/share/archboot/installer/archboot.txt +++ b/usr/share/archboot/installer/archboot.txt @@ -1,7 +1,7 @@ Archboot Guide - May,30th 2010 + June,3th 2010 Tobias Powalowski @@ -53,7 +53,7 @@ Introduction License Arch Linux 2002-2007 Judd Vinet - 2007-2009 Aaron Griffin + 2007-2010 Aaron Griffin and are licensed under the GNU General Public License (GPL). What is Archboot? @@ -68,10 +68,7 @@ Introduction What is the difference to the official install media? - * It uses syslinux as initial bootloader. - * It provides x86_64/i686 architecture in one image. - * It provides the long time support kernel as installation option. - * It uses hybrid iso format. + * It provides the long time support kernel as installation option. * It runs a modified Arch Linux system in initramfs. * It is restricted to RAM usage, everything which is not necessary like man or info pages etc. is not provided. @@ -97,7 +94,7 @@ Introduction mkinitcpio.conf, rc.conf, crypttab and mdadm.conf * Configuration of basic system files * Setting root password - * grub, grub2, lilo and syslinux bootloader support + * grub, grub2, lilo, extlinux and syslinux bootloader support Archboot bootparameters diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index b79fd2db6..c23e6cac7 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -2669,6 +2669,130 @@ create_filesystem() { RUN_CREATE_FILESYSTEM="yes" } +doextlinux () { + if [ ! -e $DESTDIR/usr/bin/extlinux ]; then + DIALOG --msgbox "Couldn't find extlinux binary, installing syslinux now ..." 0 0 + PACKAGES="syslinux" + run_pacman + # reset PACKAGES after installing + PACKAGES="" + fi + USE_DMRAID="" + activate_special_devices + getrootfs + getraidarrays + getcryptsetup + getrootuuid + getrootlabel + # look for a separately-mounted /boot partition + bootdev=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1) + # extlinux only can boot from ext2/3/4 and btrfs partitions! + FSTYPE="$(blkid -c /dev/null $bootdev -o value -s TYPE)" + if ! [ "$FSTYPE" = "ext2" -o "$FSTYPE" = "ext3" -o "$FSTYPE" = "ext4" -o "$FSTYPE" = "btrfs" ]; then + DIALOG --msgbox "Error:\nCouldn't find ext2/3/4 or btrfs partition with /boot on it." 0 0 + return 1 + fi + # extlinux cannot boot from any raid partition, encrypted and dmraid device + if [ "$(echo $bootdev | grep /dev/md*p)" -o "$(echo $bootdev | grep /dev/mapper)" ]; then + DIALOG --msgbox "Error:\EXTLINUX cannot boot from any raid, raid partition, encrypted or dmraid device." 0 0 + return 1 + fi + # check if raid1 device is used, else fail. + if [ "$(echo $bootdev | grep /dev/md)" ]; then + if ! [ "$(mdadm --detail $bootdev | grep Level | sed -e 's#.*:\ ##g')" = "raid1" ]; then + DIALOG --msgbox "Error:\EXTLINUX cannot boot from none raid1 devices." 0 0 + return 1 + fi + fi + # check on GUID (gpt) + if [ "$(parted -sl | grep "Partition Table: gpt")" ]; then + DIALOG --defaultno --yesno "Warning:\nSetup detected GUID (gpt) partition table.\n\nEXTLINUX doesn't support booting from GUID (gpt) partition table.\n\nDo you want to install syslinux to an other device, which contains a msdos partition table?" 0 0 || return 1 + fi + DIALOG --msgbox "Attention:\nIn order to get a booting system, you need the boot flag on the partition syslinux will boot the kernel from!" 0 0 + DEVS="$(findbootloaderdisks _)" + DEVS="$DEVS $(findbootloaderpartitions _)" + if [ "$DEVS" = "" ]; then + DIALOG --msgbox "No hard drives were found" 0 0 + return 1 + fi + DIALOG --menu "Select the boot device where the EXTLINUX bootloader will be installed (usually the MBR)" 14 55 7 $DEVS 2>$ANSWER || return 1 + ROOTDEV=$(cat $ANSWER) + # generate extlinux.conf + TEMPDIR=/tmp + MBR=$DESTDIR/usr/lib/syslinux/mbr.bin + [ -e ${TEMPDIR}/extlinux.conf ] && rm ${TEMPDIR}/extlinux.conf + cat << EOF > ${TEMPDIR}/extlinux.conf +DEFAULT vesamenu.c32 +PROMPT 0 +MENU TITLE Arch Linux +MENU BACKGROUND splash.png +TIMEOUT 300 + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 10 +MENU VSHIFT 10 +MENU TIMEOUTROW 15 +MENU TABMSGROW 13 +MENU CMDLINEROW 11 +MENU HELPMSGROW 17 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std + +ONTIMEOUT arch +EOF + sort /tmp/.device-names >> ${TEMPDIR}/extlinux.conf + echo "label arch" >> ${TEMPDIR}/extlinux.conf + echo "TEXT HELP" >> ${TEMPDIR}/extlinux.conf + echo "Boot Arch Linux" >> ${TEMPDIR}/extlinux.conf + echo "ENDTEXT" >> ${TEMPDIR}/extlinux.conf + echo "MENU LABEL Arch Linux" >> ${TEMPDIR}/extlinux.conf + echo "kernel $VMLINUZ" >> ${TEMPDIR}/extlinux.conf + if [ "$NAME_SCHEME_PARAMETER" = "UUID" -o "$NAME_SCHEME_PARAMETER" = "LABEL" ]; then + echo "append initrd=$KERNELPKG.img root=${_rootpart} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" | sed -e 's# # #g' >> ${TEMPDIR}/extlinux.conf + else + echo "append initrd=$KERNELPKG.img root=${PART_ROOT} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" | sed -e 's# # #g' >> ${TEMPDIR}/extlinux.conf + fi + echo "label fallback" >> ${TEMPDIR}/extlinux.conf + echo "TEXT HELP" >> ${TEMPDIR}/extlinux.conf + echo "Boot Arch Linux Fallback" >> ${TEMPDIR}/extlinux.conf + echo "ENDTEXT" >> ${TEMPDIR}/extlinux.conf + echo "MENU LABEL Arch Linux Fallback" >> ${TEMPDIR}/extlinux.conf + echo "kernel $VMLINUZ" >> ${TEMPDIR}/extlinux.conf + if [ "$NAME_SCHEME_PARAMETER" = "UUID" -o "$NAME_SCHEME_PARAMETER" = "LABEL" ]; then + echo "append initrd=$KERNELPKG-fallback.img root=${_rootpart} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" | sed -e 's# # #g' >> ${TEMPDIR}/extlinux.conf + else + echo "append initrd=$KERNELPKG-fallback.img root=${PART_ROOT} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" | sed -e 's# # #g' >> ${TEMPDIR}/extlinux.conf + fi + # edit extlinux.conf + DIALOG --msgbox "Before installing SYSLINUX, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, SYSLINUX will be installed." 0 0 + [ "$EDITOR" ] || geteditor + $EDITOR ${TEMPDIR}/extlinux.conf + # install syslinux + DIALOG --infobox "Installing the SYSLINUX bootloader..." 0 0 + cp ${TEMPDIR}/extlinux.conf ${DESTDIR}/boot/extlinux.conf + cp ${DESTDIR}/usr/lib/syslinux/*.c32 ${DESTDIR}/boot/ + cat ${MBR} > ${ROOTDEV} + [ -e ${DESTDIR}/boot/ldlinux.sys ] && rm ${DESTDIR}/boot/ldlinux.sys + chroot /usr/bin/extlinux --install /boot >$LOG 2>&1 + if [ $? -gt 0 ]; then + DIALOG --msgbox "Error installing EXTLINUX. (see $LOG for output)" 0 0 + return 1 + fi + DIALOG --msgbox "EXTLINUX was successfully installed." 0 0 +} + dosyslinux() { if [ ! -e $DESTDIR/usr/bin/syslinux ]; then DIALOG --msgbox "Couldn't find syslinux binary, installing syslinux now ..." 0 0 @@ -2696,9 +2820,9 @@ dosyslinux() { DIALOG --msgbox "Error:\nCouldn't find vfat /boot partition." 0 0 return 1 fi - # syslinux cannot boot from any raid, raid partition, ecncrypted and dmraid device + # syslinux cannot boot from any raid, raid partition, encrypted and dmraid device if [ "$(echo $bootdev | grep /dev/md)" -o "$(echo $bootdev | grep /dev/mapper)" ]; then - DIALOG --msgbox "Error:\nSyslinux cannot boot from any raid, raid partition, ecncrypted or dmraid device." 0 0 + DIALOG --msgbox "Error:\nSyslinux cannot boot from any raid, raid partition, encrypted or dmraid device." 0 0 return 1 fi # check on GUID (gpt) @@ -3792,15 +3916,17 @@ install_bootloader() prepare_pacman CANCEL="" DIALOG --menu "Which bootloader would you like to use?" \ - 11 55 4 \ + 11 55 5 \ "GRUB" "Use the GRUB bootloader (default)" \ "GRUB2" "Use the GRUB2 bootloader (experimental)" \ "LILO" "Use the LILO bootloader" \ + "EXTLINUX" "Use the EXTLINUX bootloader" \ "SYSLINUX" "Use the SYSLINUX bootloader" 2>$ANSWER || CANCEL=1 case $(cat $ANSWER) in "GRUB") dogrub ;; "GRUB2") dogrub2 ;; "LILO") dolilo ;; + "EXTLINUX") doextlinux ;; "SYSLINUX") dosyslinux ;; esac if [ "$CANCEL" = "1" ]; then