From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Developer(s)H. Peter Anvin
Stable release
2.0.7 / October 7, 2019; 11 months ago (2019-10-07)
Repository Edit this at Wikidata
Operating systemLinux
TypeRuntime library
LicenseGNU General Public License or BSD licence

In computing, klibc is a minimalistic subset of the standard C library developed by H. Peter Anvin. It was developed mainly to be used during the Linux startup process, and it is part of the early user space, i.e. components used during kernel startup, but which do not run in kernel mode.[1] These components do not have access to the standard library (usually glibc) used by normal userspace programs.

The development of klibc library was part of the 2002 effort to move some Linux initialization code out of the kernel.[2][3][4] According to its documentation, the klibc library is optimized for correctness and small size.[1] Because of its design, klibc is also technically suitable for embedded software in general, and even some full-featured programs such as the MirBSD Korn Shell. klibc is licensed under the full GPL license, which (unlike LGPL) imposes itself on any code linked with it. (This only applies to klibc as a whole due to embedding some Linux kernel derived files; most of the library source code is actually[5] available under a BSD licence from UCB or the Historical Permission Notice and Disclaimer.) This may limit its applicability to proprietary embedded software.[6]

During the Linux startup process, klibc is loaded from within a temporary RAM file system, initramfs. It is incorporated by default into initial RAM file systems that are created by the mkinitramfs script in Debian[7] and Ubuntu. Furthermore, it has a set of small Unix utilities that are useful in early user space: cpio, dash, fstype, mkdir, mknod, mount, nfsmount, run-init, etc. all using the klibc library.[8] An alternate strategy is to include everything in one executable, like BusyBox, which determines the requested applet via arguments or hard links or symlinks.


  1. ^ a b http://free-electrons.com/kerneldoc/latest/early-userspace/README
  2. ^ Jonathan Corbet, (November 2002) Initramfs arrives, LWN.net
  3. ^ "initramfs merge, part 1 of N". 2002-02-11.
  4. ^ "Re: initramfs merge, part 1 of N". 2002-02-11.
  5. ^ "LICENSE\klibc\usr - klibc/klibc.git - klibc main development tree". git.kernel.org. Archived from the original on 10 July 2012. Retrieved 23 April 2018.
  6. ^ Hagen, William W. (2006). The Definitive Guide to GCC, Second Edition. Berkeley, CA: APress. pp. 286–289. ISBN 1-59059-585-8.
  7. ^ Debian Wheezy Klibc.
  8. ^ "libs/klibc/klibc.git / tree". Archived from the original on 2012-07-08.

External links[edit]