3.1.3 Building Kernel Image

Perform the following steps to build the kernel.

  1. Clone the linux4microchip GitHub linux kernel repository by using the following command:
    $ git clone https://github.com/linux4microchip/linux.git
  2. Move to the kernel directory and export the toolchain path by using the following command:
    export CROSS_COMPILE=arm-linux-gnueabi-
  3. Configure the kernel by using the following commands:
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- sama5_defconfig
  4. Modify the default kernel configuration using the menuconfig. Use the following command to execute:
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  5. Select the ATWILC driver module, from the GUI selection window:
    1. Go to Device Drivers > Network device support > Wireless LAN.
    2. Press M to modularize WILC SDIO to include the module during run time.
    3. Save the configuration.
  6. Include the cfg80211 module as an inbuilt module to kernel, from the GUI selection window:
    1. Go to Networking support > wireless.
    2. Press * to include the cfg80211 – wireless configuration API module to the kernel.
    3. Save the configuration.
  7. Build the kernel using the following command:
     $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage

    zImage is available in the arch/arm/boot directory.

  8. Build the modules using the following command:
    $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules
    The file wilc-sdio.ko will be available in the driver/net/wireless/microchip/wilc1000 directory.
  9. Build the .dtb file using the following command:
    $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- at91-sama5d2_xplained.dtb
    The at91-sama5d2_xplained.dtb file is available in the arch/arm/boot/dts folder.