> ## Documentation Index
> Fetch the complete documentation index at: https://docs.t3gemstone.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> T3 Edge AI Package Installation

This section provides instructions on how to install the Edge AI package on the T3 Gemstone O1 development board.
With these packages, you will be able to perform image processing operations using AI accelerators.

<Steps>
  <Step title="Update the Package Repository">
    ```bash theme={"system"}
    sudo apt update
    ```

    Keeping the system package list up to date prevents dependency errors that may occur during installation.
  </Step>

  <Step title="Install T3 Edge AI Packages">
    ```bash theme={"system"}
    sudo apt install t3-gem-o1-edgeai
    ```

    This command installs the Edge AI development tools and libraries in a single step.
  </Step>

  <Step title="Activate Edge AI Overlay">
    Open the `uEnv.txt` file located in the boot directory using the `nano` text editor from the terminal interface.

    ```bash theme={"system"}
    sudo nano /boot/uEnv.txt
    ```

    <Tip>
      Since we are using the command with sudo, it will prompt for a password. If you have not changed it, you
      must use the password you set while writing the image with Gem-Imager.
    </Tip>

    The `uEnv.txt` file will contain definitions such as the following:

    ```
    firstboot=0
    overlays=k3-am67a-t3-gem-o1-spidev0-2cs.dtbo k3-am67a-t3-gem-o1-i2c1-400000.dtbo

    bootpart=1:1
    initrdaddr=0x90000000
    fdtoverlayaddr=0x89000000
    get_kern_mmc=load mmc ${bootpart} ${loadaddr} Image
    get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} k3-am67a-t3-gem-o1.dtb;fdt addr ${fdtaddr};fdt resize 8192
    get_initrd_mmc=load mmc ${bootpart} ${initrdaddr} gemstone-image-rd-t3-gem-o1.cpio.gz
    get_overlays=for o in ${overlays}; do load mmc ${bootpart} ${fdtoverlayaddr} overlays/${o};fdt apply ${fdtoverlayaddr}; done
    args_mmc=setenv bootargs console=${console} ${optargs} root=/dev/mmcblk1p2 rw rootfstype=btrfs bootpart=/dev/mmcblk1p1 firstboot=${firstboot} init_fatal_sh=1
    boot_mmc=run get_kern_mmc;run get_fdt_mmc;run get_overlays;run get_initrd_mmc;booti ${loadaddr} ${initrdaddr}:${filesize} ${fdtaddr}
    distro_bootcmd=run args_mmc;run boot_mmc
    ```

    Add the `k3-am67a-t3-gem-o1-edgeai-apps.dtbo` filename to the end of the `overlays=` line, leaving a space.

    The final state of the `uEnv.txt` file will look like this. You must place the appropriate filename in the `<file-name>` section.

    ```
    firstboot=0
    overlays=k3-am67a-t3-gem-o1-spidev0-2cs.dtbo k3-am67a-t3-gem-o1-i2c1-400000.dtbo <file-name>

    bootpart=1:1
    initrdaddr=0x90000000
    fdtoverlayaddr=0x89000000
    get_kern_mmc=load mmc ${bootpart} ${loadaddr} Image
    get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} k3-am67a-t3-gem-o1.dtb;fdt addr ${fdtaddr};fdt resize 8192
    get_initrd_mmc=load mmc ${bootpart} ${initrdaddr} gemstone-image-rd-t3-gem-o1.cpio.gz
    get_overlays=for o in ${overlays}; do load mmc ${bootpart} ${fdtoverlayaddr} overlays/${o};fdt apply ${fdtoverlayaddr}; done
    args_mmc=setenv bootargs console=${console} ${optargs} root=/dev/mmcblk1p2 rw rootfstype=btrfs bootpart=/dev/mmcblk1p1 firstboot=${firstboot} init_fatal_sh=1
    boot_mmc=run get_kern_mmc;run get_fdt_mmc;run get_overlays;run get_initrd_mmc;booti ${loadaddr} ${initrdaddr}:${filesize} ${fdtaddr}
    distro_bootcmd=run args_mmc;run boot_mmc
    ```

    After defining the overlay file, the board must be rebooted for the changes to be applied by the system.

    ```bash theme={"system"}
      sudo reboot
    ```
  </Step>

  <Step title="Load Environment Variables">
    ```bash theme={"system"}
    sudo su
    source /opt/t3-edgeai-env
    ```

    These commands allow you to switch to the `root` user and load the environment variables required for Edge AI.

    <Warning>
      Note: Due to the use of AI accelerators, operations are performed at the hardware level. Therefore, the
      relevant steps must be executed under the root user.
    </Warning>
  </Step>
</Steps>
