Build kernel

This how-to describes the process of building the Linux kernel.  This is a part of the Xilinx design flow described in Xilinx Open Source Linux.

Table of Contents

Task Dependencies (Pre-requisites)

Tools Required

  • Cross-compilation toolchain (installed with Xilinx SDK)
  • system.mhs (from the hardware project) *required for MicroBlaze only

Environment Variables Required

  • "CROSS_COMPILE" for gcc cross platform compile settings
  • "PATH" for the make procedure being able to find the cross platform compiler tools
  • The settings of these environment variables can be found in Install Xilinx tools page

Input Files Required

  • Linux kernel source directory

Output Files Produced

  • Linux kernel images

Task Description

All commands need to be executed in the Linux kernel source directory.

Generic instructions for building the kernel

First, configure the Linux kernel:
make ARCH=<architecture> <kernel config>
Optionally, additional kernel options may be configured:
make ARCH=<architecture> (menu|x|n)config
Build the Linux kernel (requires that the environment is set up for cross compilation):
make ARCH=<architecture> UIMAGE_LOADADDR=<kernel load address> <make targets>
This will create the Linux images used for boot in linux-xlnx/arch/<architecture>/boot/, as well as linux-xlnx/vmlinux.

Linux for Zynq AP SoC

The kernel is configured based on linux-xlnx/arch/arm/configs/xilinx_zynq_defconfig:
make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm menuconfig
To produce the kernel image:
make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage
In the process, linux-xlnx/arch/arm/boot/Image and linux-xlnx/arch/arm/boot/zImage are created. The Image file is the uncompressed kernel image and the zImage file is a compressed kernel image which will uncompress itself when it starts.
If the mkimage utility is available in the build environment, linux-xlnx/arch/arm/boot/uImage will be created by wrapping zImage with a U-Boot header.

Linux for Zynq UltraScale+ MPSoC

The kernel is configured based on linux-xlnx/arch/arm64/configs/xilinx_zynqmp_defconfig:
make ARCH=arm64 xilinx_zynqmp_defconfig
make ARCH=arm64 menuconfig
To produce the kernel image:
make ARCH=arm64
In the process, linux-xlnx/arch/arm64/boot/Image is created. The Image file is the uncompressed kernel image.

Linux for MicroBlaze

The kernel is configured based on linux-xlnx/arch/microblaze/configs/mmu_defconfig:
make ARCH=microblaze mmu_defconfig
The kernel configuration needs to be modified to match the MicroBlaze settings as specified in <hardware project>/implementation/system.mhs:
make ARCH=microblaze menuconfig
   Platform options --->
      (<kernel load address>) Physical address where Linux Kernel is
      (1) USE_MSR_INSTR range (0:1)
      (1) USE_PCMP_INSTR range (0:1)
      (<0|1>) USE_BARREL range (0:1)
      (<0|1>) USE_DIV range (0:1)
      (<0|1|2>) USE_HW_MUL values (0=NONE, 1=MUL32, 2=MUL64)
      (<0|1|2>) USE_FPU values (0=NONE, 1=BASIC, 2=EXTENDED)
   Processor type and features --->
      [*] MMU support
      [ ] Default bootloader kernel arguments
The corresponding MicroBlaze entries in the system.mhs project file are:
BEGIN microblaze
   PARAMETER C_USE_FPU = <0|1|2>
<kernel load address> needs to be assigned to a valid address in memory as determined by the system.mhs project file. e.g.:
BEGIN axi_s6_ddrx
   C_S0_AXI_BASEADDR = <base address of memory>
   C_S0_AXI_HIGHADDR = <high address of memory>
To produce the arch/microblaze/boot/linux.bin kernel image:
make ARCH=microblaze UIMAGE_LOADADDR=<kernel load address> linux.bin
If the mkimage utility is available in the build environment, arch/microblaze/boot/linux.bin.ub will also be created. The *.ub suffix indicates that this file is linux.bin wrapped with the header required to boot Linux from U-Boot.

Linux for PowerPC

The kernel is configured based on linux-xlnx/arch/powerpc/44x/virtex5_defconfig:
make ARCH=powerpc 44x/virtex5_defconfig
make ARCH=powerpc menuconfig
To produce the kernel image:
make ARCH=powerpc UIMAGE_LOADADDR=0x8000 uImage
If the mkimage utility is available in the build environment, linux-xlnx/arch/microblaze/boot/uImage which is a U-Boot header.

Build Steps

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy