Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Grub 2
???????? ?? ????????????
GRUB (Grand Unified Bootloader)
????????? ??, ??????????? ??? ???????? ???? Linu
x, OpenSolaris, BSD ? Hurd (StartUp Manager). GRUB 2 ??? ????? ?????? GRUB, ????
?? ???????????? ?? ????????????.
?????? Grub ? ?????????
?????????? [??????]
1 ??? ??????????, ????? ????????? ? ??? ?????
2 GRUB2 - ?????? ????.
2.1 /etc/default/grub
2.1.1 ??? ??????, ???? ????? /etc/default/grub ???
2.1.2 ????????? ???????????? ?????? ????????
2.1.2.1 ??????
2.1.3 ????????? ??????? ??????????? ????
2.1.4 "???????" ????
2.1.5 ????????? ??????????? ?????????? ???????? ????
2.1.5.1 ??????
2.1.6 ????????? ????????? ????? /etc/default/grub
2.2 /etc/grub.d
2.2.1 ??????
2.3 ?????????? ?????????
2.4 ????? ? ?????????? ?????? ? ????????
2.5 ????????? ?????
3 ??????????
3.1 ????????? ???????? ???????????
3.1.1 ?????? ?2:
3.2 ????????? ????? ??????? ????
3.2.1 ??????
4 ?????????????? GRUB2
4.1 ?????????????? GRUB2 ? LiveCD
4.2 ?????????????? GRUB2 ? LiveCD. ?????? 2 (??? chroot)
4.3 ?????????????? GRUB2 ? LiveCD. ?????? 3 (?????? ???????)
4.4 ??????????? ???????? GRUB 2 ? ?????? ??????[1]
4.5 ???????? ??????? ??? ????????? ??????????????????? GRUB2
4.6 ?????
4.7 ???????? Windows ??????????? ???????
5 Advanced
5.1 ???????? ????????-????????????? GRUB2-liveUSB
5.2 ??????? grub2 - ??????? ? ????????
5.2.1 ls
5.2.2 cat
5.2.3 linux
5.2.4 initrd
5.2.5 chainloader
5.2.6 boot
5.2.7 root
5.2.8 set
5.2.9 search
5.2.10 lsfonts
5.2.11 help
5.2.12 halt
5.2.13 reboot
5.2.14 background_image
5.2.15 vbeinfo
5.2.16 configfile
5.2.17 terminal_output.console
5.3 ??????????? ;)
GRUB_CMDLINE_LINUX=""
# 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 entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"
?? ?????, ??? ???? ???????????? ????? ????? ????? ? ???????????????? ??????? ???
??=????????. ?? ?? ????? ????? ????????????? ??? ?????????????? ?????????, ?????
???? ???????? ???????????? ?????? ?????????? ????????? ????-?????? ???????? ????
??????. ???????? ????? ????????????? ??????????? ??? ????????? grub
????????? ??
?????????? ?????? ???????? ?/??? ??????? ?????? ????. ?????????? ??, ??? ??? ???
?????.
??? ??????, ???? ????? /etc/default/grub ???[???????]
?????????? ???????????? ??????????? ?????? ???? ????????????? ???????, ? ???????
? ????????? ????????? ????? ?????????. ?????? ??? ?? ?????????? ?? ??????: ?????
/etc/default/grub ???. 1) ? ??? ?????? Grub1 2) ?????????, ???? ?? ???? /etc/sy
sconfig/grub2. ??????? ??? ??????????? ???????. ? ???? ??????? ????? ????????, ?
????? ????? ????? ??? ? ??? ??????????? ????????? ? ???? ??????.
????????? ???????????? ?????? ????????[???????]
?? ????????? ??????????? ????? (?????????? ??? ?????? ????) ??????? ? ??????. ??
??? ????????? Ubuntu ??? ???????? ???????, ? Windows, ????????, ????? ?????????
???????. ????? ?????????? ???? ?????? ??????? ?????? ?????????? ???????? ? ?????
?????. ??? ?????????? ??????, ??? ?????? ?????? ????? ???????? ???????? ???????
???? ?? ?????????. ?? ???, ??????????, ???????? ???????? "GRUB_DEFAULT". ???????
?? ??? ???????? ????? ?????? ? ???? ????????, ??????? ?????? ???? ?????? ???????
????, ?????? ????????? ?????????? ? ????. ???????? ?? ????????? - 0, ??????? ? ?
????????? ?????? ?????. ??? ????, ????? ??????? ?????? ?????, ??? ????? ??????,
????? ?? ????? ?? ????? ? ??????. ??? ???? ??? ????????: ??????????? ??????????
"/boot/grub/grub.cfg" ? ?????????, ????? ?? ????? ???????? ?????? ??????, ??? ??
??????????????? ? ????? ???????? ?????????? ?? ?? ????? ? ???? ???????? (?????
???? ????????? ??????????? ?? ????, ????? ?????????? ??????). ?????? ??????? ???
??????? ????? ????????? ??????????????, ??? ????? ??? ?????????? ????????????. ?
????? ??????? ?? ????????? ? ??????? ????????? 0, 1, 2, 3 ? ??? ?????, ?? ????
?????? ?????? ?????? ????? ??????????????? ???????? 4, ??????? 1, ???????
0. ? ?
?????????????? ??????? ??????????? ???????? 6, ?? ???? ??????????? ????? ???????
????? ????. ????? ??????? ??????????? ?????? ???? ??? ?????? ?????????? ???????
?. ????????, ???? ? ???????? ???????? ??????? "saved"(??? ???????) ? ???????? ??
???? GRUB_SAVEDEFAULT=true - ????? ??? ???????? ????? ?????? ??? ?????, ???????
??? ???????? ? ??????? ???. ??? ?? ????? ??????? ?????? ???????? ??????. ? ?????
? ?????? ??? ?????? ???? ?????? ?????, ????? ?? ??? ????? ? "/boot/grub/grub.cfg
". ??? ???? ???????? ?????? ??????????? ? ????????. ?????? ?????? ?????? ???, ??
? ????? ?????????? ???? ?? ???????? ???????? ????????? ??-?? ????????? ?????????
.
??????[???????]
???? ? "grub.cfg" ????? ???? ???????? ???:
menuentry "Ubuntu, Linux 2.6.32-020632rc6-generic" {
recordfail=1
....
}
?? ? ???????? ????????? "GRUB_DEFAULT" ?????? ??????????? ?????? ? ????
GRUB_DEFAULT="Ubuntu, Linux 2.6.32-020632rc6-generic"
????????? ??????? ??????????? ????[???????]
?? ????????? ???? ???????? ???????????? 10 ??????, ????? ???? ??????????? ??????
????? ????? (???? ?????? ?? ????? enter ? ?? ?????? ?????? ?????, ??? ??????????
??? ??????). ? ?????????? ???????? ??? ?????? ??????. ?? ??? ???????? ???????? ?
??????? "GRUB_TIMEOUT" (?? ??????? ? "GRUB_HIDDEN_TIMEOUT"!). ???????? ????????
? ????????. ???????? ????????, ??? ????? ??????????? ? ????????. ? ????? ???????
??? ????????
2, ?? ???? ???? ???????????? ??? ???????. ????? ????, ???? ???? ??
??????. ???? ????????? ???????? "-1", ?? ???? ????? ???????????? ?? ??? ???, ???
? ???????????? ?? ??????? ?????-???? ?????. ?? ???? ??? ?????? ???????? ? ??????
??? ??????.
"???????" ????[???????]
? ??????, ???? ?? ?????????? ??????????? ?????? Ubuntu, ???? ???????? ?? ???????
?? ?? ????? ????????????, ? grub2 ????? ????????? ??? ???????? ? ???????. ??????
??, ?????? ????? ?????????? ????????????? ??????????? ? ?????? ????? ??? ?? ???
?????? ???????? ??????. ??? ????? ????????????? "??????? ????". ?? ???? ????????
???????? "GRUB_HIDDEN_TIMEOUT". ? ??????, ????? ??????????? ?????? ??, ???? ???
????? ??????????????? (# ? ?????? ??????).???? ? ???? ???????? ???????????? Wind
ows, ???? ???????? ????????????, ???? ???? ?? ????????????????, ?.?. ???????????
? ??????? ???? ??????????. ? ?????? ? ???????????? ?? ?? ????? ???????. ????????
??? ?????? ???????? ? ????????. Grub2 ???????????? ???????? ?? ???????? ???????
??? ??????, ????? ???????????? ??????????? ??????? ???? ????????, ????? Escape.
???? ???????? ??????????? ? 0, ?? ???????? ?? ?????. ??????, ???????????? ??? ??
??? ?????? ??????? ??????????? ????, ????????? ??? ???????? shift. ???????? "GRU
B_HIDDEN_TIMEOUT_QUIET" ???????? ?? ??????????? ??????? ?? ????? ?????. ??? ????
???? "true" ?????? ??????? ?? ?????. ??? ?????? "false" - ????? ????????????.
????????? ??????????? ?????????? ???????? ????[???????]
?????? ?????? ?????????? ????????? ???? ??????? ? ??????-???? ??????? ??????????
?. ????????, ??? ?????????? ?????? ?????????????? ????????????. ? ???? ?????? ??
???? ??????? ????? ???????? "GRUB_CMDLINE_LINUX_DEFAULT". ?? ???????? ?? ?? ????
?????, ? ???????? ??????????? linux-???? ??? ????????. ???????? ??? ?? ?????????
- "quiet splash", ??? ???????? ? ?????? ??????????? ???????? ??? ??????? ??????
?, ? ?????????? ??????????? ?????-???? ????????? ??????????. ?? ?????? ????????
??????????? ??? ????????? ??????? ????, ??????? ??? ???????? ? ???? "quiet splas
h your_param1 your_param2", ?? ???? ??????? ????? ?????? ?????? ?????????.
??????[???????]
?????? ????, ????? ????????? ????? ?????????, ?? ?????? ???????????. ???????? ??
????????? ???????? ? "?????????? ?????". ???????
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
??
GRUB_CMDLINE_LINUX_DEFAULT=""
?????? ??? ???? ?????? ???????? linux-???? ????? ????????????? ? verbose mode, ?
? ???? ????? ???????? ??? ??????????? ???????? ? ? ??????? ?? ????? ????????? ??
???????? ? ???????? ??????????? ???????, ??? ????????? ??????? ?? ????????? ????
???? ? ???????? ?????????.
???????? ????????, ????? ???? ?? ???????????? ?????? ????????? ????? GRUB_CMDLIN
E_LINUX, ???? ?? ?? ??????. ??? ????????????? ???????? ???
GRUB_CMDLINE_LINUX=""
????????? ????????? ????? /etc/default/grub[???????]
??? ? ??? ???????????, ??????? ?????? ??????? ?? ?????? ???????? ???????. ??????
??????: ?? ?????? ???????? ????? ??????? ? ?????????????, ?????????? ??????? ??
?????????. ??? ???????? ??????????/????????? ???????????. ??????, ????????: ???
???? root ?????? ????? ??? ??????? ????? r-x ?? ???? ???????. ????? ?? ????? ???
?????? ???????? ? ???????????? home-???????, ?.?. ?? ?????? ???????? ?? ??? ?? ?
????????????. ????? ?????? ???????? ???? ?????????? ???????? "/usr/share/images/
grub" ? ??????? ??? ???????? ???. ?????? PNG ? TGA ?????????????? ????? ?????? J
PEG. ?? ?? ??????? ?????? ??????????? ?????? ????????? jpeg ? 8-?????? ??????. ?
?????? ??????????? jpeg-????? ?????? ???? ?? ?????????, ??? ????? ??????? ?????
? ??? ????????? ??????????? ? 8-?????? ?????. ??? ????, ????? ???????? ?????????
jpeg-??????, ????????? ?????? ???????? ?????? ? ?????? ????: "{png,tga,jpg,jpeg
}".
???????? ????????, ??? ? ?????????, ?? ?????? ?????? (23.10.2010), ??????? GRUB,
????????? ???????? ??????????? ??????????? ??? ??????. ?????? ??? ????????? ???
????? ??????????? ?????????? ? ??????:
WALLPAPER="/usr/share/images/desktop-base/moreblue-orbit-grub.png"
??????? ? ???????? ???? ? ????? ? ????? ?? ????????????? ???? ?????????? (.png,.
tga,.jpg) ? ??????????? 640x480. ????? ???? ???????? ????????????:
sudo update-grub
?????? ?2:[???????]
? ????? /etc/default/grub ?????????? ????????? GRUB_BACKGROUND ? ???????? ?? ???
? ? ????? ? ?????????.
????????? ????? ??????? ????[???????]
????? ??????? ???? ????? ???????? ? ????? "/etc/grub.d/05_debian_theme". ? ?????
?????? ????? ????? ?????-??????? ???????? ???????? ??????????:
COLOR_NORMAL=
COLOR_HIGHLIGHT=
????? ? ????????????? ????? ??? ??????? ???? ????????. ?????????? "color_normal"
???????? ?? ????? ???????? (?????????????) ?????? ????. "color_highlight" - ??
????? ??????????? ??????. ??? ??? ??? ?????????? ?? ? ????? ????????. ???????? ?
????? ?? ???? ????? ???????????? ????? ??? ?????, ??????????? ??????. ?????? ???
? - ??? ???? ??????. ?????? ???? - ???? ???? ??????. ??? ?????? ????????? ??????
:
black - ??????; blue - ?????; brown - ??????????; cyan - ???????; dark-gray - ??
???-?????; green - ???????; light-cyan - ??????-???????; light-blue - ??????-???
??; light-green - ????-???????; light-gray - ?????; light-magenta - ???????; lig
ht-red - ??????-???????; magenta - ?????????; red - ???????; white - ?????; yell
ow - ??????.
????????, ??? black (??????) ??? ????????????? ? ???????? ??????? ????????? (?.?
. ????? ????) ? ?????????? ???? ?????????? ???, ??? ?????-???? ???????, ????? ??
??? ?????? ????????. ????????????? black ? ???????? ????? ?????? ???? ?????? ???
??.
??????[???????]
COLOR_NORMAL=black/black
COLOR_HIGHLIGHT=black/light-gray
? ???? ?????? ?????? ????????? ?????????: ??????? ????? - ?????? ?????, ????????
?? ???; ?????????? ????? - ?????? ?????, ????? ????????? ??????.
?????????????? GRUB2[???????]
?????, ????????, ????????? Windows, ?? ?????? ??????????? ? ???, ??? ??? ???????
? ????? ???????????? ?????? ???? ???????? Windows, ? ???? grub2 ?? ?? ??????? ??
???, ??? ???????? ? ????????????? ????????? ???-???? ????? Windows. ????? ??????
???? ??-?? ????, ??? Windows ??? ????????? ???????? ??????????? ??????? ????????
????? (??? ?????????? MBR-??????), ?????? ?????? ??? ?????????? grub2. ??? ????
?????????? grub2 ??? ??????????? liveCD Ubuntu 10.04 ??? ????? ?????? ??????????
? ???????, ?????????? grub2 ? ???? ???????????.
?????????????? GRUB2 ? LiveCD[???????]
??????????? ? ?????? LiveCD (?????????????? ???????? ???? ????????? ???????? ???
??????? ???????? ??? ?? ?????????? cd-?????? ?????? boot device ? BIOS). ??????
??? ???????. ??? ?????? ??? ????? ????? ??????, ?? ????? ????? ? ?? ????? ??????
? ??????????? Ubuntu. ???? ?? ?? ??????? ????? - ?????????????? ????????
sudo fdisk -l
??? ?????? ??? ??????????? /-?????? (root). ????????????? ??? ????????
sudo mount /dev/sda5 /mnt
? ???? ?????? ???????? ?????? ??????? - /dev/sda5, ?? ?? ??????????? ???? ??????
??. ???? ? ??? /boot ?????? ????????? ????????, ??? ????? ???? ????? ???????????
???. ? ?? ????????? ????????? boot-??????, ?? ???????????, ??? sda3 ??????? ???
/boot. ????????? ???:
sudo mount /dev/sda3 /mnt/boot
????? ????????? ??????? /dev ????? live-??????? ??? /dev ?????? root-???????:
sudo mount --bind /dev /mnt/dev
? /proc live-??????? ??? /proc root-???????:
sudo mount --bind /proc /mnt/proc
?????? ????????? ????????? ???????:
sudo chroot /mnt
???? ?? ?????????????? GRUB ??? Gentoo:
sudo mount sysfs /sys -t sysfs
?????? ?? - root-???????????? ? ???????, ???????? ???????? ??????? ????????? /mn
t, ?? ???? ???????? ?????? ????? ????????? ???????. ? ??? ?? ?????? ???????? MBR
-?????? ???????? ?????, ????????????? grub2. ?? ??? ?????? ??? ????? ???????????
?, ? ?????? ??????????? ????? ??????????? ??? ?????????. ???? ? ??? ???? ???????
????, ???????? ?? ??????? - ?? ????? ??????????? sda. ???? ????????? - ?????? ?
? ??? - sda, ?????? - sdb, ? ??? ?????. ?????????? ??????????? ???? ????? ??????
? ???????
sudo fdisk -l
? ?????????? ??????? ???? ??????? "???????????". ? ???? ?????? ???????? ???????
sda1 ????? ?????????, ??????????, ??? ? ???? ??????????? ???????? ?????? ???????
????, ?? ???? sda. ????????????? ? ??????????? ??????, ?????? ?? ???? grub2:
grub-install /dev/sda
???? ?? ??????????? ? ??????-???? ???????? - ?????????? ????????????? ??????? ?
?????? --recheck:
grub-install --recheck /dev/sda
????? ? ????????? ??????? ????? ?????? ???????
grub-install --recheck --no-floppy /dev/sda
???????? ????????: ?? ????????????? grub2 ?? ?????????? ???? (sda, sdb...) ?.?.
? mbr, ? ?? ?? ?????? (sda3, sdb1...)! ???? ??? ?????? ???????, ??????? ?? chroo
t ????????
exit
??????????? ???? ????? ? ????????: /dev ????? live-???????:
? ??????, ???? ????? ?????? ???????????? MBR ????? (????????, ????? (????)??????
??? Windows), ??? ????? ??????? ??? ?????, ?????? ?????? ?? ????????. ???????? ?
LiveCD. ?????????? ?????? ??????? ???? ? ??????? "sudo fdisk -l". ???? ?? ?????
??????? - ??????, sda. ?????? ???????
sudo grub-install --root-directory=/tmp /dev/sda
??????? /dev/sda ?? ?????? ????. ????? ????? ????????? ? ????? ?????.
??????????? ???????? GRUB 2 ? ?????? ??????[1][???????]
????? ?????? ????????????? ????????? ????????? ?????????? GRUB 2 ?? ?????? ?????
? (?????? ???????? ?????? ?????). ??? ????? ????? ??????????? ? LiveCD ??? ?????
??????? ??? ????????????? ??????? (?????? ? ??? ????? ? ??? ????????? GRUB 2 ??
??????? ??????, ? ???????? ????????? ?????????? ???????). ??? ?????? ???????????
? ???? Linux ?????????? ????????? ? ?????????:
grub-setup -d /.../boot/grub /dev/sdX
?? ????? root (?????????????????) ????????:
sudo grub-setup -d /.../boot/grub /dev/sdX
???:
/.../boot/grub
?????? ???? ?? ?????? GRUB 2, ??????? ?????????? ????????????,
/dev/sdX ???????? ?????? ????? ? ??????? ??????????? ?????? (MBR) ???????? ?????
????? ?????????? GRUB 2, ? X
????? ????????? ??????? ?????, ?? ????? ???????? ??
???????????, ???????? ??????? ????? ????????, ???????? ? ?????????:
sudo fdisk -l
????? ???? ????????? ??????????????? ??????????? GRUB 2 ?? ????????? ????? ?????
? ???????? ????????? update-grub, ????????:
sudo update-grub
??? ???? ????????? ??????????? ?????? ? ????????? ??????????????? ?????? ???????
? ???? ??????????? ?? ?????????????? Multiboot ???????????? ?????? ?, ????????,
??????????? ?????? ???????????? ?????? (???????? Windows, OS/2 ? ?.?.).
???????? ??????? ??? ????????? ??????????????????? GRUB2[???????]
? ????????? ??????? ????? ????????? ???, ??? ????????? ????? grub2 ????? ???????
??? (????????, ? ?????????? ???? ??? ?????????? "update-grub"). ??????, ?????? ?
??? ???? ??????????? ? ???? ??????? ? ???????????? grub2 ?? ??? ??? ????????????
? ?????? ????????????? ?????. ???? ??? ???????? grub2 ?? ?????? ????????? ?? ???
???? - ?? ??????? ??????????? ??????. ??? ????? ???? ??? ?????? ?????????. ?? ??
???? ?????? ???? ??????? ???? - ??????? ? ??????? grub2. ?? ?????? ????? ???????
?? ?? ??????, ??? ?? ????? ?????????? ???-???? ?????? ??? ??????? ??? ??????? ?
??????. ? ????? ??????, ???? ??? ??????? ????????? ??????? - ?????????, ????? ??
???????? ?????????! ??????? grub2 ?????? ?? ????? ????????? ???????? bash. ????
? ????? ?????????????? ?????????????? ?????? ?? ??????? tab. ???? ?? ?????? tab
? ?????? ?????? - ?? ?????? ?????? ?????? ????????? ??????. ??? ?, ????????? ? ?
???????? ??????? ???????. ??? ?????? ??? ????? ?????? root-??????, ?? ???? ?????
?, ?? ??????? ??????????? ???? ???????. ? ???? ?????? ??? "/dev/sda5" (? grub2 ?
?????? ???????? ? ???? "hd*,*". ???? ?? ???? ??????? ? ?????????? ???????? ? gru
b2 - ????????? ????? "????? ? ?????????? ?????? ? ????????" ? I ?????). root-???
??? ???????? ????????
set root=(hd0,5)
? ???? ?????? ??? "hd0,5", ?? ?? "/dev/sda5", ?? ???? ????? ?????? ??????? ?????
. ?????? ?????? ????????? ???????? ????? ???????? ??? ???????? ?????? ???????? "
ls". ??? ?????? ???-?? ?????
(hd0,1) (hd0,2) (hd1.1) (hd2,1)
????? ????, ??? ?? ?????? root-??????, ????? ?????????????? ? ???, ??? ??? ?????
?????, ???????? ??????? "root". ??? ?????? ????????? ?????????? ????:
??? ???? ? ??? ?????? ???? ?????? - ?? ?????? ???? ?? ??? ?? ???????. ??????????
: ?????? ??????? ?? ??????? ???? ????????? ??????????, ??? ????? ??????? ???? ??
??????? ?????.
vbeinfo[???????]
??????? ?????? ?????????????? ????????????. ???? ???????? ??????? ????? ????????
??????? ????? ?????????? ?????????? ? "/etc/default/grub".
configfile[???????]
??????? ??????????? ??????? ? grub-legacy. ????????? ????????? ?????? ???? ?????
??????? ? ?????? ???? ?????? ???????? "grub.cfg". ?????? ????? ????, ?? ?????? ?
?????? ?????? ???? ? ??????? ???????????, ??????????? ? ????????, ?? ??????????
???????? ????. ???????????? ???:
configfile /????/??????_????_????
???????? ? ????????????? ????? ???? ????? ????? ??????????? ????????.
terminal_output.console[???????]
????????? ????????????? ?? ??????? ?????-????? ???????? ?????. ?????? ??????? ??
? ?????? ? ???????? ? ??? ??????, ???? ? ??? ??????????? ??????? ???????????. ??
?????? ?? ???? - ???, ???????, ???????, ?? ?? ????????? ???????? ???? ????? ????
?? ????? ????? (???? ???????? ?? ????? ??????????). ???????? ??? ???????, ?? ??
?????? ??????????? ????? (????? ????? ?? ?????? ????) ? ??????? ??????? ?????. ?
??? ?? ????? ??????????? ??????? grub2, ????? ????? ???????? ? 40_custom ????? ?
???? ????????, ????????:
menuentry "black&white mode"{
terminal_output.console
}
??????????? ;)[???????]
?? ? ??? ??????? ??????? ???? ? ??????? ????????? ?????? ????????????, ??????? ?
?????? ??? ????????? ?????? ? ???????: ??? ?????????? ?????????????? ?????? (???
? bash) ?? ??????? tab. tab ? ?????? ?????? ??????? ?????? ?????? ????????? ???
???. ??? ????? ?????????????? ????? ????????????? ?????? ?????????????. ???? ??
?? ???????, ????? ?????? ??? ?????, ???????? "root (hd0," (??? "root (hd1." ? ??
??? ?? ??????) ? ??????? tab. ????? ??????? ?????? ???????? ????????? ????? ? ??
??????? ???????? ??????, UUID ? ??????? ?????????? ?????????. ??? ??????? ???? "
(hd*,*)" ????? ???????????? ? ?????? ???? ? ?????, ????????, ??? ???:
cat (hd0,6)/home/username/???????/????
??? ???? ???????? ??????
ls (hd0,3)/
????????? ??????????? ?????????? ????????? ??????? ??? ???????????? root.
???????? ??????? grub2 ?? ????????[???????]
??? ?????????? ? ???? ?????????????, ??? ?????? ??????. ??????????? ? grub2, ???
?????? ? ??????? ???????? "c". ???????? ??????? grub2 ?????????? ?? ?????? "set
root - chainloader - boot". ??? ?????? ??????????? ? ??????, ? MBR ???????? ????
???? grub2, ??????? ?? ?????????? ?????????. ????????? ???????
ls
????? ??????? ?????? ??????? ?????? ? ????????. ????, ? ???????? ???????????? ??
?????? ????? ??????????? (hd0). ? ????? ??????? ?? ???????? ? ?????? ???????? gr
ub2 ?? ??????? ?????. ???? ?????? - (hd0), ?? ??????? ???? ????? (hd1). ????????
?
set root=(hd1)
??? ??
root (hd1)
?? ?????? ?????? ????? ?????????, ??? ???????? ??????? ??????????. ??? ?????????
. ???????? ?????????? ?? ???????
chainloader +1
? ???? ??????? ?? ??????
boot
? ???????? ? ??????? ?????????.
???????? ?????????????? ???? ????????[???????]
? ???? ??????? ?? ?????????? ???????? ????? ??????????? ??????????? ???? ?? ????
? ?????????????. ???? ? ???, ??? ?????? ??? ????????? ??? "grub.cfg" ????? ?????
???? ?????? ???? ????????????. ??? ????????? ??????? ?????????????? ????, ??????
???? ??????
? ??????? ????????, ???????????. ???????????. ??, ??? ???? ???? ? ??
???????? ArchLinux, ????? ???????? ????????? ??????? ? grub ????????????? ?????.
???????? ????? ????? ?? ? ????? ????????????. ????, ???????? ??? ????? ???? ???
?????????. ?????? ? ???? ?? ???, ??????? ??, ?? ?????, ? ???????? ?? ?????? ????
?????? "grub.cfg". ??? ???? ????????? ?????????, ??? ????? ???, ????????:
sudo cp /boot/grub/{grub,custom}.cfg
????????? ???? ??????????? ? ??????? 444, ???????? ??? ????? ?? ??????:
sudo chmod 744 /boot/grub/custom.cfg
?????? ????????? ??? ? ??????? ????????? ????????? ? ???????? ????????. ???? ??
? ??????????? ???? ?????? ????????? "grub.cfg" ? ?????????, ????? ?????? ??? ???
???, ????? ??????????? ????????? ???? ????, ??????? ??????, ? ???????? ??? ? ???
?? ?????????????? ????. ?????? ??, ????? ? ?? ??????? ?????? ??? ??????, ? ?????
??? ???? ???????????? ?????????, ??? ?? ? ?????????. ??? ?????? ?????? ?????? "s
et default=...." (? ???? ??? 13-? ??????). ????? ????? ?????? ????? ???? ?? ????
?????, ?????? ??? ??? ????? ??? ?????? ????????. ????? ?????? ?????? "set gfxmod
e...." (24-? ? ???? ??????). ????? ???????? ?????????? ?????? ? ????????? ??????
? WxH. ????? ????? ??????? ??????? ?????, ???????? "1024x768x32". ????? ???????
????????? ?????????, ??? ???? ???? ?????? ?? ?????? ???? ??????????, ????? ?????
??? ??????, ???? ? ?? ?? ????????? - ?????? ? ?.?. ???????? ????????????? ?????
??????? ? ??? ????????:
set gfxmode=1024x768x32,1024x768x24,1024x768
?????? ??????? ????? ??????????? ????. ??? ????? ???? ?????? "set timeout", ?? ?
????? ??, ??????? ???? ????? "else" (36). ????? ? ???????? ???????? ? ????????.
?????????? -1 ??? ?????????? ???????. ???????? ?????????? ?????? ????. ??? ?????
?? ???????? ??????????? ?????? ?????? ? "if background_image....." (45). (?????
???????????????, ??? ? ????? grub.cfg ???????????? ??????? ???????????. ???? ???
- ???????? ?????? ????? ? ????? ????? ???????). ????? ??????? background_image
???????? ???? ? ????? ????????. ????????? ??? ?? ?????? ???? (???????? ????????,
??? ?????????? ???????? ?????? ??????????????? ????????? ???? ?????????? ??????
!). ??????? ???? ?? ????? ?????? ????? ??????. ???????? ??? ????? ??? ??, ??? ?
? "/etc/grub.d/05_debian_theme" (????????? ? ?????? ??????? ? ????? II, ?????? "
????????? ????? ??????? ????"). ??? ????? ????????? ???? ?????????? ????: ??????
? ?????? ? "set color_highlight" ? "else". ?????? ????????? ????? ?????: color_n
ormal ?????? ????/??? ?????? ?????? ? ????? (?????? grub ? ???????????) ? ??????
? ??????? menu_color_normal ???????? ?? ???? ??????? ???? ? ??? ??????????????,
? ??????? ??? ????????? menu_color_higlight ?????? ????/??? ??????????? ??????
????. ???????? ? ??????????, ???????? ?????????? ? ???????. ???? ???? ?????? ??
?????? "grub.cfg". ???????? ??, ??????? ???????? ? ???????? ?????, ?????????????
? ?? ???? ????. ???? ????? ???????? ?????? ? ??????? ?????????????????? ????? ??
?????? ????????. ???????? ???? ????, ????????? ???. ?????? ??? ????? ???????? ??
????????? ????????? ??? ?????? "grub.cfg". ??? ????? ? ????????? ????? ????? ???
????? ??? ???? ?????, ??? ?? ??????? ????? "/etc/grub.d/40_custom". ??? ????? ??
??? ???????????? ? grub2 ???????????? ??????? "configfile". ?? ?? ? ????????????
insmod ext2
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else terminal gfxterm; fi
insmod png
### ??????? ???????????
background_image /usr/share/images/grub/yellow.png
### ????????? ??????
set color_normal=black/black
set menu_color_normal=green/light-blue
set menu_color_highlight=red/blue
menuentry "9.10 @ 2.6.32" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.32-020632-generic root=UUID=0e717c2a-24bd-4abe-acfe-ecf9
8fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.32-020632-generic
}
menuentry "9.10 @ 2.6.32 (recovery)" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.32-020632-generic root=UUID=0e717c2a-24bd-4abe-acfe-ecf9
8fc814f8 ro single
initrd /boot/initrd.img-2.6.32-020632-generic
}
menuentry "windooz"{
search -u AC9C75E59C75AA8A -s
chainloader +1
}
MBR
?????, ?????????????? ? ???????? ????? ?????[???????]
??? ???, ??? ?? ?????, ??????: MBR
???????? ??????? ??????? ???????? ?????, ? ??
?????, ? ??? ?????, ???????? ???, ??????????? ?????????. ??? ???????? ? ????? ??
???? ??????????? ?????????? ? ???, ??? ????????? ?????????. grub2 ??????????? ??
?? ??? ? MBR ??? ????????? (? ??? ?? ?? ??????, ???????? grub-install
/dev/sda). ?
? ?????? ??????????? MBR (??????? ?????? ???????) ? ??? ??????????? ???????? ???
??????????? ????????????????? grub2 ??????? ????? ????? ????????? ????? MBR ????
???? ?????. ????? ??????? ??, ??????? ????? ????????????, ? ?????? ?? ??????? ??
???? ???????????? ???????? (????? ?????????? ? ??????? sudo fdisk -l). ????? ?????
????????? ?????? ?????? (?????? 512 ????) ????? ? ???? ? ??????? ??????? dd:
sudo dd if=/dev/sda of=mbr.bin bs=512 count=1
???? ??? ??????????? ????
?? sda, ????????? ???????? ?? ???? (?? ????? ????, ???
?????????? ???????? ?????? 446 ????, ? ?????? ???????? ??????? ????????, ?? ???
???????? ?????? ?????? ?? ?????? ???? ?? ?????? 512 ????). ??? ????? ?????! ???
??? ????????? ? ???? mbr.bin ? ????? ???????? ??????????. ????????? ?????????? ???
??, ????? ????????? ???????? grub2 ??-??? ??????? ??? ???????????? MBR ?????. ??
?? ? ??? ???? ?????? ????????????? linux-??????? ? grub2 ?? ?????? ??????? ?????
??? ??????????? ?????? ? grub2 (???????? ??????? ??????? ????)
?????? ?????????
?? ?? ???????? ??????????????? ?????. ????, ? ???? ??????? ? ?????????? ?? ?????
???????????? ?????? ? grub2, ?? ??????? ? ?????????????? ??????? ????? MBR ????
?? ???????? ?????. ???????????? ? grub2, ??????? ? ??????? (????? c). ????????? ?
???????? ????????? ??????? ??? ??????? ????, ?? ??????? ?? ???????? ???????? MBR
, ? ? ???????? ?? ????? ????????? grub2. ????? ??????? ??? ???? ??? ????? ?? ???
????????, ???????? ???:
set root=(hd1)
???????? ????????? ????????
root
???? ??? ????? ????????? ??? ????? ? ??????? chainloader. ????? ????? ??????? ??
???? ????, ??????? ? ???????, ?? ??????? ????? ??? ????. ??????, ? ??????? ? ???
????? ????????? (hd0), ??? ??? ??????? ????? ????????? ???:
chainloader (hd0,1)/mbr.bin
???? ??? ????
???? ??????? ?? ??????:
boot
? ???????????? ?????? grub2.
??????????: ? MBR (?, ??????????????, ? ?????????? ??????) ??? ??????? ????????
???????? ?????, ??????? ????? ??? ????? ?????????? grub2 ? ???? ???????, ???????
??? ?????? ? ???????? ????????? (root) ? ??????? grub2. ???????? ?????? ???????
, ?? ????? ???????????? ??-??? ??? MBR ?????. ?? ???? ??????? grub2 ? ??? ??? ??
??? ???, ??????????? ?? ????? ? LiveCD.
???????? ? LiveCD ????? linux-??????? (? ?????? ?????? ????????? grub2 ???? ?? ?
?????). ??? ?????????????? MBR ??? ????? ????? ????????? ????? ????????? ????? ???
???? ? ?????? ?????? ?????. ?? ??? ?????? ???????? ??????? ????????, ???? ??????
????????, ??? grub2 ?? ???????? ? ??-?? ???. ??? ????? ?????????
sudo fdisk -l
???? fdisk ????? ??????? - ??????? ???????? ??????? ?? ?????, ? ??????????? ????
?? ??? ??????????. ? ???? ?????? ??? ????? ???????????? ???? ?????? 446 ????. ??
?? ?? "?????" ? ??????? ???????? - ??? 512. ?????????????, ??? ?????? ?? ??????,
???????? ?????? ?????????? ???? ?? ?????? ? ?????? ?????? ?????. ? ??????? ????
??????? ???????? ? ???????, ??????????????? ?????? grub2:
sudo dd if=/mnt/mbr.bin of=/dev/sda bs=446 count=1
menuentry "winxp" {
sear?h -u uuid_???????_?_win -s
chainloader +1
}
???????? ? ??????, ????????? ??? ??? "grub.cfg" ? ??????? ???????? (? ???? ?????
? - "~/tmp/iso/boot/grub/grub.cfg"). ?????? ?? ?????? ? ???????? iso-?????? ????
?? LiveCD. ? ???? ??? ??????? ??????? grub-mkrescue. ??????? ????? ????????? ???
:
grub-mkrescue --overlay=tmp/iso/ tmp/grub.iso
?????? "tmp/iso" ??????? ???? ???????, ? ?????? "tmp/grub.iso" - ????, ???? ????
????? ?????????? iso-?????. ???? ??? ??????? - ???????? ?? ?????? ????? ????????
? iso-???? (~2.8M), ????????? ??? ?? rw-??? ? ??????? ?????????!
?????? ????? "grub.cfg"[???????]
??? ? ??????, ??????? ?????? ????? "grub.cfg", ????????? ??????????? ?? LiveCD ?
?????????????:
### ?????? ???????? ??????? iso9660 (cd-????)
insmod iso9660
### ?????? ??? ????????????? ??????? ???????? ???????? ?????! must have!!
insmod part_msdos
###
set
###
set
###
set
????????? ??????
color_normal=white/black
menu_color_normal=green/black
menu_color_highlight=light-blue/black
#0
menuentry "9.10 @ 2.6.33rc1" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.33-020633rc1-generic root=UUID=0e717c2a-24bd-4abe-acfe-e
cf98fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.33-020633rc1-generic
}
#1
menuentry "9.10 @ 2.6.33rc1 (recovery)" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.33-020633rc1-generic root=UUID=0e717c2a-24bd-4abe-acfe-e
cf98fc814f8 ro single
initrd /boot/initrd.img-2.6.33-020633rc1-generic
}
#2
menuentry "windooz"{
search -u AC9C75E59C75AA8A -s
chainloader +1
}
menuentry "ubuntu-11.04.iso" {
loopback loop (hd0,2)/ubuntu-11.04.iso
linux (loop)/install/vmlinuz boot=install iso-scan/filename=/ubuntu-11.04.iso
initrd (loop)/install/initrd.gz
}
menuentry "linuxmint-12-kde-dvd-64bit.iso" {
search -l FAT -s
#set root=(hd0,msdos1)
loopback loop /linuxmint-12-kde-dvd-64bit.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/mint.seed boot=casper iso-scan
/filename=/linuxmint-12-kde-dvd-64bit.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu-12.04-beta2-desktop-i386.iso" {
search -l FAT -s
#set root=(hd0,msdos1)
loopback loop /ubuntu-12.04-beta2-desktop-i386.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/ubuntu.seed boot=casper iso-sc
an/filename=/ubuntu-12.04-beta2-desktop-i386.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu live-dvd" {
loopback loop (hd0,2)/ubuntudvd.iso
linux (loop)/install/vmlinuz boot=install iso-scan/filename=/ubuntudvd.iso
initrd (loop)/install/initrd.gz
}
menuentry "Mint live-cd" {
loopback loop (hd0,2)/mint.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/mint.iso
initrd (loop)/casper/initrd.gz
}
menuentry "pmagic-4.10.iso" {
loopback loop (hd0,2)/pmagic-4.10.iso
linux (loop)/pmagic/bzImage boot=casper iso-scan/filename=/pmagic-4.10.iso
initrd (loop)/pmagic/initramfs
}
menuentry "Plop.bin" {
root (hd0,2)
linux16 (hd0,2)/boot/grub/plpbt.bin
}
menuentry "Plop.com" {
root (hd0,2)
linux16 (hd0,2)/boot/grub/plpinstc.com
}
menuentry "ubuntu-11.10-desktop-i386.iso" {
loopback loop /boot/iso/ubuntu-11.10-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-11.10
-desktop-i386.iso noeject noprompt -initrd (loop)/casper/initrd.lz
}
menuentry "linuxmint-12-gnome-dvd-32bit.iso" {
loopback loop /boot/iso/linuxmint-12-gnome-dvd-32bit.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/mint.seed boot=casper iso-scan
/filename=/boot/iso/linuxmint-12-gnome-dvd-32bit.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "Lucid ISO" {
loopback loop (hd0,1)/boot/iso/ubuntu-10.04-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-10.04-desk
top-i386.iso noprompt noeject
initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu-9.10-desktop-amd64.iso" {
loopback loop (hd0,1)/boot/iso/ubuntu-9.10-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-9.10-deskt
op-amd64.iso noprompt quiet splash
initrd (loop)/casper/initrd.lz
}
menuentry "gparted-live-0.6.1-2.iso" {
loopback loop (hd0,1)/boot/iso/gparted-live-0.6.1-2.iso
linux (loop)/live/vmlinuz boot=live union=aufs noswap noprompt ip=frommedia find
iso=/boot/iso/gparted-live-0.6.1-2.iso toram=filesystem.squashfs
initrd (loop)/live/initrd.img
}
menuentry "systemrescuecd-x86-1.5.8.iso" {
loopback loop (hd0,1)/boot/iso/systemrescuecd-x86-1.5.8.iso
linux (loop)/isolinux/rescue64 setkmap=us isoloop=/systemrescuecd-x86-1.5.8.iso
initrd (loop)/isolinux/initram.igz
}
menuentry "pmagic-5.2.iso" {
loopback loop (hd0,1)/boot/iso/pmagic-5.2.iso
linux (loop)/pmagic/bzImage iso_filename=/boot/iso/pmagic-5.2.iso boot=live load
_ramdisk=1 prompt_ramdisk=0 noeject noprompt
initrd (loop)/pmagic/initramfs
}
menuentry "Boot IMG - Seagate Tools" {
linux16 /memdisk bigraw
initrd16 /SeaTools.img
}
# Live Gparted ??????? ?????????, ?????? ?????????? ???? ? ?????????? ??? ?? ???
??? (?????????? live)
menuentry "Gparted" {
linux /live/vmlinuz boot=live config noswap ip=frommedia nosplash -initrd /live/initrd.img
}
#? ???? ?? LiveCD, ? ???-?? ???????? ???????????
menuentry "debian-6.0.3-amd64-netinst.iso" {
loopback loop /boot/iso/debian-6.0.3-amd64-netinst.iso
linux (loop)/install.amd/vmlinuz vga=normal -initrd (loop)/install.amd/initrd.gz
}
menuentry "debian installer amd64 netboot" {
linux /boot/debian/linux auto preseed/url=http://www.panticz.de/pxe/preseed/xen.
seed locale=en_US console-setup/layoutcode=de netcfg/choose_interface=eth0 debco
nf/priority=critical -initrd /boot/debian/initrd.gz
}
# ? "?????????" ?????? ? alternate ??????? ????????? (? ???? ? ?????) ??????????
. ??? ??? ????????? ?????? ??? "alternate":
menuentry "Xubuntu 12.04 64 bit" {
loopback loop /xubuntu-12.04-alternate-amd64.iso
linux (loop)/install/vmlinuz iso-scan/filename=/xubuntu-12.04-alternate-amd64
.iso vga=normal noeject noprompt nosplash -initrd (loop)/install/initrd.gz
#FreeDOS - ??????????????? ????????!
menuentry "FreeDOS 1.0" {
loopback loop /boot/iso/fdbasews.iso
linux16 (loop)/isolinux/data/memdisk
initrd16 (loop)/isolinux/data/fdboot.img
}
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
???????? LiveCD ? GRUB2 ?? ???? ?????????? ????????????[???????]
(?? ???? ??????? ???. komix)
????????? ??????? ????? ???????? ???? ?????? iso-????? ? grub2 ? 3 ????????? ???
? ?? ?????, ????? ?????????? ???????? ? ????????, ? ??????: LiveCD ? grub2 ? ???
????????? ???? ?????-?????? ???????. ???????? ?? ????? ?? ????, ??? ??????? iso
??????? LiveCD, ? ???????? ?? ????? ?????????? grub2. ??????? ???????? ????? ? ?
???? ?????????? ?????????? ? ?????????? ??????. ?????? ????? ???????? ???????, ?
??????? ????? ???????? ??? ????? ????. ? ??? ?? ???????? ??????? /boot/grub ? ?
??????, ? ??????? ????? ???????? ????? ????? live-??????? (? ?????? ?? live):
mkdir -p tmp/iso/{boot/grub,live}
?????? ??? ????? ?????????????? iso-????? ????? ??????? ? ?????????????? ???????
??? ???:
sudo mount -o loop downloads/some-live-system.iso tmp/iso/live
?????? ???????? "grub.cfg", ??? ??? ??????? ? ?????????? ?????? (?? ???????? ???
???????? ???? ??????, ???? ?????? ???????????? ??????????? ????). ????? ??? ????
?????? ?????????????? ???????, ?? ? ??? ???? ????????, ??? ? ???? ?? ??????? ???
?? ??? ???????? ????? live-???????. ??? ?????? ????? ????????? "????? ????"? ??
???? ?????? ??? ?????????????? ??????. ?????? ??? ?????, ??????????? ? ?????????
? ???????????? ?????????? (?????? ??? isolinux ??? ?? ?????? grub - ? ????? ????
??? ?????? ?????? ????????). ??????? ?????????? ?????? ??? ????-???????????? Par
ted Magic:
menuentry "Parted Magic" {
linux /live/bzImage
initrd /live/initramfs
}
? ?????? ?????? ????? ????? ??????????. ??? ?????? ?????? ????? ????????????? ??
???????????? ????????? ???????? ????. ???? ?? ????? ?????? ? "/live/boot" ??? ?
?????? ???????? ? ??????????? ?? ??????????? ????????????. ???????? ???????? ??
??, ??? ????? ?? ???????????? ?????? ???? "set root..." ??? "search...". ???? ??
??????? ?????????? "grub.cfg", ?? ???????? ???????? ??? ???????? ??????????????
? cdrom, ??????? ??? ????? ??? ???????? ????????. ????? ????, ??? "grub.cfg" ???
??, ????? ?????????? ? ???????? iso-??????:
sudo grub-mkrescue --overlay=tmp/iso tmp/my-live-system-grub2.iso
????????????????? ???????? ??????? ?? ??????? ????????????? ????????????. ?? ???
?????? ???????? ??????????????? iso-????? ? ???????????? ????????????? ? ???????
? ???? grub2. ??????????? ???????????? iso:
sudo umount tmp/iso/live
? ????????? ????? iso-???? ?? ????????. ???????? ? ????????? ?????????.