DP Reading: Kunpeng Processor Architecture and Programming (13) Operating System Kernel and Cloud Basic Software


Supplementary update, because of the drawing a few days ago...

Kunpeng Software Composition

hardware specific software

Kunpeng Software Composition

The software ecology of the Kunpeng processor is a constantly developing software ecology. The server itself also has a variety of complexity. After a long period of development, server hardware has different operating system solutions. These operating systems often implement a layered combination of software. , it is difficult to simply describe its software architecture .

This section introduces the composition of Kunpeng software from a relatively high level, mainly from the perspective of GNU/Linux software ecology .

The following is a high-level view of the software architecture of Kunpeng GNU/Linux:

A high-level view of the software architecture of Kunpeng GNU/Linux
In the picture above, the bottom is the Kunpeng server hardware, which is a general-purpose server device with the Kunpeng processor as the core .
Software running on a hardware system that includes an ARM core will inevitably contain system-specific code. Such code is usually separated from other system software in the form of firmware . This section refers to the code of this feature---- hardware-specific software .

In the server field, the hardware and hardware-specific software of the server have the greatest impact on the " out-of-the-box " server, so these two parts must meet the compliance requirements related to ARM servers (see: ARMv8-A architecture , Kunpeng software Ecology and cloud services )

hardware specific software

Hardware-specific software refers to software that is specific to a system in an ARM server and is often provided in the form of firmware, mainly including the so-called Boot Loader and device-specific firmware.

This section will first introduce the Boot Loader , and then introduce the firmware requirements specifications SBSA and SBBR in the ARM server , as well as some important elements involved, such as UEFI, ACPI and ATF (ARM Trusted Firmware) .

1. Boot Loader

Boot Loader is the boot loader, which is an abbreviated version of the word Bootstrap Loader. It is usually the first software after the system is powered on or reset , so it is specific to a specific processor and motherboard.

A rough look at the startup process consists of three main stages:

  1. The system is powered on, and the hardware loads the Boot Loader ;
  2. Boot Loader loads the operating system, such as the Linux kernel;
  3. The operating system loads applications and user data, completing the boot process.
系统上电 加载
加载
加载
硬件
BootLoader
操作系统
应用程序和用户数据

Among them, the main function of the Boot Loader is to act as an intermediary between the hardware and the operating system for loading the operating system. To accomplish this purpose, Boot Loader often finds and releases the operating system, and establishes the basic environment for the operating system to run (such as initializing memory, discovering hardware device parameters and returning them to the operating system, etc.). Some complex Boot Loaders will also have many additional functions, such as supporting multi-stage booting, multiple booting methods (such as Flash memory, disk, network, U disk, CD, etc.), starting multiple operating systems, updating firmware, providing running Time service, support for bottom-level debugging, etc.

In the server field, support for secure boot is also a very important feature.

2. SBSA and SBBR

Different operating systems have different requirements for the system loading process. Soc products in the field of ARM's traditional strengths - embedded devices and mobile terminals - are often customized, differentiated, and price-sensitive , and users rarely change hardware module operating systems. In these cases, the cost of custom software is far less than the cost savings of removing hardware functionality. Therefore, in such cases, the usage plan is mostly highly customized, such as "boot firmware + Boot Loader (u-boot, fastboot) + operating system (Linux) + application software"

But in the field of servers and PCs , the software is usually developed by a third party, and users only need to consider "out of the box" and "modules can be replaced". The cost of custom hardware far exceeds the cost of software. Therefore, the solutions used are generally compatible with standardized interfaces.

SBSA (Server Base Boot Requirements) and SBBR (Server Base Boot Requirements) are specifications proposed by ARM for the basic boot requirements of servers in the field of server applications .

The SBBA specification is a specification based on the hardware architecture of the ARM 64-bit processor architecture. It describes in detail the server operating system software , such as: the operating system, Hypervisor (virtual machine manager) and firmware rely on the features and key aspects of the system architecture. Including CPU, PCIe, timer, IOMMU, UART (Universal Asynchronous Receiver / Transmitter, Universal Asynchronous Receiver Transmitter), watchdog and interrupt, etc., the goal is to have enough standard system architecture to enable a proper system image to
be used in Runs on all compliant system hardware.

The SBSA standard mainly defines the requirements for the following aspects:

1.服务器在加电自检(POST)阶段应该检查的基本硬件组件,例如处理器、内存、硬盘驱动器、键盘和鼠标等。
2.服务器引导过程中需要加载的最小软件集合,包括固件(如BIOS或UEFI固件)、引导加载器(如GRUB或UEFI引导加载器)以及内核等。
3.服务器在引导过程中应该遵循的基本时序和顺序。
4.对于采用多引导架构的系统,SBSA还规定了引导过程中如何处理多个操作系统的引导选项。

The SBBR specification is a specification for system boot firmware , which defines the basic firmware requirements for an operating system or Hypervisor (virtual machine manager) on an ARM AArch64 architecture server that conforms to the SBSA standard to achieve out-of-the-box capabilities , including the required startup and Runtime service and security requirements, and follow UEFI (Unified Extensible Firmware Interface, Unified Extensible Firmware Interface) and ACPI (Advanced Adaptive Power Management Interface Specification)

SBSA/SBBR is the minimum set of requirements for ARM servers to be able to start firmware such as OS or monitors , and at the same time follows industry standards such as UEFI, ACPI, PSCI, and SMBIO. Among them, although SBSA and SBBR have similar names, they actually focus on different aspects. SBSA mainly focuses on the minimum requirements for system startup and operation, including boot loaders, runtime services, firmware abstraction, etc., while SBBR focuses on the minimum requirements for boot programs, such as UEFI's BootServices, RuntimeServices, Protocol and other basic services and protocol interfaces.

At the implementation level, the SBSA and SBBR specifications are mainly implemented through LuvOS, a customized Linux system. LuvOS is based on the Linux kernel and is obtained by compiling the tools of FWTS (Firmware Test Suite) and SBSA-ACS (ARM Server Base Architecture - Automotive and Server Consortium Starter Kit) under Linux with the standard Linux kernel.

3. UEFI

Originally introduced by Intel, UEFI is the successor to the 16-bit x86 "legacy" PC BIOS and is currently maintained by the UEFI Forum .

UEFI (Unified Extensible Firmware Interface) is a graphical standard interface used in computer firmware, which is designed to replace the traditional BIOS. UEFI is defined as an extensible firmware interface specification, which provides a set of standard APIs so that the operating system can interact with the firmware in the pre-boot environment.

The open source reference implementation of the UEFI specification is edk2 or EDK Ⅱ, and the source code is located at https://github.com/tianocore/tianocore.github.io/tree/master/edk2
The upstream development team is the TianoCore community

UEFI is displayed in a graphical interface , which is easier to use and customize than traditional BIOS. In addition, UEFI also provides some advanced features, such as network configuration, hardware diagnostics, and secure boot.

UEFI is jointly formulated by some industry-leading companies, including AMD, Intel, Microsoft, etc. With the development of computer hardware, UEFI is also evolving to meet new needs.

The UEFI specification includes a boot manager BOOT Manager, which will determine how to load executable files (maybe Boot Loader or other image files) according to the parameters in NVRAM (Non-Volatile Random Access Memory, non-volatile random access memory) , EFI (Extensible Firmware Interface) executable file format must conform to PE (Protable Executable, Portable Executable) format, PE is a widely used Windows platform

4. ACPI

ACPI (Advanced Configuration and Power Interface) is an open power management interface specification, which is designed to provide a common and standardized power management method . ACPI defines an interface specification for complete control of power management under the control of the operating system.

ACPI mainly includes the following parts:

  1. Tables used to describe the power state and device state in the computer system (Tables);
  2. Interfaces for communication between the operating system and firmware;
  3. Specifications for describing power supply, thermal management, and system configuration;
  4. Events (Events) used to provide runtime power management.

ACPI is a relatively complex specification that provides a wealth of power management functions. In the computer field, many new power management features are implemented based on ACPI.
ACPI subsystem and structure diagram

operating system kernel

The operating system kernel is the core of a computer system and is responsible for key tasks such as managing hardware resources, scheduling processes, and memory management. The Linux kernel is a free and open source operating system kernel that powers many computer systems, including personal computers, servers, mobile devices, and more.

Linux system calls

System calls are the interface through which applications interact with the operating system kernel. Linux system calls are a way for applications to request kernel services, such as file operations, process control, network connections, and more.

Linux process scheduling

Process scheduling is a key part of the operating system responsible for allocating computing resources to individual processes. Linux uses a priority-based preemptive scheduling algorithm to support multi-processor and real-time tasks.
Linux kernel

Linux memory management

Memory management is responsible for allocating and managing the memory resources of a computer system. Linux memory management supports virtual memory, physical memory management, and page replacement algorithms.

Linux Virtual File System

The virtual file system is a part of the Linux kernel and provides a unified file system interface for upper-layer applications. Linux supports a variety of file systems, such as ext4, NFS, SMB, etc.

Linux network subsystem

The network subsystem is responsible for managing the network protocol stack of the computer system, including network interface, data packet forwarding, routing, etc. The Linux network subsystem provides a rich set of network programming interfaces.

Linux interprocess communication

Inter-process communication is a part of the operating system that allows data exchange and cooperation between different processes. Linux provides a variety of inter-process communication mechanisms, such as pipes, sockets, and shared memory.

Linux loadable kernel modules

Loadable kernel modules are parts of the Linux kernel that can be dynamically loaded and unloaded when needed. These modules provide the ability to extend the functionality of the kernel without modifying existing code.

Linux device drivers

Device drivers are the interface between the operating system kernel and hardware devices. Linux device drivers are responsible for managing hardware devices, including device initialization, data transmission and control, etc.

Linux architecture related code

The Linux kernel code consists of multiple modules, each responsible for specific functions and subsystems. The collaboration and communication between these modules is based on the Linux kernel architecture and design principles. Understanding the architecture and code of the Linux kernel can help developers better understand and optimize system performance.

操作系统内核
Linux系统调用
Linux进程调度
Linux内存管理
Linux虚拟文件系统
Linux网络子系统
Linux进程间通信
Linux可加载内核模块
Linux设备驱动程序
Linux架构相关代码
参考

base library

glibc (GNU system library) is the basic core library of GNU/Linux and running Linux.
glibc is the libc library released by GNU, that is, the c runtime library. Glibc is the lowest-level API in the Linux system, and almost any other runtime library will depend on glibc. In addition to encapsulating the system services provided by the Linux operating system, glibc itself also provides the realization of many other necessary functional services. Since glibc includes almost all common UNIX standards, it is conceivable that its content is all-encompassing. And just like other UNIX systems, the file groups contained in it are scattered in the tree-like directory structure of the system, supporting the entire operating system like a bracket. In the GNU/Linux system, the development history of its C function library points out several important milestones in the evolution of GNU/Linux. Using glibc as the C function library of the system is an important milestone in the evolution of GNU/Linux.

glibc是GNU发布的libc库
即c运行库
封装Linux操作系统所提供的系统服务
实现了必要功能服务的实现
UNIX通行的标准
Linux系统中
内含的档案群分散于系统的树状目录结构中
像其他的UNIX系统一样
包含了许多必要功能服务的实现
是GNU/Linux演进的重要里程碑
用glibc作为系统的C函式库

Development Tools, Middleware and Applications

Development Tools, Middleware and Applications

  1. Software modeling tools : These tools help developers design, plan, and simulate early in the software development cycle. Such tools are typically used to create conceptual, logical, and physical models, and for system architectural design.
  2. Software Implementation Tools : These tools support development activities such as coding, compiling, debugging, and integration. They include IDEs (Integrated Development Environments), compilers, debuggers, version control systems, and more.
  3. Software simulation tools : These tools simulate the behavior of a software system for testing and validation before being deployed into a live environment. They can simulate system behavior under various conditions, including performance, safety and reliability.
  4. Software Testing Tools : These tools are used to test the quality of a software system to ensure that it meets expected functional and performance requirements. They include automated testing tools, performance testing tools, code quality analysis tools, and more.
  5. Software development support tools : These tools provide various support required by the development team, including project management tools, requirements management tools, defect tracking tools, etc. They help development teams collaborate better, improve development efficiency and ensure smooth project completion.
软件建模工具
软件实施工具
软件模拟工具
软件测试工具
软件开发支撑工具

cloud based software

云基础软件的基础是虚拟化技术,本节云基础软件主要为虚拟化软件与容器。

  1. 虚拟化技术简介:虚拟化技术是一种将物理硬件资源虚拟化成多个逻辑资源的技术,从而实现资源的共享、灵活配置和高效利用。虚拟化技术是云基础软件的基础。
  2. Hypervisor:Hypervisor是一种虚拟化软件,它允许在物理计算机上创建多个虚拟机,每个虚拟机都可以运行独立的操作系统和应用程序。Hypervisor对虚拟机的管理包括资源分配、隔离、备份和恢复等。
  3. 容器:容器是一种轻量级的虚拟化技术,它可以将应用程序及其依赖项打包成一个独立的容器,并在容器中运行应用程序。容器共享宿主操作系统的内核,因此相比于传统的虚拟化技术,容器具有更高的资源利用率和更快的启动时间。
  4. ARM服务器开源主流解决方案: Xen、KVM 和 Docker:ARM服务器是一种基于ARM架构的服务器,具有低功耗、高性能和高密度等优点。Xen、KVM和Docker是ARM服务器开源主流解决方案,分别提供虚拟化和容器技术,以支持ARM服务器的高效运行和管理。
云基础软件
虚拟化技术简介
Hypervisor
容器
ARM服务器开源主流解决方案: Xen KVM 和 Docker

鲲鹏软件开发模式

原生开发模式

原生开发模式

  1. 物理服务器:物理服务器是一种将硬件服务器资源出租给用户的云服务。用户可以自行安装操作系统和应用程序,拥有完全的控制权。但是,由于需要购买硬件设备和维护,成本相对较高。
  2. 云服务器:云服务器是一种将虚拟机出租给用户的云服务。用户可以在虚拟机上安装操作系统和应用程序,拥有完全的控制权。相比物理服务器,云服务器更加灵活,可以按需购买资源,且维护成本较低。
  3. 搭建原生开发环境示例:这里以Node.js开发环境为例。首先,需要安装Node.js运行环境,可以从官网下载安装程序进行安装。然后,使用npm(Node Package Manager)安装需要的第三方模块。最后,配置好应用所需的环境变量和路由规则等,就可以开始进行开发了。
原生开发模式
物理服务器
云服务器
搭建原生开发环境示例

交叉开发模式

要完成这两个任务,您可以按照以下步骤进行操作:

  1. 搭载 ARM GCC 交叉编译环境:

首先,您需要安装 ARM GCC 交叉编译工具链。这个工具链是一组用于将源代码编译成在 ARM 架构上运行的二进制文件的工具。

以下是在 Ubuntu 或其他 Linux 系统中安装 ARM GCC 交叉编译工具链的步骤:

# 更新系统软件包列表
sudo apt-get update

# 安装交叉编译工具链
sudo apt-get install gcc-arm-linux-gnueabi

安装完成后,您可以使用 arm-linux-gnueabi-gcc 命令来运行 ARM GCC 编译器。

如果您使用的是其他操作系统,可以参考相关的文档或资源来安装 ARM GCC 交叉编译环境。

  1. 搭建 QEMU 模拟开发环境:

QEMU(Quick Emulator)是一个开源的模拟器,可用于在计算机上模拟不同的硬件平台和操作系统。

以下是在 Ubuntu 或其他 Linux 系统中安装 QEMU 并配置为模拟 ARM 架构的步骤:

# 安装 QEMU
sudo apt-get install qemu

# 下载并解压 ARM 镜像文件(例如,使用 Raspberry Pi 的操作系统)
wget http://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest.zip

# 在 QEMU 中创建一个虚拟机,并指定使用的镜像文件和模拟的 ARM 架构
qemu-system-arm -machine type=qEMU,kernel=kernel.img,initrd=initrd.img,append="root=/dev/sda2 panic=1 rootfstype=ext4" -m 1024M -display vnc=127.0.0.1:0 -vnc :0

上述命令将启动一个使用 ARM 架构的 QEMU 虚拟机,并加载指定的镜像文件。您可以根据自己的需求调整命令中的参数。

请注意,这只是一个简单的示例,具体的配置可能因您的需求和使用的镜像文件而有所不同。您可以参考 QEMU 的官方文档和相关资源以获取更详细的信息和指导。

搭载 ARM GCC 交叉编译环境
搭建 QEMU 模拟开发环境

云端开发模式

  1. CloudIDE基本特性ClouldIDE
    Cloud IDE(Integrated Development Environment)是一种基于云计算技术的集成开发环境,它提供了一个在线的开发平台,使开发人员能够在浏览器中进行软件开发和协作。以下是Cloud IDE的基本特性:
    wangyejietu

  2. 在线开发环境:Cloud IDE提供了一个完整的开发环境,包括代码编辑器、调试器、编译器、版本控制工具等,使开发人员可以直接在浏览器中进行开发,无需在本地安装和配置开发环境。

  3. 多语言支持:Cloud IDE支持多种编程语言,包括但不限于Java、Python、JavaScript、C++、Ruby等,以满足不同项目和开发需求。

  4. 版本控制集成:Cloud IDE通常与版本控制系统(如Git)紧密集成,方便开发人员对代码进行版本管理、协作和团队合作。

  5. 云存储支持:Cloud IDE允许开发人员将代码和文件存储在云端,避免了本地存储的限制和风险,并方便与团队成员共享和访问。

  6. 调试和测试功能:Cloud IDE提供了调试和测试工具,帮助开发人员在开发过程中进行代码调试和单元测试,以确保代码的质量和稳定性。insert image description here

  7. 协作和分享:Cloud IDE允许多个开发人员同时在同一个项目上进行协作开发,实时共享代码和编辑器状态,提供了更便捷的协作和沟通方式。

  8. 扩展和插件支持:Cloud IDE通常支持扩展和插件机制,开发人员可以根据自己的需求自定义和集成各种工具和功能。

  9. 跨平台访问:由于Cloud IDE在云端运行,开发人员可以通过浏览器从任何设备(如电脑、平板或手机)访问和使用,实现跨平台开发和远程工作。

Cloud IDE的基本特性使其成为开发人员在团队协作、敏捷开发和学习等场景中的有力工具。但也需要考虑网络连接和应用性能等因素对开发体验的影响。

  1. CloudIDE操作流程

以下是典型的Cloud IDE操作流程:

  1. 注册和登录:访问Cloud IDE提供商的网站,注册一个新账号并登录。

  2. 创建项目:在Cloud IDE界面中创建一个新项目或导入现有项目。你可以选择命名项目并指定项目的语言和框架。

  3. 编辑代码:打开项目文件并使用内置的代码编辑器修改代码。Cloud IDE通常提供代码自动完成、语法高亮和代码格式化等功能,以提高开发效率。

  4. Debugging and testing: If debugging and testing is required, Cloud IDE usually provides integrated debugger and unit testing tools. You can set breakpoints, watch variables and execute code for debugging, and write and run unit tests.

  5. Version control: Cloud IDE is usually integrated with version control systems such as Git, you can add files to the code repository, commit changes, pull and push code, and manage branches and merge requests, etc.

  6. Build and deploy: Depending on project requirements, Cloud IDE may provide build and deploy tools for building code into executable files, libraries, or installation packages, and deploying them to test environments or production servers.

  7. Collaborative development: Cloud IDE usually supports multi-person collaborative development. You can invite team members to join projects, share code, edit and communicate in real time, and track changes made by others.

  8. Save and sync: Cloud IDE automatically saves your code changes and syncs your project files through cloud storage services to access and continue development on different devices.

  9. Extension and customization: As needed, you can install and use plug-ins to enhance the editor, integrate other development tools, or add custom functions according to the extension mechanism provided by Cloud IDE.

  10. Export and Deployment: Once you have finished developing your project, you can export the project files and deploy them to an actual production environment, or package them as a distributable application.

  1. Example of using CloudIDE
    The following is an example of using the Cloud IDE:
1. 注册和登录:访问Cloud IDE提供商的网站,点击注册按钮创建一个新账号,并使用注册的账号登录。

2. 创建项目:在Cloud IDE界面中点击"New Project"按钮,选择一个项目模板或创建一个空项目。输入项目名称并选择语言和框架。

3. 编辑代码:在Cloud IDE的编辑器中打开项目文件,开始编写代码。你可以使用代码自动完成、语法高亮和代码格式化等功能来提高开发效率。

4. 调试与测试:如果需要调试代码,你可以在编辑器中设置断点,单步执行代码,并查看变量的值以进行调试。另外,你可以编写单元测试并运行测试来验证代码的正确性。

5. 版本控制:Cloud IDE通常提供与Git等版本控制系统的集成。你可以将代码添加到本地仓库、提交更改并推送到远程仓库。还可以查看提交历史、分支和合并请求等。

6. 构建和部署:根据你的项目需求,Cloud IDE可能会提供构建和部署工具。你可以使用这些工具将代码构建为可执行文件、库或安装包,并将其部署到测试环境或生产服务器。

7. 协作开发:Cloud IDE通常支持多人协作开发功能。你可以邀请团队成员加入项目,并共享代码和编辑器状态。这样你们可以一起编辑代码、讨论和解决问题。

8. 保存和同步:Cloud IDE会自动保存你的代码更改,并将项目文件同步到云存储中。这样你可以在不同设备上访问和继续开发,而无需担心数据丢失。

9. 扩展和定制:根据需要,你可以浏览Cloud IDE提供的插件市场,并安装适合你项目的插件。这些插件可以增强编辑器功能、集成其他工具或添加自定义功能。

10. 导出和部署:完成项目开发后,你可以导出项目文件,并将其部署到实际的生产环境。你还可以将项目打包为可分发的应用程序,以便分享给其他人使用
注册和登录
创建项目
编辑代码
调试与测试
版本控制
构建和部署
协作开发
保存和同步
扩展和定制
导出和部署

Reference: "Kunpeng Processor Architecture and Programming"

Guess you like

Origin blog.csdn.net/m0_74037814/article/details/132475630