How to use XDB to do kernel debug on Yocto with Minnowboard MAX


Minnowboard MAX is an open hardware which is utilized Intel Atom processor. This hardware is a small and low cost but offer exceptional performance, flexibility, openness and standards. We can prepare micro sd card or usb flash device to expand the hardware storage and easy exchange difference OS to develop. Yocto project is an open source which helps you to create a customized Linux-based system for embedded products.

We set up the debug environment as figure below and build your Yocto image for the Minnowboard MAX first.

Build Yocto Image

Follow the steps below to build the Yocto image for the MinnowBoard MAX. After that, we can write the image to the micro sd card or usb flash device.

Step 1. Download the Board Support Package (abbr. BSP) and untar it (/home/meta-intel). According to the release notes, the BSP version should be “Intel-corei7-64” which can support MinnowBoard MAX. You can download the package through this link  

$ tar –jxvf intel-corei7-64-1.0-daisy-1.6.1.tar.bz2

Step 2. Download the Yocto Build System through this link which version should be correspond to BSP version, and untar it (/home/poky).

$ tar –jxvf poky-daisy-11.0.2.tar.bz2

Step 3. Copy the /home/meta-intel folder into the /home/poky

Step 4. Regarding to our BSP version which can also support Minnowboard MAX, we should modify our configuration file. Add the MACHINE = ”intel-corei7-64” into /home/poky/build/conf/local.conf and comment the MACHINE = ”qemu-x86”. At the same time, we should add dbg-pkgs parameter to EXTRA_IMAGE_FEATURES so that we can get the symbol file after building image. The result should be the same as below.

EXTRA_IMAGE_FEATURES = “debug – tweaks dbg - pkgs”

Step 5. Add the /home/poky/meta-intel path to the /home/poky/build/conf/bblayers.conf file. The directory path will depend on the difference host machine.

Step 6. Before building the image, we should install the package we needed. This step will depend on difference situation which means it may meet some warning during building image. For example, it may meet the packages are fetched failed. It could be the internet connection problem or anything else so that we can install it in advance to avoid this kind of error. For my case, I pre-install these packages in advance. Otherwise, the package will be installed automatically during the image building.  

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath libsdl1.2-dev xterm
$ sudo apt-get install sed cvs subversion coreutils texi2html libsdl1.2-dev docbook-utils gawk python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff libtool

Step7. Initialize the build environment under the /home/poky folder.

$ source oe-init-build-env

Step 8. Start to build the image. (Can do the basic one to make sure there is no error for building.)

$ bitbake core-image-minimal    // for basic Yocto image with command line


$ bitbake core-image-sato         // for Yocto image with GUI  

Step 9. Get the image from /home/poky/build/tmp/deploy/images folder which named as core-image-sato-intel-corei7-64.hddimg and write the image to micro sd card. 

$ sudo dd if= core-image-sato-intel-corei7-64.hddimg of=/dev/mmcblk0

Step 10. Boot it from minnowboard EFI shell.

Shell> connect -r
Shell> map -r
Shell> fs0:
Shell> bootx64

After booting, you can see the Yocto desktop screen successfully. 

Kernel debug

Once you get the Yocto booting successfully, you need to get corresponding symbol file from folder. (Z:\home\inteldpd\source\poky\build\tmp\work\corei7-64-intel-common-poky-linux\linux-yocto\3.14.4+gitAUTOINC+62f236c734_cb22733185-r0\linux-corei7-64-intel-common-standard-build)

Otherwise, it’s hard for us to debug kernel with assembly language.

For this part, you may see the vmliux or vmliuz. vmlinuz is a compressed Linux kernel, and it is bootable. Bootable means that it is capable of loading the operating system into memory so that the computer becomes usable and application programs can be run. vmlinuz should not be confused with vmlinux, which is the kernel in a non-compressed and non-bootable form. vmlinux is generally just an intermediate step to producing vmlinuz.

First, we upload symbol file to the Intel® System Debugger. From the console view, we can confirm the upload status. Once it is done, you can see the message on it.

After upload the symbol file, you can set up the source code path in advance or you may get the warning message after connecting to the target device. (show as figure below)

If you get this message, select the “Yes” and locate the source file path. 

Once finish setting up the hardware environment, we can connect to the target via the Intel® system Debugger. Select the hardware probe and target platform which are corresponding to your target device.

If the connection is successful, you can see the message, “Initialization Complete”, from the console view window. And then, you can start to debug kernel. 

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.