Overview
Online Support
FAQ
  Atmel Series  (29) TOP10
  MYS-SAM9X5 (3)
  MYS-SAM9G45 (1)
  MYD-SAM9X5 (7)
  MYD-SAM9X5-V2 (2)
  MYD-JA5D2X (0)
  MYD-SAMA5D3X (11)
  MYD-SAMA5D3X-C (0)
  MYD-JA5D4X (0)
  MYC-SAM9X5 (4)
  MYC-SAM9X5-V2 (1)
  MYC-JA5D2X (0)
  MYC-SAMA5D3X (0)
  MCC-SAMA5D3X-C (0)
  MYC-JA5D4X (0)
  NXP Series  (23) TOP10
  MYS-6ULX (4)
  MYD-Y6ULX (3)
  MYD-Y6ULX-HMI (1)
  MYD-IMX28X (2)
  MYD-LPC435X (2)
  MYD-LPC185X (1)
  MYD-LPC1788 (0)
  MYC-Y6ULX (4)
  MYC-IMX28X (0)
  i.MX 6UL/6ULL (6)
  TI Series  (24) TOP10
  MYD-AM335X (12)
  MYD-AM335X-Y (0)
  MYD-AM335X-J (0)
  MYD-C437X (0)
  MYD-C437X-PRU (5)
  Rico Board (6)
  MYC-AM335X (1)
  MCC-AM335X-Y (0)
  MCC-AM335X-J (0)
  MYC-C437X (0)
  Xilinx Series  (20) TOP10
  Z-turn Board (9)
  Z-turn Lite (2)
  MYD-C7Z010/20 (0)
  MYD-C7Z015 (7)
  MYD-Y7Z010/007S (0)
  MYC-C7Z010/20 (0)
  MYC-C7Z015 (0)
  MYC-Y7Z010/007S (0)
  HMI Solutions  (0) TOP10
  MYD-Y6ULX-CHMI (0)
  MY-EVC5100S-HMI (0)
  Others  (1) TOP10
  MY-WF003U (1)
 
  Home >  Support > NXP Series > i.MX 6UL/6ULL
 
Part Two: Modify and recompile the kernel, uboot, and the file system
 
Question
2. Modify and recompile the kernel, uboot, and the file system
2.1 How to modify Yocto after the source code of kernel or uboot is modified?
2.2 How to tailor “make menuconfig“ of kernel? How to add new device?
2.3 After compiling the kernel or uboot separately we get many files, which one to use?
2.4 How to find “myd-y6ull-boot-mmc0-tftp.txt”? How to use?
Answer

2. Modify and recompile the kernel, uboot, and the file system

2.1 How to modify Yocto after the source code of kernel or uboot is modified?

When we recompile in Yocto after the source code of kernel or uboot is modified, we need to modify commit ID of the kernel or uboot.

  • How to get the commit ID of the kernel or uboot?

In the directory of the kernel or uboot:

git add . (commit all the modification)

git config - -gobal user.email “your Email address” (commit the email address of the modifier)

git config - - global user.name “your name” (commit the name of the modifier)

git commit -m “comment”(add comment)

git log (get the commit ID)


  • If the kernel is modified, we need to modify the “SRCREV” under below address:

/home/roy/MYD-Y6ULX-devel/04-Source/fsl-release-Yocto/sources/meta-myir-imx6ulx/recipes-kernel/linux/linux-mys6ulx_4.1.15.bb

Example code:

# Copyright (C) 2013-2016 Freescale Semiconductor

# Released under the MIT license (see COPYING.MIT for the terms)

SUMMARY = "Linux Kernel for MYiR MYS6ULx board"

DESCRIPTION = "Linux Kernel provided and supported by Freescale with focus on \

i.MX Family Reference Boards. It includes support for many IPs such as GPU, VPU and IPU."

require recipes-kernel/linux/linux-imx.inc

require recipes-kernel/linux/linux-dtb.inc

