11 September 2015

Compiling a device tree using yocto


I am assuming you have a functional kernel recipe, say 'linux-yocto' with a device tree in e.g. arch/arm/boot/dts.

First build your kernel using

bitbake linux-yocto

Then run again using devshell

bitbake linux-yocto -c devshell

This places you in an shell in the temporary kernel source directory:

tmp/work-shared/machine/kernel-source 

However all of the yocto scripts required to build are in the build output directory, $KBUILD_OUTPUT. That will be something like:

tmp/work/machine-poky-linux-gnueabi/linux-mainline/4.2+gitAUTOINC+2bb14348ec-r1/linux-yocto-standard-build

so to edit-build-deploy a device tree, you need to edit the dts file in the build directory (I find I need to do this from a different window, as editors don't work right in the devshell)

emacs arch/arm/boot/dts/machine.dts

then (still from the source directory)

make machine.dtb

(Note: machine.dtb, not machine.dts.)

Then copy your dtb file from the build output directory:

cp $KBUILD_OUTPUT/arch/arm/boot/dts/machine.dtb ~

Do not forget to copy your updated dts someplace permanent, because the kernel-source work dir will get wiped out in the next do_fetch() operation.

06 April 2015

Compiling Ericsson CXP_MBM_Tools_Development_Kit


We use a modem chipset from Ericsson. Ericsson has left this business so their engineering support is somewhat less than totally awesome. Perhaps you have the CXP_MBM_Tools_Development_Kit in your hot little hands and would like to make it compile under recent versions of gcc. (Note that if you do not have this kit, I cannot help you.) If you try to build under Ubuntu 14.04 it will fail with an error like:

Linking C executable out/mtool
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlopen'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlclose'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlerror'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status

Per this post, changes to the "strictness" of shared libraries requires that you call -ldl after the desired shared libraries rather than before. #THANKS OBAMA.

There's probably a better way to do it than this, but this will suffice:

IN CXC_Manufacturing_Tool/src/CMakeLists.txt:


-  set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -ldl -Wl,-rpath=./")
+  set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -Wl,-rpath=./")

-  target_link_libraries(${TARGET_NAME} ${LIBRARY_LIST} ${CMAKE_THREAD_LIBS_INIT})
+  target_link_libraries(${TARGET_NAME} ${LIBRARY_LIST} ${CMAKE_THREAD_LIBS_INIT} -ldl)