Arch Linux Installation---gpt--boot Chapter

Source: Internet
Author: User
Tags stub arch linux

New into a second-hand X240, directly formatted, loaded ArchLinux.

First, the Boot program installation---------------

1. First figure out what UEFI is

boot sequence under under Uefi
  1. System switched on. The Power on Self Test (POST) is executed.
  2. UEFI firmware is loaded. Firmware initializes the hardware required for booting.
  3. Firmware reads the boot entries in the Firmware ' s boot Manager to determine which UEFI application to is launched and from where (i.e. from which disk and partition).
  4. Firmware launches the UEFI application.
    • This could was the Arch kernel itself (since efistub is enabled by default).
    • It could is some other application such as a shell or a graphical boot manager.
    • Or The boot entry could simply be a disk. In this case the firmware looks for a EFI System Partition on that disk and tries to run the fallback UEFI application (on BOOTIA32.EFI 32-bit systems). This is what UEFI bootable thumb drives work.

If Secure Boot is enabled, the Boot process would verify authenticity of the EFI binary by signature.

Note: on some (poorly-designed) UEFI systems, the only-to-boot is using a disk boot entry with the FALLBAC K UEFI application path.

EFI System Partition

    • Must be a physical partition (LVM not supported, soft raid, etc.)
    • The ESP partition is independent of the operating system, and EFI firmware directly reads the bootloader and startup programs within that partition.
    • It is recommended to set the 512M size.
    • Install the grub and efibootmgr,grub subsequent installation scripts to create an. EFI executable using Efibootmgr.
    • EFI boot does not require bootloader, and the boot entry can be written directly to the EFI boot entry via the Efibootmgr or EFI shell.
#备注内容 (excerpt from Archwiki) the EFI System Partition (also called ESP or Efisys) isA FAT32 formatted physical partition (inchThe main partition table of the disk, not under LVM or software RAID etc.) from whereThe UEFI firmware launches the UEFI bootloader and application. It isAn OS independent partition that acts asThe Storage Place forThe EFI bootloaders and applications to is launched by the EFI firmware. It isRecommended to keep ESP size at +MiB Although smaller/larger sizes is fine. Install the packages grub and efibootmgr. GRUB isthe bootloader, Efibootmgr creates bootable. EFI stub entries used by the GRUB installation script. The following steps, install its modules to/boot/grub/x86_64-efi, and place the bootable Grubx64.efi stub inesp/efi/Grub. First, tell GRUB-to-use UEFI,SetThe Boot directory andSetThe bootloader ID.

2. Install Grub boot program and Efibootmgr

#pacman-S Grub  
#grub-install--target=x86_64-efi--efi-directory=esp--bootloader-id=grub
#利用efibootmgr的功能, create the EFI boot boot file Grubx64.efi
#上面一条命令, specify the path to X86_64-efi and Grubx64.efi so that when the EFI firmware accesses the ESP partition, loads the bootloader, runs Grubx64.efi, reads Grub.cfg
# and is --efi-directory --bootloader-id specific to GRUB UEFI. --efi-directory Specifies the mountpoint of the ESP

3, Configuration Grub.cfg

Grub-mkconfig-o/boot/grub/grub.cfg

For more information about GRUB, see Https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file

Https://wiki.archlinux.org/index.php/EFISTUB

Https://wiki.archlinux.org/index.php/Arch_boot_process

--Add, when we give the hard disk first partition, we will find that the 34th sector began, the principle of the following, from other places----

Protect MBR

The protection MBR contains a DOS partition table (LBA0) that contains only one partition entry with a type value of 0xEE, an entire disk on a disk less than 2TB, and a fixed size of 2TB on a larger disk. It is intended to prevent disk tools that do not recognize GPT partitions from attempting to format them, so the sector is called "protected mbr." In fact, EFI does not use this partition table at all.

EFI section

The EFI section can also be divided into 4 areas: the EFI Information area (GPT header), the partition table, the GPT partition, and the backup area.

EFI Information area (GPT header)
LBA1, which starts on disk, usually consumes only this single sector. Its role is to define the location and size of the partitioned table. The GPT header also contains the checksum of the header and partition tables so that errors can be found in a timely manner.
Partition table
The partition table area contains the partition table entry. This area is defined by the GPT header, which generally occupies the disk lba2~lba33 sector. Each partition entry in a partitioned table consists of a start address, an end address, a type value, a name, a property flag, and a GUID value. After the partition table is established, the 128-bit GUID is unique to the system.
GPT Partition
The largest region, composed of sectors assigned to partitions. The start and end addresses of this area are defined by the GPT header.
Backup area
The
backup area is at the end of the disk and contains a backup of the GPT header and partition table. It occupies 33 sectors between the GPT end sector and the EFI end sector. The last sector is used to back up the EFI information for Sector 1th, and the remaining 32 sectors are used to back up the partition table for the LBA2~LBA33 sector.
EFI Information Area data structure

