Help us shape the future of Go! Take the 2026 Go Developer Survey

linuxdt

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package linuxdt reads identity information from the Linux DeviceTree, exposed by the kernel under /sys/firmware/devicetree/base. It is the DeviceTree counterpart to the linuxdmi package and is used as a fallback on systems (most ARM/RISC-V boards) that have no DMI/SMBIOS tables.

All knowledge of DeviceTree property names and layout lives here: callers ask for a piece of identity (Model, Vendor, SerialNumber, ...) and never deal with raw property paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(ctx context.Context) bool

Available returns true if the DeviceTree firmware tree is present, i.e. the host exposes /sys/firmware/devicetree/base.

func ChassisType

func ChassisType(ctx context.Context) string

ChassisType returns the SMBIOS chassis type code corresponding to the standardized DeviceTree "chassis-type" property (e.g. "34" for "embedded"), or util.UNKNOWN if the property is absent or unrecognized. Only some boards expose it.

func Model

func Model(ctx context.Context) string

Model returns the DeviceTree "model" string (e.g. "Raspberry Pi 4 Model B Rev 1.4"), or util.UNKNOWN if absent.

func SerialNumber

func SerialNumber(ctx context.Context) string

SerialNumber returns the DeviceTree "serial-number" string, or util.UNKNOWN if absent (not all boards provide one).

func SoC

func SoC(ctx context.Context) string

SoC returns the System-on-Chip identifier taken from the most specific (last) entry of the "compatible" list, e.g. "rockchip,rk3576" from "seeed,recomputer-rk3576-devkit\0rockchip,rk3576\0". The compatible list runs from most specific board to the underlying SoC, so the last entry is the SoC. Returns util.UNKNOWN if there is no compatible property.

func UBootVersion

func UBootVersion(ctx context.Context) string

UBootVersion returns the U-Boot firmware version recorded by the bootloader in the "chosen" node, or util.UNKNOWN if absent (boards using another bootloader do not provide it).

func Vendor

func Vendor(ctx context.Context) string

Vendor returns the manufacturer/vendor prefix derived from the first entry of the "compatible" property (the substring before the first comma, e.g. "raspberrypi" from "raspberrypi,4-model-b"), or util.UNKNOWN if absent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL