Linux Device Driver Lecture 4: Tool-chain installation and PATH settings

  • Post author:
  • Post category:Blog

 

Tool-chain installation and PATH settings

 

 

In this article, let’s learn how to set up the toolchain path. In the previous article, you have already downloaded the toolchain. We have to set the appropriate path. This will be helpful while compiling our source codes.

You have to add the toolchain binary path to the home directory .bashrc file.

Steps you have to follow. 

    1. Go to your home directory
    2. Open .bashrc using a gedit text editor
    3. Copy the below export command with path information to the .bashrc file

export PATH = $PATH:<path_to_tool_chain_binaries>

    1. Save and close
  1.  

Or simply we can do: echo “export PATH=$PATH:<path_to_tool_chain_binaries>” >> ~/.bashrc

 

Let’s go to the downloads folder and extract this toolchain. Right-click and use extract here as shown in Figure 1.

Next, open the .bashrc file using a text editor like Gedit. You can do this by entering the following command in your terminal.

Toolchain extraction
Figure 1. Toolchain extraction

 

Go inside this folder, and here you find the bin, go inside that as shown in Figure 2. You have to give this path in the path settings.

 Bin path
Figure 2. Bin path

 

For that, let’s go to the command prompt and let’s head over to that folder, downloads, gcc-linaro.

And just type pwd, and this is a path, just select that path as shown in Figure 3.

Figure 3. Bin Path finder on terminal.
Figure 3. Bin Path finder on terminal.

 

And now come to your home directory, open .bashrc as shown in Figure 4.

Opening .bashrc file
Figure 4. Opening .bashrc file

 

And here, come at the end, type export. And after that, PATH= $PATH: and now paste that path as shown in Figure 5.

Pasting export path into .bashrc file
Figure 5.Pasting export path into .bashrc file

 

After that save and exit as shown in Figure 6.

Saving .bashrc
Figure 6. Saving .bashrc

 

Type the command source .bashrc. Just type three letters arm and hit double tab as shown in Figure 7.

Detecting toolchain binaries
Figure 7. Detecting toolchain binaries

Here we can see that the command prompt has detected our toolchain binaries.

For example, cross compiler, gcc for our ARM Cortex A8 architecture.

Assembler, cross compiler, and a linker, these are the tools used to analyze the elf file format; by using the nm command, you can analyze the symbols, object copy, you can used to convert elf to a different binary format, such as a .bin or .hex, like that.

Object dump is used to dump the contents of the elf file format and various tools we can use to analyze the kernel modules or any file, which is in the elf format.  Reproduce this at your desk and let me know if you face any issues; I’ll see you in the following article.

 

Get the Full course on Linux Device Driver  Here.

FastBit Embedded Brain Academy Courses 

click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.