diff options
-rwxr-xr-x | helpers/lh_binary | 1 | ||||
-rwxr-xr-x | helpers/lh_binary_grub2 | 309 | ||||
-rwxr-xr-x | helpers/lh_binary_iso | 39 | ||||
-rwxr-xr-x | helpers/lh_chroot_hacks | 10 | ||||
-rw-r--r-- | manpages/lh_binary_grub2.en.1 | 29 | ||||
-rw-r--r-- | manpages/live-helper.en.7 | 2 | ||||
-rw-r--r-- | templates/grub2/grub.cfg | 12 | ||||
-rw-r--r-- | templates/grub2/splash.tga | bin | 0 -> 45997 bytes |
8 files changed, 401 insertions, 1 deletions
diff --git a/helpers/lh_binary b/helpers/lh_binary index 91e04a480..271bfd784 100755 --- a/helpers/lh_binary +++ b/helpers/lh_binary @@ -54,6 +54,7 @@ lh binary_linux-image ${*} lh binary_debian-installer ${*} lh binary_memtest ${*} lh binary_grub ${*} +lh binary_grub2 ${*} lh binary_syslinux ${*} lh binary_yaboot ${*} lh binary_silo ${*} diff --git a/helpers/lh_binary_grub2 b/helpers/lh_binary_grub2 new file mode 100755 index 000000000..7be3bf53f --- /dev/null +++ b/helpers/lh_binary_grub2 @@ -0,0 +1,309 @@ +#!/bin/sh + +# lh_binary_grub2(1) - installs grub2 into binary +# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Including common functions +. "${LH_BASE:-/usr/share/live-helper}"/functions.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs grub2 into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "grub2" ] +then + exit 0 +fi + +Echo_message "Begin installing grub2..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_grub + +# Checking grub2 templates +Check_templates grub2 + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture amd64 i386 lpia +Check_crossarchitecture + +# Checking depends +Check_package chroot/usr/bin/grub-mkimage grub-pc + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Grub_live_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + LINUX_LIVE="${LINUX_LIVE}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" + LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}" + LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}" + LINUX_LIVE="${LINUX_LIVE}\n}" +} + +Grub_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + if [ "${LH_DISTRIBUTION}" != "etch" ] && [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ] + then + APPEND="${APPEND} quiet" + fi + + LINUX_INSTALL="${LINUX_INSTALL}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" + LINUX_INSTALL="${LINUX_INSTALL}\nlinux\t\t/${KERNEL} ${APPEND} LH_BOOTAPPEND_INSTALL" + LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" + LINUX_INSTALL="${LINUX_INSTALL}\n}" +} + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Setting destination directory +case "${LH_BINARY_IMAGES}" in + iso|tar) + case "${LH_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-initramfs) + DESTDIR_LIVE="binary/live" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + usb-hdd|net) + Echo_warning "Bootloader in this image type not yet supported by live-helper." + Echo_warning "This would produce a not bootable image, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters + +case "${LH_ENCRYPTION}" in + ""|disabled) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + +if [ "${LH_EXPOSED_ROOT}" != "disabled" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + +Grub_live_entry "live" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" +Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${FAILSAFE}" + +for KERNEL in chroot/boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + Grub_live_entry "live, kernel ${VERSION}" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" + Grub_live_entry "live, kernel ${VERSION} (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" "${FAILSAFE}" +done + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ] +then + LINUX_LIVE="#\t \"Live\"\n${LINUX_LIVE}" + LINUX_INSTALL="#\t \"Installer\"\n" + + VMLINUZ_DI="install/vmlinuz" + INITRD_DI="install/initrd.gz" + APPEND_DI="vga=normal" + + VMLINUZ_GI="install/gtk/vmlinuz" + INITRD_GI="install/gtk/initrd.gz" + APPEND_GI="video=vesa:ywrap,mtrr vga=788" + + Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" + Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" + Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}" + Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" + Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}" + Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" + Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}" +fi + +LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling memtest configuration +if [ -f "${DESTDIR_LIVE}"/memtest ] +then + MEMTEST="#\t \"Other\"\n" + MEMTEST="${MEMTEST}\nmenuentry\t\"${LH_MEMTEST}\" {\nlinux16\t$(basename ${DESTDIR_LIVE})/memtest\n}" + MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" +fi + +# Copying templates +mkdir -p binary/boot/grub +cp -r "${TEMPLATES}"/* binary/boot/grub + +case ${LH_BINARY_IMAGES} in + iso) + FILES="chroot/usr/lib/grub/i386-pc/*.mod chroot/usr/lib/grub/i386-pc/*.lst chroot/usr/lib/grub/i386-pc/efiemu??.o chroot/usr/share/grub/*.pf2" + ;; + + tar|usb-hdd) + FILES="chroot/usr/lib/grub/i386-pc/*" + ;; +esac + +if [ "${LH_CHROOT_BUILD}" = "disabled" ] +then + FILES="$(echo ${FILES} | sed -e 's|chroot||g')" +fi + +# Copying grub +cp ${FILES} binary/boot/grub + +# Copying local configuration file +if [ -f config/binary_grub/grub.cfg ] +then + cp config/binary_grub/grub.cfg binary/boot/grub/grub.cfg +fi + +# Copying splash screen +if [ -f config/binary_grub/splash.tga ] +then + LH_GRUB_SPLASH="config/binary_grub/splash.tga" +fi + +if [ -n "${LH_GRUB_SPLASH}" ] +then + if [ "${LH_GRUB_SPLASH}" = "none" ] + then + # Removing splash file + rm -f binary/boot/grub/splash.tga + + # Removing splash entry + sed -i -e "s|background_image.*||" binary/boot/grub/grub.cfg + else + # Overwriting splash file + cp -f "${LH_GRUB_SPLASH}" binary/boot/grub + sed -i -e "s|background_image .*.tga|background_image \$\(root\)/boot/grub/$(basename ${LH_GRUB_SPLASH})|" binary/boot/grub/grub.cfg + fi +fi + +sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/grub.cfg +sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/boot/grub/grub.cfg + +sed -i -e 's|\ $||g' binary/boot/grub/grub.cfg + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_grub diff --git a/helpers/lh_binary_iso b/helpers/lh_binary_iso index 0b8bb5540..d9f390255 100755 --- a/helpers/lh_binary_iso +++ b/helpers/lh_binary_iso @@ -99,6 +99,12 @@ case "${LH_BOOTLOADER}" in GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito" ;; + grub2) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/grub_eltorito -J" + GENISOIMAGE_EXCLUDE="boot/grub/grub_eltorito" + ;; + silo) GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -G boot/isofs.b -B ..." GENISOIMAGE_EXCLUDE="boot/isofs.b" @@ -132,7 +138,40 @@ then fi fi +if [ "${LH_BOOTLOADER}" = "grub2" ] +then + cat > binary.sh << EOF +#!/bin/sh + +input_dir=/usr/lib/grub/i386-pc + +# build core.img +core_img=\$(mktemp) +grub-mkimage -d ${input_dir} -o ${core_img} biosdisk iso9660 + +# build grub_eltorito image +cat ${input_dir}/cdboot.img ${core_img} > binary/boot/grub/grub_eltorito + +rm -f ${core_img} + +for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ + ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ + ${input_dir}/handler.lst ${input_dir}/parttool.lst +do + if test -f "$file" + then + cp -f "$file" binary/boot/grub + fi +done +EOF + +else + echo "#!/bin/sh" > binary.sh +fi + +cat >> binary.sh << EOF + genisoimage ${GENISOIMAGE_OPTIONS} -o binary.iso binary EOF diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks index 721a6d79f..cc12630fd 100755 --- a/helpers/lh_chroot_hacks +++ b/helpers/lh_chroot_hacks @@ -124,7 +124,15 @@ then # late to fix it in d-i because lenny rc2 has been already released. case "${LH_ARCHITECTURE}" in amd64|i386|lpia) - Apt install grub + case "${LH_BOOTLOADER}" in + grub) + Apt install grub + ;; + + grub2) + Apt install grub2 + ;; + esac ;; powerpc) diff --git a/manpages/lh_binary_grub2.en.1 b/manpages/lh_binary_grub2.en.1 new file mode 100644 index 000000000..26149ddf6 --- /dev/null +++ b/manpages/lh_binary_grub2.en.1 @@ -0,0 +1,29 @@ +.TH LH_BINARY_GRUB2 1 "2009\-10\-09" "1.0.5" "live\-helper" + +.SH NAME +lh_binary_grub2 \- install grub2 into binary + +.SH SYNOPSIS +\fBlh_binary_grub2\fR [\fIlive\-helper options\fR] + +.SH DESCRIPTION +lh_binary_grub2 is a low\-level command (plumbing) of live\-helper, the Debian Live tool suite. It installs grub2 into binary. + +.SH OPTIONS +lh_binary_grub2 has no specific options but understands all generic live\-helper options. See \fIlive\-helper\fR(7) for a complete list of all generic live\-helper options. + +.SH SEE ALSO +\fIlh_binary\fR(1) +.br +\fIlive\-helper\fR(7) +.PP +This program is a part of live\-helper. + +.SH HOMEPAGE +More information about live\-helper and the Debian Live project can be found in the homepage at <\fIhttp://debian\-live.alioth.debian.org/\fR> and in the manual at <\fIhttp://live.debian.net/manual/\fR>. + +.SH BUGS +Report bugs by submitting a bugreport for the live\-helper package in the Debian Bug Tracking System at <\fIhttp://bugs.debian.org/\fR> or write a mail to the mailinglist at <\fIdebian-live@lists.debian.org\fR>. + +.SH AUTHOR +live\-helper was written by Daniel Baumann <\fIdaniel@debian.org\fR> for the Debian project. diff --git a/manpages/live-helper.en.7 b/manpages/live-helper.en.7 index 67fbebbbb..1ef64c983 100644 --- a/manpages/live-helper.en.7 +++ b/manpages/live-helper.en.7 @@ -159,6 +159,8 @@ install disk information into binary encrypts rootfs .IP "\fBlh_binary_grub\fR(1)" 4 installs grub into binary +.IP "\fBlh_binary_grub2\fR(1)" 4 +installs grub2 into binary .IP "\fBlh_binary_includes\fR(1)" 4 copy files into binary .IP "\fBlh_binary_iso\fR(1)" 4 diff --git a/templates/grub2/grub.cfg b/templates/grub2/grub.cfg new file mode 100644 index 000000000..4ad86bd98 --- /dev/null +++ b/templates/grub2/grub.cfg @@ -0,0 +1,12 @@ +set default=0 + +insmod tga +background_image ($root)/boot/grub/xbmc.tga +set color_normal=cyan/blue +set color_highlight=white/blue + +LINUX_LIVE + +LINUX_INSTALL + +MEMTEST diff --git a/templates/grub2/splash.tga b/templates/grub2/splash.tga Binary files differnew file mode 100644 index 000000000..854d0b26d --- /dev/null +++ b/templates/grub2/splash.tga |