pmb: Also apply ext4 metadata_csum workaround for archived ports

Ports in the archived category may be downstream ports. While mainline
ports also are allowed, archived ports should generally not be relied on
anyway so the loss of ext4 reliability on those shouldn't matter.

Fixes 89a80265de

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2640
This commit is contained in:
Newbyte 2025-07-07 15:04:28 +02:00
parent 3c1699b5c1
commit 7b78bcfcf9
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 17 additions and 2 deletions

View file

@ -51,6 +51,21 @@ class DeviceCategory(Enum):
DeviceCategory.DOWNSTREAM,
]
def allows_downstream_ports(self) -> bool:
"""Check whether a given category is allowed to contain downstream ports. This does not
necessarily mean that it exclusively contains downstream ports.
:returns: True, if the category allows downstream ports, False if only allows mainline ports.
"""
match self:
case DeviceCategory.ARCHIVED | DeviceCategory.DOWNSTREAM:
return True
case DeviceCategory.TESTING | DeviceCategory.COMMUNITY | DeviceCategory.MAIN:
return False
case _:
raise AssertionError
def explain(self) -> str:
"""Provide an explanation of a given category.

View file

@ -1,7 +1,7 @@
# Copyright 2023 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.helpers import logging
from pmb.helpers.devices import get_device_category_by_name, DeviceCategory
from pmb.helpers.devices import get_device_category_by_name
import pmb.chroot
from pmb.core import Chroot
from pmb.core.context import get_context
@ -177,7 +177,7 @@ def format_and_mount_root(
if filesystem == "ext4":
device_category = get_device_category_by_name(get_context().config.device)
if device_category == DeviceCategory.DOWNSTREAM:
if device_category.allows_downstream_ports():
# Some downstream kernels don't support metadata_csum (#1364).
# When changing the options of mkfs.ext4, also change them in the
# recovery zip code (see 'grep -r mkfs\.ext4')!