Embedded, Linux

Generics with make and make files

Overview of make talks something like this:

The make utility automatically determines which pieces of a large program need to be recompiled, and issues commands to recompile them.

We can always read more and more about make and its syntax, how to make a make file for your program.We preferably admit “Its strong tool, strong enough that every IDE, Cross Compile tool, and almost all builds are automated/commanded through make and its pretty common in open source community (Linux..).

Fun fact:

  • GNU make conforms to section 6.2 of IEEE Standard 1003.2-1992 (POSIX.2).
    • This assure that GNU make will work on all the environments following POSIX.2.

Umm.. going back to the topic, Generics ..

What is generic way ?what is the meaning..

Well, let’s go with the literal meaning of the word i.e. “the common” or the usual way/approach with make file. Now not to get confused with creating a make file for automating a build of source directory, but this post is about utilizing the already built makefile for altering to support our use if in cased facing an error. Now question will be why one should know this? Answer is, In the cross compilation we generally not compile with the same environment but for the other environments/architectures which usually goes along with different source/build directories, different header files and different directory of share objects(shared libraries or .so files), though make files are written that there are less and less such dependencies yet the reality is not the same. This usually make the task of make-ing  tricky. Below steps are the generic one which we usually follow for any cross compilation(U-Boot, hostapd, wpa-supplicants). Steps goes as below:

  • Read, read, read and read everything about compilation steps.
  • Setting cross-compilation
    • we need to set-up a cross compiler usually by CROSS_COMPILE flag while building or in the make file itself by modifying the variable:
      • make all CROSS_COMPILE=/opt/bin/ arm-linux-gnueabihf-

         Capture

  • Modifying path of libs and include as below

CFLAGS += -I$

CFLAGS += -I$(abspath ../src)

CFLAGS += -I$(abspath ../src/utils)

  • Usually these modifications are present in Read-me.txt of the source files(example from git)
  • Use Google, and take help from community. If its driver from custom community, copyright material seek help from them. Since sometimes it is impossible to figure out the dependencies which they have included while making such builds.
  • Be patient since playing with kernel and working with products of  Linux community is as such task.

Generally or generic-lly this are the things which we do while compiling such builds.If you feel something we missed, or facing any problem.. write back to us on comment we will get back to you for sure.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s