type
Post
status
Published
date
Feb 24, 2025
slug
2025/02/24/Building-Debian-packages-Xenomai-3
summary
tags
Linux
rt-kernel
category
Linux
created days
new update day
icon
password
Created_time
Feb 24, 2025 06:56 AM
Last edited time
Mar 1, 2025 01:50 AM

Xenomai packages in Debian

First, please note that Xenomai is officially included in Debian. This means that the latest version of Xenomai will be directly incorporated into Debian “unstable” which from time to time migrates to the latest “stable” version of Debian. The latter will be stabilized and maintained for a whole Debian stable version lifetime without following the latest versions of “upstream” Xenomai. Please check the official Debian package page for Xenomai and the Debian development page for Xenomai .
首先,请注意 Xenomai 已被正式纳入 Debian。 这意味着 Xenomai 的最新版本将直接并入 Debian "不稳定 "版本,并不时迁移到最新的 Debian "稳定 "版本。 后者将在整个 Debian 稳定版的生命周期内得到稳定和维护,而不会跟随 Xenomai 的最新 "上游 "版本。 请查看 Xenomai 的 Debian 官方软件包页面和 Xenomai 的 Debian 开发页面。
Debian’s “unstable” version of Xenomai is also tracked with the files in the debian/ directory in the Xenomai source code repository which means that you can also build a Xenomai package from the trunk. If you want to track the latest Xenomai repository developments that aren’t yet in Debian, you should follow the instructions on this page to build Xenomai Debian packages.
Debian 的 "不稳定 "版 Xenomai 也与 Xenomai 源代码库中 debian/ 目录下的文件一起被跟踪,这意味着你也可以从主干中构建 Xenomai 软件包。 如果你想跟踪 Xenomai 源代码库中尚未在 Debian 中出现的最新进展,你应该按照本页的说明来构建 Xenomai Debian 软件包。

Building Xenomai packages

This howto was written for Xenomai 2.6.3, please use the latest stable Xenomai release and adapt the version numbers accordingly.
本说明是针对 Xenomai 2.6.3 编写的,请使用最新的稳定版 Xenomai 并相应调整版本号。

prerequisites

Install the following packages:
安装以下软件包
# apt-get install devscripts debhelper dh-kpatches findutils

from a Git repository

To build from a git Repository install these additional packages and clone the Git repository:
要从 Git 仓库构建,请安装这些附加软件包并克隆 Git 仓库:
# apt-get install git-core git-buildpackage $ git clone git://xenomai.org/xenomai-2.6.git
Change to the Xenomai Git working tree and update the repository:
切换到 Xenomai Git 工作树并更新版本库:
$ cd xenomai-2.6 && git fetch origin
Create and checkout a new branch based on a git treeish object. In this example, we create a branch v2.6.3-deb based on git tag v2.6.3:
根据 git treeish 对象创建并签出一个新分支。 在本例中,我们根据 git 标签 v2.6.3 创建了一个分支 v2.6.3-deb:
xenomai-2.6$ git checkout -b v2.6.3-deb v2.6.3
Create a new debian changelog entry:
创建新的 debian 更新日志条目:
xenomai-2.6$ DEBEMAIL="your@email" DEBFULLNAME="Your Name" \ debchange -v 2.6.3 Release 2.6.3
Commit the changelog to the v2.6.3-deb branch:
将更新日志提交到 v2.6.3-deb 分支:
xenomai-2.6$ git commit -a --author="Your Name" -m 2.6.3
Build the packages in the parent directory:
在父目录中构建软件包:
xenomai-2.6$ git-buildpackage \ --git-debian-branch=v2.6.3-deb \ --git-export-dir=.. \ -uc -us
Thats all folks. Switch back to the master branch and delete the branch v2.6.3-deb:
就这些了。 切换回主分支,删除 v2.6.3-deb 分支:
xenomai-2.6$ git checkout master && git branch -D v2.6.3-deb

from a tar.bz2 archive

Download and extract a Xenomai tar.bz2 release archive:
下载并解压 Xenomai tar.bz2 版本压缩包:
$ wget -O - https://ftp.denx.de/pub/xenomai/xenomai/stable/xenomai-2.6.3.tar.bz2 | tar -jxf -
Change to the extracted Xenomai tree:
更改提取的 Xenomai 树:
$ cd xenomai-2.6.3
Create a new debian changelog entry:
创建新的 debian 更新日志条目:
xenomai-2.6.3$ DEBEMAIL="your@email" DEBFULLNAME="Your Name" \ debchange -v 2.6.3 Release 2.6.3
Build the packages in the parent directory:
在父目录中构建软件包:
xenomai-2.6.3$ debuild -uc -us

result

The build results in the following packages:
构建结果如下:
  • xenomai-runtime - Xenomai runtime utilities - Xenomai 运行时实用程序
  • libxenomai1 - Shared libraries for Xenomai - Xenomai 运行时实用程序
  • libxenomai-dev - Headers and static libraries for Xenomai - Xenomai 的头文件和静态库
  • xenomai-kernel-source - Sources of the Xenomai 2.x kernel - Xenomai 2.x 内核的源代码
  • xenomai-doc - Xenomai documentation - Xenomai 文档
For development, xenomai-kernel-source and libxenomai-dev are needed, for “production” systems, you should just need xenomai-runtime und libxenomai1 (together with the self built kernel as described in the next section). The package xenomai-doc is optional, of course, but contains important documentation for developers using or developing Xenomai.
在开发过程中,需要 xenomai-kernel-source 和 libxenomai-dev,而在 "生产 "系统中,则只需要 xenomai-runtime 和 libxenomai1(以及下一节所述的自建内核)。 当然,xenomai-doc 软件包是可选的,但它包含了为使用或开发 Xenomai 的开发人员提供的重要文档。

