Rechercher dans ce blog

Affichage des articles dont le libellé est grub. Afficher tous les articles
Affichage des articles dont le libellé est grub. Afficher tous les articles

lundi 18 novembre 2024

EFI SHELL Usefull commands / secure boot Mokmanager

 Pour lancer le shell.efi depuis grub, il faut parfois faire sortir sur la console et non sur gfx :

grub> terminal_output console

la commande terminal_output seule indique les modes disponibles

en mode console, le shell démarre en 80x25. Pour changer la définition il faut utiliser la commande

shell> mode

lancée seule elle indique les modes disponibles, sous la forme col rang comme 80 25, 80 50, 100 56

pour changer de mode :

shell> mode 100 56 par exemple

pour insérer une extension :

shell> load ntfs.efi par exemple

pour remaper les fs après l'ajout d'un périphérique ou d'un module de fs, 

shell> map -r 

Il y a aussi un éditeur 

shell> edit

A partir du shell il est possible de lancer les outils pour la gestion des clefs pour secure boot

MokManager, Keytool, hashtool permettent d'ajouter ou de supprimer des keys ou des hashes

RU.efi est un éditeur de BIOS... plutôt pointu et pas facile à gérer. A n'utiliser qu'avec beaucoup de précautions voire pas du tout !!!

Tous les fichiers sur : https://drive.google.com/drive/folders/1p8bFNmjYE-shY64pTNntJeYMO2aGatfr?usp=drive_link


vendredi 22 août 2014

grub 10s timeout forced when other OS are probed / 30_OS_PROBER grub script remove timeout

Quand un autre OS est trouvé par le script 30_os_prober dans /etc/grub.d/ il ajoute automatiquement un timeout de 10s quelque soit le réglage de timeout dans

/etc/default/grub

Pour empêcher ce comportement, il faut modifier le script en commentant la fonction timeout du script et aussi en commentant l'appel de la fonction timeout à la fin du script.

How to pass memmap parameters to kernel via grub to not use bad ram

memmap linux kernel parameters are:

        mem=nn[KMG]     [KNL,BOOT] Force usage of a specific amount of memory
                        Amount of memory to be used when the kernel is not able
                        to see the whole system memory or for test.
                        [IA-32] Use together with memmap= to avoid physical
                        address space collisions. Without memmap= PCI devices
                        could be placed at addresses belonging to unused RAM.

        mem=nopentium   [BUGS=IA-32] Disable usage of 4MB pages for kernel
                        memory.

        memmap=exactmap [KNL,IA-32] Enable setting of an exact
                        E820 memory map, as specified by the user.
                        Such memmap=exactmap lines can be constructed based on
                        BIOS output or other requirements. See the memmap=nn@ss
                        option description.

        memmap=nn[KMG]@ss[KMG]
                        [KNL] Force usage of a specific region of memory
                        Region of memory to be used, from ss to ss+nn.

        memmap=nn[KMG]#ss[KMG]
                        [KNL,ACPI] Mark specific memory as ACPI data.
                        Region of memory to be used, from ss to ss+nn.

        memmap=nn[KMG]$ss[KMG]
                        [KNL,ACPI] Mark specific memory as reserved.
                        Region of memory to be used, from ss to ss+nn.

When passing via grub you need to escape the $:

ie: memmap 128M\$1024M 

Without the escaping, memmap doesn't behave correctly.

In /etc/default/grub you need to escape \ too.

So option as to be writed this way: memmap 128M\\\$512M

Several memmap options could be used as the same time.


vendredi 6 juin 2014

UBUNTU 14.04 GRUB DISABLE OS PROBED MEMTEST+ SUBMENU

Pour que update-grub n'ajoute pas dans grug.cfg certaines entrées :

memtest+ :

chmod -x /etc/grub.d/20_memtest86+

Recovery & Advanced Menu

GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_SUBMENU="y"



SKIP LIST OS PROBED

Pour interdire certaines entrées des os détectés il faut modifier le script 30_os-prober de /etc/grub.d/ qui ne fonctionne pas tel quel. En fait il fait le test du contenu de la variable GRUB_OS_PROBER_SKIP_LIST en ajoutant à l'uuid de la partition l'id du device. Le plus simple surtout sur un portable avec un seul disque est de changer la variable de EXPUUID à UUID.

Ligne 142 changer

ORIG: if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
 
NEW: if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${UUID}'\b'`" != "x" ] ; then

et ajouter dans /etc/default/grub la variable suivante


GRUB_OS_PROBER_SKIP_LIST="uuid de la partition de l'OS que l'on veut exclure"


Si l'on veut que les Probed OS soient au début du menu grup il suffit de changer le numéro du script ; par exemple 09_os-prober.


REMARQUE
Attention les paramètres passés par /etc/default/grub  GRUB_CMDLINE_LINUX="par1 par2" sont ajoutés au kernel UNIQUEMENT avant les paramètres passés dans GRUB_CMDLINE_LINUX_DEFAULT. Ca a son importance si le paramètres doit être passé avant ou après un autre.



mercredi 9 décembre 2009

installer grub

Pour installer grub à partir d'un liveCD avec grub ou bien une linux box.

Copier le dossier genre /boot/grub du liveCD vers le disque de destination

Ensuite lancer grub

#grub

>

Repérer le disque où installer grub

Alors on peut faire au prompt de grub (si les fichiers de boot sont dans /boot/grub)

>find /boot/grub/stage1

et on obtient la liste des hd possibles

(hd0,0)

(hd1,0)

par exemple

Ce que je fais quand il y a plusieurs disques, clefs usb, etc, pour ne pas m'embrouiller, c'est de mettre un fichier genre t.txt dans la racine du disque où installer grub et je fais un

>find /t.txt

et là j'obtiens le disque cible...

ensuite on root le disque et la partition

>root (hdn,m)

puis on installe attention pas de partition indiquée

>setup (hdn)

>quit

Voilà c'est bootable en principe.

Je m'assure toujours que le flag boot est mis sur la partition mais je ne suis pas sûr que ce soit indispensable.

Pour booter sur une partition windows alors que le système est booté sur une carte sd/usb il faut d'abord remapper les drives car windows ne démarre que sur le premier disque.

Donc utiliser genre

title XP

map (hd1) (hd0)

map (hd0) (hd1)

root (hd1,1)

chainloader +1  

Manuel de grub

Toutes les commandes de grub

http://www.gnu.org/software/grub/manual/grub.html#Commands

Extrait :

4.2.6 DOS/Windows

GRUB cannot boot DOS or Windows directly, so you must chain-load them (see Chain-loading). However, their boot loaders have some critical deficiencies, so it may not work to just chain-load them. To overcome the problems, GRUB provides you with two helper functions.

If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command map (see map), like this:

   grub> map (hd0) (hd1)

   grub> map (hd1) (hd0)

This performs a virtual swap between your first and second hard drive.

Caution: This is effective only if DOS (or Windows) uses BIOS to access the swapped disks. If that OS uses a special driver for the disks, this probably won't work.

Another problem arises if you installed more than one set of DOS/Windows onto one disk, because they could be confused if there are more than one primary partitions for DOS/Windows. Certainly you should avoid doing this, but there is a solution if you do want to do so. Use the partition hiding/unhiding technique.

If GRUB hides a DOS (or Windows) partition (see hide), DOS (or Windows) will ignore the partition. If GRUB unhides a DOS (or Windows) partition (see unhide), DOS (or Windows) will detect the partition. Thus, if you have installed DOS (or Windows) on the first and the second partition of the first hard disk, and you want to boot the copy on the first partition, do the following:

   grub> unhide (hd0,0)

   grub> hide (hd0,1)

   grub> rootnoverify (hd0,0)

   grub> chainloader +1

   grub> makeactive

   grub> boot