Kernel

Introduction

The OpenHarmony kernel is a real-time OS kernel developed for IoT devices. It is as lightweight as the real-time operating system (RTOS) and as easy-to-use as Linux.

The OpenHarmony kernel provides basic kernel functions such as process and thread scheduling, memory management, inter-process communication (IPC) mechanism, and timer management.

The source code of the OpenHarmony kernel consists of two repositories: the kernel_liteos_a repository for standard devices and the kernel_liteos_m repository for tiny and mini devices. The following describes the kernel_liteos_a repository. Figure1 shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.

Figure 1 Architecture of the OpenHarmony LiteOS Cortex-A kernel

Directory Structure

/kernel/liteos_a
├── apps                   # User-space init and shell application programs
├── arch                   # System architecture, such as ARM
│   └── arm                # Code for ARM architecture
├── bsd                    # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module
├── compat                 # Kernel API compatibility
│   └── posix              # POSIX APIs
├── drivers                # Kernel drivers
│   └── char               # Character device
│       ├── mem            # Driver for accessing physical input/output (I/O) devices
│       ├── quickstart     # APIs for quick start of the system
│       ├── random         # Driver for random number generators
│       └── video          # Framework of the framebuffer driver
├── fs                     # File system module, which mainly derives from the NuttX open-source project
│   ├── fat                # FAT file system
│   ├── jffs2              # JFFS2 file system
│   ├── include            # Header files exposed externally
│   ├── nfs                # NFS file system
│   ├── proc               # proc file system
│   ├── ramfs              # RAMFS file system
│   └── vfs                # VFS layer
├── kernel                 # Kernel modules including the process, memory, and IPC modules
│   ├── base               # Basic kernel modules including the scheduling and memory modules
│   ├── common             # Common components used by the kernel
│   ├── extended           # Extended kernel modules including the dynamic loading, vDSO, and LiteIPC modules
│   ├── include            # Header files exposed externally
│   └── user               # Init process loading
├── lib                    # Kernel library
├── net                    # Network module, which mainly derives from the lwIP open-source project
├── platform               # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
│   ├── hw                 # Logic code related to clocks and interrupts
│   ├── include            # Header files exposed externally
│   └── uart               # Logic code related to the serial port
├── platform               # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
├── security               # Code related to security features, including process permission management and virtual ID mapping management
├── syscall                # System calling
└── tools                  # Building tools as well as related configuration and code

Constraints

Hi3518E V300 uses the JFFS2 file system by default, and Hi3516D V300 uses the FAT file system by default. If other file systems need to be used, their configurations must be added accordingly.

Usage

For details, see the Usage section of LiteOS Cortex-A and LiteOS Cortex-M.

Repositories Involved

Kernel subsystem

drivers_liteos

kernel_liteos_a

kernel_liteos_m

device_qemu

prebuilts_lite_sysroot