The EFI information area is located on the disk's number 1th sector (LBA1), also known as the GPT header. The specific structure is shown in the following table

EFI Information area structure
Relative byte offset
(hex)
Number of bytes description [integers are expressed in little endian mode]
00~07 8 GPT header Signature "All-in-A-box" (ASCII code "EFI part")
08~0b 4 Version number, currently 1.0, with a value of "00 00 01 00"
0c~0f 4 The size of the GPT header (in bytes), usually "5C" (0x5C), which is 92 bytes.
10~13 4 GPT Header CRC checksum (the field itself is considered a 0 value when calculating)
14~17 4 Reserved, must be "00 00 00 00"
18~1f 8 The initial sector code for the EFI Information area (GPT header), typically "01 00 00 00 00 00 00 00", which is LBA1.
20~27 8 The sector area code of the EFI Information area (GPT header) backup location, which is the EFI zone end sector area code. Usually the last sector of the entire disk.
28~2f 8 The starting sector area of the GPT partition area, usually "0x22", or LBA34.
30~37 8 The end sector area of the GPT partition area, usually the 34th-lowest sector.
38~47 16 Disk GUID (globally unique identifier, which is synonymous with UUID)
48~4f 8 The partition table starts with the sector code, which is usually "0x02" (the "XX"), which is LBA2.
50~53 4 The total number of partition tables is usually limited to "0x80" (128).
54~57 4 Each partition table entry occupies a number of bytes, usually limited to "0x80", which is 128 bytes.
58~5b 4 Partitioned table CRC Checksum
5c~* * reserved, usually full 0 filled
Partition entry
Partition Item Structure
Relative byte offset
(hex)
Number of bytes description [integers are expressed in little endian mode]
00~0f 16 Partition type represented by GUID
10~1f 16 Partition unique identifier represented by GUID
20~27 8 The starting sector of the partition, represented by the LBA value.
28~2f 8 The end sector (inclusive) of the partition, represented by the LBA value, is usually an odd number.
30~37 8 Attribute flags for this partition
38~7f 72 UTF-16LE encoded human readable partition name, maximum 32 characters.

Note that the sector size cannot be assumed to be 512 bytes, that is, a sector may hold more than 4 partition items, or it may only be part of a partition item. That is, in addition to the first two sectors (LBA 0 and LBA 1), the GPT specification defines only the dimensions of the data structure and does not care how many sectors are used for storage.

Partition Type
Related operating Systems Guid[little Endian] meaning
None 00000000-0000-0000-0000-000000000000 Not used
None 024dee41-33e7-11d3-9d69-0008c781f39f MBR partition table
None c12a7328-f81f-11d2-ba4b-00a0c93ec93b EFI Systems partition [EFI System partition (ESP)]
None 21686148-6449-6e6f-744e-656564454649 The corresponding ASCII string for the BIOS boot partition is "hah! Idontneedefi ".
None d3bfe2de-3daf-11df-ba40-e3a556d89593 Intel Fast Flash (IFFS) partition (for Intel Rapid Start Technology)
Windows E3c9e316-0b5c-4db8-817d-f92df00215ae Microsoft Reserved Partition
Windows Ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Basic Data Partitioning
Windows De94bba4-06d1-4d40-a16a-bfd50179d6ac Windows Recovery Environment
Linux 0fc63daf-8483-4772-8e79-3d69d8477de4 Data partitioning. Linux used to use the same GUID as the Windows Basic data partition.
This new GUID was invented by GPT Fdisk and the GNU Parted developer based on the Linux legacy "8300" Partition code.
Linux a19d880f-05fc-4d3b-a006-743f0f84911e RAID partitions
Linux 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f Swap partition
Linux e6d6d379-f507-44c2-a23c-238f2a3df928 Logical Volume Manager (LVM) partitioning
Linux 8da63339-0007-60c0-c436-083ac8230908 Keep

Microsoft has further subdivided the properties of a partition: A low 4 byte represents a property independent of the partition type, and a high 4 byte represents a property related to the partition type. Microsoft currently uses the following properties:

Partition properties
Bit explain
0 System partition (the disk partitioning tool must leave this partition intact and not be modified)
1 EFI Hidden partition (EFI invisible partition)
2 A traditional BIOS bootable partition flag
60 Read-only
62 Hide
63 Do not automatically mount, that is, do not automatically assign the drive letter

Arch Linux Installation---gpt--boot Chapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.