add grub2

This commit is contained in:
philm 2010-11-21 19:35:32 +01:00
parent 1791d094a6
commit 7beeb039ac
14 changed files with 472 additions and 0 deletions

6
grub2/05_chakratheme Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash -e
cat << EOF
set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue
EOF

27
grub2/20_memtest86+ Normal file
View File

@ -0,0 +1,27 @@
#! /bin/sh -e
########################################################
# This script generates a memtest86+ entry on grub.cfg #
# if memtest is installed on the system. #
########################################################
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
MEMTEST86_IMAGE="/boot/memtest86+/memtest.bin"
CLASS="--class memtest86 --class gnu --class tool"
if [ -e $MEMTEST86_IMAGE ] && is_path_readable_by_grub $MEMTEST86_IMAGE; then
# image exists, create menu entry
echo "Found memtest86+ image: $MEMTEST86_IMAGE" >&2
cat << EOF
menuentry "Memory test (memtest86+)" $CLASS {
EOF
prepare_grub_to_access_device `${grub_probe} --target=device $MEMTEST86_IMAGE` | sed -e "s/^/ /"
cat << EOF
linux16 (\$root)`make_system_path_relative_to_its_root $MEMTEST86_IMAGE`
}
EOF
fi

82
grub2/PKGBUILD Normal file
View File

@ -0,0 +1,82 @@
#
# Core Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
# include global config
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
pkgname=grub2
pkgver=1.98
pkgrel=1
pkgdesc="The GNU GRand Unified Bootloader"
url="http://www.gnu.org/software/grub/"
arch=('i686' 'x86_64')
license=('GPL3')
depends=('sh' 'lzo2' 'freetype2')
optdepends=('ruby:usr/share/grub/genmk.rb script' 'libusb: /sbin/grub-emu' 'gettext: /sbin/grub-mkconfig')
makedepends=('bdf-unifont' 'ruby')
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
conflicts=('grub')
provides=('grub')
source=(ftp://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.gz
'chakralinux-script-fixes.patch'
'gfxmenu-dependencies.patch'
'menucolors-in-mkconfig.patch'
'background-image-in-mkconfig.patch'
'hidden-timeout-fix.patch'
'grub.default'
'grub.cfg'
'20_memtest86+'
'lvm-detection.patch')
md5sums=('c0bcf60e524739bb64e3a2d4e3732a59'
'0910da120700a6928cd0290211acc79f'
'897f8af2fc83fcdaf7329da39f06d3dc'
'00ae9ff8991b8f00ab90739859af2921'
'fa14d3feabe17ac11dd3163501a66155'
'81bcdf26aa01b08b9925d72cbc4c3dab'
'6cdfe6bbe7e8fd0d6079d404d810f1bd'
'43cf74b91918e3bdec6dee0acc1c7032'
'5a07e04c4ecb8ed145d54fec3043e0d5'
'60b0157ed87041541ad0f62e3c7c0577')
build() {
cd $srcdir/grub-${pkgver}
# some random patches to facilitate automatic creation of grub.cfg
patch -Np1 -i ${srcdir}/chakralinux-script-fixes.patch
patch -Np1 -i ${srcdir}/gfxmenu-dependencies.patch
patch -Np1 -i ${srcdir}/menucolors-in-mkconfig.patch
patch -Np1 -i ${srcdir}/background-image-in-mkconfig.patch
patch -Np1 -i ${srcdir}/hidden-timeout-fix.patch
# fix lvm symlink detection
patch -Np0 -i ${srcdir}/lvm-detection.patch
# run autogen.sh to create configure files
./autogen.sh
# fix unifont.bdf location
sed -i 's|/usr/src/unifont.bdf|/usr/share/fonts/misc/unifont.bdf|' configure
CFLAGS= ./configure --prefix=/usr --enable-grub-mkfont --bindir=/bin \
--sbindir=/sbin --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc
CFLAGS= make
}
package() {
cd $srcdir/grub-${pkgver}
make DESTDIR=${pkgdir} install
# install /etc/default/grub
install -Dm644 ${srcdir}/grub.default ${pkgdir}/etc/default/grub
# install grub.cfg (needed so it doesn't get removed on upgrading because it was previously here)
install -Dm644 ${srcdir}/grub.cfg ${pkgdir}/boot/grub/grub.cfg
# install memtest config detection
install -Dm755 ${srcdir}/20_memtest86+ ${pkgdir}/etc/grub.d/20_memtest86+
}

View File

