LinuxForum.Fans
Тема

Grub2 параметры cmdline

Автор: zenon 32 сообщений 9291 просмотров
#211968
Wolfenberg написал:
vga=
newzenon написал:
vga=792

А разьвее второй Grub не ругнется на такой параеметр (как для первого Grub'a) что-то типа "устаревший параметр" и не откажется так переключать. Я имею в виду если это писать именно в строке передачи параметров ядру? Работает так, да?

#211974
Wolfenberg написал:

Да, основное, но это-то тут причем?
Режим vga=792 это 1024×768, 24 bit, и он у меня нормально работает.

text
$ hwinfo --framebuffer
02: None 00.0: 11001 VESA Framebuffer                           
  [Created at bios.459]
  Unique ID: rdCR.zn7pM8BU3A5
  Hardware Class: framebuffer
  Model: "NVIDIA BIOS-P/N@N7129"
  Vendor: "NVIDIA Corporation"
  Device: "BIOS-P/N@N7129"
  SubVendor: "NVIDIA"
  SubDevice: 
  Revision: "Chip Rev"
  Memory Size: 14 MB
  Memory Range: 0xcf000000-0xcfdfffff (rw)
  Mode 0x0300: 640x400 (+640), 8 bits
  Mode 0x0301: 640x480 (+640), 8 bits
  Mode 0x0303: 800x600 (+800), 8 bits
  Mode 0x030e: 320x200 (+640), 16 bits
  Mode 0x030f: 320x200 (+1280), 24 bits
  Mode 0x0311: 640x480 (+1280), 16 bits
  Mode 0x0312: 640x480 (+2560), 24 bits
  Mode 0x0314: 800x600 (+1600), 16 bits
  Mode 0x0315: 800x600 (+3200), 24 bits
  Mode 0x0330: 320x200 (+320), 8 bits
  Mode 0x0331: 320x400 (+320), 8 bits
  Mode 0x0332: 320x400 (+640), 16 bits
  Mode 0x0333: 320x400 (+1280), 24 bits
  Mode 0x0334: 320x240 (+320), 8 bits
  Mode 0x0335: 320x240 (+640), 16 bits
  Mode 0x0336: 320x240 (+1280), 24 bits
  Mode 0x033d: 640x400 (+1280), 16 bits
  Mode 0x033e: 640x400 (+2560), 24 bits
#211976
redux написал:
[quote=Wolfenberg]vga=
newzenon написал:
vga=792

А разьвее второй Grub не ругнется на такой параеметр (как для первого Grub'a) что-то типа "устаревший параметр" и не откажется так переключать. Я имею в виду если это писать именно в строке передачи параметров ядру? Работает так, да?[/quote]
Ну я ж говорю это работает также как и 0x318 - только для ядра на котором grub2 стоит. Ядра на других разделах не получают этот параметр.

#211979
newzenon написал:
Ядра на других разделах не получают этот параметр.

Если ядра на других разделах,то может тогда и загрузчики туда поставить свои, чтоб основной загрузчик им управление передавал? (Хотя извращение- не спорю).
UPD: фигню сказал, оказывается я так не умею.

#211984
redux написал:

Если ядра на других разделах,то может тогда и загрузчики туда поставить свои, чтоб основной загрузчик им управление передавал? (Хотя извращение- не спорю).

Да, это уже каша будет.
Кстати недосмотрел, ядра-то получают параметр, вот какой конфиг генерирует update-grub для других ядер у меня (это кусок grub.cfg и результат работы грубовского 30_os-prober_proxy)

text

### BEGIN /etc/grub.d/30_os-prober_proxy ###
menuentry "Debian GNU/Linux, with Linux 3.1-1.slh.1-aptosid-amd64 (on /dev/sda1)" --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod reiserfs
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root 0b72ab7e-7dc7-4afb-96f2-c5d4bc376655
        linux /boot/vmlinuz-3.1-1.slh.1-aptosid-amd64 root=UUID=0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 ro quiet vga=792 nomodeset nouveau.modeset=0
        initrd /boot/initrd.img-3.1-1.slh.1-aptosid-amd64
}
menuentry "Gentoo Base System release 2.1 (on /dev/sda7)" --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod reiserfs
        set root='(hd0,msdos7)'
        search --no-floppy --fs-uuid --set=root f960b405-1099-4d92-916a-9ed39bf2e9f1
        linux /boot/kernel-genkernel-x86_64-2.6.38.5-zen-libre root=/dev/sda7
        initrd /boot/initramfs-genkernel-x86_64-2.6.38.5-zen-libre
}
menuentry "Gentoo Base System release 2.1 (on /dev/sda7)" --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod reiserfs
        set root='(hd0,msdos7)'
        search --no-floppy --fs-uuid --set=root f960b405-1099-4d92-916a-9ed39bf2e9f1
        linux /boot/kernel-genkernel-x86_64-3.1.4-zen+ root=/dev/sda7
        initrd /boot/initramfs-genkernel-x86_64-3.1.4-zen+
}
menuentry "Debian GNU/Linux, with Linux 3.0-4.slh.3-aptosid-amd64 (on /dev/sda1)" --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod reiserfs
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root 0b72ab7e-7dc7-4afb-96f2-c5d4bc376655
        linux /boot/vmlinuz-3.0-4.slh.3-aptosid-amd64 root=UUID=0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 ro quiet vga=792 nomodeset nouveau.modeset=0
        initrd /boot/initrd.img-3.0-4.slh.3-aptosid-amd64
}
### END /etc/grub.d/30_os-prober_proxy ###

