Debian:BeagleY-AI 入门指南

本页面介绍 BeagleBoard 的 BeagleY-AI;官网链接:https://www.beagleboard.org/boards/beagley-ai

获取渠道

开发板:

串口线:

散热片:

基础要求

交叉编译器: 32 arm-linux-gnueabi-gcc

此为预构建的 GCC(64 位)版本,适用于通用 Linux 系统。仍在使用 32 位 x86 架构的用户请考虑升级设备…

下载/解压:

#user@localhost:~$
wget -c https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.5.0/x86_64-gcc-11.5.0-nolibc-arm-linux-gnueabi.tar.xz
tar -xf x86_64-gcc-11.5.0-nolibc-arm-linux-gnueabi.tar.xz
export CC32=`pwd`/gcc-11.5.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-

测试交叉编译器:

#user@localhost:~$
${CC32}gcc --version
#Test Output:
arm-linux-gnueabi-gcc (GCC) 11.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

交叉编译器: 64 aarch64-linux-gcc

此为预构建的 GCC(64 位)版本,适用于通用 Linux 系统。仍在使用 32 位 x86 架构的用户请考虑升级设备……

下载/解压:

#user@localhost:~$
wget -c https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.5.0/x86_64-gcc-11.5.0-nolibc-aarch64-linux.tar.xz
tar -xf x86_64-gcc-11.5.0-nolibc-aarch64-linux.tar.xz
export CC64=`pwd`/gcc-11.5.0-nolibc/aarch64-linux/bin/aarch64-linux-

测试交叉编译器:

#user@localhost:~$
${CC64}gcc --version
#Test Output:
aarch64-linux-gcc (GCC) 11.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

引导加载程序:

预安装包含build-essential和git在内的若干主机软件包,这些将用于构建其他所有组件。

主机软件包需求

#user@localhost:~$
sudo apt update ; \
sudo apt-get install -y build-essential git

引导加载程序: TI Linux 固件

系统功能需要TI固件支持:https://git.ti.com/gitweb?p=processor-firmware/ti-linux-firmware.git;a=shortlog;h=refs/heads/ti-linux-firmware

下载:

#user@localhost:~$
git clone -b 11.01.03 https://github.com/beagleboard/ti-linux-firmware.git --depth=1

引导加载程序:可信固件 A

面向A系列Arm CPU的可信固件:https://git.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a.git/

下载:

#user@localhost:~$
git clone -b lts-v2.12.4 https://github.com/TrustedFirmware-A/trusted-firmware-a.git  --depth=1

构建:

#user@localhost:~$
make -C ./trusted-firmware-a/ -j4 CROSS_COMPILE=${CC64} PLAT=k3 ARCH=aarch64 SPD=opteed TARGET_BOARD=lite  all

引导加载程序: OP TEE

开放式便携可信执行环境(OP-TEE):https://github.com/OP-TEE/optee_os

主机软件包需求

#user@localhost:~$
sudo apt update ; \
sudo apt-get install -y python3-cryptography python3-minimal ; \
sudo apt-get install -y python3-pyelftools

下载:

#user@localhost:~$
git clone -b 4.6.0 https://github.com/OP-TEE/optee_os.git --depth=1

构建:

#user@localhost:~$
make -C ./optee_os/ -j4 CROSS_COMPILE=${CC32} CROSS_COMPILE64=${CC64} CFG_ARM64_core=y PLATFORM=k3-am62x  all

引导加载程序: U-Boot

Das U-Boot – 通用引导加载程序:官网 http://www.denx.de/wiki/U-Boot

主机软件包需求

#user@localhost:~$
sudo apt update ; \
sudo apt-get install -y bc bison flex libgnutls28-dev libssl-dev; \
sudo apt-get install -y python3-dev python3-jsonschema ; \
sudo apt-get install -y python3-setuptools python3-yaml ; \
sudo apt-get install -y swig uuid-dev yamllint

下载:

#user@localhost:~$
git clone -b v2025.07-rc5-Beagle https://github.com/beagleboard/u-boot.git --depth=1

配置与构建:Cortex-R4

