Debian Build Release TI

From Variscite Wiki
Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release am62-debian-bookworm-6.1.83_09.02.01.10-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
VAR-SOM-AM62 - Debian Bookworm 12.8 based on 09.02.01.10 TI release


Note

Since Debian Bookwarm with TI release 09.02.01.10, the debian build system has transitioned to using TI-customized version of bdebstrap for creating root filesystems. TI customized the bdebstrap also integrates additional components, including the TI Graphics SDK and other essential packages tailored for am62 platforms. Therefore, it is recommended to familiarize yourself with the following guides first:

Variscite customizes the TI-modified bdebstrap by adding their own tailored U-Boot, kernel, and other specialized packages to suit VAR-SOM-AM62 SOM.

Create build environment

These instructions were tested on Ubuntu 22.04 x64 host PCs. When using other distributions, there may be issues.

Installing required packages

Please make sure your host PC is running Ubuntu 22.04 64-bit and is up to date:

 $ sudo apt-get update && sudo apt-get dist-upgrade

Then, install the following packages:

 $ sudo apt install -y pigz expect pv binfmtc binfmt-support qemu-user \
   qemu-user-static qemu-system-arm debian-archive-keyring bdebstrap \
   build-essential autoconf automake bison flex libssl-dev \
   bc git wget u-boot-tools swig python3-pyelftools python3-pip python3-dev \
   python3-yaml python3-jsonschema python3-cryptography
  
 $ sudo apt install --fix-broken
 
 $ sudo pip3 install toml-cli

For Ubuntu 20.04 and earlier, install python2:

$ sudo apt-get install python python-pysqlite2

-->Starting in Ubuntu 22.04, python2 is no longer available. Install the following to create a symbolic link from python to python3:

$ sudo apt-get install python-is-python3


Note: Variscite provides Docker containers that can be used for a development environment as an alternative to using a virtual machine or a dedicated computer. To learn more, please see Variscite's Docker Build Environment guide.

Create a build directory:

$ mkdir ~/debian_am62x_var_som
$ cd ~/debian_am62x_var_som

Deploy source

Download archive containing the build script and support files for building Debian Bookworm for the VAR-SOM-AM62:

$ git clone https://github.com/varigit/ti-bdebstrap -b debian_bookworm_var01 debian_am62x_var_som

= Building the Debian image = (Internet and ipv6 connection should be available):

 $ cd ~/debian_am62x_var_som
 $ sudo ./build.sh am62-bookworm-09.02.01.10_var01

The ouput build logs can be found under ~/debian_am62x_var_som/logs/am62-bookworm-09.02.01.10_var01.log

Create debian image

 $ sudo ./create-wic.sh am62-bookworm-09.02.01.10_var01
 

This image combines the U-Boot bootloader, kernel, device tree blob (DTB), and root filesystem (rootfs) into a single, complete disk image, ready for deployment.

The image is located at ~/debian_am62x_var_som/build/am62-bookworm-09.02.01.10_var01

Build Results

Image name
How to use
tisdk-am62-bookworm-variscite-am62xx-var-som-rootfs.tar.xz Root filesystem tarball used for installation on SD card and eMMC
tisdk-am62-bookworm-variscite-am62xx-var-som-boot.tar.xz
boot/tiboot3-am62x-gp-evm.bin
boot/tiboot3-am62x-hs-evm.bin
boot/tiboot3-am62x-hs-fs-evm.bin
boot/tiboot3.bin
boot/tispl.bin
boot/u-boot.img
tisdk-am62-bookworm-variscite-am62xx-var-som-boot.tar.xz that contains U-boot images
tisdk-debian-bookworm-am62xx-var-som.wic.zst wic image to flash on SD card
tisdk-debian-bookworm-am62xx-var-som-recovery-image.wic.zst Debian Recovery Image to install debian on eMMC
am62-bookworm-09.02.01.010_var01.swu update debian using swupdate agent


Create a bootable SD card

SD Card Structure

Disk /dev/sda: 7,4 GiB, 7948206080 bytes, 15523840 sectors Disk model: Storage Device Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4046c095

Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 264191 262144 128M c W95 FAT32 (LBA) /dev/sda2 264192 15523839 15259648 7,3G 83 Linux


  • sda1 is the fat partition which contains uboot images for r5 and a53 (tiboot3.bin , tispl.bin and uboot.img)
  • sda2 partition is an ext3/ext4 partition that contains the complete root filesystem (including kernel image and device tree files under /boot).


Note: This partition includes an unallocated area to ensure compatibility with all 8 GB SD cards, as their actual sizes may vary. For instructions on optimizing the usage of your SD card's capacity, refer to the section Extending the SD Card Size.

Flash the image on SD card

Flash the image tisdk-debian-bookworm-am62xx-var-som.wic.zst located in the folder debian_am62x_var_som/build/am62-bookworm-09.02.01.10_var01. This is a complete, bootable image that can be directly flashed onto an SD card. Refer to Build Results section

Example usage:

 $ sudo umount /dev/sdX*
 $ cd debian_am62x_var_som/build
 $ zstdcat tisdk-debian-bookworm-am62xx-var-som.wic.zst | sudo dd of=/dev/sdX bs=1M conv=fsync
 

Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.


Note: Booting your system from an SD card requires pressing the boot-select button, or switching the relevant DIP switch to "Boot from SD card", according to the relevant start-up guide of your system


Note: If using any of the native .img.zst images output from Debian, these will only have a default partition size of slightly less than 8 GB in order to fit on most SD cards. In order to maximize all usable space on the SD card, please see the section on Extending the SD Card Size.

Extending the SD Card Size

Flashing the default .img.zst images from Yocto results in a rootfs that does not utilize the entire SD card. This section explains how the SD card can be extended on the build host after flashing.
Procedure:

Begin with an SD card on which you have previously flashed a Yocto .img.zst image. Ensure the SD card is inserted and the device present (i.e. /dev/sda, /dev/mmcblk0, etc.)

Note: Below replace /dev/sdX with your actual device (i.e. /dev/sda)
 $ sudo fdisk /dev/sdX
 

Disk /dev/sda: 7,4 GiB, 7948206080 bytes, 15523840 sectors Disk model: Storage Device Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x4046c095

Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 264191 262144 128M c W95 FAT32 (LBA) /dev/sda2 264192 15523839 15259648 7,3G 83 Linux

sda2 which is having rootfs , so we can use sda2 to resize the filesystem.

Next, run the following sequence of commands followed by enter with each step explained with a "-" to the right. Each command/input should be followed by enter:

  • d - Delete current partition (2).
  • n - Create a new parition.
  • - Empty, hit enter only which will leave default response p for primary partition.
  • - Empty, hit enter only which will leave default response 2 for first partition.
  • - Empty, hit enter only which will leave default response as 264192 for first sector.
  • - Empty, hit enter only which will leave default response as 15523839 for last sector.
  • N - Answers no to not remove the ext3 signature on the disk
  • p - Print output and verify before we write. We should see the starting offset the same and the end expanded to fill the SD card.
  • w - Write output to disk


See the full log of the above sequence below:

$ sudo fdisk  /dev/sda

This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap partitions on this disk.

Command (m for help): n Partition type

  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)

Select (default p): p Partition number (1-4, default 1): First sector (2048-15523839, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15523839, default 15523839): +128M

Command (m for help): p

Disk /dev/sda: 7,4 GiB, 7948206080 bytes, 15523840 sectors Disk model: Storage Device Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xb9b89088

Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 264191 262144 128M c W95 FAT32 (LBA) /dev/sda2 264192 12582911 12318720 5,9G 83 Linux

Command (m for help): d Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): n Partition type

  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)

Select (default p):

Using default response p. Partition number (2-4, default 2): First sector (264192-15523839, default 264192): Last sector, +/-sectors or +/-size{K,M,G,T,P} (264192-15523839, default 15523839):

Created a new partition 2 of type 'Linux' and of size 7,3 GiB. Partition #2 contains a ext3 signature.

Do you want to remove the signature? [Y]es/[N]o: N

Command (m for help): p

Disk /dev/sda: 7,4 GiB, 7948206080 bytes, 15523840 sectors Disk model: Storage Device Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xb9b89088

Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 264191 262144 128M c W95 FAT32 (LBA) /dev/sda2 264192 15523839 15259648 7,3G 83 Linux

Command (m for help): w The partition table has been altered. Syncing disks.


Finally, the file system needs to be resized on the disk to fill the now larger partition. Do that as follows:

$ sudo e2fsck -f /dev/sdX2                                                   

e2fsck 1.46.5 (30-Dec-2021) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information rootfs: 59259/385024 files (7.4% non-contiguous), 590981/1539840 blocks


$ sudo resize2fs /dev/sdX2                                                   

resize2fs 1.46.5 (30-Dec-2021) Resizing the filesystem on /dev/sda2 to 1907456 (4k) blocks. The filesystem on /dev/sda2 is now 1907456 (4k) blocks long.

$ sync


Again, numbers and output should differ slightly depending on your card.

Your rootfs image should now fill the entire SD card and is ready to boot.


Boot the board with a bootable SD card

Setting the Boot Mode

Make sure the BOOT SELECT DIP switch on the carrier board is set correctly before you power on the board.

SW7
 0 : Boot from SD card
 1 : Boot from eMMC


Automatic device tree selection in U-Boot

As shown in the Build Results table above, we have different kernel device trees, corresponding to our different H/W configurations (sometimes they are renamed without the "-" prefix).

We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware. }}

Enable/Disable Automatic Device Tree selection

To enable the automatic device tree selection in U-Boot (already enabled by default):

$ setenv fdt_file undefined
$ saveenv

To disable the automatic device tree selection in U-Boot, set the device tree file manually:}}

$ setenv fdt_file YOUR_DTB_FILE
$ saveenv


Debian Recovery Image

The Debian recovery image, named tisdk-debian-bookworm-am62xx-var-som-recovery-image.wic.zst, is located in debian_am62x_var_som/build/am62-bookworm-09.02.01.10_var01. This image is used to create a bootable SD card that contains another target image to be programmed to the eMMC. See the Recovery SD card or the more manual Installing Debian to the SOM's internal storage articles for specifics of installing a recovery image.

Usage:

To create a recovery image, simply run the following from your Debian environment:

$ cd debian_am62x_var_som/scripts/am62x-var-som
$ ./create-recovery-sdcard.sh am62-bookworm-09.02.01.10_var01


Linux console access

Default users and passwords

User name User password User descriptor
root root system administrator
user user local user

You can customize the users during runtime with the common known methods in Debian. Please follow up with the next section if you'd like to customize them during the build.