Значит тут ещё что-то не так.

#211986

newzenon, я тебе уже ссылки дал почитать, что где прописать и как. А ты все упираешься.

#212090

Стормозил тут http://linuxforum.ru/viewtopic.php?pid=232456#p232456, не тот скрипт за это отвечает, а этот /etc/grub.d/proxifiedScripts/os-prober
Весь:

text

#! /bin/sh
set -e

# grub-mkconfig helper script. # Copyright (C) 2006,2007,2008,2009 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/>.

prefix=/usr exec_prefix=${prefix} libdir=/lib64

. ${libdir}/grub/grub-mkconfig_lib

if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then exit 0 fi

if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then # missing os-prober and/or linux-boot-prober exit 0 fi

OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`" if [ -z "${OSPROBED}" ] ; then # empty os-prober output, nothing doing exit 0 fi

osx_entry() { cat << EOF menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" --class osx --class darwin --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" cat << EOF load_video set do_resume=0 if [ /var/vm/sleepimage -nt10 / ]; then if xnu_resume /var/vm/sleepimage; then set do_resume=1 fi fi if [ \$do_resume = 0 ]; then xnu_uuid ${OSXUUID} uuid if [ -f /Extra/DSDT.aml ]; then acpi -e /Extra/DSDT.aml fi $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then xnu_mkext /System/Library/Extensions.mkext else xnu_kextdir /System/Library/Extensions fi if [ -f /Extra/Extensions.mkext ]; then xnu_mkext /Extra/Extensions.mkext fi if [ -d /Extra/Extensions ]; then xnu_kextdir /Extra/Extensions fi if [ -f /Extra/devprop.bin ]; then xnu_devprop_load /Extra/devprop.bin fi if [ -f /Extra/splash.jpg ]; then insmod jpeg xnu_splash /Extra/splash.jpg fi if [ -f /Extra/splash.png ]; then insmod png xnu_splash /Extra/splash.png fi if [ -f /Extra/splash.tga ]; then insmod tga xnu_splash /Extra/splash.tga fi fi } EOF }

for OS in ${OSPROBED} ; do DEVICE="`echo ${OS} | cut -d ':' -f 1`" LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" BOOT="`echo ${OS} | cut -d ':' -f 4`"

if [ -z "${LONGNAME}" ] ; then LONGNAME="${LABEL}" fi

echo "Found ${LONGNAME} on ${DEVICE}" >&2

case ${BOOT} in chain)

cat << EOF menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"

case ${LONGNAME} in Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*) ;; *) cat << EOF drivemap -s (hd0) \${root} EOF ;; esac

cat <<EOF chainloader +1 } EOF ;; linux) LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`" prepare_boot_cache=

for LINUX in ${LINUXPROBED} ; do LROOT="`echo ${LINUX} | cut -d ':' -f 1`" LBOOT="`echo ${LINUX} | cut -d ':' -f 2`" LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`" LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`" LINITRD="`echo ${LINUX} | cut -d ':' -f 5`" LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

if [ -z "${LLABEL}" ] ; then LLABEL="${LONGNAME}" fi

if [ "${LROOT}" != "${LBOOT}" ]; then LKERNEL="${LKERNEL#/boot}" LINITRD="${LINITRD#/boot}" fi

cat << EOF menuentry "${LLABEL} (on ${DEVICE})" --class gnu-linux --class gnu --class os { EOF save_default_entry | sed -e "s/^/\t/" if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")" fi printf '%s\n' "${prepare_boot_cache}" cat << EOF linux ${LKERNEL} ${LPARAMS} EOF if [ -n "${LINITRD}" ] ; then cat << EOF initrd ${LINITRD} EOF fi cat << EOF } EOF done ;; macosx) OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`" osx_entry xnu_kernel 32 osx_entry xnu_kernel64 64 ;; hurd) cat << EOF menuentry "${LONGNAME} (on ${DEVICE})" --class hurd --class gnu --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" grub_device="`${grub_probe} --device ${DEVICE} --target=drive`" mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`" grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`" case "${grub_fs}" in *fs) hurd_fs="${grub_fs}" ;; *) hurd_fs="${grub_fs}fs" ;; esac cat << EOF multiboot /boot/gnumach.gz root=device:${mach_device} module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ --device-master-port='\${device-port}' \\ --exec-server-task='\${exec-task}' -T typed '\${root}' \\ '\$(task-create)' '\$(task-resume)' module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)' } EOF ;; *) echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2 ;; esac done >

