Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ENV LC_ALL=C.UTF-8

WORKDIR /workspace

# fdisk 包提供 sfdisk:Stage 5 镜像脚本 build_imx6ull_image.sh 用它写 MBR 分区表;
# Ubuntu 已将 sfdisk 从 util-linux 拆到独立的 fdisk 包(非 Essential),故需显式声明
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
bc \
Expand All @@ -73,6 +75,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rsync \
file \
u-boot-tools \
fdisk \
picocom \
imagemagick \
libts-dev \
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.cn
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ ENV LC_ALL=C.UTF-8

WORKDIR /workspace

# fdisk 包提供 sfdisk:Stage 5 镜像脚本 build_imx6ull_image.sh 用它写 MBR 分区表;
# Ubuntu 已将 sfdisk 从 util-linux 拆到独立的 fdisk 包(非 Essential),故需显式声明
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources \
&& apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand All @@ -73,6 +75,7 @@ RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.li
rsync \
file \
u-boot-tools \
fdisk \
picocom \
imagemagick \
libts-dev \
Expand Down
26 changes: 23 additions & 3 deletions scripts/init/env-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ALL_PKGS=(
"libssl-dev"
"libgnutls28-dev"
"libncurses-dev"
"fdisk"
)

# 按构建目标划分的依赖包
Expand Down Expand Up @@ -71,6 +72,12 @@ BUSYBOX_PKGS=(
"libncurses-dev"
)

# 镜像生成(Stage 5):build_imx6ull_image.sh 用 sfdisk 写 MBR 分区表
# 注意 Ubuntu 已将 sfdisk 从 util-linux 拆到独立的 fdisk 包
IMAGE_PKGS=(
"fdisk"
)

# 检查单个命令是否存在
check_cmd() {
local cmd=$1
Expand Down Expand Up @@ -163,6 +170,9 @@ check_dependencies() {
imagemagick)
check_cmd convert imagemagick || true
;;
fdisk)
check_cmd sfdisk fdisk || true
;;
libssl-dev)
if dpkg -s libssl-dev &> /dev/null; then
FOUND_PKGS+=(${pkg})
Expand Down Expand Up @@ -273,6 +283,11 @@ check_busybox_dependencies() {
check_dependencies BUSYBOX_PKGS "BusyBox"
}

# 检查镜像生成依赖包(Stage 5)
check_image_dependencies() {
check_dependencies IMAGE_PKGS "镜像生成"
}

# 显示帮助信息
show_help() {
cat << EOF
Expand All @@ -281,10 +296,11 @@ Usage: $(basename "$0") [OPTIONS]
检查主机依赖包并可选安装缺失的依赖。

OPTIONS:
--stage <1|2|3> 检查特定构建阶段的依赖包
--stage <1|2|3|5> 检查特定构建阶段的依赖包
1 = U-Boot依赖
2 = Linux依赖(NXP BSP & Mainline)
3 = BusyBox依赖
5 = 镜像生成依赖(sfdisk 等)
-h, --help 显示此帮助信息

EXAMPLES:
Expand Down Expand Up @@ -315,14 +331,18 @@ if [[ "$(basename "$0")" == "env-init.sh" ]]; then
log_info "检查 Stage 3 (BusyBox) 依赖包..."
check_busybox_dependencies
;;
5)
log_info "检查 Stage 5 (镜像生成) 依赖包..."
check_image_dependencies
;;
*)
echo "Usage: $0 [--stage 1|2|3]"
echo "Usage: $0 [--stage 1|2|3|5]"
echo "Use '$0 --help' for more information"
exit 1
;;
esac
else
echo "Usage: $0 [--stage 1|2|3]"
echo "Usage: $0 [--stage 1|2|3|5]"
echo "Use '$0 --help' for more information"
exit 1
fi
Expand Down
Loading