# x-kernel-image **Repository Path**: openkylin/x-kernel-image ## Basic Information - **Project Name**: x-kernel-image - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-02 - **Last Updated**: 2026-04-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # x-kernel-image 为 kylin-x 内核构建根文件系统镜像,供内核仓库 `make rootfs` 使用。 提供 Alpine 和 Debian 两类 rootfs,其中 Alpine 支持轻量 profile: | 类型 | C 库 | 包管理器 | 产出文件 | | ------ | --------- | -------- | ----------------------------- | | Alpine | musl | apk | `rootfs-.img.xz` | | Alpine CI | musl | apk | `rootfs--ci.img.xz` | | Debian | **glibc** | apt/dpkg | `rootfs-debian-.img.xz` | ## Alpine rootfs (musl) 依赖:`curl`、`xz`、`fallocate`、`mkfs.ext4`、`fsck.ext4`;需 root 权限。 构建非 `base` profile 时优先使用 host `apk-tools`;如果 host `apk` 不存在或不可用, 会自动使用 Docker 中的 Alpine `apk` 作为轻量 fallback。 ```sh sudo make all # 默认 aarch64,生成 rootfs-aarch64.img.xz sudo make all ARCH=riscv64 # 指定架构,仍生成 base rootfs sudo make all ARCH=aarch64 PROFILE=ci # 生成 rootfs-aarch64-ci.img.xz sudo make all4 # 构建四个架构(aarch64 / riscv64 / x86_64 / loongarch64) make clean # 清理产物 ``` 变量在 `config.mk`(`ARCH`、`PROFILE`、`IMG_SIZE`、`BASE`、`REL`),可命令行覆盖。 ### Alpine profiles `PROFILE=base` 是默认值,保持历史产物名 `rootfs-.img.xz`,只使用 Alpine minirootfs 和仓库内的 `etc/` overlay。 `PROFILE=ci` 生成 `rootfs--ci.img.xz`,用于 pjdfstest、LTP 子集等 测试运行时。包列表维护在 `profiles/ci.packages`,当前包含: - `perl`、`perl-utils`、`perl-test-harness`:运行 pjdfstest 原版 Perl/TAP 测试。 - `bash`、`coreutils`、`findutils`、`grep`、`sed`:复杂 shell 测试的基础工具。 - `e2fsprogs`:ext4 镜像检查工具。 - `strace`:调试 syscall 行为。 新增 profile 时只需要增加 `profiles/.packages`,并使用 `sudo make all PROFILE= ARCH=` 构建。`base.packages` 为空,表示不安装 额外包。 CI profile 构建完成后可检查镜像内容: ```sh sudo mount rootfs-aarch64-ci.img mnt ls mnt/usr/bin/perl mnt/usr/bin/prove mnt/sbin/e2fsck sudo umount mnt ``` 如果 host 与目标架构一致,也可以进一步用 `chroot` 检查版本;跨架构时交给 QEMU guest 验证。 ## Debian rootfs (glibc) 依赖:Docker(支持多架构,通过 QEMU binfmt 模拟);**不需要** root 权限。 ```sh bash scripts/build-debian-rootfs.sh --arch aarch64 # aarch64 bash scripts/build-debian-rootfs.sh --arch x86_64 # x86_64 bash scripts/build-debian-rootfs.sh --arch riscv64 # riscv64 # 可选参数 bash scripts/build-debian-rootfs.sh --arch aarch64 --size 4G --debian bookworm ``` 首次构建跨架构镜像时需注册 QEMU binfmt: ```sh docker run --rm --privileged tonistiigi/binfmt --install all ```