Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update GCC_Toolchain instructions for AM335x/AM437x/AM57x #149

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 52 additions & 28 deletions source/linux/Foundational_Components/Kernel/_Users_Guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Overview

This document will cover the basic steps for building the Linux kernel.

.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. rubric:: Install host dependencies

Expand Down Expand Up @@ -56,7 +56,7 @@ Compiler

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

Before compiling the kernel or kernel modules the SDK's toolchain needs
to be added to the PATH environment variable
Expand All @@ -67,7 +67,7 @@ Compiler

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. include:: Overview/GCC_ToolChain.rst
:start-after: .. start_include_yocto_toolchain_host_setup
Expand All @@ -94,15 +94,15 @@ The command to clean the kernel is:

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- distclean

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -127,15 +127,15 @@ a command of the form:

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- <defconfig>

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -150,7 +150,7 @@ as a starting point).

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

platformName is am335x-evm for AM335x, am437x-evm for AM437x, am57xx-evm for
AM57xx, k2hk-evm for K2H/K2K, k2e-evm for K2E, k2l-evm for K2L, k2g-evm for
Expand All @@ -173,7 +173,7 @@ as a starting point).

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

For example, to apply the recommended kernel configuration for K3 devices, use:

Expand Down Expand Up @@ -209,7 +209,7 @@ To invoke the kernel configuration you simply use a command like:

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -223,7 +223,7 @@ To invoke the kernel configuration you simply use a command like:

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -250,7 +250,7 @@ Compiling the Kernel

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

Once the kernel has been configured it must be compiled to generate the
bootable kernel image as well as any dynamic kernel modules that were
Expand All @@ -269,7 +269,7 @@ Compiling the Kernel

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

By default U-boot expects to boot kernel `Image`, DTB, and DTOs found in root/boot of the
SD card if using SD/MMC boot. The exception is for HS-SE (High Security - Security Enforced)
Expand Down Expand Up @@ -297,7 +297,7 @@ Compiling the Device Tree Binaries

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

Starting with the 3.8 kernel each TI evm has an unique device tree
binary file required by the kernel. Therefore, you will need to build
Expand Down Expand Up @@ -370,7 +370,7 @@ Compiling the Device Tree Binaries

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

Each TI evm has an unique device tree
binary file required by the kernel. Therefore, you will need to build
Expand Down Expand Up @@ -439,7 +439,7 @@ Compiling the Kernel Modules

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

By default the majority of the Linux drivers used in the sdk are not
integrated into the kernel image file (zImage). These drivers are built as
Expand All @@ -451,7 +451,7 @@ Compiling the Kernel Modules

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

By default the majority of the Linux drivers used in the sdk are not
integrated into the kernel image file (Image). These drivers are built as
Expand Down Expand Up @@ -483,10 +483,19 @@ But developers may want to deploy and test new Kernel and DTB without going
through the standard build system. For the specific purpose, board specific
fitImage.its will be present in the prebuilt-images directory.

Pre-requisites ( Already part of SDK installations ):
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

- Uboot build directory for ARMV8
- Linux Image and DTB
Pre-requisites ( Already part of SDK installations ):

- Uboot build directory for ARMV7
- Linux Image and DTB

.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

Pre-requisites ( Already part of SDK installations ):

- Uboot build directory for ARMV8
- Linux Image and DTB

.. note::

Expand Down Expand Up @@ -626,9 +635,17 @@ Generating the fitImage
This step will embed the public key in the u-boot.dtb file that was already
built during the initial u-boot build.

.. code-block:: console
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

mkimage -r -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K $UBOOT_PATH/build/$ARMV7/dts/dt.dtb fitImage

mkimage -r -f fitImage.its -k $UBOOT_PATH/arch/arm/mach-k3/keys -K $UBOOT_PATH/build/$ARMV8/dts/dt.dtb fitImage
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

mkimage -r -f fitImage.its -k $UBOOT_PATH/arch/arm/mach-k3/keys -K $UBOOT_PATH/build/$ARMV8/dts/dt.dtb fitImage

.. note::

Expand All @@ -639,8 +656,15 @@ built during the initial u-boot build.
Build uboot again
^^^^^^^^^^^^^^^^^

The updated u-boot.dtb needs to be packed in u-boot.img for authentication
so rebuild uboot ARMV8 without changing any parameters.
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

The updated u-boot.dtb needs to be packed in u-boot.img for authentication
so rebuild uboot ARMV7 without changing any parameters.

.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

The updated u-boot.dtb needs to be packed in u-boot.img for authentication
so rebuild uboot ARMV8 without changing any parameters.

Refer to :ref:`top-level-makefile`

Expand All @@ -658,7 +682,7 @@ Installing the Kernel Image and Device Tree Binaries

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -678,7 +702,7 @@ Installing the Kernel Image and Device Tree Binaries

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand Down Expand Up @@ -714,7 +738,7 @@ file system. The general format of the command is:

..
[comment] instructions for 32 bit processors
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand All @@ -729,7 +753,7 @@ file system. The general format of the command is:

..
[comment] instructions for 64 bit processors
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family')
.. ifconfig:: CONFIG_part_family not in ('General_family', 'AM335X_family', 'AM437X_family', 'AM57X_family')

.. code-block:: console

Expand Down
69 changes: 49 additions & 20 deletions source/linux/Overview/GCC_ToolChain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Before compiling any of the sources referenced in this document, set the cross c

host# export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-"
host# export SYSROOT_32="${SDK_INSTALL_DIR}/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi"
host# export CC_32="${CROSS_COMPILE_32}gcc --sysroot=${SYSROOT_32}"
host# export CFLAGS="-march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard"
host# export CC_32="${CROSS_COMPILE_32}gcc ${CFLAGS} --sysroot=${SYSROOT_32}"

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

Expand All @@ -33,9 +34,17 @@ If the Processor SDK is not installed, the Arm GNU toolchains can be downloaded
Yocto-built SDK Toolchains
--------------------------

The |__SDK_FULL_NAME__| package contains cross compile toolchains for the ARMv8
(:ref:`linux-devkit`) and ARMv7 (:ref:`k3r5-devkit`) architectures. These toolchains
are used by the :ref:`top level makefile <top-level-makefile>` when
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')

The |__SDK_FULL_NAME__| package contains cross compile toolchain for the ARMv7
(:ref:`linux-devkit`) architecture.

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

The |__SDK_FULL_NAME__| package contains cross compile toolchains for the ARMv8
(:ref:`linux-devkit`) and ARMv7 (:ref:`k3r5-devkit`) architectures.

These toolchains are used by the :ref:`top level makefile <top-level-makefile>` when
compiling the binaries for the target. These also package an environment setup
script that, when sourced, sets all the right variables to compile binaries for
the target architecture. The toolchain installers are built through the yocto
Expand Down Expand Up @@ -65,13 +74,13 @@ referred to using the first column in the following sections.
- Description
* - CROSS_COMPILE_32
- linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-
- Cross compiler toolchain for the ARMv8 architecture
- Cross compiler toolchain for the ARMv7 architecture
* - SYSROOT_32
- linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/
- Sysroot with the cross compiled libraries and headers for the ARMv8 architecture with Linux OS
- Sysroot with the cross compiled libraries and headers for the ARMv7 architecture with Linux OS
* - ENV_SETUP_32
- linux-devkit/environment-setup-armv7at2hf-neon-oe-linux-gnueabi
- Shell script that sets environment variables to compile binaries for the ARMv8 linux target
- Shell script that sets environment variables to compile binaries for the ARMv7 linux target

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

Expand All @@ -98,24 +107,34 @@ referred to using the first column in the following sections.
The toolchain within the Linux SDK contains more than just the
cross-compiler, it also contains pre-built libraries that can be used
in your applications without requiring you to cross-compile them
yourself. These libraries include packages from alsa to zlib.
or a list of the
libraries you can refer to the software manifest found in the **<SDK
INSTALL DIR>/manifest** directory or look at the list of libraries
available in the **<SYSROOT_64>/usr/lib** directory. You will
also find the header files corresponding to these libraries in the
**<SYSROOT_64>/usr/include** directory. As
an example if your application wants access to the alsa asound library
then you can now do the following command:
yourself.

.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')

These libraries include packages from ALSA to zlib, for a list of the
libraries you can refer to the software manifest found in the **<SDK
INSTALL DIR>/manifest** directory or look at the list of libraries
available in the **<SYSROOT_32>/usr/lib** directory. You will
also find the header files corresponding to these libraries in the
**<SYSROOT_32>/usr/include** directory. As
an example if your application wants access to the alsa asound library
then you can now do the following command:

.. code-block:: console

host# ${CROSS_COMPILE_32}gcc -lasound app.c -o app.out

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

These libraries include packages from ALSA to zlib, for a list of the
libraries you can refer to the software manifest found in the **<SDK
jeevantelukula marked this conversation as resolved.
Show resolved Hide resolved
INSTALL DIR>/manifest** directory or look at the list of libraries
available in the **<SYSROOT_64>/usr/lib** directory. You will
also find the header files corresponding to these libraries in the
**<SYSROOT_64>/usr/include** directory. As
an example if your application wants access to the alsa asound library
then you can now do the following command:

.. code-block:: console

host# ${CROSS_COMPILE_64}gcc -lasound app.c -o app.out
Expand Down Expand Up @@ -194,7 +213,7 @@ libraries.

.. code-block:: console

host# ${CROSS_COMPILE_32}gcc --sysroot=${SYSROOT_32} helloworld.c -o helloworld
host# ${CROSS_COMPILE_32}gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=${SYSROOT_32} helloworld.c -o helloworld

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

Expand Down Expand Up @@ -227,10 +246,19 @@ libraries.
simple way to check this is to run the "file" command. It should
return an output similar to below:

.. code-block:: console
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')

.. code-block:: console

host# file helloworld
helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=f163acd736f827b9743b27d9a94e431d63990711, for GNU/Linux 3.2.0, with debug_info, not stripped

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')

.. code-block:: console

host# file helloworld
helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bb96180ad71bd44e07fc148015a55c844134f30d, for GNU/Linux 3.14.0, with debug_info, not stripped
host# file helloworld
StaticRocket marked this conversation as resolved.
Show resolved Hide resolved
helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bb96180ad71bd44e07fc148015a55c844134f30d, for GNU/Linux 3.14.0, with debug_info, not stripped

|

Expand Down Expand Up @@ -299,4 +327,5 @@ commands of the Foundational Components in this document.
host# export CROSS_COMPILE_64=$COMPILER_PATH/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
host# export CROSS_COMPILE_32=$COMPILER_PATH/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
host# export CC_64="${CROSS_COMPILE_64}gcc"
host# export CC_32="${CROSS_COMPILE_32}gcc"

Loading
Loading