Template:Yocto Build Release TI: Difference between revisions

From Variscite Wiki
 
(46 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:UBUNTU_COMPAT|18.04/20.04}}<!--
<includeonly>
{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 |
  {{#vardefine:UBUNTU_COMPAT|22.04}}
  |
  {{#vardefine:UBUNTU_COMPAT|18.04/20.04}}
  }}<!--
-->
-->
{{PageHeader|{{#var:HARDWARE_NAME}} - Yocto {{#var:YOCTO_NAME}} {{#var:YOCTO_VERSION}}}}
{{PageHeader|{{#var:HARDWARE_NAME}} - Yocto {{#var:YOCTO_NAME}} {{#var:YOCTO_VERSION}}}}


= Introduction =
= Introduction =
This guide walks through the process for building Variscite's reference Yocto image from source code. It is derived from TI's guide [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:TI_RELEASE_}}/exports/docs/linux/Overview_Building_the_SDK.html?highlight=bitbake Overview Building the SDK]
This guide walks through the process for building Variscite's reference Yocto image from source code. It is derived from TI's guide [{{#var:TI_RELEASE_OVERVIEW_BUILD}} Overview Building the SDK]


= Installing required packages =
= Installing required packages =
{{Note|'''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 | Docker Build Environment]] guide.
If you are using docker, you can skip this section.
}}


Please make sure your host PC is running Ubuntu {{#var:UBUNTU_COMPAT}} 64-bit and is up to date:
Please make sure your host PC is running Ubuntu {{#var:UBUNTU_COMPAT}} 64-bit and is up to date:
Line 16: Line 28:
         automake bison \
         automake bison \
         flex libssl-dev bc u-boot-tools \
         flex libssl-dev bc u-boot-tools \
         python diffstat \
         diffstat \
         texinfo gawk chrpath dos2unix \
         texinfo gawk chrpath dos2unix \
         wget unzip socat doxygen libc6:i386 \
         wget unzip socat doxygen libc6:i386 \
Line 22: Line 34:
         libz1:i386 g++-multilib \
         libz1:i386 g++-multilib \
         git python3-distutils python3-apt
         git python3-distutils python3-apt
For Ubuntu 20.04 and older:
$ sudo apt install python
For Ubuntu 22.04 and newer,:
$ sudo apt install python-is-python3


By default Ubuntu uses “dash” as the default shell for /bin/sh. You must reconfigure to use bash by running the following command:
By default Ubuntu uses “dash” as the default shell for /bin/sh. You must reconfigure to use bash by running the following command:
Line 29: Line 47:
Be sure to select “No” when you are asked to use dash as the default system shell.
Be sure to select “No” when you are asked to use dash as the default system shell.


{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |&nbsp;
= Install Toolchains to home directory =
= Install Toolchains to home directory =
{{K3_TOOLCHAIN_INSTALL}}
{{K3_TOOLCHAIN_INSTALL}}
}}


= Download Yocto {{#var:YOCTO_NAME}} and setup environment =
= Download Yocto {{#var:YOCTO_NAME}} and setup environment =


Download the source code:
'''Download the latest source code (recommended):'''


$ mkdir ~/var-ti-yocto && cd ~/var-ti-yocto
  $ git clone {{#var:OE_LAYERSETUP_GIT}} ~/var-ti-yocto
  $ git clone {{#var:OE_LAYERSETUP_GIT}} tisdk
$ cd tisdk
$ ./oe-layertool-setup.sh -f {{#var:OE_LAYERSETUP_MANIFEST_PATH}}


Fetch the core-secdev-k3 Security Dev Tool:
or
{{GIT_FETCH|NAME=CORE_SECDEV_K3|WORKDIR=~/var-ti-yocto/tisdk/build|USE_COMMIT=y}}


'''Download a release tag:'''


Next, setup the environment. The above commands are only required for the very first build setup: whenever restarting a newer build session (from a different terminal or in a different time), you can skip the full setup and just run:
$ git clone {{#var:OE_LAYERSETUP_GIT}} ~/var-ti-yocto -b {{#var:RELEASE_NAME}}


$ cd build
{{Note|'''Optional:''' Variscite provides Docker containers that can be used for a development environment as an alternative to using a virtual machine or a dedicated computer.
$ . conf/setenv
To learn more, please see Variscite's [[Docker_Build_Environment | Docker Build Environment]] guide.
$ export TOOLCHAIN_PATH_ARMV7=$HOME/{{#var:armv7_toolchain}} && \
      export TOOLCHAIN_PATH_ARMV8=$HOME/{{#var:armv8_toolchain}} && \
      export TI_SECURE_DEV_PKG_K3=`pwd`/core-secdev-k3


= Build GUI demo image =
If you choose to use docker, launch a new container with the host build directory mounted to /workdir/build and the toolchains mounted to the home directory:


  $ MACHINE=am62x-var-som bitbake var-default-image
{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 |
$ cd ~/var-ti-yocto
$ ~/var-host-docker-containers/run.sh  -u 22.04 -w $(pwd) {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $(for dir in ~/gcc-arm*; do echo -n "-v $dir:/home/vari/$(basename $dir) "; done)}}
  |
  $ cd ~/var-ti-yocto
$ ~/var-host-docker-containers/run.sh  -u 20.04 -w $(pwd) {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $(for dir in ~/gcc-arm*; do echo -n "-v $dir:/home/vari/$(basename $dir) "; done)}}
}}


= Create a bootable SD card =
Follow the remaining steps to build an image, replacing the path ~/var-ti-yocto/build with /workdir/build.
}}


The wic image fully supports booting from an SD Card. Use the command below to write it to an SD Card:
* Download the source code dependencies'''<br>
$ cd ~/var-ti-yocto
$ ./oe-layertool-setup.sh -f {{#var:OE_LAYERSETUP_MANIFEST_PATH}}
<!--
* '''Download a release tag'''<br>
$ cd ~/var-ti-yocto
$ git checkout {{#var:RELEASE_NAME}}
$ ./oe-layertool-setup.sh -f {{#var:OE_LAYERSETUP_MANIFEST_PATH}}
-->
{{#varexists:CORE_SECDEV_K3_GIT |
Fetch the core-secdev-k3 Security Dev Tool:
{{GIT_FETCH|NAME=CORE_SECDEV_K3|WORKDIR=~/var-ti-yocto/build|USE_COMMIT=y}}
| }}


$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/var-default-image-am62x-var-som.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
Next, setup the environment. The above commands are only required for the very first build setup: whenever restarting a newer build session (from a different terminal or in a different time), you can skip the full setup and just run:
{{note|'''NOTE''': The wic image does not support all features booting from eMMC. For example, /etc/fw_env.config is configured for the SD Card (/dev/mmcblk1) |info}}


= Create a Recovery SD card =
{{#switch: {{#var:SOC}}
| am33
= {{AM33_SETUP_ENV_RETURN}}
| #default
= {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | {{AM62_SETUP_ENV_RETURN}} | {{AM62_SETUP_ENV_RETURN_YOCTO_TOOLCHAIN}} }}
}}


As mentioned above, the wic image only supports booting from an SD card. To flash an image to eMMC, Variscite provides an image '''var-recovery-sd-image''', which inherits '''var-default-image''' and adds the following files needed for installing to eMMC:
= Build GUI demo image =


  /usr/bin/install_yocto.sh
  $ MACHINE={{#var:MACHINE_NAME}} bitbake var-default-image
/usr/bin/echos.sh
/opt/images/Yocto/
/opt/images/Yocto/boot
/opt/images/Yocto/boot/u-boot.img
/opt/images/Yocto/boot/tiboot3.bin
/opt/images/Yocto/boot/tispl.bin
/opt/images/Yocto/boot/uEnv.txt
/opt/images/Yocto/rootfs.tar.zst


By default, the image will be named '''var-recovery-sd-image-am62x-var-som.wic.zst'''. It can be overridden adding the '''RECOVERY_SD_NAME''' variable to local.conf. For example:
= Build thin demo image =
This image is based on var-default-image, but the size is strongly reduced removing the biggest packages (mainly LTP, multimedia, Qt5)


  echo 'RECOVERY_SD_NAME="{{#var:RECOVERY_SD_NAME}}"' >> conf/local.conf
  $ MACHINE={{#var:MACHINE_NAME}} bitbake var-thin-image


Build the image:
= Create a bootable SD card =


$ MACHINE=am62x-var-som bitbake var-recovery-sd-image
The wic image fully supports booting from an SD card. Use the command below to write it to an SD card:


Write it to an SD Card:
$ {{#var:UNZIP}} {{#var:DEPLOY_DIR}}/images/{{#var:MACHINE_NAME}}/{{#var:DEFAULT_IMAGE_BB_NAME}}-{{#var:MACHINE_NAME}}.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
{{note|'''NOTE''': The wic image does not support all features booting from eMMC. For example, /etc/fw_env.config is configured for the SD card (/dev/mmcblk1) |info}}


$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/var-recovery-sd-image-am62x-var-som.wic.zst | sudo dd of=/dev/sdX bs=1M && sync
= Create a Recovery SD card =
Or, if the image name was overidden with RECOVERY_SD_NAME:
$ zstdcat arago-tmp-external-arm-glibc/deploy/images/am62x-var-som/{{#var:RECOVERY_SD_NAME}} | sudo dd of=/dev/sdX bs=1M && sync


Note: Some SD card duplicator machines do not support 64-bit filesystems. To build a recovery SD card image with 32-bit filesystems, add '''MKE2FS_NO_64="y"''' to '''conf/local.conf''' and rebuild the image:
{{#switch: {{#var:RELEASE_NAME}}
| am62-yocto-dunfell-5.10.168_08.06.00.42-v1.2
| am62-yocto-dunfell-5.10.168_08.06.00.42-v1.1
| am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0
= {{AM62-recovery-image
    | var-recovery-recipe = var-recovery-sd-image
  }}
| am33-yocto-dunfell-5.10.100_08.02.00.24-v1.0
= {{AM33-recovery-image
    | var-recovery-recipe = var-recovery-image
  }}
| #default
= {{AM62-recovery-image
    | var-recovery-recipe = var-recovery-image
  }}
}}


  $ echo 'KE2FS_NO_64="y"' >> conf/local.conf
{{#switch: {{#var:SOC}}
| am62
  = {{AM62-partition-table}}
}}
</includeonly>
</includeonly>

Latest revision as of 14:27, 11 August 2024