Introduction#
I previously replaced the SSD hard drive on my laptop and installed the Deepin system on a 60GB partition. However, it still wasn't sufficient (this sentence is grammatically awkward, but that's how the Deepin system feels).
Then I partitioned the C drive and copied the Windows system from the old hard drive. After some operations, the boot for the Deepin system was lost, and I have been trying to figure out how to restore it.
Also, what do the terms "ESP" and "EFI" mean?
Some Preparatory Links#
rEFInd Official Repository: https://sourceforge.net/p/refind/code/ci/master/tree/
rEFInd-theme: https://github.com/topics/refind-theme
rEFInd Booting Tutorial - Zhihu: https://zhuanlan.zhihu.com/p/67114559
Obtaining the Binary Files#
The rEFInd Boot Manager: Getting rEFInd:
https://www.rodsbooks.com/refind/getting.html
↑ In the above page, the "A binary zip file" link points to the download location for the compiled files. Extract them for later use.
Mounting the ESP Partition and Setting Access Permissions in Windows#
Open cmd or PowerShell with administrator privileges and execute the following commands, where select disk 0
and select par 3
are the disk or partition numbers for my current setup:
# Enter the tool
diskpart
# —— After entering, comments are no longer supported, so please copy the commands line by line
# List disks
list disk
# Select the disk where the EFI partition is located
select disk 0
# List partitions
list par
# Select the ESP/EFI partition
select par 3
# Automatically assign a drive letter
ass
# Obtain permissions (after selecting the partition with select par <serid>, the system needs to be restarted)
set id=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
# Restore permissions (after selecting the partition with select par <serid>)
set id=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
Placing the rEFInd Files in the EFI Partition#
Copy the "refind" folder from the downloaded files to the EFI partition, where E
is the drive letter assigned earlier with the ass
command:
refind-bin-0.13.3.1\refind
→E:\EFI\refind
;
Copy or rename:
refind\refind.conf-sample
→refind\refind.conf
;
Adding to UEFI Boot Entries#
EasyUEFI is not user-friendly, but I found that DiskGenius
can also achieve the same result;
"- Can this software also be used for the operations that were previously unhidden -"
-
"Tools" → "Set UEFI/BIOS Boot Entries";
-
"Add" → "Select partition: EFI partition" → "Boot file: \EFI\refind\refind_x64.efi";
-
Select the newly added entry from the left list → "Boot Entry Name:
rEFInd
" → click "Save Current Boot Entry Settings" → "Move Up" the entry to the first position; -
(Optional) Check the "Hidden" attribute for "Windows Boot Manager" → "Save Current Boot Entry Settings";
Custom Configuration and Themes#
# /e/EFI/deepin$
ls *.efi
fbx64.efi* grub.efi* grubx64.efi* mmx64.efi* shimx64.efi*
The above are just some of the EFI files in the Deepin boot directory, each of which will be recognized by rEFInd as a boot entry;
Additionally, it directly scans Linux kernels to identify bootable entries;
In short, by default, there will be various duplicate icons, which need to be excluded through customization;
# Timeout
timeout 0
# Not sure what this is
use_nvram false
# Disable kernel discovery
scan_all_linux_kernels false
# Exclude files, for Deepin, only keep grubx64.efi
dont_scan_files grub.efi, fbx64.efi, mmx64.efi, shimx64.efi
# The above dont_scan_files does not exclude all efi files, which will overlap with the menuentry below;
# So, in general, there is no need to use the menuentry command to define entries, as the icons will be automatically matched and recognized;
# menuentry "Deepin" {
# icon /EFI/refind/themes/rEFInd-minimal/icons/os_deepin.png
# loader /EFI/deepin/grubx64.efi
# }
# menuentry "Windows" {
# icon /EFI/refind/themes/rEFInd-minimal/icons/os_win.png
# loader /EFI/Microsoft/Boot/bootmgfw.efi
# }
include themes/rEFInd-minimal/theme.conf