summaryrefslogtreecommitdiff
path: root/src/shared/gpt.h
Commit message (Collapse)AuthorAgeFilesLines
* gpt: add helpers for deriving data partition from verity or verity sig ↵Lennart Poettering2022-12-061-0/+2
| | | | | | | designator let's add the inverse of the existing partition_verity_of() and partition_verity_sig_of()
* gpt: Drop PARTITION_LINUX_GENERIC and PARTITION_USER_HOMEDaan De Meyer2022-11-221-2/+0
| | | | | | | | These don't have an inherent purpose, and aren't used throughout the codebase, so let's simplify things and remove these. See https://github.com/systemd/systemd/pull/24803#discussion_r1028190421 for more information.
* gpt: Expose GptPartitionType and get rid of SECONDARY/OTHERDaan De Meyer2022-11-151-25/+6
| | | | | | | | | | | | Instead of exposing just the partition type UUID, let's expose the GptPartitionType struct, which has a lot more information available in a much more accessible way. Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These were only there to support preferred architectures in dissect-image.c, but we can easily handle that by comparing architectures when we decide whether to override a partition. This is done in a new function compare_arch().
* gpt: Add gpt_partition_type_mountpoint_nulstr()Daan De Meyer2022-11-101-0/+2
|
* gpt: Replace bitfields with designator field in GptPartitionTypeDaan De Meyer2022-11-101-7/+43
| | | | | To achieve this we move the PartitionDesignator enum from dissect-image.h to gpt.h
* shared: Add GPT_PARTITION_TYPE_UUID_TO_STRING_HARDER()Daan De Meyer2022-09-221-0/+3
|
* headers: export partition uuids and flags in new sd-gpt.h fileZbigniew Jędrzejewski-Szmek2022-09-201-289/+1
| | | | | | I think those constants are generally useful. It's quite easy to make a mistake when copying things from the docs, so let's make them easy and convenient to access.
* gpt: fix native uuids for s390xYu Watanabe2022-08-221-10/+10
| | | | | __s390__ is defined for both s390 and s390x. Hence, we need to define the native uuids for s390x at first.
* gpt: add PARISC UUIDsSam James2022-06-281-0/+6
| | | | Not doing PARISC64 for now as no userland exists for it yet.
* share/gpt: add stringified defines for GPT partition typesZbigniew Jędrzejewski-Szmek2022-02-151-9/+18
|
* sd128: export sd_id128_to_uuid_string()Lennart Poettering2022-02-141-1/+1
| | | | | | | | | We expose various other forms of UUID helpers already, i.e. SD_ID128_UUID_FORMAT_STR and SD_ID128_MAKE_UUID_STR(), and we parse UUIDs, hence add a high-level helper for formatting UUIDs too. This doesn't add any new code, it just moves some helpers id128-util.[ch] → sd-id128.[ch], to make them public.
* gpt: Store the partition type in GptPartitionTypeDaan De Meyer2021-11-241-0/+9
| | | | This replaces the _GPT_ALL_ARCHES macro.
* gpt: Store the architecture in GptPartitionTypeDaan De Meyer2021-11-241-0/+4
| | | | | We also add a function gpt_partition_type_uuid_to_arch() to get the architecture of a partition type uuid.
* gpt: Rename PPC64LE TO PPC64_LEDaan De Meyer2021-11-241-12/+12
| | | | For consistency with ARCHITECTURE_PPC64_LE
* shared/gpt: fix bit-flip in LoongArch root partition UUIDZbigniew Jędrzejewski-Szmek2021-11-191-1/+1
| | | | | | | | | | | | | 4e767154891083069a58c5c960f386974ad87fb4 added a slightly different UUID in the header and in the docs. This makes the code match the docs. > As some downstream projects are already using the UUID as in the docs, most > notably util-linux [1], we should adjust code to match doc; no shipping > LoongArch systems are using upstream systemd, and no open-source distro is > merging LoongArch support yet, so the change should break no one. This also > matches the work being done by @yetist at loongarch64/systemd#7. [1] https://github.com/util-linux/util-linux/commit/2d29fccaad267d1b003dc0ed2bb9634ff76f3e49
* docs: generate table from header using a scriptZbigniew Jędrzejewski-Szmek2021-11-191-10/+10
| | | | | | | | | | | | | | This adds a helper script: $ python3 tools/list-discoverable-partitions.py <src/shared/gpt.h <!-- generated with tools/list-discoverable-partitions.py --> | Partition Type UUID | Name | Allowed File Systems | Explanation | |---------------------|------|----------------------|-------------| | _Root Partition (Alpha)_ | `6523f8ae-3eb1-4e2a-a05a-18b695ae656f` | [Root Partition] | [Root Partition more] | | _Root Partition (ARC)_ | `d27f46ed-2919-4cb8-bd25-9531f3c16534` | ditto | ditto | ... The output can be pasted into the markdown file. I think this works better than trying to match the two lists by hand.
* shared/gpt: ARM_64 → ARM64Zbigniew Jędrzejewski-Szmek2021-11-191-12/+12
| | | | "arm64" is generally written without the underscore.
* shared/gpt: add entries for a bunch of architecturesZbigniew Jędrzejewski-Szmek2021-11-191-2/+125
| | | | | | | | | | | | | | | I don't think we want people to send us pull requests over the next two years. Let's just make something up ourselves, this is going to have at least as good results, and will be much quicker. Note that this only includes architectures for which there's some indication that they are in active use. In architecture.h there are some more esoteric ones like ARC_BE. We can add those if there's some actual user demand. In particular, I included everything on the Debian "List of official ports" [1] and a few other arches that we have received patches for in recent times. [1] https://www.debian.org/ports/#portlist-released
* shared/gpt: reorder arches alphabeticallyZbigniew Jędrzejewski-Szmek2021-11-191-52/+47
| | | | It's just too annoying to add new ones otherwise.
* shared/gpt: drop outdated commentZbigniew Jędrzejewski-Szmek2021-11-191-4/+0
| | | | C.f. 1fb2d8fcb69bcdbab0a5dd23bbf02f729e47e656.
* gpt: add partition type for PKCS#7 signatures for root hashesLennart Poettering2021-09-281-0/+38
|
* gpt: reformat for restoring vertical alignmentWANG Xuerui2021-07-201-39/+39
|
* gpt: support LoongArch 64-bitWANG Xuerui2021-07-201-2/+14
|
* repart: make No-Auto GPT partition flag configurable tooLennart Poettering2021-06-181-0/+1
| | | | | | | | | | | | | | This is useful for provisioning initially empty secondary A/B root file systems. We don't want those to ever be considered for automatic mounting, for example in "systemd-nspawn --image=", hence we should create them with the No-Auto flag turned on. Once a file system image is dropped into the partition the flag may be turned off by the updater tool, so that it is considered from then on. Thew new option for this is called NoAuto. I dislike negated options like this, but this is taken from the naming in the spec, which in turn inherited the name from the same flag for Microsoft Data Partitions. To minimize confusion, let's stick to the name hence.
* gpt: introduce GPT_LAVEL_MAXYu Watanabe2021-05-121-0/+3
|
* repart: add GrowFileSystem= setting to set new GPT partition flag for newly ↵Lennart Poettering2021-04-231-0/+1
| | | | | | created partitions And set it to on by default, except if partition is marked read-only.
* dissect: look for new GPT partition flag marking partitions for growingLennart Poettering2021-04-231-1/+2
| | | | | | | | | | | | | | | systemd-repart can grow partitions dynamically at boot, but it won't grow the file systems inside them. In /etc/fstab you can request that via x-systemd.growfs. So far we didn't have a nice scheme for images with GPT auto-discovery however, and that meant in particular in tools such as systemd-nspawn the file systems couldn't be grown automatically. Let's address this: let's define a new GPT partition flag that can be set for our partition types. If set it indicates that the file system should be grown to the partition size on mount. This commit adds the flag and adds code to discover it when dissecting images. There's no code yet to actually do something about it.
* repart: add new ReadOnly= and Flags= settings for repart dropinsLennart Poettering2021-04-191-0/+2
| | | | | | | | | | | | | Let's make the GPT partition flags configurable when creating new partitions. This is primarily useful for the read-only flag (which we want to set for verity enabled partitions). This adds two settings for this: Flags= and ReadOnly=, which strictly speaking are redundant. The main reason to have both is that usually the ReadOnly= setting is the one wants to control, and it' more generic. Moreover we might later on introduce inherting of flags from CopyBlocks= partitions, where one might want to control most flags as is except for the RO flag and similar, hence let's keep them separate.
* gpt: add some simple helpers for categorizing GPT partition typesLennart Poettering2021-04-191-0/+5
|
* gpt: generalize validator for GPT partition labelsLennart Poettering2021-03-041-0/+2
| | | | | | | This adds a proper validator function. No change in behaviour, just some minor refactoring (this should be useful elsewhere later on though)
* treewide: fix spellingJoerg Behrmann2021-02-251-1/+1
|
* gpt: add RISC-V GPT partition typecode uuidDimitri John Ledkov2020-11-231-0/+22
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* gpt: add new GPT partition types of /usr partitionsLennart Poettering2020-09-191-5/+29
|
* gpt: move GPT_LINUX_GENERIC definition next to the user GPT partition typesLennart Poettering2020-09-161-24/+21
| | | | No code changes, just some reordering.
* Merge pull request #14696 from poettering/dissect-tweaksAnita Zhang2020-01-301-0/+2
|\ | | | | various tweaks to the image dissection logic
| * dissect: complain if partition flags are set that we don't knowLennart Poettering2020-01-291-0/+2
| |
* | home: add new systemd-homed service that can manage LUKS homesLennart Poettering2020-01-281-0/+1
|/ | | | Fixes more or less: https://bugs.freedesktop.org/show_bug.cgi?id=67474
* systemd-id128: add new verb to print GPT partitions UUIDsZbigniew Jędrzejewski-Szmek2020-01-231-0/+7
|
* shared/gpt: export gpt_partition_type_uuid_{to,from}_string functionsZbigniew Jędrzejewski-Szmek2020-01-231-0/+8
|
* dissect: introduce new recognizable partition types for /var and /var/tmpLennart Poettering2019-12-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has been requested many times before. Let's add it finally. GPT auto-discovery for /var is a bit more complex than for other partition types: the other partitions can to some degree be shared between multiple OS installations on the same disk (think: swap, /home, /srv). However, /var is inherently something bound to an installation, i.e. specific to its identity, or actually *is* its identity, and hence something that cannot be shared. To deal with this this new code is particularly careful when it comes to /var: it will not mount things blindly, but insist that the UUID of the partition matches a hashed version of the machine-id of the installation, so that each installation has a very specific /var associated with it, and would never use any other. (We actually use HMAC-SHA256 on the GPT partition type for /var, keyed by the machine-id, since machine-id is something we want to keep somewhat private). Setting the right UUID for installations takes extra care. To make things a bit simpler to set up, we avoid this safety check for nspawn and RootImage= in unit files, under the assumption that such container and service images unlikely will have multiple installations on them. The check is hence only required when booting full machines, i.e. in in systemd-gpt-auto-generator. To help with putting together images for full machines, PR #14368 introduces a repartition tool that can automatically fill in correctly calculated UUIDs on first boot if images have the var partition UUID initialized to all zeroes. With that in place systems can be put together in a way that on first boot the machine ID is determined and the partition table automatically adjusted to have the /var partition with the right UUID.
* gpt: add definition for boot loader spec partitionLennart Poettering2019-03-011-0/+1
| | | | | | As listed in the boot loader spec since a long time: https://systemd.io/BOOT_LOADER_SPECIFICATION#technical-details
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: remove some double newlines in headers, tooLennart Poettering2018-05-221-1/+0
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* dissect: don't honour NOAUTO flags when looking for ESP (#5224)Lennart Poettering2017-02-071-0/+2
| | | | | | | | | | The flag is originally defined for "basic data partitions", but not for the ESP. We reuse it for the various partitions defined by the Discoverable Partitions Spec, but it isn't defined for the ESP, hence don't check for it. Instead, do check for GPT_FLAG_NO_BLOCK_IO_PROTOCOL, as that flag actually is defined for all partition types, and recommended to use by the UEFI spec. Fixes: #5218
* nspawn/dissect: automatically discover dm-verity verity partitionsLennart Poettering2016-12-071-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for discovering and making use of properly tagged dm-verity data integrity partitions. This extends both systemd-nspawn and systemd-dissect with a new --root-hash= switch that takes the root hash to use for the root partition, and is otherwise fully automatic. Verity partitions are discovered automatically by GPT table type UUIDs, as listed in https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ (which I updated prior to this change, to include new UUIDs for this purpose. mkosi with https://github.com/systemd/mkosi/pull/39 applied may generate images that carry the necessary integrity data. With that PR and this commit, the following simply lines suffice to boot up an integrity-protected container image: ``` # mkdir test # cd test # mkosi --verity # systemd-nspawn -i ./image.raw -bn ``` Note that mkosi writes the image file to "image.raw" next to a a file "image.roothash" that contains the root hash. systemd-nspawn will look for that file and use it if it exists, in case --root-hash= is not specified explicitly.
* tree-wide: place #pragma once at the same place everywhereLennart Poettering2016-02-201-2/+2
| | | | | | Usually, we place the #pragma once before the copyright blurb in header files, but in a few cases we didn't. Move those around, so that we do the same thing everywhere.