За линуксовые ядра отвечает сие:

text
    linux)
      LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
      prepare_boot_cache=

for LINUX in ${LINUXPROBED} ; do LROOT="`echo ${LINUX} | cut -d ':' -f 1`" LBOOT="`echo ${LINUX} | cut -d ':' -f 2`" LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`" LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`" LINITRD="`echo ${LINUX} | cut -d ':' -f 5`" LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

if [ -z "${LLABEL}" ] ; then LLABEL="${LONGNAME}" fi

if [ "${LROOT}" != "${LBOOT}" ]; then LKERNEL="${LKERNEL#/boot}" LINITRD="${LINITRD#/boot}" fi

cat << EOF

Наверное только скрипт изменять придеться, а конкректно
это

text
LKERNEL="${LKERNEL#/boot}"

на

text

LKERNEL="${LKERNEL#/boot} ${GRUB_CMDLINE_LINUX_DEFAULT}"
#212312

Особо не вникал в вышеописанное, но если память не изменяет, то:

text
GRUB_CMDLINE_LINUX_DEFAULT=""

Для ядра загружаемое по умолчанию;

text
GRUB_CMDLINE_LINUX=""

Для всех остальных ядер.

#212468

Вот смотрим:

text
$ cat /mnt/gentoo/etc/default/grub
GRUB_DEFAULT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="false"
GRUB_TIMEOUT="10"

GRUB_BACKGROUND="/boot/grub2/for-grub-1600-1200-0057-1080p.png" GRUB_CMDLINE_LINUX="splash quiet vga=795 noapic acpi=off" GRUB_CMDLINE_LINUX_DEFAULT="splash quiet vga=795 noapic acpi=off" GRUB_GFXMODE="1024x768"

Вот что сгенерировал update-grub:

text

$ cat /mnt/gentoo/boot/grub2/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then load_env fi set default="0" 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 load_video { insmod vbe insmod vga insmod video_bochs insmod video_cirrus }

insmod part_msdos insmod ext2 set root='(hd0,msdos10)' search --no-floppy --fs-uuid --set=root 6f9c97fe-bea8-467f-a3be-5a124224970a if loadfont /share/grub2/unicode.pf2 ; then set gfxmode=1024x768 load_video insmod gfxterm fi terminal_output gfxterm insmod part_msdos insmod reiserfs set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root ead6564b-03af-44a6-b645-1c948bd47cca insmod png background_image -m stretch /boot/grub2/for-grub-1600-1200-0057-1080p.png set timeout=10 ### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux_proxy ### menuentry "GNU/Linux, с Linux x86_64-3.1.2-zen+" --class gnu-linux --class gnu --class os { load_video insmod gzio insmod part_msdos insmod reiserfs set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root ead6564b-03af-44a6-b645-1c948bd47cca echo 'Загружается Linux x86_64-3.1.2-zen+ ...' linux /boot/kernel-genkernel-x86_64-3.1.2-zen+ root=/dev/sdb1 ro splash quiet vga=795 noapic acpi=off splash quiet vga=795 noapic acpi=off echo 'Загружается начальный ramdisk ...' initrd /boot/initramfs-genkernel-x86_64-3.1.2-zen+ } menuentry "GNU/Linux, с Linux x86_64-3.1.2-zen+ (режим восстановления)" --class gnu-linux --class gnu --class os { load_video insmod gzio insmod part_msdos insmod reiserfs set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root ead6564b-03af-44a6-b645-1c948bd47cca echo 'Загружается Linux x86_64-3.1.2-zen+ ...' linux /boot/kernel-genkernel-x86_64-3.1.2-zen+ root=/dev/sdb1 ro single splash quiet vga=795 noapic acpi=off echo 'Загружается начальный ramdisk ...' initrd /boot/initramfs-genkernel-x86_64-3.1.2-zen+ } menuentry "GNU/Linux, с Linux x86_64-3.1.1-gentoo" --class gnu-linux --class gnu --class os { load_video insmod gzio insmod part_msdos insmod reiserfs set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root ead6564b-03af-44a6-b645-1c948bd47cca echo 'Загружается Linux x86_64-3.1.1-gentoo ...' linux /boot/kernel-genkernel-x86_64-3.1.1-gentoo root=/dev/sdb1 ro splash quiet vga=795 noapic acpi=off splash quiet vga=795 noapic acpi=off echo 'Загружается начальный ramdisk ...' initrd /boot/initramfs-genkernel-x86_64-3.1.1-gentoo } menuentry "GNU/Linux, с Linux x86_64-3.1.1-gentoo (режим восстановления)" --class gnu-linux --class gnu --class os { load_video insmod gzio insmod part_msdos insmod reiserfs set root='(hd1,msdos1)' search --no-floppy --fs-uuid --set=root ead6564b-03af-44a6-b645-1c948bd47cca echo 'Загружается Linux x86_64-3.1.1-gentoo ...' linux /boot/kernel-genkernel-x86_64-3.1.1-gentoo root=/dev/sdb1 ro single splash quiet vga=795 noapic acpi=off echo 'Загружается начальный ramdisk ...' initrd /boot/initramfs-genkernel-x86_64-3.1.1-gentoo } ### END /etc/grub.d/10_linux_proxy ###

### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober_proxy ### menuentry "Debian GNU/Linux, with Linux 3.1-1.slh.1-aptosid-amd64 (on /dev/sda1)" --class gnu-linux --class gnu --class os { insmod part_msdos insmod reiserfs set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set=root 0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 linux /boot/vmlinuz-3.1-1.slh.1-aptosid-amd64 root=UUID=0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 ro quiet vga=792 nomodeset nouveau.modeset=0 initrd /boot/initrd.img-3.1-1.slh.1-aptosid-amd64 } menuentry "Gentoo Base System release 2.1 (on /dev/sda7)" --class gnu-linux --class gnu --class os { insmod part_msdos insmod reiserfs set root='(hd0,msdos7)' search --no-floppy --fs-uuid --set=root f960b405-1099-4d92-916a-9ed39bf2e9f1 linux /boot/kernel-genkernel-x86_64-2.6.38.5-zen-libre root=/dev/sda7 initrd /boot/initramfs-genkernel-x86_64-2.6.38.5-zen-libre } menuentry "Gentoo Base System release 2.1 (on /dev/sda7) ZEN-KERNEL 3.1.4" --class gnu-linux --class gnu --class os { insmod part_msdos insmod reiserfs set root='(hd0,msdos7)' search --no-floppy --fs-uuid --set=root f960b405-1099-4d92-916a-9ed39bf2e9f1 linux /boot/kernel-genkernel-x86_64-3.1.4-zen+ root=/dev/sda7 initrd /boot/initramfs-genkernel-x86_64-3.1.4-zen+ } menuentry "Debian GNU/Linux, with Linux 3.0-4.slh.3-aptosid-amd64 (on /dev/sda1)" --class gnu-linux --class gnu --class os { insmod part_msdos insmod reiserfs set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set=root 0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 linux /boot/vmlinuz-3.0-4.slh.3-aptosid-amd64 root=UUID=0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 ro quiet vga=792 nomodeset nouveau.modeset=0 initrd /boot/initrd.img-3.0-4.slh.3-aptosid-amd64 } ### END /etc/grub.d/30_os-prober_proxy ###

### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ### if [ -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###

Для раздела на котром сам grub2 строчка:

text
linux    /boot/kernel-genkernel-x86_64-3.1.2-zen+ root=/dev/sdb1 ro splash quiet vga=795 noapic acpi=off splash quiet vga=795 noapic acpi=off

Для Debian почему-то проигнорировал GRUB_DISABLE_LINUX_UUID="true" и на CMDLINE тоже игнор:

text
linux /boot/vmlinuz-3.1-1.slh.1-aptosid-amd64 root=UUID=0b72ab7e-7dc7-4afb-96f2-c5d4bc376655 ro quiet vga=792 nomodeset

Для Gentoo:

text

linux /boot/kernel-genkernel-x86_64-3.1.4-zen+ root=/dev/sda7

Вывод, - по ходу update-grub выполняя сценарий os_prober заползает в разделы Linux и в каждом разделе ищет /etc/default/grub? Во всех ли дистрибутивах этот файло есть?

Почему так решил, потому что на разделе Debian как раз параметры

text
GRUB_CMDLINE_LINUX_DEFAULT="quiet vga=792 nomodeset nouveau.modeset=0"

На разделе /dev/sda7 с Gentoo этого файла вообще нет.
Такие дела.

#212474

Подитожу: Grub2 может очень много, документирован отвратно, о таких вещах как эта приходится доперать самому, например для того чтобы он показывал фоном картинку в меню надо тупо в какой-то каталог ее скопировать, забыл в какой.

#212844
newzenon написал:

...например для того чтобы он показывал фоном картинку в меню надо тупо в какой-то каталог ее скопировать, забыл в какой.

http://linuxforum.ru/viewtopic.php?id=12148

Войдите или зарегистрируйтесь, чтобы ответить.