---
name: "zmk.OS"
section: "5"
platform: "linux"
package: "zmk-doc"
version: "0.5.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/zmk.OS"
---

# zmk.OS(5)

module providing operating system information

## NAME

**OS** – module providing operating system information

## SYNOPSIS

```
include z.mk
$(eval $(call ZMK.Import,OS))
```

## DESCRIPTION

The module **OS** provides information about the operating system executing zmk. It can be used to provide tailored behavior and account for differences between UNIX flavours.

## TARGETS

This module does not provide any targets.

## VARIABLES

This module provides the following variables.

### OS.Kernel

Identifier of the operating system kernel.

Known values are listed in the following table.

| | |
| --- | --- |
| **Value** | **Description** |
|  |  |
| Darwin | The MacOS kernel |
| FreeBSD | The FreeBSD kernel |
| GNU/kFreeBSD | The FreeBSD kernel with GNU userspace |
| GNU | The Hurd kernel |
| Linux | All Linux kernel |
| NetBSD | The NetBSD kernel |
| OpenBSD | The OpenBSD kernel |
| SunOS | The Solaris kernel |
| Windows\_NT | The Windows kernel |
| Haiku | The Haiku kernel |

### OS.ImageFormat

Identifier or the application image format used.

| | |
| --- | --- |
| **Value** | **Description** |
|  |  |
| ELF | Used by most UNIX-like systems, except Darwin |
| Mach-O | Used by MacOS |
| PE | Used by Windows |
| MZ | Used by DOS |

Due to *cross-compiling* it is more useful to look at **Toolchain.ImageFormat** instead.

## IMPLEMENTATION NOTES

Windows is detected by the presence and specific value of the **OS** environment variable. All other kernels are identified by invoking *uname* *-s*.

## HISTORY

The **OS** module first appeared in zmk 0.1

## AUTHORS

Zygmunt Krynicki ⟨*me@zygoon.pl*⟩