#user@localhost:~$
make -C ./u-boot/ O=../CORTEXR CROSS_COMPILE=${CC32} am67a_beagley_ai_r5_defconfig ; \
make -C ./u-boot/ -j4 O=../CORTEXR CROSS_COMPILE=${CC32} BINMAN_INDIRS=../ti-linux-firmware/

复制构建对象:Cortex-R4

#user@localhost:~$
mkdir -p ./input/ ; \
cp -v ./CORTEXR/tiboot3-j722s-hs-fs-evm.bin ./input/

配置与构建:Cortex-A53

#user@localhost:~$
make -C ./u-boot/ O=../CORTEXA CROSS_COMPILE=${CC64} am67a_beagley_ai_a53_defconfig ; \
make -C ./u-boot/ -j4 O=../CORTEXA CROSS_COMPILE=${CC64} BL31=../trusted-firmware-a/build/k3/lite/release/bl31.bin TEE=../optee_os/out/arm-plat-k3/core/tee-pager_v2.bin BINMAN_INDIRS=../ti-linux-firmware/

复制构建对象:Cortex-A53

#user@localhost:~$
cp -v ./CORTEXA/tispl.bin ./input/ ; \
cp -v ./CORTEXA/u-boot.img ./input/

Linux 内核

本脚本将构建内核、模块、设备树二进制文件,并将其复制到部署目录。

下载:

#user@localhost:~$
git clone https://github.com/RobertCNelson/arm64-multiplatform ./kernelbuildscripts
cd kernelbuildscripts/

适用于v6.15.x-arm64-k3(6.15.x版本):

#user@localhost:~/kernelbuildscripts$
git checkout origin/v6.15.x-arm64-k3 -b tmp

构建:

#user@localhost:~/kernelbuildscripts$
./build_kernel.sh

根文件系统

Debian 12

用户 密码
debian temppwd

下载:

#user@localhost:~$
wget -c https://rcn-ee.com/rootfs/eewiki/minfs/debian-12.11-minimal-arm64-2025-05-28.tar.xz

验证:

#user@localhost:~$
sha256sum debian-12.11-minimal-arm64-2025-05-28.tar.xz
#sha256sum output:
1c1683ff874a0efe130a924de67362171422132a8f5aeacc3db9214bcadcbcd2  debian-12.11-minimal-arm64-2025-05-28.tar.xz

解压:

#user@localhost:~$
tar xf debian-12.11-minimal-arm64-2025-05-28.tar.xz

安装内核与根文件系统

为帮助新用户,因内核版本可能每日变更。本页列出的内核构建脚本现会提示所构建的内核版本。

-----------------------------
Script Complete
eewiki.net: [user@localhost:~$ export kernel_version=5.X.Y-Z]
-----------------------------

请完全按照显示的格式复制粘贴“export kernel_version=5.X.Y-Z”到您的构建/桌面环境中,按回车创建后续使用的环境变量。

export kernel_version=5.X.Y-Z

使用 genimage 创建根文件系统:

现使用genimage工具https://github.com/pengutronix/genimage生成sdcard.img,而非直接操作microSD卡。

主机软件包需求

#user@localhost:~$
sudo apt update ; \
sudo apt-get install -y dosfstools genimage mtools

创建 genimage 工作目录:

#user@localhost:~$
sudo mkdir -p ./input/.rootfs

复制根文件系统

#user@localhost:~$
sudo tar xfvp ./debian-*-*-arm64-*/arm64-rootfs-*.tar -C ./input/.rootfs/
sync

启用首次启动自定义

#user@localhost:~$
sudo cp ./input/.rootfs/etc/bbb.io/templates/sysconf.txt ./input/

在文本编辑器中打开./input***/sysconf.txt***并修改任意用户设置。

  • user_name=
  • user_password=
  • hostname=
#user@localhost:~$
sudo nano ./input/sysconf.txt

配置 extlinux.conf

#user@localhost:~$
sudo sh -c "echo 'label Linux' > ./input/extlinux.conf"
sudo sh -c "echo '    kernel /Image.gz' >> ./input/extlinux.conf"
sudo sh -c "echo '    fdtdir /' >> ./input/extlinux.conf"
sudo sh -c "echo '    append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02860000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0' >> ./input/extlinux.conf"

复制内核镜像

内核镜像:

#user@localhost:~$
sudo cp -v ./kernelbuildscripts/deploy/${kernel_version}.Image ./input/Image.gz

复制内核设备树二进制文件

#user@localhost:~$
sudo mkdir -p ./input/dtbs/
sudo tar xfv ./kernelbuildscripts/deploy/${kernel_version}-dtbs.tar.gz -C ./input/dtbs/
sudo cp -v ./input/dtbs/ti/k3-am67a-beagley-ai.dtb ./input/k3-am67a-beagley-ai.dtb

复制内核模块

#user@localhost:~$
sudo tar xfv ./kernelbuildscripts/deploy/${kernel_version}-modules.tar.gz -C ./input/.rootfs/usr/

文件系统表 (/etc/fstab)

#user@localhost:~/$
sudo sh -c "echo '/dev/mmcblk1p2  /  auto  errors=remount-ro  0  1' >> ./input/.rootfs/etc/fstab"
sudo sh -c "echo '/dev/mmcblk1p1  /boot/firmware  vfat user,uid=1000,gid=1000,defaults 0 2' >> ./input/.rootfs/etc/fstab"

检查分区大小

验证根文件分区大小,可用于调整下方seek值以优化空间。

#user@localhost:~$
sudo du -sh ./input/.rootfs/

创建 rootfs.ext4

#user@localhost:~$
sudo dd if=/dev/zero of=./input/rootfs.ext4 bs=1 count=0 seek=1600M
sudo mkfs.ext4 -F ./input/rootfs.ext4 -d ./input/.rootfs/

使用 genimage 创建 sdcard.img

现使用genimage工具 https://github.com/pengutronix/genimage 生成sdcard.img,而非直接操作microSD卡。

创建 genimage.cfg 文件

#user@localhost:~$
nano genimage.cfg
#genimage.cfg
image boot.vfat {
        vfat {
            files = {
                    "tispl.bin",
                    "u-boot.img",
                    "Image.gz",
                    "sysconf.txt",
            }
            file tiboot3.bin {
                    image = "tiboot3-j722s-hs-fs-evm.bin"
            }
            file ti/k3-am67a-beagley-ai.dtb {
                    image = "k3-am67a-beagley-ai.dtb"
            }
            file extlinux/extlinux.conf {
                    image = "extlinux.conf"
            }
        }
        size = 256M
}
image sdcard.img {
        hdimage {}
        partition u-boot {
                partition-type = 0xC
                bootable = "true"
                image = "boot.vfat"
        }
        partition rootfs {
                partition-type = 0x83
                image = "rootfs.ext4"
        }
}

genimage.cfg 运行 genimage

#user@localhost:~$
sudo genimage --rootpath `mktemp` --config genimage.cfg

genimage 输出

可通过bb-imager-rshttps://github.com/beagleboard/bb-imager-rs 或rpi-imager https://github.com/raspberrypi/rpi-imager 或您常用的镜像烧录软件将sdcard.img写入microSD卡。

#user@localhost:~$
tree images/
images/
└── sdcard.img

1 directory, 1 file

最终调整(扩展根文件系统分区)

此时您已在使用烧录好的sdcard.img运行目标板。

扩展根文件系统分区以占满驱动器可用空间。

使用 growpart 扩展分区表中的分区

sudo growpart /dev/mmcblk1 2
voodoo@eewiki:~$ sudo growpart /dev/mmcblk1 2
CHANGED: partition=2 start=524289 old: size=3276800 end=3801088 new: size=61809630 end=62333918

首次重启

sudo reboot

使用 resize2fs 扩大现有文件系统

sudo resize2fs /dev/mmcblk1p2
voodoo@eewiki:~$ sudo resize2fs /dev/mmcblk1p2
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mmcblk1p2 is now 7726203 (4k) blocks long.

第二次重启

由于fsck在启动时检查分区,最后一次重启将耗时较长。

sudo reboot

评论

如有疑问或建议,请访问我们的技术论坛:技术论坛