DEPENDS += "lzop-native bc-native"

LOCALVERSION = "-1.2.0"

SRCREV = "d87b5be6bfc5a78cd45d8efa044fddcd7f4b2ac1"

SRCBRANCH = "mys-6ulx"

SRC_URI = "git:///${HOME}/MYiR-iMX-Linux;protocol=file;branch=${SRCBRANCH} \

           file://defconfig \

        "

DEFAULT_PREFERENCE = "1"

COMPATIBLE_MACHINE = "(mx6ull|mx6ul)"


  • In Yocto, the directory to modify the commit ID of uboot:

/home/roy/MYD-Y6ULX-devel/04-Source/fsl-release-Yocto/sources/meta-myir-imx6ulx/recipes-bsp/u-boot/u-boot-mys6ulx_2016.03.bb

2.2 How to tailor “make menuconfig“ of kernel? How to add new device?

Below is how to configure the kernel and how to add new device.


  • 3 ways to configure the kernel:


1.     make config

2.     make menuconfig

3.     make xconfig (QT is needed)

Either of above 3 ways works, “make menuconfig” is recommended.

Input this command in the terminal for VM to open the kernel configuration interface: make menuconfig.


  • How to operate the kernel configuration interface


1. Pressing y to select.

2. Pressing n not to select.

3. Pressing m to make it a module.

4. Press Esc to back to upper level page.

5. Press the arrow keys to select.

6. [*] means already selected.

7. [ ] means not selected yet.

Generally, we tailor the kernel according to actual demand. We introduce some necessary items here.

“General setup-->System V IPC (IPC: Inter Process Communication)” is necessary.

After all the necessary items have been configured, press Esc to quit, choose Yes to save.

After setting up the cross-compiler, input the command in the terminal: make. Then wait for a long period of time. After the compilation is completed, “zlmage” would be generated under directory “. /arch/arm/boot/”.


  • Add new device in the kernel (take LED driver for example)


Create a LED directory under “kernel\drivers\char\”, put the LED driver code in this directory.

Modify the “Makefile” in “kernel\drivers\char\” to include the LED directory: add “obj-y += led/” in the “Makefile”.


  • obj-y means get “foo.o” from compiling “xx.c” or “foo.s” file and connect “foo.o” to the kernel.
  • obj-m means to compile this file as a module.


Object files except “y” and “m” won’t be compiled.

Add “Makefile” file and “Kconfig” file to LED directory, then add below contents to these 2 files:

“Makefile” file:

obj-$(CONFIG_MY_LED_DRIVER) += my-led.o

“Kconfig” file

config MY_LED_DRIVER

bool "my led driver"

default y

help

compile for leddriver, y for kernel, m for module.

The needed knowledge in practice is far more than we have introduced here, to read relevant books or contents online is suggested.

2.3 After compiling the kernel or uboot separately we get many files, which one to use?

“zlmage” file under directory “~/MYiR-imx-Linux/arch/arm/boot/” is from compiling kernel.

“u-boot.imx” file under directory “~/MYiR-iMX-uboot/” is from compiling uboot.

2.4 How to find “myd-y6ull-boot-mmc0-tftp.txt”? How to use?

When we boot Linux from SD card using u-boot, the system would check the file “boot.scr”. When creating SD card booting file, if nand flash is used on the board, “boot.scr” is not needed. If eMMC flash is used on the board, “boot.scr” is needed.

Generally, the content of “boot.scr” won’t be modified. The content of “boot.scr” is not included in the CDs which MYIR delivers with MYD-Y6UL & 6ULL development boards, you may edit it by yourself as below.

setenv mmcroot '/dev/mmcblk0p2 rootwait rw rootdelay=5 mem=256M'

run mmcargs

tftpboot 0x83000000 zImage

tftpboot 0x84000000 myd-y6ull-gpmi-weim.dtb

bootz 0x83000000 - 0x84000000