@ -0,0 +1,35 @@
diff -urN grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-10 20:30:56.319608325 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-10 23:01:20.856612701 -0400
@@ -104,6 +104,20 @@
terminal gfxterm
fi
EOF
+if [ x$GRUB_BACKGROUND != x ] && [ -f $GRUB_BACKGROUND ] \
+ && is_path_readable_by_grub $GRUB_BACKGROUND; then
+ echo "Found background: $GRUB_BACKGROUND" >&2
+ case $GRUB_BACKGROUND in
+ *.png) reader=png ;;
+ *.tga) reader=tga ;;
+ *.jpg|*.jpeg) reader=jpeg ;;
+ esac
+ prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_BACKGROUND` | sed -e "s/^/ /"
+ cat << EOF
+ insmod $reader
+ background_image (\$root)`make_system_path_relative_to_its_root $GRUB_BACKGROUND`
+EOF
+fi
if [ x$GRUB_THEME != x ] && [ -f $GRUB_THEME ] \
&& is_path_readable_by_grub $GRUB_THEME; then
echo "Found theme: $GRUB_THEME" >&2
diff -urN grub-1.98.orig/util/grub-mkconfig.in grub-1.98/util/grub-mkconfig.in
--- grub-1.98.orig/util/grub-mkconfig.in 2010-03-10 20:30:56.319608325 -0400
+++ grub-1.98/util/grub-mkconfig.in 2010-03-10 20:34:00.689582261 -0400
@@ -220,6 +220,7 @@
GRUB_DISABLE_LINUX_UUID \
GRUB_DISABLE_LINUX_RECOVERY \
GRUB_GFXMODE \
+ GRUB_BACKGROUND \
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \

View File

@ -0,0 +1,59 @@
diff -ur grub-1.98.orig/util/grub.d/10_linux.in grub-1.98/util/grub.d/10_linux.in
--- grub-1.98.orig/util/grub.d/10_linux.in 2010-03-13 22:10:15.953099258 -0400
+++ grub-1.98/util/grub.d/10_linux.in 2010-03-13 22:10:44.217896122 -0400
@@ -30,8 +30,8 @@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
+ OS="${GRUB_DISTRIBUTOR}"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | tr -d ' ') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -46,7 +46,7 @@
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
+ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
fi
linux_entry ()
@@ -97,7 +97,7 @@
EOF
}
-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+list=`for i in /boot/vmlinu[xz]* /vmlinu[xz]* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
@@ -109,13 +109,12 @@
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
- alt_version=`echo $version | sed -e "s,\.old$,,g"`
+ base_init=`echo $basename | sed -e "s,vmlinuz,kernel,g"`
+ alt_version="${base_init}-fallback"
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
- for i in "initrd.img-${version}" "initrd-${version}.img" \
- "initrd-${version}" "initrd.img-${alt_version}" \
- "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+ for i in "${base_init}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
@@ -130,6 +129,9 @@
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ initrd="${alt_version}.img"
+ linux_entry "${OS}" "${version} Fallback" false \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"

View File

@ -0,0 +1,32 @@
diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-12 12:54:12.686589681 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-13 01:55:04.425437673 -0400
@@ -108,6 +108,28 @@
&& is_path_readable_by_grub $GRUB_THEME; then
echo "Found theme: $GRUB_THEME" >&2
prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /"
+ theme_dir=`dirname $GRUB_THEME`
+ old_reader="null"
+ # add any font dependency
+ for f in ${theme_dir}/*.pf2 ; do
+ if [ -e $f ] ; then
+ echo " loadfont (\$root)`make_system_path_relative_to_its_root $f`"
+ fi
+ done
+ # adding insmod dependencies for images
+ for f in ${theme_dir}/*.{jpg,jpeg,png,tga} ; do
+ if [ -e $f ] ; then
+ case $f in
+ *.png) reader=png ;;
+ *.tga) reader=tga ;;
+ *.jpg|*.jpeg) reader=jpeg ;;
+ esac
+ if [ $old_reader != $reader ] ; then
+ echo " insmod ${reader}"
+ old_reader=$reader
+ fi
+ fi
+ done
cat << EOF
insmod gfxmenu
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`

View File

@ -0,0 +1,23 @@
diff -Nru grub-1.96.orig/kern/i386/pc/startup.S grub-1.96/kern/i386/pc/startup.S
--- grub-1.96.orig/kern/i386/pc/startup.S 2008-02-03 14:11:32.000000000 +0100
+++ grub-1.96_20081229/kern/i386/pc/startup.S 2008-02-17 06:22:54.000000000 +0100
@@ -594,15 +594,15 @@
call EXT_C(grub_dl_unload_all)
+ /* Turn off Gate A20 */
+ xorl %eax, %eax
+ call EXT_C(grub_gate_a20)
+
/* set up to pass boot drive */
popl %edx
/* ESI must point to a partition table entry */
popl %esi
-
- /* Turn off Gate A20 */
- xorl %eax, %eax
- call EXT_C(grub_gate_a20)
call prot_to_real
.code16

