2017-12-12 21:18:51 +00:00
|
|
|
************************
|
|
|
|
Prepare a boot directory
|
|
|
|
************************
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
Choose useful modules
|
|
|
|
=====================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
Commented list: :ref:`grub_modules`
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
Download packages
|
|
|
|
=================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
current
|
|
|
|
-------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
================== ===================================
|
|
|
|
grub2-common fichiers v2 communs
|
|
|
|
grub-common fichiers v2 et v1 communs
|
|
|
|
grub-efi-amd64 architecture EFI avec installation
|
|
|
|
grub-efi-amd64-bin architecture EFI sans installation
|
|
|
|
grub-pc architecture BIOS avec installation
|
|
|
|
grub-pc-bin architecture BIOS avec installation
|
|
|
|
================== ===================================
|
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
legacy
|
|
|
|
------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
=========== ============
|
|
|
|
grub-efi transitional
|
|
|
|
grub-legacy maintenance
|
|
|
|
=========== ============
|
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
Put up a functional directory
|
|
|
|
=============================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
boot/grub/grub.cfg
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
search --set --fs-uuid "YYYY-MM-DD-hh-mm-ss-cc"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
Or at worst:
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
search --set --label "LA_BEL"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
Generate a modular image
|
|
|
|
========================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
/bin/tar
|
2017-12-07 19:43:06 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
tar
|
|
|
|
--create
|
|
|
|
--dereference
|
|
|
|
--file='grub.tar'
|
|
|
|
--verbose
|
|
|
|
boot
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* moddep.lst
|
|
|
|
* kernel.img
|
|
|
|
* lzma_decompress.img
|
|
|
|
* diskboot.img
|
2018-05-10 11:00:53 +00:00
|
|
|
* \*.mod
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
/usr/bin/grub-mkimage
|
2017-12-07 19:43:06 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
grub-mkimage
|
|
|
|
--directory='i386-pc'
|
|
|
|
--format='i386-pc'
|
|
|
|
--memdisk='grub.tar'
|
|
|
|
--output='i386-pc/core.img'
|
|
|
|
modules…
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
i386-pc-eltorito for ISO encapsulation
|
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
Make a device bootable
|
|
|
|
======================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* boot.img
|
|
|
|
* core.img
|
|
|
|
|
|
|
|
/usr/sbin/grub-bios-setup
|
2017-12-07 19:43:06 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
grub-bios-setup \
|
|
|
|
--directory="i386-pc" \
|
|
|
|
/dev/sd?
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
Prepare a boot menu
|
|
|
|
===================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
available colors
|
|
|
|
----------------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
========= ============= =========== ==========
|
|
|
|
black blue green cyan
|
|
|
|
red magenta brown light-gray
|
|
|
|
dark-gray light-blue light-green light-cyan
|
|
|
|
light-red light-magenta yellow white
|
|
|
|
========= ============= =========== ==========
|
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
* black backgrounds are actually transparent!
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
available environment variables
|
|
|
|
-------------------------------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
==================== =============================
|
2017-12-05 23:56:46 +00:00
|
|
|
chosen 4
|
|
|
|
color_highlight black/light-gray
|
|
|
|
color_normal light-gray/black
|
|
|
|
default "${id}"
|
|
|
|
gfxmode 1024x768
|
|
|
|
gfxpayload keep
|
|
|
|
gfxterm_font unicode
|
|
|
|
lang en_US
|
|
|
|
locale_dir
|
|
|
|
menu_color_highlight white/blue
|
|
|
|
menu_color_normal cyan/blue
|
|
|
|
pager 1
|
2017-12-07 19:43:06 +00:00
|
|
|
prefix (hd?,msdos?)/live/boot/2.02-2
|
2017-12-05 23:56:46 +00:00
|
|
|
root hd?,msdos?
|
|
|
|
theme …/.txt
|
|
|
|
timeout -1
|
2017-12-07 19:43:06 +00:00
|
|
|
==================== =============================
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
======= =====
|
|
|
|
cmdpath (hd?)
|
|
|
|
======= =====
|
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
persistent environment variables file
|
|
|
|
-------------------------------------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
* /usr/bin/grub-editenv
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
grub-editenv file create
|
|
|
|
grub-editenv file set variable=value
|
|
|
|
grub-editenv file unset variable
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-12 21:18:51 +00:00
|
|
|
boot a prepared system
|
|
|
|
----------------------
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:39:38 +00:00
|
|
|
.. warning::
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:39:38 +00:00
|
|
|
Violent kernel crashes are to be expected if:
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:39:38 +00:00
|
|
|
1. the live-media-path has no .squashfs file
|
|
|
|
#. the image basename:
|
2018-05-10 11:00:53 +00:00
|
|
|
|
|
|
|
* doesn't end with .squashfs
|
|
|
|
* is just .squashfs
|
|
|
|
* contains ,
|
2017-12-06 21:39:38 +00:00
|
|
|
|
|
|
|
----
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* /live/name.squashfs
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
linux /live/subdir/vmlinuz boot="live" toram="subdir/name.squashfs"
|
|
|
|
initrd /live/subdir/initrd.img
|
|
|
|
|
|
|
|
.. code:: shell
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
loopback loop /live/dir/name.squashfs
|
|
|
|
linux (loop)/vmlinuz boot="live" toram="dir/name.squashfs"
|
|
|
|
initrd (loop)/initrd.img
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* Debian installed
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
unset path
|
|
|
|
uuid="????????-????-????-????-????????????"
|
|
|
|
search --set="path" --fs-uuid "${uuid}"
|
|
|
|
if [ "${path}" ]; then
|
|
|
|
path="(${path})"
|
|
|
|
linux "${path}/vmlinuz" \
|
|
|
|
elevator=deadline \
|
|
|
|
root=UUID=${uuid}
|
|
|
|
initrd "${path}/initrd.img"
|
|
|
|
fi
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* Debian Installer
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
linux "/path/to/vmlinuz" priority="low"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
linux "/path/to/vmlinuz" auto="true" \
|
|
|
|
file="/hd-media/path/to/preseed"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
----
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
initrd /path/to/gtk/initrd.gz
|
|
|
|
|
|
|
|
----
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
* iso-scan's first pass goes only 1 subdirectories level down!
|
|
|
|
|
|
|
|
.. todo::
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-07 19:43:06 +00:00
|
|
|
Test if iso-scan/filename really works
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
iso-scan/ask_second_pass="true" iso-scan/filename="/path/to/file.iso"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* Debian Live
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
file="/path/to.iso"
|
|
|
|
loopback loop "${file}"
|
|
|
|
path="(loop)/live"
|
|
|
|
linux "${path}/vmlinuz" boot="live" findiso="${file}" components
|
|
|
|
initrd "${path}/initrd.img"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* PartedMagic
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
file="/path/to.iso"
|
|
|
|
loopback loop ${file}
|
|
|
|
path="(loop)/pmagic"
|
|
|
|
linux "${path}/bzImage64" iso_filename="${file}" load_ramdisk=1
|
|
|
|
initrd "${path}/initrd.img" "${path}/fu.img" "${path}/m64.img"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2019-10-24 12:33:02 +00:00
|
|
|
* Windows ≥ Vista
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
menuentry "Windows" {
|
|
|
|
root=(hd0,msdos2)
|
|
|
|
ntldr /bootmgr
|
|
|
|
}
|
|
|
|
|
|
|
|
* Windows ≤ XP
|
2017-12-05 23:56:46 +00:00
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
menuentry "Windows" {
|
|
|
|
drivemap -s (hd0) (hd1)
|
|
|
|
chainloader (hd0,msdos2)+1
|
|
|
|
}
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* CloneZilla
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
file="/path/to/file.iso"
|
|
|
|
loopback loop "${file}"
|
|
|
|
path="(loop)/live"
|
|
|
|
linux "${path}/vmlinuz" findiso="${file}" \
|
|
|
|
boot="live" union="overlay" \
|
|
|
|
username="user" config components \
|
|
|
|
toram="filesystem.squashfs" ip="" \
|
|
|
|
locales="en_US.UTF-8" keyboard-layouts="fr-latin9" \
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ocs_live_batch="yes" \
|
|
|
|
ocs_prerun="mount /dev/disk/by-uuid/${cz_home} /mnt" \
|
|
|
|
ocs_prerun1="mount --bind /mnt/${cz_partimag} /home/partimag" \
|
|
|
|
ocs_live_run="ocs-live-restore" \
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ocs_live_extra_param="\
|
|
|
|
-e1 auto -e2 -t -r -j2 -cs -k \
|
|
|
|
-p reboot restoreparts ask_user ${cz_target}"
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ocs_live_extra_param="\
|
|
|
|
-q2 -j2 -rm-win-swap-hib -gs -z1p -i 1000000 -fsck-y \
|
|
|
|
-p reboot saveparts ask_user ${cz_target}"
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ocs_live_batch="no" \
|
|
|
|
ocs_live_run="ocs-live-general" \
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
initrd "${path}/initrd.img"
|
2017-12-05 23:56:46 +00:00
|
|
|
|
|
|
|
* ISO
|
|
|
|
|
2017-12-06 21:47:24 +00:00
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
xorrisofs \
|
|
|
|
\
|
|
|
|
-output live-grub.iso \
|
|
|
|
\
|
|
|
|
-volid "LIVE_GRUB" \
|
|
|
|
-boot-info-table \
|
|
|
|
-no-emul-boot \
|
|
|
|
--modification-date="YYYYMMDDhhmmsscc" \
|
|
|
|
-eltorito-boot live/boot/grub/2.02-2/i386-pc/core.img \
|
|
|
|
-eltorito-catalog "boot.cat" \
|
|
|
|
--boot-catalog-hide \
|
|
|
|
\
|
|
|
|
-exclude live/sources \
|
|
|
|
-exclude live/boot/debian.squashfs/debootstrap \
|
|
|
|
-exclude live/boot/debian.squashfs/live \
|
|
|
|
-root "live" \
|
|
|
|
"live"
|
2019-10-24 12:42:40 +00:00
|
|
|
|
|
|
|
power
|
|
|
|
-----
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
reboot
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
halt
|