www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁(yè) > 芯聞號(hào) > 充電吧
[導(dǎo)讀]https://wiki.archlinux.org/index.php/GRUB2_(簡(jiǎn)體中文) GRUB2?下一代 GRand Unified Bootloader (GRUB)。 GRUB

https://wiki.archlinux.org/index.php/GRUB2_(簡(jiǎn)體中文)


GRUB2?下一代 GRand Unified Bootloader (GRUB)。 GRUB2 來(lái)自下一代 GRUB 研究項(xiàng)目?PUPA,代碼全部重寫,實(shí)現(xiàn)了模塊化和增強(qiáng)了移植性。[1].

簡(jiǎn)單的說(shuō),啟動(dòng)引導(dǎo)器是電腦啟動(dòng)時(shí)第一個(gè)運(yùn)行的程序。負(fù)責(zé)裝載內(nèi)核并將控制權(quán)轉(zhuǎn)入。內(nèi)核再初始化操作系統(tǒng)的其它部分。

Contents ?[hide]? 1?前言 1.1?當(dāng)前 GRUB 用戶請(qǐng)注意1.2?GRUB2 所需條件 1.2.1?BIOS 系統(tǒng) 1.2.1.1?GPT 專用指令1.2.1.2?MBR 即 msdos 分區(qū)專用指令1.2.2?UEFI 系統(tǒng) 1.2.2.1?創(chuàng)建并掛載 UEFI 系統(tǒng)分區(qū)2?安裝 2.1?在已有系統(tǒng)中安裝grub2 2.1.1?BIOS 系統(tǒng) 2.1.1.1?備份之前的數(shù)據(jù)2.1.1.2?grub_bios 安裝前2.1.1.3?Run grub-install3?引導(dǎo)器配置 3.1?Dual booting 3.1.1?其他GNU/Linux發(fā)行版3.2?背景圖像和點(diǎn)陣字體3.3?菜單顏色3.4?Hidden menu3.5?設(shè)置 Framebuffer 分辨率4?常見問(wèn)題 4.1?msdos-style Error Message4.2?Other5?更多資源 前言

GRUB Legacy(如0.9x)已經(jīng)被上游開發(fā)團(tuán)隊(duì)標(biāo)為過(guò)時(shí),有許多發(fā)行版使用 GRUB2 或者syslinux替換。Arch 現(xiàn)在提供的?grub?已經(jīng)是 Grub2,推薦現(xiàn)在的 grub 用戶進(jìn)行切換。

注意:?grub2 支持 btrfs 根分區(qū),不需要給 /boot 單獨(dú)分區(qū)。 當(dāng)前 GRUB 用戶請(qǐng)注意 GRUB 和 GRUB2 的內(nèi)置命令有所不同(例如 "find" 已經(jīng)變成 "search"),詳情可見:?GRUB2 命令GRUB2 已經(jīng)模塊化,不再需要"stage 1.5"。所以,啟動(dòng)引導(dǎo)器可以變得很小 -- 模塊按需從硬盤導(dǎo)入以擴(kuò)展功能。(例如LVM?或 RAID 支持)。GRUB 和 GRUB2 的分區(qū)命名有變化。分區(qū)從 1開始編號(hào),并以分區(qū)類型開始,原來(lái)是從 0 開始編號(hào)。注意:磁盤還是從 0 編號(hào)。例如,/dev/sda1應(yīng)該是?(hd0,msdos1)?(用于MBR) 或?(hd0,gpt1)?(用于 GPT)。 GRUB2 所需條件 BIOS 系統(tǒng) GPT?專用指令

BIOS-GPT 配置中的 GRUB2 需要一個(gè)BIOS 啟動(dòng)分區(qū)以便植入core.img,因?yàn)?GPT 分區(qū)系統(tǒng)中 MBR 后面沒(méi)有了 32 KiB 的空間(已經(jīng)被 GPT 主頭部和主分區(qū)表占據(jù))。此分區(qū)僅在 BIOS-GPT 配置中使用,如果使用 MBR 分區(qū)方式,此分區(qū)不被使用。同時(shí)如果系統(tǒng)是基于 UEFI 的,也無(wú)需創(chuàng)建這個(gè)分區(qū),因?yàn)槠渲胁](méi)有嵌入啟動(dòng)扇區(qū)。 Syslinux 也不使用這個(gè)分區(qū)。

