Merge pull request #21273 from yuwata/hostname-device-tree

hostnamed: use /proc/device-tree to get chassis type
This commit is contained in:
Luca Boccassi
2021-11-10 23:15:20 +00:00
committed by GitHub
3 changed files with 5 additions and 8 deletions

View File

@@ -302,7 +302,7 @@ try_acpi:
}
try_devicetree:
r = read_one_line_file("/sys/firmware/devicetree/base/chassis-type", &type);
r = read_one_line_file("/proc/device-tree/chassis-type", &type);
if (r < 0) {
log_debug_errno(r, "Failed to read device-tree chassis type, ignoring: %m");
return NULL;

View File

@@ -219,7 +219,7 @@ int id128_get_product(sd_id128_t *ret) {
r = id128_read("/sys/class/dmi/id/product_uuid", ID128_UUID, &uuid);
if (r == -ENOENT)
r = id128_read("/sys/firmware/devicetree/base/vm,uuid", ID128_UUID, &uuid);
r = id128_read("/proc/device-tree/vm,uuid", ID128_UUID, &uuid);
if (r < 0)
return r;

View File

@@ -509,7 +509,7 @@ static int condition_test_architecture(Condition *c, char **env) {
return a == b;
}
#define DTCOMPAT_FILE "/sys/firmware/devicetree/base/compatible"
#define DTCOMPAT_FILE "/proc/device-tree/compatible"
static int condition_test_firmware_devicetree_compatible(const char *dtcarg) {
int r;
_cleanup_free_ char *dtcompat = NULL;
@@ -530,11 +530,8 @@ static int condition_test_firmware_devicetree_compatible(const char *dtcarg) {
return false;
}
/*
* /sys/firmware/devicetree/base/compatible consists of one or more
* strings, each ending in '\0'. So the last character in dtcompat must
* be a '\0'.
*/
/* /proc/device-tree/compatible consists of one or more strings, each ending in '\0'.
* So the last character in dtcompat must be a '\0'. */
if (dtcompat[size - 1] != '\0') {
log_debug("%s is in an unknown format, assuming machine is incompatible", DTCOMPAT_FILE);
return false;