win8+archlinux引导修复

先装的win8,再装的arch,把win8的保留分区删了,然后共用efi系统分区,此分区挂载在arch的/boot/efi目录下,最后只能进 arch。按网上搜索的办法修复了无数次都无效,最后重装win,挂载方法与前面一样(参见arch的wiki中grub的安装)。重装win后,u盘启 动进arch,chroot进已经安装好的arch,安装grub。

说一下自己的一份可以正确启动的配置以供参考吧。
1. 固件设置中,UEFI ONLY, cms禁用,安全启动禁用。

2.efi系统分区(/boot/efi)的结构是这样的.(efi分区挂到arch的/boot/efi目录下)
$ tree /boot/efi -L 4
/boot/efi
└── EFI
├── arch_grub
│ └── grubx64.efi
├── Boot
│ └── bootx64.efi
└── Microsoft
└── Boot
├── BCD
├── BCD.LOG
├── BCD.LOG1
├── BCD.LOG2
├── bg-BG
├── bootmgfw.efi
├── bootmgr.efi
├── BOOTSTAT.DAT
├── boot.stl
├── cs-CZ
├── da-DK
├── de-DE ..... 略去一堆语言的文件,不重要


其中,/EFI/Boot/bootx64.efi和/EFI/Microsoft/Boot/bootmgfw.efi是同样文件的不同命名,若已丢失,在这里下载他们(win_lin_efi.tar.bz2)。


3. 主要配置文件,
/etc/grub.d/40_custom (用于生成/boot/grub/grub.cfg中的自定义引导项),其中uuid(下面的E41F-6734)和hint-string(下面的 --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2) 的获取在archwiki中grub那节都有详细说明
#!/bin/sh  exec tail -n +3 $0 menuentry "Microsoft Windows 8 x86_64 UEFI-GPT" { insmod part_gpt
	insmod fat
	insmod search_fs_uuid
	insmod chain
	search --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 E41F-6734
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi  } menuentry "System shutdown" {  echo "System shutting down..." halt }  menuentry "System restart" { echo "System rebooting..." reboot }

/boot/grub/grub.cfg: (由命令grub-mkconfig -o /boot/grub/grub.cfg生成)
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

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 {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt 
insmod ext2
set root='hd0,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  02dbcdb7-8b21-435f-a3a1-91b5712f257f
else
  search --no-floppy --fs-uuid --set=root 02dbcdb7-8b21-435f-a3a1-91b5712f257f
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-02dbcdb7-8b21-435f-a3a1-91b5712f257f' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt 
	insmod ext2
	set root='hd0,gpt5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  02dbcdb7-8b21-435f-a3a1-91b5712f257f
	else
	  search --no-floppy --fs-uuid --set=root 02dbcdb7-8b21-435f-a3a1-91b5712f257f
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=02dbcdb7-8b21-435f-a3a1-91b5712f257f rw  quiet
	echo	'Loading initial ramdisk ...'
	initrd	 /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-02dbcdb7-8b21-435f-a3a1-91b5712f257f' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-02dbcdb7-8b21-435f-a3a1-91b5712f257f' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod ext2
		set root='hd0,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  02dbcdb7-8b21-435f-a3a1-91b5712f257f
		else
		  search --no-floppy --fs-uuid --set=root 02dbcdb7-8b21-435f-a3a1-91b5712f257f
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=02dbcdb7-8b21-435f-a3a1-91b5712f257f rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	 /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-02dbcdb7-8b21-435f-a3a1-91b5712f257f' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod ext2
		set root='hd0,gpt5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  02dbcdb7-8b21-435f-a3a1-91b5712f257f
		else
		  search --no-floppy --fs-uuid --set=root 02dbcdb7-8b21-435f-a3a1-91b5712f257f
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=02dbcdb7-8b21-435f-a3a1-91b5712f257f rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	 /boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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.


#	chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi

menuentry "Microsoft Windows 8 x86_64 UEFI-GPT" {
	insmod part_gpt
	insmod fat
	insmod search_fs_uuid
	insmod chain
	search --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 E41F-6734
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

#menuentry "win8.1" {
#	set root='(hd0,gpt1)'
#	chainloader /EFI/Boot/bootx64.efi
#	chainloader /EFI/microsoft/boot/bootmgfw.efi
#}


menuentry "System shutdown" {
	echo "System shutting down..."
	halt
}

menuentry "System restart" {
	echo "System rebooting..."
	reboot
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###
 





你可能感兴趣的:(引导修复)