用 cgdisk 或 GNU Parted 創(chuàng)建 2 MB 的無(wú)文件系統(tǒng)分區(qū)。只要位于磁盤的前 2TiB 空間內(nèi),分區(qū)位置沒(méi)有要求。但是建議放在磁盤開始位置,/boot 之前。cgdisk 中設(shè)置類型為 "EF02" 或在GNU Parted 中設(shè)置set bios_grub on標(biāo)記。

只有在 BIOS-GPT 配置中 GRUB2 才會(huì)使用這個(gè)分區(qū)。MBR 分區(qū)中不存在這種分區(qū)類型(至少 GRUB2 中如此)。如果系統(tǒng)基于 UEFI,也是不需要這個(gè)分區(qū),因?yàn)闆](méi)有嵌入。GRUB-legacy 和 SYSLINUX 也都不需要這個(gè)分區(qū)。

注意:?這個(gè)分區(qū)應(yīng)該在 grub2_bios-install 或 grub-setup 和 Archlinux 安裝程序的Install Bootloader?部分執(zhí)行之前建立。 注意:?如果選擇 GRUB2 作為啟動(dòng)加載器,這個(gè)分區(qū)應(yīng)該在 grub2_bios-install 或 grub-setup 和 Archlinux 安裝程序的Install Bootloader?部分執(zhí)行之前建立。 MBR?即 msdos 分區(qū)專用指令

通常情況下,在許多 MBR(或 msdos 磁盤標(biāo)簽)分區(qū)的系統(tǒng)中,只要 DOS 兼容扇區(qū)對(duì)齊問(wèn)題能夠滿足,MBR 后面就有 32KiB 空白(MBR 512字節(jié)區(qū)域之后,第一個(gè)分區(qū)之前)。然而,要放置 grub2 的 core.img, 推薦使用 1MiB 或 2 MiB。建議使用支持 1MiB 分區(qū)對(duì)齊的分區(qū)工具獲取所需空間,同時(shí)滿足其他非 512 字節(jié)簇的問(wèn)題(與嵌入 core.img 無(wú)關(guān))。

如果不雙啟動(dòng) MS Windows,建議切換到 GPT 分區(qū)方式 -?無(wú)損數(shù)據(jù)切換到 GPT

注意:?轉(zhuǎn)換到 GPT 之前就要?jiǎng)?chuàng)建上面說(shuō)的 2MiB 分區(qū)。否則 gparted 認(rèn)不出啟動(dòng)分區(qū),重啟時(shí) grub2 也不知道到哪里找數(shù)據(jù)。 UEFI 系統(tǒng) 創(chuàng)建并掛載 UEFI 系統(tǒng)分區(qū)

Linux 中創(chuàng)建 UEFI 系統(tǒng)分區(qū)?包含了創(chuàng)建指令。創(chuàng)建后將 UEFI 系統(tǒng)分區(qū)掛載到?/boot/efi。這個(gè)分區(qū)應(yīng)該是 FAT32 格式,至少 200 MiB 大小。如果已經(jīng)在其它地方掛載了這個(gè)分區(qū),用掛載點(diǎn)替換掉下面的?/boot/efi:

# mkdir -p /boot/efi
# mount -t vfat  /boot/efi

創(chuàng)建 /efi 目錄:

# mkdir -p /boot/efi/efi
安裝 在已有系統(tǒng)中安裝grub2 BIOS 系統(tǒng) 備份之前的數(shù)據(jù)

grub 安裝應(yīng)該很順利,但是極個(gè)別時(shí)候會(huì)導(dǎo)致系統(tǒng)無(wú)法啟動(dòng)。所以強(qiáng)烈建議安裝?grub-bios?前備份數(shù)據(jù)。

復(fù)制 grub 模塊和數(shù)據(jù)
# cp -a /boot/grub /path/to/backup/
備份 MBR 和 GRUB-Legacy stage 1.5
# dd if=/dev/sdX of=/path/to/backup/mbr-boot-code bs=440 count=1

現(xiàn)在可以刪除?/boot/grub?了:

# rm -rf /boot/grub

如果后面的指令出了問(wèn)題,可以通過(guò)如下方式恢復(fù):

刪除無(wú)法工作的 grub-legacy 或 grub2 文件
# mv /boot/grub /boot/grub.nonfunctional
將備份的 grub 復(fù)制到 /boot
# cp -a /path/to/backup/grub /boot/
將 MBR 和它后面的 62 簇 sda 數(shù)據(jù)替換為備份數(shù)據(jù)(危險(xiǎn)!)
# dd if=/path/to/backup/mbr-boot-code of=/dev/sdX bs=440 count=1
grub_bios 安裝前

用 pacman 安裝 GRUB2(會(huì)替換掉?grub):

# pacman -S grub-bios
注意:?安裝 1.99~rc1-3-x86_64 在一些系統(tǒng)上花了很長(zhǎng)時(shí)間,因?yàn)榘惭b中調(diào)用的腳步grub-mkconfig,沒(méi)有使用?--no-floppy選項(xiàng),會(huì)不斷檢測(cè)軟驅(qū))。 注意:?僅安裝軟件不會(huì)更新 /boot/grub/core.img 文件和 /boot/grub 中的 grub 模塊。需要用下面的 grub_bios-install 手動(dòng)更新它們。

裝入 device-mapper 內(nèi)核模塊,有了這個(gè)模塊 grub-probe 才能更好的檢測(cè)磁盤和分區(qū):

# modprobe dm-mod
Run grub-install
# grub-install --boot-directory=/boot --no-floppy --recheck --debug /dev/sda
# cp /usr/share/grub/{unicode.pf2,ascii.pf2} /boot/grub/

附加說(shuō)明:若只是生成 core.img 文件而不將 grub2 安裝到 MBR,加上--grub-setup=/bin/true?參數(shù)到 grub2_bios-install:

# grub-install --grub-setup=/bin/true --boot-directory=/boot --no-floppy --recheck /dev/sda

這樣就可以從 grub-legacy 像多內(nèi)核啟動(dòng)一樣載入 grub2 的 core.img。

/dev/sda是安裝到目的磁盤(第一個(gè) SATA 磁盤的 MBR)。如果/boot?使用?LVM,可以將 GRUB2 安裝到多個(gè)物理磁盤。

--no-floppy參數(shù)加上之后就不會(huì)查找軟驅(qū),可大大減少該安裝所需時(shí)間,并避免了下面問(wèn)題的發(fā)生:

grub-probe: error: Cannot get the real path of '/dev/fd0'
Auto-detection of a filesystem module failed.
Please specify the module with the option '--modules' explicitly.

執(zhí)行“生成GRUB2配置文件”步驟。

# GRUB_PREFIX="/boot/grub" grub-mkconfig -o /boot/grub/grub.cfg

如果失敗,用下面腳本將/boot/grub/menu.lst?轉(zhuǎn)換為?/boot/grub/grub.cfg

# grub-menulst2cfg /boot/grub/menu.lst /boot/grub/grub.cfg

例如:

/boot/grub/menu.lst
default=0
timeout=5

title  Arch Linux Stock Kernel
root   (hd0,0)
kernel /vmlinuz-linux root=/dev/sda2 ro
initrd /initramfs-linux.img

title  Arch Linux Stock Kernel Fallback
root   (hd0,0)
kernel /vmlinuz-linux root=/dev/sda2 ro
initrd /initramfs-linux-fallback.img
/boot/grub/grub.cfg
set default='0'; if [ x"$default" = xsaved ]; then load_env; set default="$saved_entry"; fi
set timeout=5

menuentry 'Arch Linux Stock Kernel' {
  set root='(hd0,1)'; set legacy_hdbias='0'
  legacy_kernel   '/vmlinuz-linux' '/vmlinuz-linux' 'root=/dev/sda2' 'ro'
  legacy_initrd '/initramfs-linux.img' '/initramfs-linux.img'
  
}

menuentry 'Arch Linux Stock Kernel Fallback' {
  set root='(hd0,1)'; set legacy_hdbias='0'
  legacy_kernel   '/vmlinuz-linux' '/vmlinuz-linux' 'root=/dev/sda2' 'ro'
  legacy_initrd '/initramfs-linux-fallback.img' '/initramfs-linux-fallback.img'
}

如果忘記創(chuàng)建/boot/grub/grub.cfg配置文件就重啟,進(jìn)入 GRUB2命令后執(zhí)行:

sh:grub> insmod legacycfg
sh:grub> legacy_configfile ${prefix}/menu.lst

啟動(dòng)后可以重新修改?/boot/grub/grub.cfg?配置文件。

如果想生成新的GRUB2配置文件,請(qǐng)執(zhí)行:

# grub-mkconfig -o /boot/grub/grub.cfg
注意:?僅在 BIOS 系統(tǒng)工作,UEFI 系統(tǒng)不能這么做。 引導(dǎo)器配置

grub2的配置文件是:

/boot/grub/grub.cfg

Be warned this section is incomplete, feel free to put all missing configuration options here!

(hdn,m)?is the partition?m?on disc?n, partition numbers starting with 1, disc numbers starting with 0set default=n?is the default boot entry, that is choosen after timeout for user actionset timeout=m?– time?m?to wait in seconds for a user selection, before default is bootedmenuentry "str"{entry options}?– title string?str?for a boot entry & basic layoutset root=(hdn,m)?– base partition, where the kernel is stored tolinux /path ro root=/dev/device initrd /initrd.img?– use the root option, if the kernel not placed in /chainloader +1?sets?root?active and gives booting procedure to its boot-loader (for Windows, e.g.)

For UUID entries:

# blkid

This gives you the UUID. We were doing the following command to set the root device:

# root=/dev/device
Instead, replace it with this:
# root=/dev/disk/by-uuid/bc285871-413 .... and so on, for your UUID.
Dual booting

These are the two most common ways of configuring the?grub.cfg?file. For more complex uses, feel free to add descriptions here.

其他GNU/Linux發(fā)行版

這和載入Arch linux一樣。假設(shè)另一個(gè)發(fā)行版在分區(qū)[s/h]da2.

menuentry "Other Linux" {
set root=(hd0,2)
linux /boot/vmlinuz (add other options here as required)
initrd /boot/initrd.img (if the other kernel uses/needs one)
}
背景圖像和點(diǎn)陣字體

GRUB2支持背景圖像和pf2格式的點(diǎn)陣字體。unifont字體以unicode.pf2的文件名包含于grub2的安裝包,也可能只是文件名為ascii.pf2的ascii字體。只要載入適合的模塊,Grub2支持tga、png和jpeg的圖像格式。支持的最大分辨率取決于你的硬件配置。下面是一個(gè)以tga格式圖片為背景的配置的例子:

if loadfont /usr/share/grub/unicode.pf2?; then
  set gfxmode="1024x768x32"
  insmod gfxterm
  insmod vbe
  terminal_output gfxterm
  if terminal_output gfxterm; then true?; else
     terminal gfxterm
  fi
fi
insmod tga
background_image /boot/grub/archlinux.tga
菜單顏色

想要改變 GRUB2 菜單顏色,你需要在?/boot/grub/grub.cfg?指定一個(gè)選項(xiàng):

set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

這是Arch's 官方 GRUB-legacy 的默認(rèn)顏色。可用的顏色可以在http://www.gnu.org/software/grub/manual/html_node/color.html 查看

Hidden menu

For hiding menu put that code in grub.cfg after picture initialization but before?menuentries?(e.g. background_image /boot/grub/archlinux.tga).

  set timeout=5
  echo -n "Press ESC to see the menu... "
if sleep --verbose --interruptible 5?; then
  set timeout=0
fi
設(shè)置 Framebuffer 分辨率

想要在 grub2 中改變 framebuffer 分辨率,在 grub.cfg 中?linux?行加入一行:

video=vesafb:mode=1024x768-32 vga=790

In the preceeding statement, the format mode=- vga= is used where fbresolution follows the following scheme:

+-------------------------------------------------+
     | 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
+-------------------------------------------------+

Make sure you add the following somewhere, (insmod statements are usually found at the top of the grub.cfg file):

insmod vbe
常見問(wèn)題 msdos-style Error Message
grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding won't be possible!
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.
            However, blocklists are UNRELIABLE and its use is discouraged.
grub-setup: error: If you really want blocklists, use --force.

This error may occur when you try installing GRUB2 in a VMware container. Read more about it?here. Hopefully a fix will be provided soon.

Other

