LKL (Linux Kernel Library) is aiming to allow reusing the Linux kernel code
as extensively as possible with minimal effort and reduced maintenance
overhead.

Examples of how LKL can be used are: creating userspace applications
(running on Linux and other operating systems) that can read or write Linux
filesystems or can use the Linux networking stack, creating kernel drivers
for other operating systems that can read Linux filesystems, bootloaders
support for reading/writing Linux filesystems, etc.

With LKL, the kernel code is compiled into an object file that can be
directly linked by applications. The API offered by LKL is based on the
Linux system call interface.

LKL is implemented as an architecture port in arch/lkl. It relies on host
operations defined by the application or a host library (tools/lkl/lib).

The latest LKL version can be found at g...@github.com:lkl/linux.git

FAQ
===

Q: How is LKL different from UML?
A: UML provides a full OS environment (e.g. user/kernel separation, user
processes) and also has requirements (a filesystem, processes, etc.) that
makes it hard to use it for standalone applications. UML also relies
heavily on Linux hosts. On the other hand LKL is designed to be linked
directly with the application and hence does not have user/kernel
separation which makes it easier to use it in standalone applications.

Q: How is LKL different from LibOS?
A: LibOS re-implements high-level kernel APIs for timers, softirqs,
scheduling, sysctl, SLAB/SLUB, etc. LKL behaves like any arch port,
implementing the arch level operations requested by the Linux kernel. LKL
also offers a host interface so that support for multiple hosts can be
easily implemented.


Building LKL the host library and LKL applications
==================================================

% cd tools/lkl
% make

will build LKL as a object file, it will install it in tools/lkl/lib together
with the headers files in tools/lkl/include then will build the host library,
tests and a few of application examples:

* tests/boot - a simple applications that uses LKL and exercises the basic
LKL APIs

* fs2tar - a tool that converts a filesystem image to a tar archive

* cptofs/cpfromfs - a tool that copies files to/from a filesystem image


Supported hosts
===============

Currently LKL supports POSIX and Windows userspace applications. New hosts
can be added relatively easy if the host supports gcc and GNU ld. Previous
versions of LKL supported Windows kernel and Haiku kernel hosts.


