Compare commits

1 Commits
Author SHA1 Message Date
SalimTerryLi b8f0ae1f2e Update docs
Assisted-by: GPT-5.6-Sol
2026-09-01 16:03:37 +08:00
2 changed files with 83 additions and 16 deletions
-5
View File
@@ -45,21 +45,16 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debi
RUN apt-get update && apt-get install -y \
attr \
bsdextrautils \
bzip2 \
coreutils \
dosfstools \
e2fsprogs \
fdisk \
findutils \
gdisk \
gzip \
libsqlite3-0 \
mtools \
rsync \
tar \
util-linux \
uuid-runtime \
xz-utils \
zstd \
zlib1g \
policycoreutils \
+83 -11
View File
@@ -34,11 +34,79 @@ It can be interrupted at any time, without harming your host OS.
## Prerequirements
- Root-mode docker with `--priviledged` option available
- May not be necessary in the future
- rsync
- GNU Makefile
- ~~And other basic shell utils~~
- GNU Make 4 or newer
- `rsync`, `curl`, and `unzip` for staging recipes and downloading blobs
- RISC-V user-mode emulation and binfmt registration: `qemu-riscv64-static`
and `binfmt`; registration is a one-time system setup step
- Docker or Podman; rootless operation is supported
### Dependencies
The Makefile uses these host commands before a build script runs:
| Command | Debian package | Fedora package | Used for |
| --- | --- | --- | --- |
| `make` | `make` | `make` | Makefile target management |
| `rsync` | `rsync` | `rsync` | Recipe staging |
| `curl` | `curl` | `curl` | Remote blob downloads |
| `unzip` | `unzip` | `unzip` | Extracting blob archives |
| `qemu-riscv64-static` | `qemu-user-static` | `qemu-user-static` | Running RISC-V binaries on the build host |
| `binfmt` registration | `binfmt-support` | `systemd` (`systemd-binfmt`) | Dispatching RISC-V binaries to QEMU |
The build scripts and the recipe post-processing scripts use the following
commands. The package names are the packages to install on the build host;
some commands are also supplied by the default base image in Docker.
| Command or tool | Debian package | Fedora package | Used for |
| --- | --- | --- | --- |
| `setfattr` | `attr` | `attr` | Removing the SELinux attribute from `/boot` |
| `bash` | `bash` | `bash` | Running recipe scripts |
| `column` | `bsdextrautils` | `util-linux` | Formatting generated `fstab` |
| `coreutils` (`basename`, `cat`, `chmod`, `cp`, `cut`, `dd`, `du`, `head`, `ln`, `mkdir`, `mktemp`, `mv`, `readlink`, `rm`, `sha256sum`, `sort`, `stat`, `tee`, `tr`, `truncate`) | `coreutils` | `coreutils` | File, stream, and image operations |
| `dosfstools` (`mkfs.vfat`) | `dosfstools` | `dosfstools` | Creating VFAT filesystems |
| `e2fsprogs` (`mkfs.ext4`, `tune2fs`, `e2fsck`, `resize2fs`) | `e2fsprogs` | `e2fsprogs` | Creating and shrinking ext4 filesystems |
| `find` | `findutils` | `findutils` | Finding and copying filesystem contents |
| `grep` | `grep` | `grep` | Validation and command detection |
| `hexdump` | `bsdextrautils` | `util-linux` | Generating VFAT UUIDs |
| `mcopy`, `mlabel` | `mtools` | `mtools` | Writing and labeling VFAT images |
| `blockdev`, `mount`, `umount`, `rev`, `seq`, `uuidgen` | `fdisk`, `util-linux`, `uuid-runtime` | `util-linux` | Mounting, partitioning, iteration, and UUIDs |
| `policycoreutils` (`setfiles`) | `policycoreutils` | `policycoreutils` | Applying SELinux labels |
| `rpm`/`dnf` (`yum`) | `rpm`, `dnf` | `rpm`, `dnf` | Installing packages into the rootfs |
| `sed` | `sed` | `sed` | Parsing configuration and command output |
| `tar` | `tar` | `tar` | Rootfs archive creation and extraction |
| `zstd` | `zstd` | `zstd` | Rootfs compression |
| `pseudo`, `pseudodb`, `pseudolog` | Build from source | Build from source | Rootfs ownership and metadata emulation |
| `img2simg` | Build from source | Build from source | Optional sparse-image post-processing |
For CI environments that invoke the scripts directly, install the dependencies
with Debian:
```shell
sudo apt-get update
sudo apt-get install --no-install-recommends \
attr bash bsdextrautils coreutils curl dosfstools e2fsprogs fdisk findutils \
grep make mtools policycoreutils qemu-user-static binfmt-support rsync rpm \
sed tar unzip util-linux uuid-runtime zstd
sudo update-binfmts --enable qemu-riscv64
```
The corresponding Fedora setup is:
```shell
sudo dnf install \
attr bash coreutils curl dosfstools e2fsprogs findutils grep make mtools \
policycoreutils qemu-user-static rsync rpm sed tar unzip util-linux zstd
sudo systemctl enable --now systemd-binfmt
```
`pseudo` and `img2simg` are built in the Dockerfile and are not standard
runtime packages on Debian or Fedora. They must also be available in `PATH`
when scripts are invoked directly.
The current Dockerfile does not need `bzip2`, `gzip`, `xz-utils`, `gdisk`, or
`rsync`: the scripts use Zstandard only, partitioning is done by `sfdisk`, and
recipe staging, downloading, and extraction happen on the host. `zlib1g`
remains required by the custom `img2simg` binary.
## Usage
@@ -52,7 +120,7 @@ Firstly, let it build a container image for later use:
make container
```
It will be tagged and managed by docker.
It will be tagged and managed by the configured container runtime.
Listing all available targets:
@@ -78,16 +146,20 @@ Build all available BSP targets, parallelly:
make -j$(nproc) all_bsp
```
To invoke `build_rootfs.sh` and `build_bsp.sh` directly on the host instead of
through a container, clear `CONTAINER_CMD`:
For CI jobs that invoke `build_rootfs.sh` and `build_bsp.sh` directly instead
of through a container, clear `CONTAINER_CMD`:
```shell
make CONTAINER_CMD= openEuler-24.03-LTS-SP4-RVA23-base-OLK-generic
```
Direct execution requires the tools used by the scripts, including `pseudo`,
`yum` or `dnf`, filesystem utilities, and sufficient privileges for mounting
filesystems. `make container` still builds the Docker image.
Normal builds use the configured container runtime. Set `CONTAINER_CMD=podman`
to use Podman instead of Docker:
```shell
make CONTAINER_CMD=podman container
make CONTAINER_CMD=podman openEuler-24.03-LTS-SP4-RVA23-base-OLK-generic
```
> BSP target will be rebuilt each time even if no configuration is changed