I couldn't figure out how to uninstall grub1, and install grub2 to the MBR, as it isn't being booted by default. It is still booting grub1. So, an easy work-around, is rename?menu.lst.pacsave?or whatever, to?menu.lst?(in /boot/grub/) and for each menu entry that you would like to use grub2, at the end type?"chainloader +1". This will tell grub1 to forward control to grub2. This is an ugly hack though, so I advise setting the?menu.lst's timout as 0, otherwise the total timeout would be grub1's time out + grub2's which, for me would equal more than 18 seconds, which is quite a bit.

P.S. hopefully someone figures out how to pry grub1's dead fingers off of my MBR, and place grub2 on it?:) .

In my case it had to do with my boot partition. Say boot-partition is?(hd0,1)?and your root is?(hd0,3)?(grub2 naming). grub-setup searches for?(hd0,3)/boot/grub/core.img. Just because it's on?(hd0,1)/grub/core.img, it is unable to find it. So I copied the grub-folder to my root partition and everything worked fine:

E.g. (as root:)

# mount /boot
# cp -a /boot/grub /
# umount /boot
# mv /grub /boot/
# grub-install /dev/sda
更多資源 GRUB主頁(yè)GRUB維基
本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車的華為或?qū)⒋呱龈蟮莫?dú)角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關(guān)鍵字: 阿維塔 塞力斯 華為

倫敦2024年8月29日 /美通社/ -- 英國(guó)汽車技術(shù)公司SODA.Auto推出其旗艦產(chǎn)品SODA V,這是全球首款涵蓋汽車工程師從創(chuàng)意到認(rèn)證的所有需求的工具,可用于創(chuàng)建軟件定義汽車。 SODA V工具的開發(fā)耗時(shí)1.5...

關(guān)鍵字: 汽車 人工智能 智能驅(qū)動(dòng) BSP

北京2024年8月28日 /美通社/ -- 越來(lái)越多用戶希望企業(yè)業(yè)務(wù)能7×24不間斷運(yùn)行,同時(shí)企業(yè)卻面臨越來(lái)越多業(yè)務(wù)中斷的風(fēng)險(xiǎn),如企業(yè)系統(tǒng)復(fù)雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務(wù)連續(xù)性,提升韌性,成...

關(guān)鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據(jù)媒體報(bào)道,騰訊和網(wǎng)易近期正在縮減他們對(duì)日本游戲市場(chǎng)的投資。

關(guān)鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)開幕式在貴陽(yáng)舉行,華為董事、質(zhì)量流程IT總裁陶景文發(fā)表了演講。

關(guān)鍵字: 華為 12nm EDA 半導(dǎo)體

8月28日消息,在2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)上,華為常務(wù)董事、華為云CEO張平安發(fā)表演講稱,數(shù)字世界的話語(yǔ)權(quán)最終是由生態(tài)的繁榮決定的。

關(guān)鍵字: 華為 12nm 手機(jī) 衛(wèi)星通信

要點(diǎn): 有效應(yīng)對(duì)環(huán)境變化,經(jīng)營(yíng)業(yè)績(jī)穩(wěn)中有升 落實(shí)提質(zhì)增效舉措,毛利潤(rùn)率延續(xù)升勢(shì) 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務(wù)引領(lǐng)增長(zhǎng) 以科技創(chuàng)新為引領(lǐng),提升企業(yè)核心競(jìng)爭(zhēng)力 堅(jiān)持高質(zhì)量發(fā)展策略,塑強(qiáng)核心競(jìng)爭(zhēng)優(yōu)勢(shì)...

關(guān)鍵字: 通信 BSP 電信運(yùn)營(yíng)商 數(shù)字經(jīng)濟(jì)

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺(tái)與中國(guó)電影電視技術(shù)學(xué)會(huì)聯(lián)合牽頭組建的NVI技術(shù)創(chuàng)新聯(lián)盟在BIRTV2024超高清全產(chǎn)業(yè)鏈發(fā)展研討會(huì)上宣布正式成立。 活動(dòng)現(xiàn)場(chǎng) NVI技術(shù)創(chuàng)新聯(lián)...

關(guān)鍵字: VI 傳輸協(xié)議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長(zhǎng)三角生態(tài)綠色一體化發(fā)展示范區(qū)聯(lián)合招商會(huì)上,軟通動(dòng)力信息技術(shù)(集團(tuán))股份有限公司(以下簡(jiǎn)稱"軟通動(dòng)力")與長(zhǎng)三角投資(上海)有限...

關(guān)鍵字: BSP 信息技術(shù)
關(guān)閉
關(guān)閉