installation

Change to the build directory and use dpkg to install the packages:
切换到构建目录,使用 dpkg 安装软件包:
# dpkg -i *.deb

Building a Xenomai patched Linux kernel package

构建 Xenomai 修补的 Linux 内核软件包
Starting with Xenomai 2.6.3, the method for building a Xenomai patched kernel has changed. The previous method (generating patches containing both the I-pipe patches and the Xenomai kernel-space support), imposed to maintain a prepare-patch.sh script, which was almost but not really a copy of the prepare-kernel.sh script, and so lead to duplicated maintenance efforts. It was not really worth the trouble, the patches needed to be applied by hand anyway since kernel-package had dropped support for automatically applying patches.
从 Xenomai 2.6.3 开始,构建 Xenomai 补丁内核的方法发生了变化。以前的方法(生成包含 I-pipe 补丁和 Xenomai 内核空间支持的补丁)需要维护一个 prepare-patch.sh 脚本,它几乎是但不是 prepare-kernel.sh 脚本的副本,因此会导致重复维护工作。其实这样做并不值得,因为 kernel-package 已经放弃了对自动打补丁的支持,所以无论如何都需要手工打补丁。
The new method is to generate a xenomai-kernel-source package, containing everything necessary to add Xenomai kernel-space support to a Linux kernel. The method for installing this support is essentially the same as the one for installing Xenomai from sources, the only added value of the xenomai-kernel-source packages is that the sources can be removed from your disk with apt-get remove.
新方法是生成一个 xenomai-kernel-source 软件包,其中包含为 Linux 内核添加 Xenomai 内核空间支持所需的一切。安装这种支持的方法与从源代码安装 Xenomai 的方法基本相同,xenomai-kernel-source 软件包的唯一附加值是,源代码可以用 apt-get remove 从磁盘中移除。
We use Xenomai 2.6.3 and Linux 3.10.32 on x86 in the following example, please adapt it to the versions and architectures you want to install.
以下示例使用的是 Xenomai 2.6.3 和 x86 Linux 3.10.32,请根据你要安装的版本和架构进行调整。

prerequisites

If you have not followed the dpkg -i *.deb step in the “installation” section. Install the xenomai-kernel-source package now:
如果你没有按照 "安装 "部分中的 dpkg -i *.deb 步骤进行安装。 现在就安装 xenomai-kernel-source 软件包:
# dpkg -i xenomai-kernel-source*.deb
Install the following packages:
安装以下软件包
# apt-get install kernel-package libncurses-dev fakeroot zlib1g-dev
You should look for patches in this download area .
您应在此下载区查找补丁。
$ wget https://ftp.denx.de/pub/xenomai/ipipe/v3.x/x86/older/ipipe-core-3.10.32-x86-2.patch
Download the corresponding kernel source archive, extract it and change to the source tree:
下载相应的内核源代码压缩包,解压缩后更改为源代码树:
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.32.tar.xz $ tar -xf linux-3.10.32.tar.xz && cd linux-3.10.32

patch and configure the kernel

Add Xenomai support to the Linux kernel (see the installation instructions for more details on this step).
为 Linux 内核添加 Xenomai 支持(有关此步骤的详细信息,请参阅安装说明)。
linux-3.10.32$ /usr/src/xenomai-kernel-source/scripts/prepare-kernel.sh \ --arch=x86 --linux=. --adeos=../ipipe-core-3.10.32-x86-2.patch
Optional: To recycle a old config, copy it to the current directory and call make oldconfig:
可选: 要回收旧配置,可将其复制到当前目录,然后调用 make oldconfig:
linux-3.10.32$ cp /your/old/linux/config .config linux-3.10.32$ make oldconfig
Configure the kernel: Despite using Debian packages, you still have to configure the kernel. This may not be so easy especially on x86, please see the x86 kernel configuration checklist for more details.
配置内核:尽管使用了 Debian 软件包,但仍需配置内核。 这可能并不那么容易,尤其是在 x86 系统上,详情请查看 x86 内核配置清单。
linux-3.10.32$ make menuconfig

build the kernel

Build the kernel using make-kpkg: ( CONCURRENCY_LEVEL=x is optional, but saves time on multicore machines )
使用 make-kpkg 生成内核:(CONCURRENCY_LEVEL=x 是可选项,但在多核机器上可以节省时间)
linux-3.10.32$ CONCURRENCY_LEVEL=8 CLEAN_SOURCE=no fakeroot make-kpkg --initrd \ --append-to-version -xenomai-2.6.3 --revision 1.0 kernel_image kernel_headers

result

The build results in the following packages:
构建结果如下:
  • linux-image-3.10.32-xenomai-2.6.3
  • linux-headers-3.10.32-xenomai-2.6.3

installation

Install the kernel with dpkg, the bootmanager is updated automatically:
使用 dpkg 安装内核,启动管理器会自动更新:
# dpkg -i linux-image*.deb
Ubuntu 10.04: After installing the kernel with dpkg you have to build the initrd and update the bootmanager manually:
Reboot the machine and select the kernel in your bootmanager.
Ubuntu 10.04: 使用 dpkg 安装内核后,必须手动构建 initrd 并更新引导管理器:
重启机器并在引导管理器中选择内核。
 
欢迎加入喵星计算机技术研究院,原创技术文章第一时间推送。
notion image
 
Kernel configuration :: Xenomai 3Installing Xenomai 2