build-linux-sama7d65curiosity
Last modified by Microchip on 2025/12/09 14:21
Required Packages
You must install essential host packages on your build host. These requirements are listed in the Linux kernel documentation with the "Install build requirements" chapter. You must follow this process, which includes, but is not limited to, the following packages:
- build-essential
- flex
- bison
- git
- perl-base
- libssl-dev
- libncurses5-dev
- libncursesw5-dev
- ncurses-dev
Getting Kernel Sources
To get the source code, you have to clone the repository:
$ git clone https://github.com/linux4microchip/linux
Cloning into 'linux'...
remote: Enumerating objects: 10893873, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 10893873 (delta 3), reused 3 (delta 3), pack-reused 10893865 (from 2)
Receiving objects: 100% (10893873/10893873), 5.35 GiB | 19.95 MiB/s, done.
Resolving deltas: 100% (8853194/8853194), done.
Updating files: 100% (81939/81939), done.
$ cd linux
Cloning into 'linux'...
remote: Enumerating objects: 10893873, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 10893873 (delta 3), reused 3 (delta 3), pack-reused 10893865 (from 2)
Receiving objects: 100% (10893873/10893873), 5.35 GiB | 19.95 MiB/s, done.
Resolving deltas: 100% (8853194/8853194), done.
Updating files: 100% (81939/81939), done.
$ cd linux
The source code has been taken from the master branch. You must switch to the specified tag by executing:
$ git checkout -b linux-6.12-mchp
Switched to a new branch 'linux-6.12-mchp'
Switched to a new branch 'linux-6.12-mchp'
Set Up Arm Cross Compiler
Download the Arm GNU toolchain:
wget -c https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
Add the Arm GNU toolchain to your system:
tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
export CROSS_COMPILE=`pwd`/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
export CROSS_COMPILE=`pwd`/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
or
tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
export CROSS_COMPILE=arm-none-linux-gnueabihf-
export PATH=$PATH:/YOUR/PATH/TO/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-linux-gnueabihf/bin/
export CROSS_COMPILE=arm-none-linux-gnueabihf-
export PATH=$PATH:/YOUR/PATH/TO/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-linux-gnueabihf/bin/
If you already have an old Arm GNU toolchain, you need to clean up the PATH with:
export PATH=${PATH/':/YOUR/PATH/TO/arm-gnu-toolchain-VERSION-x86_64-arm-none-linux-gnueabihf/bin/'/}
Configure and Build the Linux Kernel
Now you have to configure the Linux kernel according to your hardware. We have two default configurations for the at91 SoC in arch/arm/configs.
arch/arm/configs/at91_dt_defconfig
arch/arm/configs/sama5_defconfig
arch/arm/configs/sama7_defconfig
arch/arm/configs/sama5_defconfig
arch/arm/configs/sama7_defconfig
- at91_dt_defconfig: for SAM9 (ARM926) series chips
- sama5_defconfig: for SAMA5 series chips
- sama7_defconfig: for SAMA7 series chips