Debian: Getting Started with the PocketBeagle 2

This is a page about BeagleBoard’s PocketBeagle 2; https://www.beagleboard.org/boards/pocketbeagle-2

Availability

Boards:

Serial Cable:

Kits:

Basic Requirements

Cross Compiler: 32bit arm-linux-gnueabi-gcc

This is a pre-built (64bit) version of GCC that runs on generic linux, sorry (32bit) x86 users, it’s time to upgrade…

Download/Extract:

#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-

Test Cross Compiler:

#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.

Cross Compiler: 64bit aarch64-linux-gcc

This is a pre-built (64bit) version of GCC that runs on generic linux, sorry (32bit) x86 users, it’s time to upgrade…

Download/Extract:

#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-

Test Cross Compiler:

#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.

Bootloader: TI Linux Firmware

The TI Firmwares are required for functionality of the system: https://git.ti.com/gitweb?p=processor-firmware/ti-linux-firmware.git;a=shortlog;h=refs/heads/ti-linux-firmware

Download:

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

Bootloader: Trusted Firmware A

Trusted Firmware for A profile Arm CPUs: https://git.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a.git/

Host Package Requirements

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

Download:

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

Build:

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

Bootloader: OP TEE

Open Portable Trusted Execution Environment (OP-TEE): https://github.com/OP-TEE/optee_os

Host Package Requirements

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

Download:

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

Build:

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

Bootloader: U-Boot

Das U-Boot – the Universal Boot Loader: http://www.denx.de/wiki/U-Boot

Host Package Requirements

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

Download:

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

Configure and Build: Cortex-R4

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

Copy Build Objects: Cortex-R4

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

Configure and Build: Cortex-A53

#user@localhost:~$
make -C ./u-boot/ O=../CORTEXA CROSS_COMPILE=${CC64} am6232_pocketbeagle2_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/

Copy Build Objects: Cortex-A53

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

Linux Kernel

This script will build the kernel, modules, device tree binaries and copy them to the deploy directory.

Download:

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

For v6.14.x-arm64-k3 (6.14.x):

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

Build:

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

Root File System

Debian 12

User Password
debian temppwd

Download:

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

Verify:

#user@localhost:~$
sha256sum debian-12.10-minimal-arm64-2025-04-02.tar.xz
#sha256sum output:
a1195de7afdcb99c59be94571d83c651ac1c846bb97cdb24b2ff3e741b9e3b95  debian-12.10-minimal-arm64-2025-04-02.tar.xz

Extract:

#user@localhost:~$
tar xf debian-12.10-minimal-arm64-2025-04-02.tar.xz

Install Kernel and Root File System

To help new users, since the kernel version can change on a daily basis. The kernel building scripts listed on this page will now give you a hint of what kernel version was built.

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

Copy and paste that “export kernel_version=5.X.Y-Z” exactly as shown in your own build/desktop environment and hit enter to create an environment variable to be used later.

export kernel_version=5.X.Y-Z

Create Root File System with genimage:

The genimage https://github.com/pengutronix/genimage tool is now used to generate a sdcard.img vs directly interfacing with the microSD.

Host Package Requirements

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

Create working directory for genimage:

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

Copy Root File System

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

Enable first boot customization

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

Open ./input/sysconf.txt in your text editor and change any user setting.

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

Setup 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"

Copy Kernel Image

Kernel Image:

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

Copy Kernel Device Tree Binaries

#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-am6232-pocketbeagle2.dtb ./input/k3-am6232-pocketbeagle2.dtb

Copy Kernel Modules

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

File Systems Table (/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"

Check partition size

Verify Root File partition size, this can be used to modify the seek value below for size tweaking.

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

Create 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/

Create sdcard.img with genimage

The genimage https://github.com/pengutronix/genimage tool is now used to generate a sdcard.img vs directly interfacing with the microSD.

Create genimage.cfg file

#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-am62x-hs-fs-evm.bin
            }
            file ti/k3-am6232-pocketbeagle2.dtb {
                    image = k3-am6232-pocketbeagle2.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"
        }
}

Run genimage on genimage.cfg

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

genimage output

sdcard.img can be flashed to a microSD using rpi-imager https://github.com/raspberrypi/rpi-imager or your favorite image writing software.

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

1 directory, 1 file

Final Tweaks (extend rootfs partition)

Extend the rootfs partition to fill available space on drive.

Use growpart to extend a partition in a partition table

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

First Reboot

sudo reboot

Use resize2fs to enlarge the existing filesystem

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.

Second Reboot

This last reboot will take awhile as fsck is checking the partition on bootup.

sudo reboot

Comments

Any questions or comments please go to our TechForum: TechForum

1 Like