Yocto Build Linux TI: Difference between revisions
No edit summary |
|||
Line 68: | Line 68: | ||
Build device trees only: | Build device trees only: | ||
$ {{#var:KERNEL_MAKE}} dtbs | $ {{#var:KERNEL_MAKE}} dtbs | ||
== Install new kernel == | |||
{{#vardefine:KERNEL_ROOTFS|{{#var:WORKDIR_ENV}}/rootfs}} | |||
Change to kernel directory: | |||
$ cd {{#var:WORKDIR_ENV}}/{{#var:KERNEL_REPO}} | |||
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: | |||
$ cp arch/arm64/boot/{{#var:KERNEL_IMAGE}} {{#var:KERNEL_ROOTFS}}/boot/ | |||
$ cp arch/arm64/boot/dts/ti/k3*am*var-som*.dtb {{#var:KERNEL_ROOTFS}}/boot/ | |||
Install the modules to the rootfs: | |||
$ {{#var:KERNEL_MAKE}} modules_install INSTALL_MOD_PATH={{#var:KERNEL_ROOTFS}} | |||
You can install {{#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 - -C /' |
Revision as of 17:29, 26 April 2023
This page is using the default release am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0.
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
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 for GP am62 SoC:
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) am62x_var_defconfig $ 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
Install new kernel
Change to kernel directory:
$ cd $WORKDIR/ti-linux-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:
$ 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
You can install $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 - -C /'