]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/gpt.h
58e034e83c4ef3bdfb98a9c3b18d7d9fc9d1fd1d
[thirdparty/systemd.git] / src / shared / gpt.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2014 Lennart Poettering
8 ***/
9
10 #include <endian.h>
11
12 #include "sd-id128.h"
13
14 /* We only support root disk discovery for x86, x86-64, Itanium and ARM for
15 * now, since EFI for anything else doesn't really exist, and we only
16 * care for root partitions on the same disk as the EFI ESP. */
17
18 #define GPT_ROOT_X86 SD_ID128_MAKE(44,47,95,40,f2,97,41,b2,9a,f7,d1,31,d5,f0,45,8a)
19 #define GPT_ROOT_X86_64 SD_ID128_MAKE(4f,68,bc,e3,e8,cd,4d,b1,96,e7,fb,ca,f9,84,b7,09)
20 #define GPT_ROOT_ARM SD_ID128_MAKE(69,da,d7,10,2c,e4,4e,3c,b1,6c,21,a1,d4,9a,be,d3)
21 #define GPT_ROOT_ARM_64 SD_ID128_MAKE(b9,21,b0,45,1d,f0,41,c3,af,44,4c,6f,28,0d,3f,ae)
22 #define GPT_ROOT_IA64 SD_ID128_MAKE(99,3d,8d,3d,f8,0e,42,25,85,5a,9d,af,8e,d7,ea,97)
23 #define GPT_ESP SD_ID128_MAKE(c1,2a,73,28,f8,1f,11,d2,ba,4b,00,a0,c9,3e,c9,3b)
24 #define GPT_SWAP SD_ID128_MAKE(06,57,fd,6d,a4,ab,43,c4,84,e5,09,33,c8,4b,4f,4f)
25 #define GPT_HOME SD_ID128_MAKE(93,3a,c7,e1,2e,b4,4f,13,b8,44,0e,14,e2,ae,f9,15)
26 #define GPT_SRV SD_ID128_MAKE(3b,8f,84,25,20,e0,4f,3b,90,7f,1a,25,a7,6f,98,e8)
27
28 /* Verity partitions for the root partitions above (we only define them for the root partitions, because only they are
29 * are commonly read-only and hence suitable for verity). */
30 #define GPT_ROOT_X86_VERITY SD_ID128_MAKE(d1,3c,5d,3b,b5,d1,42,2a,b2,9f,94,54,fd,c8,9d,76)
31 #define GPT_ROOT_X86_64_VERITY SD_ID128_MAKE(2c,73,57,ed,eb,d2,46,d9,ae,c1,23,d4,37,ec,2b,f5)
32 #define GPT_ROOT_ARM_VERITY SD_ID128_MAKE(73,86,cd,f2,20,3c,47,a9,a4,98,f2,ec,ce,45,a2,d6)
33 #define GPT_ROOT_ARM_64_VERITY SD_ID128_MAKE(df,33,00,ce,d6,9f,4c,92,97,8c,9b,fb,0f,38,d8,20)
34 #define GPT_ROOT_IA64_VERITY SD_ID128_MAKE(86,ed,10,d5,b6,07,45,bb,89,57,d3,50,f2,3d,05,71)
35
36 #if defined(__x86_64__)
37 # define GPT_ROOT_NATIVE GPT_ROOT_X86_64
38 # define GPT_ROOT_SECONDARY GPT_ROOT_X86
39 # define GPT_ROOT_NATIVE_VERITY GPT_ROOT_X86_64_VERITY
40 # define GPT_ROOT_SECONDARY_VERITY GPT_ROOT_X86_VERITY
41 #elif defined(__i386__)
42 # define GPT_ROOT_NATIVE GPT_ROOT_X86
43 # define GPT_ROOT_NATIVE_VERITY GPT_ROOT_X86_VERITY
44 #endif
45
46 #if defined(__ia64__)
47 # define GPT_ROOT_NATIVE GPT_ROOT_IA64
48 # define GPT_ROOT_NATIVE_VERITY GPT_ROOT_IA64_VERITY
49 #endif
50
51 #if defined(__aarch64__) && (__BYTE_ORDER != __BIG_ENDIAN)
52 # define GPT_ROOT_NATIVE GPT_ROOT_ARM_64
53 # define GPT_ROOT_SECONDARY GPT_ROOT_ARM
54 # define GPT_ROOT_NATIVE_VERITY GPT_ROOT_ARM_64_VERITY
55 # define GPT_ROOT_SECONDARY_VERITY GPT_ROOT_ARM_VERITY
56 #elif defined(__arm__) && (__BYTE_ORDER != __BIG_ENDIAN)
57 # define GPT_ROOT_NATIVE GPT_ROOT_ARM
58 # define GPT_ROOT_NATIVE_VERITY GPT_ROOT_ARM_VERITY
59 #endif
60
61 #define GPT_FLAG_NO_BLOCK_IO_PROTOCOL (1ULL << 1)
62
63 /* Flags we recognize on the root, swap, home and srv partitions when
64 * doing auto-discovery. These happen to be identical to what
65 * Microsoft defines for its own Basic Data Partitions, but that's
66 * just because we saw no point in defining any other values here. */
67 #define GPT_FLAG_READ_ONLY (1ULL << 60)
68 #define GPT_FLAG_NO_AUTO (1ULL << 63)
69
70 #define GPT_LINUX_GENERIC SD_ID128_MAKE(0f,c6,3d,af,84,83,47,72,8e,79,3d,69,d8,47,7d,e4)