ZMK.OS(5)
β¨ zmk.OS(5) β the manual page, bestie edition β¨
okay so real talk, this is the local manual page for the OS module in zmk β it's section 5 of the manual, so you're in the right place, you didn't take a wrong turn at the filesystem, we love that for you π
πΈ NAME πΈ
OS β the module that hands you all the deets about the operating system that's out here running zmk π
π SYNOPSIS π
so to actually use it, you drop this in your makefile situation:
include z.mk
$(eval $(call ZMK.Import,OS))
and boom, that's it, you're in π«Ά
π¦ DESCRIPTION π¦
The OS module is literally your little informant β it provides info about the operating system that's executing zmk. It's giving "I know a guy". You use it to tailor your behavior and to account for the differences between all the UNIX flavours out there, because they are not the same and pretending they are is how you end up crying at 3am π
π TARGETS π
This module does not provide any targets.
(yeah, zero, none, nada β it's not that kind of module, it's purely here to spill the tea β)
π VARIABLES π
This module provides the following variables. Obsessed with them, honestly.
β OS.Kernel β
Identifier of the operating system kernel. Basically "which kernel are we on, bestie?"
Known values are listed right here, no gatekeeping:
Darwinβ The MacOS kernelFreeBSDβ The FreeBSD kernelGNU/kFreeBSDβ The FreeBSD kernel with GNU userspaceGNUβ The Hurd kernelLinuxβ All Linux kernelNetBSDβ The NetBSD kernelOpenBSDβ The OpenBSD kernelSunOSβ The Solaris kernelWindows_NTβ The Windows kernelHaikuβ The Haiku kernel
π§ OS.ImageFormat π§
Identifier or the application image format used. (yes, the original says "or", not "of", we keep it exactly as it is, we do not edit the ancestors π)
The values, served fresh:
ELFβ Used by most UNIX-like systems, except DarwinMach-Oβ Used by MacOSPEβ Used by WindowsMZβ Used by DOS
heads up bestie: due to cross-compiling it is more useful to look atToolchain.ImageFormatinstead. Like, genuinely, that's the one you want.OS.ImageFormatis lowkey the wrong vibe check when you're cross-compiling π
π IMPLEMENTATION NOTES π
The way this actually works is kinda iconic:
- Windows is detected by the presence and specific value of the
OSenvironment variable. - All other kernels are identified by invoking
uname -s.
periodt. that's the whole trick π
π HISTORY π
The OS module first appeared in zmk 0.1 β a real OG, been here since day one, main character energy from the start π
π AUTHORS π
Zygmunt Krynicki <me@zygoon.pl> β thank you for your service, we salute you π«‘
and that's the whole page, no notes, you ate that π
this was brought to you by zmk 0.5.1, dated May 3, 2020, and it's the zmk.OS(5) page so you know exactly where to find it again πβ¨ bye bestie, go write some portable makefiles π¦
π¦ where this page comes from
- debian bookworm: zmk-doc 0.5.1-2 Β· LGPL-3.0-only
- debian trixie: zmk-doc 0.5.1-2 Β· LGPL-3.0-only
- ubuntu jammy: zmk-doc 0.5.1-2 Β· LGPL-3.0-only
- ubuntu noble: zmk-doc 0.5.1-2 Β· LGPL-3.0-only
- ubuntu questing: zmk-doc 0.5.1-2
- ubuntu resolute: zmk-doc 0.5.1-2build1 Β· LGPL-3.0-only
- ubuntu stonking: zmk-doc 0.5.1-2build1 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms