Page 4 of 4 FirstFirst ... 234
Results 31 to 34 of 34

Thread: A Beginner's Guide to Theming GRUB2

  1. #31
    Join Date
    Dec 2009
    Beans
    286

    Re: A Beginner's Guide to Theming GRUB2

    The guide is dependent on you following through the previous steps. At the end of the Demo Theme chapter, you should have in /boot/grub/themes/demo:
    Code:
    7x13.pf2                       sb_th_c.png
    arch-24.png                    sb_th_n.png
    caribbean_sunset_200.jpg       sb_th_s.png
    center.png                     select_c.png
    debian-24.png                  select_e.png
    dejavu-sans-10.pf2             select_ne.png
    dejavu-sans-12.pf2             select_n.png
    dejavu-sans-bold-14.pf2        select_nw.png
    desktop.png                    select_se.png
    gentoo-24.png                  select_s.png
    gnu-linux-color-wallpaper.png  select_sw.png
    kubuntu-24.png                 select_w.png
    linuxmint-24.png               terminal-background.png
    menu_bkg_c.png                 terminal-background-workaround.png
    menu_bkg_e.png                 terminal_c.png
    menu_bkg_ne.png                terminal_e.png
    menu_bkg_n.png                 terminal_ne.png
    menu_bkg_nw.png                terminal_n.png
    menu_bkg_se.png                terminal_nw.png
    menu_bkg_s.png                 terminal_se.png
    menu_bkg_sw.png                terminal_s.png
    menu_bkg_w.png                 terminal_sw.png
    opensuse-24.png                terminal_w.png
    progress_bar_c.png             theme.txt
    progress_highlight_c.png       tick.png
    sabayon-24.png                 tux.png
    sb_fr_c.png                    ubuntu-24.png
    sb_fr_n.png                    ubuntu-glow-24.png
    sb_fr_s.png                    windows-24.png
    icons
    And under /boot/grub/themes/demo/icons:
    Code:
    arch.png    gnu-linux.png      opensuse.png  slackware.png
    debian.png  LICENSES           osx.png       submenu.png
    fedora.png  linuxmint.png      recovery.png  ubuntu.png
    gentoo.png  mandrivalinux.png  sabayon.png   windows.png
    Now, at the start of the Distributing Your Theme chapter, the first command:
    Code:
    mkdir ~/grub-themes ; cp -r --no-preserve=ownership <grub_dir>/themes/demo ~/grub-themes/ ; cp ~/Documents/grub_guide/ed3/install.sh ~/grub-themes/demo/
    creates a grub-themes directory in your /home directory and copies the /boot/grub/themes/demo directory and the ~/Documents/grub_guide/ed3/install.sh file to it.

    Follow the steps in the rest of the chapter.

    If you did not follow each step up to this point, the install script may fail. This should help with testing the demo theme:
    Code:
    mkdir ~/grub-themes
    cd ~/grub-themes
    cp -r ~/Documents/grub_guide/ed3/demo .
    cd demo
    cp -r ~/Documents/grub_guide/ed3/icons .
    cp ~/Documents/grub_guide/ed3/install.sh .
    sudo rm -r /boot/grub/themes/demo
    sudo ./install.sh
    This will install the demo themes and icons to /boot/grub/themes and set the variables GRUB_BACKGROUND and GRUB_THEME in the /etc/default/grub configuration file. It will also run update-grub to generate the new /boot/grub/grub.cfg file.

    export GRUB_MENU_PICTURE="/boot/grub/themes/demo/demo/gnu-linux-color-wallpaper.png" is not set by the install script.

    Thanks for the suggestions in your other posts.
    The Definitive Guide to Theming GRUB2 is here.

  2. #32
    Join Date
    Mar 2005
    Location
    UK
    Beans
    562

    Re: A Beginner's Guide to Theming GRUB2

    Thanks a lot for your help.

    I have another suggestion for testing grub2 themes without rebooting:

    grub-emu


    I tried grub-emu and it gave me an error relating to a video driver I do not use, so maybe someone else needs to install grub-emu.


    I followed your instructions and can confirm that it works perfectly. Thank you for all the hard work you have shared with
    the Community.
    In next few weeks I will have a go at a custom theme myself.
    Last edited by hal8000; November 8th, 2012 at 02:09 PM. Reason: Solved

  3. #33
    Join Date
    Aug 2007
    Beans
    18

    Re: A Beginner's Guide to Theming GRUB2

    Hi Towheed,

    I am new to Ubuntu. This is my first Ubuntu installation.

    I am trying to get the grub theme to work on my newly installed Ubuntu Gnome 13.04 and the terminal windows keep popping up after selection. I did try to patch the 00_header but not successful.


    Please help me to get rid of the terminal windows after selection is being made.

    Below is my grub file from /etc/default/grub :
    # For full documentation of the options in this file, see:
    # info -f grub -n 'Simple configuration'

    GRUB_DEFAULT="Ubuntu"
    #GRUB_HIDDEN_TIMEOUT="0"
    GRUB_HIDDEN_TIMEOUT_QUIET="true"
    GRUB_TIMEOUT="2"
    GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
    GRUB_CMDLINE_LINUX_DEFAULT="quiet"
    GRUB_CMDLINE_LINUX=""

    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xe fefefef"

    # Uncomment to disable graphical terminal (grub-pc only)
    #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=1024x768
    GRUB_THEME=/boot/grub/themes/demo/theme.txt

    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID="true"

    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"

    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"

    #GRUB_SAVEDEFAULT="false"

    GRUB_BACKGROUND=/boot/grub/themes/demo/terminal-background-workaround.png

    Below is my 00_header file :
    #! /bin/sh
    set -e

    # grub-mkconfig helper script.
    # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
    #
    # GRUB is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # GRUB is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with GRUB. If not, see <http://www.gnu.org/licenses/>.

    transform="s,x,x,"

    prefix="/usr"
    exec_prefix="${prefix}"
    datarootdir="${prefix}/share"
    grub_lang=`echo $LANG | cut -d . -f 1`

    export TEXTDOMAIN=grub
    export TEXTDOMAINDIR="${datarootdir}/locale"

    . "${datarootdir}/grub/grub-mkconfig_lib"

    # Do this as early as possible, since other commands might depend on it.
    # (e.g. the `loadfont' command might need lvm or raid modules)
    for i in ${GRUB_PRELOAD_MODULES} ; do
    echo "insmod $i"
    done

    if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
    if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
    if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
    if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi

    if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
    if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
    if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi

    cat << EOF
    if [ -s \$prefix/grubenv ]; then
    set have_grubenv=true
    load_env
    fi
    EOF
    if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <<EOF
    if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
    set default="${GRUB_DEFAULT_BUTTON}"
    else
    set default="${GRUB_DEFAULT}"
    fi
    EOF
    else
    cat <<EOF
    set default="${GRUB_DEFAULT}"
    EOF
    fi
    cat <<EOF

    if [ x"\${feature_menuentry_id}" = xy ]; then
    menuentry_id_option="--id"
    else
    menuentry_id_option=""
    fi

    export menuentry_id_option

    if [ "\${prev_saved_entry}" ]; then
    set saved_entry="\${prev_saved_entry}"
    save_env saved_entry
    set prev_saved_entry=
    save_env prev_saved_entry
    set boot_once=true
    fi

    function savedefault {
    if [ -z "\${boot_once}" ]; then
    saved_entry="\${chosen}"
    save_env saved_entry
    fi
    }

    function recordfail {
    set recordfail=1
    if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
    }

    function load_video {
    EOF
    if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
    cat <<EOF
    insmod ${GRUB_VIDEO_BACKEND}
    EOF
    else
    # If all_video.mod isn't available load all modules available
    # with versions prior to introduction of all_video.mod
    cat <<EOF
    if [ x\$feature_all_video_module = xy ]; then
    insmod all_video
    else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
    fi
    EOF
    fi
    cat <<EOF
    }

    EOF

    serial=0;
    gfxterm=0;
    for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
    if [ xserial = "x$x" ]; then
    serial=1;
    fi
    if [ xgfxterm = "x$x" ]; then
    gfxterm=1;
    fi
    done

    if [ "x$serial" = x1 ]; then
    if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
    grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"
    GRUB_SERIAL_COMMAND=serial
    fi
    echo "${GRUB_SERIAL_COMMAND}"
    fi

    if [ "x$gfxterm" = x1 ]; then
    if [ -n "$GRUB_FONT" ] ; then
    # Make the font accessible
    prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
    cat << EOF
    if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
    EOF
    else
    for dir in "${pkgdatadir}" "`echo '/boot/grub' | sed "s,//*,/,g"`" /usr/share/grub ; do
    for basename in unicode unifont ascii; do
    path="${dir}/${basename}.pf2"
    if is_path_readable_by_grub "${path}" > /dev/null ; then
    font_path="${path}"
    else
    continue
    fi
    break 2
    done
    done
    if [ -n "${font_path}" ] ; then
    cat << EOF
    if [ x\$feature_default_font_path = xy ] ; then
    font=unicode
    else
    EOF
    # Make the font accessible
    prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
    cat << EOF
    font="`make_system_path_relative_to_its_root "${font_path}"`"
    fi

    if loadfont \$font ; then
    EOF
    else
    cat << EOF
    if loadfont unicode ; then
    EOF
    fi
    fi

    cat << EOF
    set gfxmode=${GRUB_GFXMODE}
    load_video
    insmod gfxterm
    EOF

    # Gettext variables and module
    if [ "x${LANG}" != "xC" ] ; then
    cat << EOF
    set locale_dir=\$prefix/locale
    set lang=${grub_lang}
    insmod gettext
    EOF
    fi

    cat <<EOF
    fi
    EOF
    fi

    case x${GRUB_TERMINAL_INPUT} in
    x)
    # Just use the native terminal
    ;;
    x*)
    cat << EOF
    terminal_input ${GRUB_TERMINAL_INPUT}
    EOF
    ;;
    esac

    case x${GRUB_TERMINAL_OUTPUT} in
    x)
    # Just use the native terminal
    ;;
    x*)
    cat << EOF
    terminal_output ${GRUB_TERMINAL_OUTPUT}
    EOF
    ;;
    esac

    if [ "x$gfxterm" = x1 ]; then
    if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
    && is_path_readable_by_grub "$GRUB_THEME"; then
    gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2

    prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
    cat << EOF
    insmod gfxmenu
    EOF
    themedir="`dirname "$GRUB_THEME"`"
    for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
    if [ -f "$x" ]; then
    cat << EOF
    loadfont (\$root)`make_system_path_relative_to_its_root $x`
    EOF
    fi
    done
    if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
    cat << EOF
    insmod jpeg
    EOF
    fi
    if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
    cat << EOF
    insmod png
    EOF
    fi
    if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
    cat << EOF
    insmod tga
    EOF
    fi

    cat << EOF
    set theme=(\$root)`make_system_path_relative_to_its_ro ot $GRUB_THEME`
    export theme
    EOF
    elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
    && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
    gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
    case "$GRUB_BACKGROUND" in
    *.png) reader=png ;;
    *.tga) reader=tga ;;
    *.jpg|*.jpeg) reader=jpeg ;;
    *) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
    esac
    prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
    cat << EOF
    insmod $reader
    background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
    EOF
    fi
    fi

    make_timeout ()
    {
    cat << EOF
    if [ "\${recordfail}" = 1 ]; then
    set timeout=${GRUB_RECORDFAIL_TIMEOUT:--1}
    else
    set timeout=${2}
    fi
    EOF
    }

    if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <<EOF
    if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
    EOF
    make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
    echo else
    make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
    echo fi
    else
    make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
    fi

    if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
    cat <<EOF
    cmosclean $GRUB_BUTTON_CMOS_ADDRESS
    EOF
    fi

    # Play an initial tune
    if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
    echo "play ${GRUB_INIT_TUNE}"
    fi

    if [ "x${GRUB_BADRAM}" != "x" ] ; then
    echo "badram ${GRUB_BADRAM}"
    fi

    Thanks.

  4. #34
    Join Date
    Dec 2009
    Beans
    286

    Re: A Beginner's Guide to Theming GRUB2

    Simply put, you cannot get rid of the terminal window. It's part of the GRUB source code.

    Also, if you followed the 3rd Edition (which you should use now), from Page 69 of the Guide:
    A background image is never shown if we are using GRUB's graphical theme
    because GRUB_THEME takes precedence over GRUB_BACKGROUND. Before a background
    image is shown in the terminal window, we must remove this precedence. This is set in GRUB's
    /etc/grub.d/00_header script as shown below:
    The patch only allows you to apply a background image to the temrinal window, not remove it all together.
    The Definitive Guide to Theming GRUB2 is here.

Page 4 of 4 FirstFirst ... 234

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •