Page 1 sur 4
[Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 21:05
par Link_
Bonjour,
Je continue mon calvaire afin d'installer Arch sur une clé USB. Alors que quand j'installe Arch sur un disque dur le menu.lst généré est parfait, là c'est visiblement pas le cas.
Infos utiles:
Clé usb détecté en tant que sdb, une unique partition sdb1 en ext2. Pas de partition /boot séparé donc.
A ma première install "réussie", dans le menu.lst généré contenait:
root (hd1,0]
kernel /boot/vmlinuz26 root/dev/sdb1 ro vga=773
initred /boot/kernel26.img
Au reboot j'ai donc vu un écran noir, avec seulement d'écrit "GRUB". Un écran qui visiblement ne bouge pas.
J'ai refait une install, en mettant cette fois dans mon menu.lst:
root (hd0,0]
Mais je me retrouve avec le même résultat.
Je vois pas bien quoi faire, j'ai peut être un début de piste:
J'ai installé grub sur /dev/sdb. Apparement c'est ce qu'il faut faire. Toutefois dans la liste des emplacements d'install disponibles pour grub j'ai
plusieurs /dev/sdb de listé...
Une idée ?
Merci encore pour votre aide, un jour je m'en sortirai peut être :/
EDIT: Il y a aussi ces infos là dans le
wiki mais elles sont peut être dépassés...:
Regenerate the initrd image, kernel26.img. Edit /etc/mkinitcpio.conf, changing the hooks to include (at a minimum): "base udev ide usb filesystems" (Note: if using the 7.2 CD, and installing from the CD, you will have mkinitrd instead of mkinitcpio. During the configuration, you will be asked to edit mkinitrd.conf; simply change REMOVE_USB=1 to REMOVE_USB=0 and ignore the following command). Then rebuild the image by issuing:
# mkinitcpio -k 2.6.25-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img.
Note: The kernel version (-k) must be the kernel version in the USB key, not the live cd's kernel version.
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 21:17
par benjarobin
Tout d'abord c'est assez risqué de mettre de l'ext2 au lieu de l'ext3, mais bon je comprend les raisons.
De plus ton problème n'a aucun lien avec le contenu du menu.lst et encore moins avec le kernel.
C'est comme si la clé USB avait un problème...
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 21:26
par FoolEcho
Heu... c'est pas un copier-coller, j'espère... parce que parenthèse ouvrante, crochet fermant... initred, ça risque pas de trop le faire.
Link_ a écrit :J'ai installé grub sur /dev/sdb. Apparement c'est ce qu'il faut faire. Toutefois dans la liste des emplacements d'install disponibles pour grub j'ai plusieurs /dev/sdb de listé...
C'est normal, tu as le disque en entier ( /dev/sdb ) et les éventuelles partitions ( /dev/sdb1,2,3 ...). C'est bien sur le sdb sans numéro qu'il faut l'installer (équivalent au MBR).
Pour générer l'image, c'est effectivement /etc/mkinitcpio.conf à éditer. Faire l'image nécessite simplement: mkinitpcio -p kernel26 .
Tu peux prévoir plusieurs entrées pour le menu.lst, comme indiqué dans le wiki (ça dépend comment lit le bios, normalement ça sera hd0,0 ).
Si tu mets root(hd1,0), il te faut sur la ligne du kernel: root=/dev/sdb1
Si tu mets root(hd0,0), il te faut sur la ligne du kernel: root=/dev/sda1 (donc ta combinaison hd0,0 / sdb1 est fausse)
...
En admettant que tu aies placé la racine d'Arch sur la première partition du disque.
Au besoin, indique-nous le contenu de ton /etc/fstab pour être sûr de ton partitionnement (là est ton principal soucis, je pense).

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 21:51
par Link_
@benjarobin: çà serait assez étonnant. Ma clé est une
OCZ Rally2 reçu voilà 3 jours.
@FoolEcho: Ce n'est pas un copié collé, j'ai recopié çà au stylo, puis tappé ici :S
Sinon quand je disais que j'ai plusieurs emplacements /dev/sdb d'install disponibles pour grub, je parlais bien de deux emplacements différents
/dev/sdb en plus de deux autres
/dev/sdb1.
Pour mon partitionnement, je suis certain d'avoir une seule partition: sdb1 monté en /.
Du coup je pense que mon soucis vient du fait que je n'ai pas édité /etc/mkinitcpio.conf. Enfin, j'en sais strictement rien à vrai dire, mais il me semble avoir fait le reste convenablement. C'est ma première install sur clé usb, mais pas la première non plus :]
Je teste çà demain, je vous tiens au courant, merci pour l'aide apporter, vraiment une bien belle communauté =D
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 21:56
par benjarobin
Je t'assure que le problème de grub n'a rien avoir avec le kernel (mkinitcpio...)
Tout au pire la syntaxe du menu.lst est fausse et tu as au moins la console de récupération/secours de Grub
Donc cela ne peut qu'être une mauvaise installation. Je te conseil dans ton cas de la faire à la main depuis un chroot en suivant bien le wiki
PS: Ôte moi d'un doute, tu n'as pas le menu de Grub qui s'affiche ou tu parles de ce qui se passe après validation de l'entrée dans le menu ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : dim. 17 avr. 2011, 22:33
par Link_
Je n'ai pas le menu de sélection de l'OS sur lequel booter non. J'ai directement l'écran noir avec écrit "GRUB".
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 10:21
par Link_
Les nouvelles (pas bonnes :/)
Ce que j'ai essayé:
- Partitionnement en ext4, rajouter usb en hooks, choix du "1er sdb" pour grub (voir photo 1)
- Partitionnement en ext2, identification par label pour grub, choix du "2nd sdb" pour grub
Les deux tentatives se sont soldés par un échec.
Photo 1, plusieurs sdb:
Photo 2, résultat:

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 12:01
par FoolEcho
Ouais, tiens, bizarre comment sont listées les partitions (ou pas, je n'ai plus installé Arch depuis... la première fois). De toutes manières, c'est bien celles sans chiffres qui sont pertinentes (sdb à priori en l'occurence).
C'est même pas le prompt de grub, si ? Tu peux saisir des trucs, genre simplement "help" (c'est pas une blague).
Tu peux nous mettre le contenu /boot/grub/menu.lst (et même le contenu de /boot avec ls -Rl /boot ) de ta clef ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 12:31
par Link_
Ce n'est pas un prompt pour grub non, impossible de rentrer quoi que ce soit.
/etc/fstab
Code : Tout sélectionner
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
devpts /dev/pts devpts defaults 0 0
shm /dev/shm tmpfs nodev,nosuid 0 0
/dev/sdb1 / ext4 defaults 0 1
/boot/grub/menu.lst
Code : Tout sélectionner
# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst
# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/sda (hd0)
# /dev/sdb2 (hd1,1)
# /dev/sda3 (hd0,2)
#
# FRAMEBUFFER RESOLUTION SETTINGS
# +-------------------------------------------------+
# | 640x480 800x600 1024x768 1280x1024
# ----+--------------------------------------------
# 256 | 0x301=769 0x303=771 0x305=773 0x307=775
# 32K | 0x310=784 0x313=787 0x316=790 0x319=793
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795
# +-------------------------------------------------+
# for more details and different resolutions see
# http://wiki.archlinux.org/index.php/GRUB#Framebuffer_Resolution
# general configuration:
timeout 2
default 0
color light-blue/black light-cyan/blue
# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*
# (0) Arch Linux
title Arch Linux
root (hd1,0)
kernel /boot/vmlinuz26 root=/dev/sdb1 ro
initrd /boot/kernel26.img
# (1) Arch Linux
title Arch Linux Fallback
root (hd1,0)
kernel /boot/vmlinuz26 root=/dev/sdb1 ro
initrd /boot/kernel26-fallback.img
# (2) Windows
#title Windows
#rootnoverify (hd0,0)
#makeactive
#chainloader +1
contenu de boot:
david@laptop /media/ocz_r2_gnome3/boot $ ls -Rl
.:
total 14180
drwxr-xr-x 2 root root 4096 Apr 18 09:46 grub
-rw-r--r-- 1 root root 8848433 Apr 18 09:45 kernel26-fallback.img
-rw-r--r-- 1 root root 1914785 Apr 18 09:44 kernel26.img
-rw-r--r-- 1 root root 1544402 Mar 30 08:49 System.map26
-rw-r--r-- 1 root root 2198256 Mar 30 08:49 vmlinuz26
./grub:
total 412
-rw-r--r-- 1 root root 12320 Apr 18 2010 e2fs_stage1_5
-rw-r--r-- 1 root root 10544 Apr 18 2010 fat_stage1_5
-rw-r--r-- 1 root root 9312 Apr 18 2010 ffs_stage1_5
-rw-r--r-- 1 root root 9312 Apr 18 2010 iso9660_stage1_5
-rw-r--r-- 1 root root 11296 Apr 18 2010 jfs_stage1_5
-rw-r--r-- 1 root root 1482 Apr 18 09:46 menu.lst
-rw-r--r-- 1 root root 9344 Apr 18 2010 minix_stage1_5
-rw-r--r-- 1 root root 13088 Apr 18 2010 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 Apr 18 2010 stage1
-rw-r--r-- 1 root root 136402 Apr 18 2010 stage2
-rw-r--r-- 1 root root 136402 Apr 18 2010 stage2_eltorito
-rw-r--r-- 1 root root 9716 Apr 18 2010 ufs2_stage1_5
-rw-r--r-- 1 root root 8768 Apr 18 2010 vstafs_stage1_5
-rw-r--r-- 1 root root 12872 Apr 18 2010 xfs_stage1_5
Voilà, merci du support

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 12:55
par Wisthler
Dans le listing des partitions, il y a 2 fois /dev/sda et 2 fois /dev/sdb ... ça me semble pas très normal tout ça
Après ça, on charge (hd1,0), ce qui correspondrait à sdb1
Pour le reste, je ne vois pas d'erreur dans les fichiers de conf ...
T'as essayé d'installer le grub sur les différents 2 /dev/sdb ? ça foire pour les 2 ? Y a/avait quoi sur le /dev/sda ? t'avais un linux installé avec un grub avant ? Si oui, c'est peut-être lui qui a la main. Dans le bios tu as bien spécifié qu'il fallait booter sur /dev/sdb et pas sur /dev/sda ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 13:13
par Link_
Ouai les /dev/sda et /dev/sdb listés plusieurs fois, çà m'intrigue aussi.
Sinon, ouai j'ai installé grub sur les deux sdb, au cours de deux install différentes, çà n'a rien changé.
Sur /dev/sda il y a actuellement Linux Mint Debian Edition que j'utilise actuellement.
Dans le bios, j'ai bien pensé à passer ma clé usb en primary boot device, j'ai même désactivé toute autre moyen de boot, au cas ou, et j'en suis toujours au même point.
Quoi qu'il en soit, je tiens à vous remercier tous pour votre aide dans ce long périple, vraiment une excellente communauté

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 13:26
par Wisthler
Ouais mais si tu désactives tout, le /dev/sdb reste-t-il sdb ?
Et, pour le test, pourrais-tu ajouter une entrée de le grub de Linux Mint pour booter sur l'Arch du sdb ?
Si ça fonctionne, on pourra essayé de chainload le grub du sdb depuis le grub du sda.
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 13:33
par FoolEcho
... grillé, j'allais proposer comme Wisthler (une entrée de plus dans le menu.lst de Mint + chainloader).
Rajoute également dans le menu.lst de ta clef:
Code : Tout sélectionner
# (3) Arch Linux
title Arch Linux - hd0
root (hd0,0)
kernel /boot/vmlinuz26 root=/dev/sda1 ro
initrd /boot/kernel26.img
Aussi, ce "grub_" est très louche. Chroote Arch depuis Mint et réinstalle grub sur sdb (grub-install /dev/sdb ...

... vérifie bien que tu es sur la bonne partition avec fdisk -l , j'ai un doute).
Question stupide: pas de swap pour Arch, c'est voulu ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 13:49
par Wisthler
de la swap sur un device usb ? il est pas un peu à l'étroit pour ça ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 13:59
par FoolEcho
Je demandais en passant, il y a des clefs assez grandes pour ça aujourd'hui. De toutes manières, ça n'est pas le sujet.

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 14:31
par Link_
Voilà ma démarche:
J'ai copié la démarche que j'ai suivi après l'avoir fait, si il y a des erreurs, il est possible que çà soit des oublis de ma part
laptop ~ # fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x76692ca8
Device Boot Start End Blocks Id System
/dev/sda1 1 2550 20480000 83 Linux
/dev/sda2 2550 60802 467905536 5 Extended
/dev/sda5 2550 60802 467904512 83 Linux
Disk /dev/sdb: 4076 MB, 4076863488 bytes
126 heads, 62 sectors/track, 1019 cylinders
Units = cylinders of 7812 * 512 = 3999744 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c1f90
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1019 3980183 83 Linux
laptop ~ # mkdir /mnt/arch
laptop ~ # mount /dev/sdb1 /mnt/arch
[Rajout de ta ligne, FoolEcho]
laptop ~ # umount /mnt/arch
Mais au reboot, toujours ce fichu "GRUB _" et rien qui ne se passe
Je voudrai bien essayer de booter sur la clé depuis le grub de LMDE (=Debian testing) mais pour le moment c'est pas gagné:
- Pas de fichier /boot/grub/menu.lst
- Un /boot/grub/grub.cfg qu'il ne me faut pas toucher à en croire les premières lignes de ce dernier:
Code : Tout sélectionner
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
- Un fichier /etc/default/grub dans lequel je ne vois pas les syntaxes que je connais de grub:
Code : Tout sélectionner
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
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,0xefefefef"
# 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=640x480
# 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_LINUX_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Sinon pour la petite parenthèse: Non pas de swap de prévu ni pour l'install sur la clé, ni sur l'install sur disque dur (4Go de RAM suffisant selon moi)
EDIT: J'ai tenté de ré-installer grub en faisant un "vrai" chroot cette fois en suivant
l'article du wiki
Voilà ce que çà me renvoie (j'ai préalablement vérifié la sortie de fdisk -l):
Code : Tout sélectionner
[root@laptop /]# grub-install /dev/sdb
Probing devices to guess BIOS drives. This may take a long time.
df: Warning: cannot read table of mounted file systems
df: Warning: cannot read table of mounted file systems
Could not find device for /boot: Not found or not a block device.
EDIT2: J'ai tenté de ré-installer grub en chroot sur une deuxième clé usb (détecté en sdc) avec laquelle j'ai rencontré le soucis (même configuration lors de l'installation, même marque, même modèle, même capacité):
Code : Tout sélectionner
[root@laptop /]# grub-install /dev/sdc
Probing devices to guess BIOS drives. This may take a long time.
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdc
J'ai par contre eu un problème lors du démontage de la partition, même avec l'option umount -f je continuais à avoir des device is busy sans trop comprendre. J'ai donc fini par la retirer comme çà.
Au reboot, j'ai eu exactement le même problème: "GRUB _" sur un fond noir

Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 15:20
par Wisthler
J'aurais tendance à dire que le /etc/default/grub est utilisé par l'OS suite à la mise à jour du kernel pour updater le grub.
S'il faut ajouter un truc, ce serait plutôt dans /etc/grub.d/
Il y a déjà quelque chose dans le dossier ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 15:33
par Link_
david@laptop ~ $ ls /etc/grub.d
00_header 06_mint_theme 20_linux_xen 40_custom README
05_debian_theme 10_linux 30_os-prober 41_custom
00_header:
Code : Tout sélectionner
#! /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}
libdir=${exec_prefix}/lib
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
. ${libdir}/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=640x480 ; 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
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 [ "\${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 {
EOF
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
cat <<EOF
insmod ${GRUB_VIDEO_BACKEND}
EOF
else
# Insert all available backends; GRUB will use the most appropriate.
for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
cat <<EOF
insmod ${backend}
EOF
done
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 ! test -e ${GRUB_PREFIX}/serial.mod ; then
echo "Serial terminal not available on this platform." >&2 ; exit 1
fi
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
grub_warn "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
# Make the font accessible
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT_PATH}"`
cat << EOF
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
load_video
insmod gfxterm
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
echo "Found theme: $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_root $GRUB_THEME`
EOF
elif [ "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 ;;
*) echo "Unsupported image format" >&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
# Gettext variables and module
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
cat << EOF
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
set lang=${grub_lang}
insmod gettext
EOF
fi
make_timeout ()
{
if [ "x${1}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
cat << EOF
if sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi
EOF
else
cat << EOF
set timeout=${2}
EOF
fi
}
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
# 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
05_debian_theme:
Code : Tout sélectionner
#!/bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2010 Alexander Kurtz <kurtz.alex@googlemail.com>
#
# 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/>.
# Include the GRUB helper library for grub-mkconfig.
. /usr/lib/grub/grub-mkconfig_lib
# We want to work in /boot/grub/ only.
test -d "${GRUB_PREFIX}"; cd "${GRUB_PREFIX}"
# Set the location of a possibly necessary cache file for the background image.
# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
BACKGROUND_CACHE=".background_cache"
set_default_theme(){
# Set the traditional Debian blue theme.
echo "${1}set menu_color_normal=cyan/blue"
echo "${1}set menu_color_highlight=white/blue"
}
set_background_image(){
# Step #1: Search all available output modes ...
local output
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "x$output" = "xgfxterm" ]; then
break
fi
done
# ... and check if we are able to display a background image at all.
if ! [ "x${output}" = "xgfxterm" ]; then
return 1
fi
# Step #2: Check if the specified background image exists.
if ! [ -f "${1}" ]; then
return 2
fi
# Step #3: Search the correct GRUB module for our background image.
local reader
case "${1}" in
*.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";;
*.png|*.PNG) reader="png";;
*.tga|*.TGA) reader="tga";;
*) return 3;; # Unknown image type.
esac
# Step #4: Check if the necessary GRUB module is available.
if ! [ -f "${reader}.mod" ]; then
return 4
fi
# Step #5: Check if GRUB can read the background image directly.
# If so, we can remove the cache file (if any). Otherwise the backgound
# image needs to be cached under /boot/grub/.
if is_path_readable_by_grub "${1}"; then
rm --force "${BACKGROUND_CACHE}.jpeg" \
"${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"
elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then
set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"
else
return 5
fi
# Step #6: Prepare GRUB to read the background image.
if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then
return 6
fi
# Step #7: Everything went fine, print out a message to stderr ...
echo "Found background image: ${1}" >&2
# ... and write our configuration snippet to stdout. Use the colors
# desktop-base specified. If we're using a user-defined background, use
# the default colors since we've got no idea how the image looks like.
# If loading the background image fails, use the default theme.
echo "insmod ${reader}"
echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
if [ -n "${2}" ]; then
echo " set color_normal=${2}"
fi
if [ -n "${3}" ]; then
echo " set color_highlight=${3}"
fi
if [ -z "${2}" ] && [ -z "${3}" ]; then
echo " true"
fi
echo "else"
set_default_theme " "
echo "fi"
}
# Earlier versions of grub-pc copied the default background image to /boot/grub
# during postinst. Remove those obsolete images if they haven't been touched by
# the user. They are still available under /usr/share/images/desktop-base/ if
# desktop-base is installed.
while read checksum background; do
if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum} ${background}" ]; then
echo "Removing old background image: ${background}" >&2
rm "${background}"
fi
done <<EOF
648ee65dd0c157a69b019a5372cbcfea4fc754a5 debian-blueish-wallpaper-640x480.png
0431e97a6c661084c59676c4baeeb8c2f602edb8 debian-blueish-wallpaper-640x480.png
968ecf6696c5638cfe80e8e70aba239526270864 debian-blueish-wallpaper-640x480.tga
11143e8c92a073401de0b0fd42d0c052af4ccd9b moreblue-orbit-grub.png
d00d5e505ab63f2d53fa880bfac447e2d3bb197c moreblue-orbit-grub.png
f5b12c1009ec0a3b029185f6b66cd0d7e5611019 moreblue-orbit-grub.png
EOF
# Include the configuration of desktop-base if available.
if [ -f "/usr/share/desktop-base/grub_background.sh" ]; then
. "/usr/share/desktop-base/grub_background.sh"
fi
# First check whether the user has specified a background image explicitly.
# If so, try to use it. Don't try the other possibilities in that case
# (#608263).
if [ -n "${GRUB_BACKGROUND+x}" ]; then
set_background_image "${GRUB_BACKGROUND}" || set_default_theme
exit 0
fi
# Next search for pictures the user put into /boot/grub/ and use the first one.
# Next try to use the background image and colors specified by desktop-base.
# If we haven't found a background image yet, use the default from desktop-base.
# Finally, if all of the above fails, use the default theme.
set_background_image "`ls -1 *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA 2>/dev/null | head -1`" ||
set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}" ||
set_background_image "/usr/share/images/desktop-base/desktop-grub.png" ||
set_default_theme
06_mint_theme:
Code : Tout sélectionner
#!/bin/bash -e
source /usr/lib/grub/grub-mkconfig_lib
set_mono_theme()
{
cat << EOF
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
EOF
}
# check for usable backgrounds
use_bg=false
if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
for i in {/boot/grub,/usr/share/images/desktop-base}/linuxmint.{png,tga} ; do
if is_path_readable_by_grub $i ; then
bg=$i
case ${bg} in
*.png) reader=png ;;
*.tga) reader=tga ;;
*.jpg|*.jpeg) reader=jpeg ;;
esac
if test -e /boot/grub/${reader}.mod ; then
echo "Found Debian background: `basename ${bg}`" >&2
use_bg=true
break
fi
fi
done
fi
# set the background if possible
if ${use_bg} ; then
prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
cat << EOF
insmod ${reader}
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=white/black
set color_highlight=white/light-gray
else
EOF
fi
# otherwise, set a monochromatic theme for Ubuntu
if ${use_bg} ; then
set_mono_theme | sed -e "s/^/ /g"
echo "fi"
else
set_mono_theme
fi
10_linux:
Code : Tout sélectionner
#! /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/>.
prefix=/usr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
export TEXTDOMAIN=grub
export TEXTDOMAINDIR=${prefix}/share/locale
CLASS="--class gnu-linux --class gnu --class os"
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]' | cut -d' ' -f1) ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
;;
esac
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
|| uses_abstraction "${GRUB_DEVICE}" lvm; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
linux_entry ()
{
os="$1"
version="$2"
recovery="$3"
args="$4"
if ${recovery} ; then
title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
else
title="$(gettext_quoted "%s, with Linux %s")"
fi
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
save_default_entry | sed -e "s/^/\t/"
# Use ELILO's generic "efifb" when it's known to be available.
# FIXME: We need an interface to select vesafb in case efifb can't be used.
if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ]; then
cat << EOF
set gfxpayload=$GRUB_GFXPAYLOAD_LINUX
EOF
fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$message'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$message'
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF
}
list=`for i in /boot/vmlinu[zx]-* /vmlinu[zx]-* ; 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
basename=`basename $linux`
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"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initramfs-${version}.img" \
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry "${OS}" "${version}" 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}"
fi
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done
20_linux_xen
Code : Tout sélectionner
#! /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/>.
prefix=/usr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
export TEXTDOMAIN=grub
export TEXTDOMAINDIR=${prefix}/share/locale
CLASS="--class gnu-linux --class gnu --class os --class xen"
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]' | cut -d' ' -f1) ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
;;
esac
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
|| uses_abstraction "${GRUB_DEVICE}" lvm; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
linux_entry ()
{
os="$1"
version="$2"
xen_version="$3"
recovery="$4"
args="$5"
xen_args="$6"
if ${recovery} ; then
title="$(gettext_quoted "%s, with Linux %s and XEN %s (recovery mode)")"
else
title="$(gettext_quoted "%s, with Linux %s and XEN %s")"
fi
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" "${xen_version}"
save_default_entry | sed -e "s/^/\t/"
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$message'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$message'
module ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF
}
linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
if grub_file_is_not_garbage "$i" && grep -qx "CONFIG_XEN_DOM0=y" /boot/config-${version} 2> /dev/null ; then echo -n "$i " ; fi
done`
xen_list=`for i in /boot/xen*; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
while [ "x${xen_list}" != "x" ] ; do
list="${linux_list}"
current_xen=`version_find_latest $xen_list`
xen_basename=`basename ${current_xen}`
xen_dirname=`dirname ${current_xen}`
rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
basename=`basename $linux`
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"`
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
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry "${OS}" "${version}" "${xen_version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" "${xen_version}" true \
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
fi
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done
xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '`
done
30_os_prober:
Code : Tout sélectionner
#! /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=${exec_prefix}/lib
. ${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})" {
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})" {
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*)
;;
*)
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})" {
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})" {
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}" | tr -d '()' | tr , s`"
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
40_costum:
Code : Tout sélectionner
#!/bin/sh
exec tail -n +3 $0
# 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.
41_custom:
Code : Tout sélectionner
#!/bin/sh
cat <<EOF
if [ -f \$prefix/custom.cfg ]; then
source \$prefix/custom.cfg;
fi
EOF
README:
Code : Tout sélectionner
All executable files in this directory are processed in shell expansion order.
00_*: Reserved for 00_header.
10_*: Native boot entries.
20_*: Third party apps (e.g. memtest86+).
The number namespace in-between is configurable by system installer and/or
administrator. For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 15:44
par Wisthler
donc, si on veut ajouter Arch, il "suffit" de créer un 01_arch_direct et un 02_arch_chainload
Après, faut réussir à comprendre la syntaxe des grubs. Mais comme je suis au boulot, j'ai pas vraiment le temps de faire ça :p
Pour revenir sur l'installation du grub depuis un chroot, l'erreur à l'umount, tu l'avais eu sur l'autre clé aussi ?
Re: [Install sur clé usb] GRUB affiché, pas de choix de boot
Publié : lun. 18 avr. 2011, 16:18
par FoolEcho
Grub2 en plus... Pour Mint, édite le 40-custom en ajoutant:
Code : Tout sélectionner
#test boot normal sur clé
menuentry "Arch Linux - hd1" {
set root=(hd1,1)
linux /boot/vmlinuz26 root=/dev/sdb1
initrd /boot/kernel26.img
}
#test boot sur clé par chaînage
menuentry "Arch Linux - chainloader" {
set root=(hd1,1)
chainloader (hd1,1)+1
}
Puis mettre à jour le grub.cfg avec (bien sûr garde-celui qui fonctionne sous le coude

):
... ou tu utilises la recherche automatique si tu l'as sous Mint (
https://wiki.archlinux.org/index.php/GRUB2#Dual-booting )
(pas de garantie, je n'utilise pas grub2 ... de toutes manières, je crains que le chaînage te fasse retomber sur le grub inexpliquablement foireux... la première option par contre devrait marcher, enfin j'espère...

)
Rapport à la clef, via le chroot, tu pourrais essayer d'installer grub manuellement via son prompt plutôt que par grub-install.