32
grub2/grub.cfg Normal file
View File

@ -0,0 +1,32 @@
# Config file for GRUB2 - The GNU GRand Unified Bootloader
# /boot/grub/grub.cfg
# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/sda (hd0)
# /dev/sdb2 (hd1,2)
# /dev/sda3 (hd0,3)
#
# Timeout for menu
set timeout=5
# Set default boot entry as Entry 0
set default=0
# (0) Chakra Linux
menuentry "Chakra Linux" {
set root=(hd0,1)
linux /vmlinuz26 root=/dev/sda1 ro
initrd /kernel26.img
}
## (1) Windows
#menuentry "Windows" {
#set root=(hd0,3)
#chainloader +1
#}

42
grub2/grub.default Normal file
View File

@ -0,0 +1,42 @@
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Chakra Linux"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true
# Uncomment to disable graphical terminal
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=1024x768x24
# Uncomment to allow the kernel use the same resolution used by grub
#GRUB_GFXPAYLOAD_LINUX=keep
# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-blue/black"
GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"
# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

17
grub2/grub2.install Normal file
View File

@ -0,0 +1,17 @@
post_install() {
echo -n "Generating grub.cfg.example config file... "
grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
echo "done."
cat << EOF
An example config file is created at /boot/grug/grub.cfg.example
EOF
}
post_upgrade() {
post_install
}

View File

@ -0,0 +1,51 @@
diff -Naur /etc/grub.d.orig/10_linux /etc/grub.d/10_linux
--- /etc/grub.d.orig/10_linux.in 2010-03-16 12:05:22.998499105 +0100
+++ /etc/grub.d/10_linux.in 2010-03-16 13:26:36.669907054 +0100
@@ -28,10 +28,10 @@
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
- OS=GNU/Linux
+ OS="Chakra Linux"
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
+ OS="${GRUB_DISTRIBUTOR} Chakra Linux"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' ) ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -46,7 +46,7 @@
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
+ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
fi
linux_entry ()
@@ -97,11 +97,12 @@
EOF
}
-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+list=`for i in /boot/vmlinu[xz]* /vmlinu[xz]* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
+
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
@@ -113,9 +114,7 @@
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
- for i in "initrd.img-${version}" "initrd-${version}.img" \
- "initrd-${version}" "initrd.img-${alt_version}" \
- "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+ for i in "$(echo $basename|sed 's|vmlinuz|kernel|'|sed 's|$|.img|')"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break

View File

@ -0,0 +1,12 @@
diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-11 00:36:05.766730374 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-11 00:40:49.046203888 -0400
@@ -150,7 +150,7 @@
fi
cat << EOF
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
- set timeout=${GRUB_TIMEOUT}
+ set timeout=0
fi
EOF
else

25
grub2/lvm-detection.patch Normal file
View File

@ -0,0 +1,25 @@
--- util/getroot.c~ 2010-07-12 20:34:58.498317508 +0200
+++ util/getroot.c 2010-07-12 20:34:58.556288678 +0200
@@ -222,9 +222,20 @@
/* Ignore any error. */
continue;
- if (S_ISLNK (st.st_mode))
- /* Don't follow symbolic links. */
+ if (S_ISLNK (st.st_mode)) {
+#ifdef __linux__
+ if (strcmp (dir, "mapper") == 0) {
+ /* Follow symbolic links under /dev/mapper/; the canonical name
+ may be something like /dev/dm-0, but the names under
+ /dev/mapper/ are more human-readable and so we prefer them if
+ we can get them. */
+ if (stat (ent->d_name, &st) < 0)
+ continue;
+ } else
+#endif /* __linux__ */
+ /* Don't follow other symbolic links. */
continue;
+ }
if (S_ISDIR (st.st_mode))
{

View File

@ -0,0 +1,29 @@
diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-11 00:36:05.766730374 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-11 00:36:27.252903963 -0400
@@ -59,6 +59,13 @@
}
EOF
+if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
+ cat << EOF
+set menu_color_normal=$GRUB_COLOR_NORMAL
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
+
+EOF
+fi
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
serial:* | *:serial)
if ! test -e ${grub_prefix}/serial.mod ; then
diff -ur grub-1.98.orig/util/grub-mkconfig.in grub-1.98/util/grub-mkconfig.in
--- grub-1.98.orig/util/grub-mkconfig.in 2010-03-11 00:36:05.781282507 -0400
+++ grub-1.98/util/grub-mkconfig.in 2010-03-11 00:36:21.511483268 -0400
@@ -223,6 +223,8 @@
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \
+ GRUB_COLOR_NORMAL \
+ GRUB_COLOR_HIGHLIGHT \
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT