Yocto Build Linux TI: Difference between revisions
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Set release according to "release" parameter in URL and use am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0 as default | <!-- Set release according to "release" parameter in URL and use am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0 as default | ||
--> {{INIT_RELEASE_PARAM|am62-yocto-dunfell-5.10.168_08.06.00.42-v1. | --> {{INIT_RELEASE_PARAM|am62-yocto-dunfell-5.10.168_08.06.00.42-v1.5}}<!-- | ||
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | --> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-linux}} <!-- | --> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-linux}} <!-- | ||
Line 8: | Line 8: | ||
= Introduction = | = Introduction = | ||
This guide walks through the process for manually building and installing Linux from source. It is derived from TI's [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:TI_RELEASE_}}/docs/linux/Foundational_Components_Kernel_Users_Guide.html#preparing-to-build Build Linux] guide | This guide walks through the process for manually building and installing Linux from source. It is derived from TI's [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:TI_RELEASE_}}/exports/docs/linux/Foundational_Components_Kernel_Users_Guide.html#preparing-to-build Build Linux] guide | ||
= Fetch source code and install dependencies = | = Fetch source code and install dependencies = | ||
Line 24: | Line 24: | ||
Fetch the Linux source: | Fetch the Linux source: | ||
{{GIT_FETCH|NAME=KERNEL|WORKDIR={{#var:WORKDIR_ENV}}}} | {{GIT_FETCH|NAME=KERNEL|WORKDIR={{#var:WORKDIR_ENV}}}} | ||
Fetch the kernel driver for the PowerVR Rogue GPU: | |||
{{GIT_FETCH|NAME=KERNEL_IMG_ROGUE|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}} | |||
= Build Linux out of Yocto tree = | = Build Linux out of Yocto tree = | ||
Line 39: | Line 42: | ||
$ export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH | $ export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH | ||
== Build | == Build Kernel image, modules, and device trees: == | ||
{{#vardefine:KERNEL_MAKE|make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc)}} | {{#vardefine:KERNEL_MAKE|make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc)}} | ||
Change to kernel directory: | Change to kernel directory: | ||
Line 52: | Line 55: | ||
Optional: Make changes to .config and save to {{#var:KERNEL_DEFCONFIG}} | Optional: Make changes to .config and save to {{#var:KERNEL_DEFCONFIG}} | ||
$ {{#var:KERNEL_MAKE}} | $ {{#var:KERNEL_MAKE}} menuconfig | ||
$ {{#var:KERNEL_MAKE}} savedefconfig | $ {{#var:KERNEL_MAKE}} savedefconfig | ||
$ cp defconfig arch/arm64/configs/{{#var:KERNEL_DEFCONFIG}} | $ cp defconfig arch/arm64/configs/{{#var:KERNEL_DEFCONFIG}} | ||
Line 68: | Line 71: | ||
Build device trees only: | Build device trees only: | ||
$ {{#var:KERNEL_MAKE}} dtbs | $ {{#var:KERNEL_MAKE}} dtbs | ||
Build Kernel drivers for the PowerVR Rogue GPU: | |||
$ cd ${WORKDIR}/{{#var:KERNEL_IMG_ROGUE_REPO}} | |||
$ {{#var:KERNEL_MAKE}} \ | |||
KERNELDIR=${WORKDIR}/{{#var:KERNEL_REPO}} \ | |||
BUILD=release PVR_BUILD_DIR=am62_linux \ | |||
WINDOW_SYSTEM={{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | wayland | lws-generic }} | |||
== Install new kernel == | |||
{{#vardefine:KERNEL_ROOTFS|{{#var:WORKDIR_ENV}}/rootfs}} | |||
Create a directory to install the kernel, device trees, and modules: | |||
Optional: delete any old installation from previous builds: | |||
$ rm -rf {{#var:KERNEL_ROOTFS}} | |||
Create new directory: | |||
$ mkdir -p {{#var:KERNEL_ROOTFS}}/boot | |||
Copy the {{#var:KERNEL_IMAGE}} and device trees to the rootfs: | |||
$ cd {{#var:WORKDIR_ENV}}/{{#var:KERNEL_REPO}} | |||
$ cp arch/arm64/boot/{{#var:KERNEL_IMAGE}} {{#var:KERNEL_ROOTFS}}/boot/ | |||
$ cp arch/arm64/boot/dts/ti/k3*am*var-som*.dtb {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | {{#var:KERNEL_ROOTFS}}/boot/ | {{#var:KERNEL_ROOTFS}}/boot/dtb/ }} | |||
Install the modules to the rootfs: | |||
$ {{#var:KERNEL_MAKE}} \ | |||
modules_install INSTALL_MOD_PATH={{#var:KERNEL_ROOTFS}} | |||
Install the GPU driver to the rootfs: | |||
$ cd {{#var:WORKDIR_ENV}}/{{#var:KERNEL_IMG_ROGUE_REPO}} | |||
$ {{#var:KERNEL_MAKE}} \ | |||
KERNELDIR=${WORKDIR}/{{#var:KERNEL_REPO}} \ | |||
BUILD=release PVR_BUILD_DIR=am62_linux \{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | | |||
WINDOW_SYSTEM=wayland \}} | |||
-C ${WORKDIR}/ti-linux-kernel M=${WORKDIR}/ti-img-rogue-driver/{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | binary_am62_linux_wayland_release | binary_am62_linux_lws-generic_release}}/target_aarch64/kbuild \ | |||
INSTALL_MOD_PATH=${WORKDIR}/rootfs \{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | | |||
INSTALL_MOD_STRIP=1 \}} | |||
modules_install | |||
== Deploy new kernel == | |||
You can deploy {{#var:KERNEL_ROOTFS}} to a running device: | |||
Option 1: Copy to a local SD card mounted at /media/user/rootfs/: | |||
$ sudo cp -r {{#var:KERNEL_ROOTFS}}/* /media/user/rootfs/ | |||
Option 2: Copy to a running device over ethernet | |||
$ tar czf - -C {{#var:KERNEL_ROOTFS}} . | ssh root@<ip address> 'tar xzf - --no-same-owner -C /' |
Latest revision as of 14:46, 1 July 2024
This page is using the default release am62-yocto-dunfell-5.10.168_08.06.00.42-v1.5.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
Introduction
This guide walks through the process for manually building and installing Linux from source. It is derived from TI's Build Linux guide
Fetch source code and install dependencies
This section describes the one time process to install the toolchains and fetch the necessary source code for building Linux.
Install Toolchains to home directory
$ cd ~ $ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz && \ tar -Jxvf gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz -C $HOME && \ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz && \ tar -Jxvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz -C $HOME
Fetch Source Code
Setup a working directory
$ export WORKDIR=~/am62x-var-som-linux $ mkdir ${WORKDIR}
Fetch the Linux source:
$ cd $WORKDIR $ git clone https://github.com/varigit/ti-linux-kernel -b ti-linux-5.10.y_var01 ti-linux-kernel
Fetch the kernel driver for the PowerVR Rogue GPU:
$ cd $WORKDIR $ git clone https://git.ti.com/git/graphics/ti-img-rogue-driver -b linuxws/dunfell/k5.10/1.15.6133109_unified_fw_pagesize ti-img-rogue-driver $ cd ti-img-rogue-driver && \ git checkout 1dd6291a5cad4f2b909fc2a14bd717a3bc5f0bb2 && \ cd ../
Build Linux out of Yocto tree
After fetching the source code and installing dependencies, you may return to $WORKDIR anytime and follow these steps to build Linux:
Setup the environment:
Export the working directory
$ export WORKDIR=~/am62x-var-som-linux
Export variables for building Linux
$ export PATH=$HOME/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin:$PATH
Build Kernel image, modules, and device trees:
Change to kernel directory:
$ cd $WORKDIR/ti-linux-kernel
Configure the Kernel:
Clean directory: $ make mrproper Create .config from am62x_var_defconfig $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) am62x_var_defconfig Optional: Make changes to .config and save to am62x_var_defconfig $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) menuconfig $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) savedefconfig $ cp defconfig arch/arm64/configs/am62x_var_defconfig
Build Kernel:
Build All: $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) Build Image only: $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) Image Build modules only: $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) modules Build device trees only: $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) dtbs
Build Kernel drivers for the PowerVR Rogue GPU:
$ cd ${WORKDIR}/ti-img-rogue-driver $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) \ KERNELDIR=${WORKDIR}/ti-linux-kernel \ BUILD=release PVR_BUILD_DIR=am62_linux \ WINDOW_SYSTEM=wayland
Install new kernel
Create a directory to install the kernel, device trees, and modules:
Optional: delete any old installation from previous builds: $ rm -rf $WORKDIR/rootfs Create new directory: $ mkdir -p $WORKDIR/rootfs/boot
Copy the Image and device trees to the rootfs:
$ cd $WORKDIR/ti-linux-kernel $ cp arch/arm64/boot/Image $WORKDIR/rootfs/boot/ $ cp arch/arm64/boot/dts/ti/k3*am*var-som*.dtb $WORKDIR/rootfs/boot/
Install the modules to the rootfs:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) \ modules_install INSTALL_MOD_PATH=$WORKDIR/rootfs
Install the GPU driver to the rootfs:
$ cd $WORKDIR/ti-img-rogue-driver $ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- -j$(nproc) \ KERNELDIR=${WORKDIR}/ti-linux-kernel \ BUILD=release PVR_BUILD_DIR=am62_linux \ WINDOW_SYSTEM=wayland \ -C ${WORKDIR}/ti-linux-kernel M=${WORKDIR}/ti-img-rogue-driver/binary_am62_linux_wayland_release/target_aarch64/kbuild \ INSTALL_MOD_PATH=${WORKDIR}/rootfs \ INSTALL_MOD_STRIP=1 \ modules_install
Deploy new kernel
You can deploy $WORKDIR/rootfs to a running device:
Option 1: Copy to a local SD card mounted at /media/user/rootfs/: $ sudo cp -r $WORKDIR/rootfs/* /media/user/rootfs/ Option 2: Copy to a running device over ethernet $ tar czf - -C $WORKDIR/rootfs . | ssh root@<ip address> 'tar xzf - --no-same-owner -C /'