Octavian Purdila (28):
  asm-generic: atomic64: allow using generic atomic64 on 64bit platforms
  kbuild: allow architectures to automatically define kconfig symbols
  lkl: architecture skeleton for Linux kernel library
  lkl: host interface
  lkl: memory handling
  lkl: kernel threads support
  lkl: interrupt support
  lkl: system call interface and application API
  lkl: timers, time and delay support
  lkl: memory mapped I/O support
  lkl: basic kernel console support
  init: allow architecture code to overide run_init_process
  lkl: initialization and cleanup
  lkl: plug in the build system
  lkl tools: skeleton for host side library, tests and tools
  lkl tools: host lib: add lkl_strerror and lkl_printf
  lkl tools: host lib: memory mapped I/O helpers
  lkl tools: host lib: virtio devices
  lkl tools: host lib: virtio block device
  lkl tools: host lib: filesystem helpers
  lkl tools: host lib: posix host operations
  lkl tools: "boot" test
  lkl tools: tool that converts a filesystem image to tar
  lkl tools: tool that reads/writes to/from a filesystem image
  signal: use CONFIG_X86_32 instead of __i386__
  asm-generic: vmlinux.lds.h: allow customized rodata section name
  lkl: add support for Windows hosts
  lkl tools: add support for Windows host

 MAINTAINERS                             |   6 +
 Makefile                                |   1 +
 arch/lkl/.gitignore                     |   1 +
 arch/lkl/Kconfig                        |  83 ++++++
 arch/lkl/Makefile                       |  39 +++
 arch/lkl/auto.conf                      |   1 +
 arch/lkl/defconfig                      |  35 +++
 arch/lkl/include/asm/Kbuild             |  77 +++++
 arch/lkl/include/asm/bitsperlong.h      |  11 +
 arch/lkl/include/asm/byteorder.h        |  10 +
 arch/lkl/include/asm/dma-mapping.h      |   6 +
 arch/lkl/include/asm/elf.h              |  13 +
 arch/lkl/include/asm/host_ops.h         |   9 +
 arch/lkl/include/asm/io.h               | 104 +++++++
 arch/lkl/include/asm/irq.h              |  10 +
 arch/lkl/include/asm/mutex.h            |   7 +
 arch/lkl/include/asm/page.h             |  13 +
 arch/lkl/include/asm/pgtable.h          |  60 ++++
 arch/lkl/include/asm/processor.h        |  53 ++++
 arch/lkl/include/asm/ptrace.h           |  23 ++
 arch/lkl/include/asm/setup.h            |  12 +
 arch/lkl/include/asm/thread_info.h      |  82 +++++
 arch/lkl/include/asm/unistd.h           |  93 ++++++
 arch/lkl/include/asm/vmlinux.lds.h      |  10 +
 arch/lkl/include/system/stdarg.h        |   1 +
 arch/lkl/include/uapi/asm/Kbuild        |  38 +++
 arch/lkl/include/uapi/asm/bitsperlong.h |  12 +
 arch/lkl/include/uapi/asm/host_ops.h    |  81 +++++
 arch/lkl/include/uapi/asm/irq.h         |  37 +++
 arch/lkl/include/uapi/asm/sigcontext.h  |  15 +
 arch/lkl/include/uapi/asm/unistd.h      | 256 ++++++++++++++++
 arch/lkl/kernel/Makefile                |   3 +
 arch/lkl/kernel/asm-offsets.c           |   1 +
 arch/lkl/kernel/console.c               |  41 +++
 arch/lkl/kernel/irq.c                   | 131 ++++++++
 arch/lkl/kernel/mem.c                   |  67 +++++
 arch/lkl/kernel/misc.c                  |  57 ++++
 arch/lkl/kernel/setup.c                 | 176 +++++++++++
 arch/lkl/kernel/syscalls.c              | 213 +++++++++++++
 arch/lkl/kernel/threads.c               | 235 +++++++++++++++
 arch/lkl/kernel/time.c                  | 125 ++++++++
 arch/lkl/kernel/vmlinux.lds.S           |  45 +++
 arch/lkl/scripts/headers_install.py     | 117 ++++++++
 include/asm-generic/atomic64.h          |   2 +
 include/asm-generic/vmlinux.lds.h       |   9 +-
 include/linux/atomic.h                  |   2 +-
 include/linux/compiler-gcc.h            |   4 +
 init/main.c                             |   4 +-
 kernel/signal.c                         |   2 +-
 scripts/Makefile                        |   2 +
 scripts/link-vmlinux.sh                 |  12 +-
 tools/lkl/.gitignore                    |   4 +
 tools/lkl/Makefile                      |  47 +++
 tools/lkl/cptofs.c                      | 467 +++++++++++++++++++++++++++++
 tools/lkl/fs2tar.c                      | 397 ++++++++++++++++++++++++
 tools/lkl/include/.gitignore            |   1 +
 tools/lkl/include/lkl.h                 | 110 +++++++
 tools/lkl/include/lkl_host.h            |  44 +++
 tools/lkl/lib/.gitignore                |   3 +
 tools/lkl/lib/fs.c                      | 218 ++++++++++++++
 tools/lkl/lib/iomem.c                   | 119 ++++++++
 tools/lkl/lib/iomem.h                   |  14 +
 tools/lkl/lib/nt-host.c                 | 227 ++++++++++++++
 tools/lkl/lib/posix-host.c              | 206 +++++++++++++
 tools/lkl/lib/utils.c                   | 177 +++++++++++
 tools/lkl/lib/virtio.c                  | 365 +++++++++++++++++++++++
 tools/lkl/lib/virtio.h                  |  94 ++++++
 tools/lkl/lib/virtio_blk.c              | 116 +++++++
 tools/lkl/tests/boot.c                  | 514 ++++++++++++++++++++++++++++++++
 tools/lkl/tests/boot.sh                 |  10 +
 70 files changed, 5570 insertions(+), 10 deletions(-)
 create mode 100644 arch/lkl/.gitignore
 create mode 100644 arch/lkl/Kconfig
 create mode 100644 arch/lkl/Makefile
 create mode 100644 arch/lkl/auto.conf
 create mode 100644 arch/lkl/defconfig
 create mode 100644 arch/lkl/include/asm/Kbuild
 create mode 100644 arch/lkl/include/asm/bitsperlong.h
 create mode 100644 arch/lkl/include/asm/byteorder.h
 create mode 100644 arch/lkl/include/asm/dma-mapping.h
 create mode 100644 arch/lkl/include/asm/elf.h
 create mode 100644 arch/lkl/include/asm/host_ops.h
 create mode 100644 arch/lkl/include/asm/io.h
 create mode 100644 arch/lkl/include/asm/irq.h
 create mode 100644 arch/lkl/include/asm/mutex.h
 create mode 100644 arch/lkl/include/asm/page.h
 create mode 100644 arch/lkl/include/asm/pgtable.h
 create mode 100644 arch/lkl/include/asm/processor.h
 create mode 100644 arch/lkl/include/asm/ptrace.h
 create mode 100644 arch/lkl/include/asm/setup.h
 create mode 100644 arch/lkl/include/asm/thread_info.h
 create mode 100644 arch/lkl/include/asm/unistd.h
 create mode 100644 arch/lkl/include/asm/vmlinux.lds.h
 create mode 100644 arch/lkl/include/system/stdarg.h
 create mode 100644 arch/lkl/include/uapi/asm/Kbuild
 create mode 100644 arch/lkl/include/uapi/asm/bitsperlong.h
 create mode 100644 arch/lkl/include/uapi/asm/host_ops.h
 create mode 100644 arch/lkl/include/uapi/asm/irq.h
 create mode 100644 arch/lkl/include/uapi/asm/sigcontext.h
 create mode 100644 arch/lkl/include/uapi/asm/unistd.h
 create mode 100644 arch/lkl/kernel/Makefile
 create mode 100644 arch/lkl/kernel/asm-offsets.c
 create mode 100644 arch/lkl/kernel/console.c
 create mode 100644 arch/lkl/kernel/irq.c
 create mode 100644 arch/lkl/kernel/mem.c
 create mode 100644 arch/lkl/kernel/misc.c
 create mode 100644 arch/lkl/kernel/setup.c
 create mode 100644 arch/lkl/kernel/syscalls.c
 create mode 100644 arch/lkl/kernel/threads.c
 create mode 100644 arch/lkl/kernel/time.c
 create mode 100644 arch/lkl/kernel/vmlinux.lds.S
 create mode 100755 arch/lkl/scripts/headers_install.py
 create mode 100644 tools/lkl/.gitignore
 create mode 100644 tools/lkl/Makefile
 create mode 100644 tools/lkl/cptofs.c
 create mode 100644 tools/lkl/fs2tar.c
 create mode 100644 tools/lkl/include/.gitignore
 create mode 100644 tools/lkl/include/lkl.h
 create mode 100644 tools/lkl/include/lkl_host.h
 create mode 100644 tools/lkl/lib/.gitignore
 create mode 100644 tools/lkl/lib/fs.c
 create mode 100644 tools/lkl/lib/iomem.c
 create mode 100644 tools/lkl/lib/iomem.h
 create mode 100644 tools/lkl/lib/nt-host.c
 create mode 100644 tools/lkl/lib/posix-host.c
 create mode 100644 tools/lkl/lib/utils.c
 create mode 100644 tools/lkl/lib/virtio.c
 create mode 100644 tools/lkl/lib/virtio.h
 create mode 100644 tools/lkl/lib/virtio_blk.c
 create mode 100644 tools/lkl/tests/boot.c
 create mode 100755 tools/lkl/tests/boot.sh

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to