Difference between revisions of "Embedded-Linux-Device-Driver/C2/Installation-of-Linux-kernel-packages/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 5: Line 5:
  
 
|-
 
|-
| style="border-top:1pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.176cm;"| Slide 1:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 1:
  
 
Welcome slide:
 
Welcome slide:
| style="border:1pt solid #000000;padding:0.176cm;"| Welcome to the spoken tutorial on '''Installation of Linux kernel packages.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Welcome to the spoken tutorial on
 +
 
 +
'''Installation of Linux kernel packages.'''
  
 
|-
 
|-
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.176cm;"| Slide 2:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 2:
  
 
Learning objectives:
 
Learning objectives:
Line 18: Line 20:
 
* Install the '''kernel header files.'''
 
* Install the '''kernel header files.'''
 
* Check the installed '''kernel '''version.
 
* Check the installed '''kernel '''version.
* Use '''Linux kernel commands'''
+
* Use linux '''kernel''' command
  
 
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| In this tutorial, we will learn how to
 
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| In this tutorial, we will learn how to
Line 25: Line 27:
 
* Install the '''kernel header files.'''
 
* Install the '''kernel header files.'''
 
* Check the installed '''kernel '''version.
 
* Check the installed '''kernel '''version.
* Use '''Linux kernel commands'''
+
* Use linux '''kernel''' commands.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 3:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 3:
  
 
System Requirements:
 
System Requirements:
Line 36: Line 38:
 
* '''Linux kernel '''version''' 5.0.0-31 generic.'''
 
* '''Linux kernel '''version''' 5.0.0-31 generic.'''
  
| style="border-top:1pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| To record this tutorial, I am using,
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| To record this tutorial, I am using,
  
 
* '''VirtualBox version 5.2'''
 
* '''VirtualBox version 5.2'''
Line 43: Line 45:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 4:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 4:
  
 
Prerequisites:
 
Prerequisites:
Line 49: Line 51:
 
To follow this tutorial, you should be familiar with
 
To follow this tutorial, you should be familiar with
  
* '''C''' programming language and
+
* '''C programming language and'''
* Basics of''' Linux kernel'''  
+
* basics of''' Linux kernel'''  
  
| style="border:1pt solid #000000;padding:0.176cm;"| To follow this tutorial, you should be familiar with
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| To follow this tutorial, you should be familiar with
  
* '''C''' programming language and
+
* '''C programming language and'''
* Basics of''' Linux kernel'''  
+
* basics of''' Linux kernel'''  
 +
 
 +
If not, then go through the '''C/C++''' and '''Linux''' spoken tutorials on this website
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 5:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 5:
  
 
VirtualBox Installation
 
VirtualBox Installation
  
* Go through the '''Ubuntu Linux on VirtualBox '''series in this website. [http://spoken-tutorial.org/ http://spoken-tutorial.org]  
+
* Go through the '''Ubuntu Linux on VirtualBox '''series in this website. [http://spoken-tutorial.org/ http][http://spoken-tutorial.org/ s][http://spoken-tutorial.org/ ://spoken-tutorial.org]  
  
 
* Do the Virtual box installation as per your system OS
 
* Do the Virtual box installation as per your system OS
  
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * Go through the '''Ubuntu Linux on VirtualBox '''series on this website
* Go through the '''Ubuntu Linux on VirtualBox '''series in this website.  
+
 
 +
* Do the VirtualBox installation as per your system OS.
 +
 
 +
|-
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| slide 6:
 +
 
 +
What is Linux Kernel?
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * The kernel is the main component of a Linux operating system.
 +
 
 +
* It bridges the hardware with the main programs that run on a computer.
 +
|-
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| slide 7:
 +
 
 +
Kernel Modules
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * It''' '''is a program that acts as translators between devices and the Linux kernel.
 +
 
 +
* Kernel modules need to be compiled with '''gcc''' options to make them work.
  
* Do the '''VirtualBox''' installation as per your '''system OS'''.
+
* '''gcc''' contains the '''C compiler''' used to '''compile '''the '''Linux kernel. '''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Click on '''ubuntu_18.04_LTS'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Click on '''ubuntu_18.04_LTS'''
  
 
Type the''' password'''
 
Type the''' password'''
| style="border:1pt solid #000000;padding:0.176cm;"| Start your''' Ubuntu 18.04 LTS virtual system.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Start your''' ubuntu 18.04 LTS''' virtual system.
  
Type the '''system password''' to '''login'''.
+
Type the system '''password''' to login.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Press '''Alt+Ctrl+T'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Press '''Alt+Ctrl+T'''
  
 
Type '''gcc -version'''
 
Type '''gcc -version'''
Line 88: Line 108:
 
Highlight '''Command ‘gcc’ not found.'''
 
Highlight '''Command ‘gcc’ not found.'''
  
| style="border:1pt solid #000000;padding:0.176cm;"| Open the''' terminal''' by pressing '''Alt+Ctrl+T''' keys simultaneously.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Open the''' terminal''' by pressing '''Alt+Ctrl+T''' keys simultaneously.
  
We require the '''gcc compiler''' to compile the''' kernel’s module'''.
+
We require the '''gcc compiler''' to compile the''' kernel’s '''module.
  
 
Let us check whether the '''gcc compiler''' is installed or not.
 
Let us check whether the '''gcc compiler''' is installed or not.
Line 101: Line 121:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
 
+
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''sudo apt update'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''sudo apt update'''
  
 
Press '''Enter'''
 
Press '''Enter'''
  
Type the '''password 2.23'''
+
Type the '''password '''
  
 
Press '''Enter'''
 
Press '''Enter'''
  
| style="border:1pt solid #000000;padding:0.176cm;"| Let us install the '''gcc compiler.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Let us install the '''gcc compiler,'''
  
 
Type '''sudo space apt space update''' and press''' Enter.'''
 
Type '''sudo space apt space update''' and press''' Enter.'''
  
If asked for the '''password''', type the '''administrative  password''' .
+
If asked for the password, type the administrative''' password'''.
  
This '''command''' will update the '''Ubuntu's''' default '''repositories'''.
+
This command will update Ubuntu's default repositories.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' sudo apt install build-essential'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' sudo apt install build-essential'''
  
 
Highlight the '''command'''
 
Highlight the '''command'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Next, type '''sudo space apt space install space build hyphen essential.'''  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Next, type '''sudo space apt space install space build hyphen essential.'''  
  
This '''package''' is used to install '''GCC/g++ compilers, libraries''' and utilities such as '''make'''.  
+
This package is used to install '''GCC/g++ '''compilers, libraries and utilities such as '''make'''.  
  
 
Press''' Enter'''.
 
Press''' Enter'''.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Show the output.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Show the output.
  
 
Type '''y '''
 
Type '''y '''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| We can see the installation process has begun.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| We can see the installation process has begun.
  
Press ''''Y'''' whenever there is a prompt during installation to confirm the '''configuration'''.
+
Press ''''Y'''' whenever there is a prompt during installation to confirm the configuration.
  
 
And press '''Enter.'''
 
And press '''Enter.'''
Line 151: Line 170:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type clear
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type clear
  
 
Press Enter
 
Press Enter
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
 
+
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >>''' gcc --version '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' '''>>''' gcc --version '''
  
 
Press''' Enter'''
 
Press''' Enter'''
  
 
Highlight '''7.4.0'''
 
Highlight '''7.4.0'''
| style="border:1pt solid #000000;padding:0.176cm;"| Let us check the version of installed '''gcc compiler.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Let us check the''' version '''of installed '''gcc compiler.'''
  
 
Type '''gcc space hyphen hyphen version''' and press''' Enter.'''
 
Type '''gcc space hyphen hyphen version''' and press''' Enter.'''
Line 169: Line 187:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' uname -r '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' uname -r '''
  
 
Press '''Enter.'''
 
Press '''Enter.'''
Line 190: Line 208:
  
 
Highlight '''generic'''
 
Highlight '''generic'''
| style="border:1pt solid #000000;padding:0.176cm;"| Let us now check the''' kernel''' version of the '''system'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Let us now check the''' kernel''' version of the system.
  
 
Type '''uname space hyphen r '''and press '''Enter.'''
 
Type '''uname space hyphen r '''and press '''Enter.'''
  
Here, you can see the''' kernel '''version of the '''system'''.
+
Here, you can see the''' kernel '''version of the system.
  
 
Five indicates the '''kernel''' version.
 
Five indicates the '''kernel''' version.
  
Zero indicates the''' kernel major '''revision.
+
Zero indicates the''' kernel''' '''major '''revision.
  
 
Zero indicates the '''kernel minor '''revision.
 
Zero indicates the '''kernel minor '''revision.
Line 204: Line 222:
 
Thirty one indicates the number of fixed '''bugs.'''
 
Thirty one indicates the number of fixed '''bugs.'''
  
'''generic '''means '''general usage kernel.'''
+
'''generic '''means general usage''' kernel.'''
  
It is used for '''Desktop '''installation.
+
It is used for '''desktop '''installation.
  
 
You may get a different version depending upon your '''Linux OS.'''
 
You may get a different version depending upon your '''Linux OS.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
  
 
Press''' Enter'''
 
Press''' Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' sudo su'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' sudo su'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' sudo space su'''.
 
  
'''su command''' stands for '''superuser '''or '''root user.'''
+
Type '''password'''  
  
'''Linux''' allows only the '''superuser ''' to run some '''commands'''.
+
Press '''Enter'''
  
Press '''Enter'''.
+
Highlight the prompt
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' sudo su'''.
  
|-
+
'''su '''command stands for '''superuser '''or '''root user.'''
| style="border:1pt solid #000000;padding:0.176cm;"|Type '''password'''  
+
  
Press '''Enter'''
+
'''Linux''' allows only the superuser to run some commands.
  
Highlight the prompt
+
Press '''Enter'''.
| style="border:1pt solid #000000;padding:0.176cm;"| If asked for the '''password''', type the '''system password''' and press '''Enter.'''
+
  
We can see the '''command prompt''' changed to '''root user'''.
+
If asked for the password, type the system '''password''' and press '''Enter.'''
 +
 
 +
We can see the command prompt changed to '''root''' user.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >>''' apt install linux-headers-$(uname -r)'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >>''' apt install linux-headers-$(uname -r)'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| To '''compile''' the''' Linux device driver,''' we need to have''' kernel header files''' installed in the '''system'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| To '''compile''' the''' Linux device driver,'''
 +
 
 +
We need to have''' kernel header files''' installed in the system.
  
 
Let us install the '''kernel header files.'''
 
Let us install the '''kernel header files.'''
  
Type '''apt space install space linux hyphen headers hyphen dollar in brackets uname hyphen r.'''
+
Type '''apt space install space linux hyphen headers hyphen dolar in brackets uname hyphen r.'''
  
 
And press''' Enter'''
 
And press''' Enter'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Point to''' linux-headers'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Point to''' linux-headers'''
  
 
Highlight '''0-upgraded'''
 
Highlight '''0-upgraded'''
  
 
Highlight '''0-newly installed'''
 
Highlight '''0-newly installed'''
| style="border:1pt solid #000000;padding:0.176cm;"| The '''files''' are already installed on the '''system'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| The files are already installed on the system.  
 
+
So, you can see the output as-
+
  
'''linux hyphen headers hyphen 5.0.0 hyphen 31 hyphen generic is already the newest version'''
+
So, you can see the output as
  
'''Zero upgraded, zero newly installed. '''
+
'''linux-headers-5.0.0-31-generic is already the newest version.'''
  
 +
'''zero upgraded, zero newly installed. '''
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''dpkg-query -s linux-headers-$(uname -r)'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''dpkg-query -s linux-headers-$(uname -r)'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Let us see the details of the '''kernel headers. '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Let us see the details of the '''kernel headers, '''
  
 
Type '''dpkg hyphen query space hyphen s space linux hyphen headers hyphen dollar in brackets uname space hyphen r.'''
 
Type '''dpkg hyphen query space hyphen s space linux hyphen headers hyphen dollar in brackets uname space hyphen r.'''
Line 281: Line 300:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight '''package'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Highlight '''package'''
  
 
Highlight''' status '''
 
Highlight''' status '''
  
 
Highlight''' Installed-size '''
 
Highlight''' Installed-size '''
| style="border:1pt solid #000000;padding:0.176cm;"| This field shows the '''package''' of''' header files.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| This field shows the package of''' header files.'''
  
 
The '''status''' field indicates that the '''header files '''are installed or not.
 
The '''status''' field indicates that the '''header files '''are installed or not.
  
The''' Installed-size''' field contains the size of installed '''kernel header files '''in '''bytes'''.
+
The''' Installed-size''' field contains the size of installed '''kernel header''' '''files '''in bytes.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight '''Architecture'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Highlight '''Architecture'''
  
 
Highlight '''version'''
 
Highlight '''version'''
| style="border:1pt solid #000000;padding:0.176cm;"| This field shows the '''architecture '''of our '''system'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| This field shows the '''architecture '''of our system.
  
The '''version''' field shows the version of the''' header files.'''
+
The '''version''' field shows the version of''' '''the''' header files.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''uname -r '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''uname -r '''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| As already learnt, to see the '''kernel version,''' type '''uname space hyphen r'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| As already learned, to see the '''kernel version,'''
  
And press '''Enter.'''
+
Type '''uname space hyphen r''' and press '''Enter.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight '''version'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Highlight '''version'''
  
 
Highlight '''5.0.0-27-generic '''
 
Highlight '''5.0.0-27-generic '''
  
 
Highlight '''version: 5.0.0-27'''
 
Highlight '''version: 5.0.0-27'''
| style="border:1pt solid #000000;padding:0.176cm;"| Here, you can see that the''' kernel header files''' version and the '''kernel '''version are the same.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Here, you can see that the''' kernel header files''' version and the '''kernel '''version are the same.
  
Make sure that both versions are the same in your '''system'''.
+
Make sure that both versions are the same in your system.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''clear'''
  
 
Press''' Enter'''
 
Press''' Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''lsmod'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''lsmod'''.
  
 
Press '''Enter'''
 
Press '''Enter'''
Line 332: Line 351:
  
 
Highlight '''lsmod'''
 
Highlight '''lsmod'''
| style="border:1pt solid #000000;padding:0.176cm;"| Let us see the '''command''' that shows the '''kernel’s modules.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Let us see the command that shows the '''kernel’s modules.'''
  
 
Type '''lsmod''' and press''' Enter'''.
 
Type '''lsmod''' and press''' Enter'''.
  
This '''command''' shows the '''modules''' currently loaded in the '''kernel'''.
+
This command shows the '''modules''' currently loaded in the '''kernel'''.
  
These '''modules''' extend the '''kernel’s functionality'''.
+
These '''modules''' extend the '''kernel’s''' functionality.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''ls -l''' /'''dev'''  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''ls''' '''-l''' /'''dev'''  
  
 
press '''Enter'''
 
press '''Enter'''
Line 355: Line 374:
 
Highlight '''/dev'''
 
Highlight '''/dev'''
  
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''ls space hyphen l space''' '''slash dev''' and press '''Enter.'''
 
  
This '''command''' displays the list of '''files''' located under the '''dev directory. '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''ls''' '''space''' '''hyphen l space''' '''slash''' '''dev''' and press '''Enter.'''
 +
 
 +
This command displays the list of '''files''' located under the '''dev directory. '''
 +
 
 +
All the devices are located in the''' dev directory'''.
  
All the '''devices''' are located in the''' dev directory'''.
 
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight '''c '''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Highlight '''c '''
  
 
Highlight '''b'''
 
Highlight '''b'''
  
 
Highlight '''oct 16 08:47'''
 
Highlight '''oct 16 08:47'''
| style="border:1pt solid #000000;padding:0.176cm;"| '''c''' indicates that it is a '''character device'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| '''c''' indicates that it is a '''character device'''.
  
 
And''' block devices''' are indicated by '''b.'''
 
And''' block devices''' are indicated by '''b.'''
Line 373: Line 394:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' clear'''
  
 
Press''' Enter'''
 
Press''' Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''ls -l/dev/tty'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''ls''' '''-l''' /'''dev'''/'''tty'''
  
 
Press '''Enter'''
 
Press '''Enter'''
Line 388: Line 409:
  
 
Highlight''' rw-rw-rw-'''
 
Highlight''' rw-rw-rw-'''
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''ls space hyphen l space slash dev slash tty '''and press '''Enter'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''ls''' '''space''' '''hyphen''' '''l space slash''' '''dev''' '''slash''' '''tty '''and press '''Enter'''.
  
The '''tty''' is a '''character device''' for the first '''uart serial port.'''
+
The '''tty''' is a character device for the first '''uart serial port.'''
  
 
Here, the '''owner''' is '''root''', and the '''group''' is '''tty.'''  
 
Here, the '''owner''' is '''root''', and the '''group''' is '''tty.'''  
  
It indicates that the '''owner''', the '''group '''and the '''others '''have '''read''' and '''write permissions'''.  
+
It indicates that the '''owner''', the '''group '''and '''others '''have read and write permissions.  
  
Another example of a '''character device''' is a '''keyboard device'''.
+
Another example of a character device is a '''keyboard''' device.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' >> ls -l /dev/sda'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' >> ls -l /dev/sda'''
  
 
Press''' Enter'''
 
Press''' Enter'''
Line 409: Line 430:
 
Highlight''' rw-rw-'''
 
Highlight''' rw-rw-'''
  
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''ls''' '''space''' '''hyphen l space slash dev slash sda''' and press '''Enter.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''ls''' '''space''' '''hyphen l space slash''' '''dev''' '''slash''' '''sda''' and press '''Enter.'''
  
It is a '''block device''' indicated by '''b'''.
+
It is a '''block '''device indicated by '''b'''.
  
All mass storage '''devices''' such as '''sda''' are '''block devices'''.  
+
All mass storage devices such as '''sda''' are '''block''' devices.  
  
 
Here, the '''owner''' is '''root''', and the '''group''' is '''disk'''
 
Here, the '''owner''' is '''root''', and the '''group''' is '''disk'''
  
It indicates that the '''owner''' and the '''group''' have '''read''' and '''write permissions.'''
+
It indicates that the '''owner''' and''' '''the '''group''' have read and write permissions.
  
These '''devices''' support '''random access'''.
+
These devices support random access.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| ype '''clear'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the '''screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >> '''ls -l /sys/class/net'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >> '''ls -l /sys/class/net'''
  
 
Press '''Enter'''
 
Press '''Enter'''
  
 
Show the output
 
Show the output
| style="border:1pt solid #000000;padding:0.176cm;"| Type''' ls space hyphen l space slash sys slash class slash net '''and press''' Enter.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type''' ls space hyphen l space slash sys slash class slash net '''and''' '''press''' Enter.'''
  
 
Here, you can see the list of''' network devices '''located in this '''directory.'''
 
Here, you can see the list of''' network devices '''located in this '''directory.'''
 
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight output
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Highlight output
  
| style="border:1pt solid #000000;padding:0.176cm;"| '''Network devices''' are also known as '''packet devices'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| '''Network devices''' are also known as '''packet''' devices.
  
 
'''Network devices''' simply transmit or receive the '''packets'''.
 
'''Network devices''' simply transmit or receive the '''packets'''.
  
This is normally a physical '''device''' like '''ethernet card. '''
+
This is normally a physical device like '''ethernet card. '''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''clear'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Clear the''' screen.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Clear the''' screen.'''
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >>''' exit'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >>''' exit'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| Type '''exit '''and press''' Enter.'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type '''exit '''and press''' Enter.'''
  
You can see the '''command prompt''' changed to regular''' user'''.
+
You can see the command prompt changed to '''regular''' user.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Type >>''' exit'''
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Type >>''' exit'''
  
 
Press '''Enter'''
 
Press '''Enter'''
| style="border:1pt solid #000000;padding:0.176cm;"| To go back to '''user login''', type '''exit''' and press '''Enter'''.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| To go back to '''user''' '''login''',
 +
 
 +
Type '''exit''' and press '''Enter'''.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 6:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"|
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| With this, we come to the end of this tutorial. Let us summarize.
 +
 
 +
|-
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 6:
  
 
Summary:
 
Summary:
Line 474: Line 500:
 
* Install the '''kernel header files.'''
 
* Install the '''kernel header files.'''
 
* See the '''kernel''' version.
 
* See the '''kernel''' version.
* Use '''Linux kernel command'''.
+
* Use linux '''kernel''' command.
  
| style="border:1pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt to
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt to
  
 
* install the '''gcc compiler.'''
 
* install the '''gcc compiler.'''
 
* install the '''kernel header files.'''
 
* install the '''kernel header files.'''
 
* Check the installed '''kernel '''version.
 
* Check the installed '''kernel '''version.
* Use '''Linux kernel command'''.
+
* Use linux '''kernel''' command.
 
+
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Assignment:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Assignment:
  
 
# Type the below commands and see the output:
 
# Type the below commands and see the output:
  
* ls -l /dev/tty2
+
> ls -l /dev/tty2
  
* ls -l /dev/sda2  
+
> ls -l /dev/sda2  
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| As an assignment,
  
| style="border:1pt solid #000000;padding:0.176cm;"| As an assignment, type the below '''commands''' and see the output.
+
# Type the below commands and see the output:
 +
 
 +
> ls -l /dev/tty2
 +
 
 +
> ls -l /dev/sda2
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 7:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 7:
  
 
About Spoken Tutorial Project:
 
About Spoken Tutorial Project:
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * The video at the following link summarizes the Spoken Tutorial project.
* The video at the following link summarizes the Spoken Tutorial project.
+
 
* Please download and watch it.
 
* Please download and watch it.
 +
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 8:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 8:
  
 
Spoken Tutorial workshops:
 
Spoken Tutorial workshops:
 +
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' Team:
  
| style="border:1pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' Team conducts workshops and gives certificates.
+
* conducts workshops and
 
+
* gives certificates.
 
For more details, please write to us.
 
For more details, please write to us.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 9:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 9:
 
+
  
 
Forum questions:
 
Forum questions:
  
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * Do you have questions in THIS Spoken Tutorial?
* Do you have questions in THIS Spoken Tutorial?
+
* Please visit this site
* Please visit this site.
+
 
* Choose the minute and second where you have the question.
 
* Choose the minute and second where you have the question.
 
* Explain your question briefly.
 
* Explain your question briefly.
* The Spoken Tutorial project will ensure an answer.
+
* The Spoken Tutorial project will ensure an answer
* You will have to register to ask questions.
+
* You will have to register to ask questions
 
+
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 10:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 10:
  
 
Forum for specific questions:
 
Forum for specific questions:
  
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * The Spoken Tutorial forum is for specific questions on this tutorial.
* The Spoken Tutorial forum is for specific questions on this tutorial.
+
 
* Please do not post unrelated and general questions on them.
 
* Please do not post unrelated and general questions on them.
 
* This will help reduce the clutter.
 
* This will help reduce the clutter.
 
* With less clutter, we can use these discussions as instructional material.
 
* With less clutter, we can use these discussions as instructional material.
 
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 11:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 11:
 +
 
  
 
Forum for specific questions:
 
Forum for specific questions:
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * Do you have general/technical questions on Embedded Linux Device Driver?
* Do you have general/technical questions on '''Embedded Linux Device Driver'''?
+
* Please visit the FOSSEE forum and post your question.
* Please visit the '''FOSSEE forum''' and post your question.
+
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 12:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 12:
  
 
Acknowledgment:
 
Acknowledgment:
| style="border:1pt solid #000000;padding:0.176cm;"| Spoken Tutorial Project is supported by MHRD, Government of India.
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| * Spoken Tutorial Project is supported by MHRD, Government of India.
 
+
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 13:
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| Slide 13:
  
 
Thank you slide:
 
Thank you slide:
| style="border:1pt solid #000000;padding:0.176cm;"| This tutorial has been contributed by '''FOSSEE '''and''' Spoken Tutorial Project, IIT Bombay'''.  
+
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.176cm;"| This tutorial has been contributed by '''FOSSEE '''and''' Spoken Tutorial Project, IIT Bombay'''.  
  
 
This is Mayuri Panchakshari signing off.
 
This is Mayuri Panchakshari signing off.
  
 
Thanks for watching.
 
Thanks for watching.
 +
 +
  
 
|}
 
|}

Revision as of 15:33, 8 July 2020

Visual cue Narration
Slide 1:

Welcome slide:

Welcome to the spoken tutorial on

Installation of Linux kernel packages.

Slide 2:

Learning objectives:

  • Install the gcc compiler.
  • Install the kernel header files.
  • Check the installed kernel version.
  • Use linux kernel command
In this tutorial, we will learn how to
  • Install the gcc compiler.
  • Install the kernel header files.
  • Check the installed kernel version.
  • Use linux kernel commands.
Slide 3:

System Requirements:

  • VirtualBox version 5.2
  • Ubuntu Linux 18.04 LTS operating system.
  • Linux kernel version 5.0.0-31 generic.
To record this tutorial, I am using,
  • VirtualBox version 5.2
  • Ubuntu Linux 18.04 LTS operating system.
  • Linux kernel version 5.0.0-31 generic.
Slide 4:

Prerequisites:

To follow this tutorial, you should be familiar with

  • C programming language and
  • basics of Linux kernel
To follow this tutorial, you should be familiar with
  • C programming language and
  • basics of Linux kernel

If not, then go through the C/C++ and Linux spoken tutorials on this website

Slide 5:

VirtualBox Installation

  • Do the Virtual box installation as per your system OS
* Go through the Ubuntu Linux on VirtualBox series on this website
  • Do the VirtualBox installation as per your system OS.
slide 6:

What is Linux Kernel?

* The kernel is the main component of a Linux operating system.
  • It bridges the hardware with the main programs that run on a computer.
slide 7:

Kernel Modules

* It is a program that acts as translators between devices and the Linux kernel.
  • Kernel modules need to be compiled with gcc options to make them work.
  • gcc contains the C compiler used to compile the Linux kernel.
Click on ubuntu_18.04_LTS

Type the password

Start your ubuntu 18.04 LTS virtual system.

Type the system password to login.

Press Alt+Ctrl+T

Type gcc -version

Press Enter

Highlight Command ‘gcc’ not found.

Open the terminal by pressing Alt+Ctrl+T keys simultaneously.

We require the gcc compiler to compile the kernel’s module.

Let us check whether the gcc compiler is installed or not.

Type gcc space hyphen hyphen version and press Enter.

As it is not installed, you will see an error as shown here.

Otherwise you will see the gcc version that has been installed.

Type >> clear

Press Enter

Clear the screen.
Type sudo apt update

Press Enter

Type the password

Press Enter

Let us install the gcc compiler,

Type sudo space apt space update and press Enter.

If asked for the password, type the administrative password.

This command will update Ubuntu's default repositories.

Type sudo apt install build-essential

Highlight the command

Press Enter

Next, type sudo space apt space install space build hyphen essential.

This package is used to install GCC/g++ compilers, libraries and utilities such as make.

Press Enter.

Show the output.

Type y

Press Enter

We can see the installation process has begun.

Press 'Y' whenever there is a prompt during installation to confirm the configuration.

And press Enter.

Now the installation of gcc compiler is completed.

Type clear

Press Enter

Clear the screen.
Type >> gcc --version

Press Enter

Highlight 7.4.0

Let us check the version of installed gcc compiler.

Type gcc space hyphen hyphen version and press Enter.

Here, you can see the installed gcc compiler version.

Type clear

Press Enter

Clear the screen
Type uname -r

Press Enter.

Highlight 5.0.0-27-generic

Highlight 5

Highlight 0

Highlight 0

Highlight -31

Highlight generic

Let us now check the kernel version of the system.

Type uname space hyphen r and press Enter.

Here, you can see the kernel version of the system.

Five indicates the kernel version.

Zero indicates the kernel major revision.

Zero indicates the kernel minor revision.

Thirty one indicates the number of fixed bugs.

generic means general usage kernel.

It is used for desktop installation.

You may get a different version depending upon your Linux OS.

Type clear

Press Enter

Clear the screen.
Type sudo su

Press Enter

Type password

Press Enter

Highlight the prompt

Type sudo su.

su command stands for superuser or root user.

Linux allows only the superuser to run some commands.

Press Enter.

If asked for the password, type the system password and press Enter.

We can see the command prompt changed to root user.

Type >> apt install linux-headers-$(uname -r)

Press Enter

To compile the Linux device driver,

We need to have kernel header files installed in the system.

Let us install the kernel header files.

Type apt space install space linux hyphen headers hyphen dolar in brackets uname hyphen r.

And press Enter

Point to linux-headers

Highlight 0-upgraded

Highlight 0-newly installed

The files are already installed on the system.

So, you can see the output as

linux-headers-5.0.0-31-generic is already the newest version.

zero upgraded, zero newly installed.

Type >> clear

Press Enter

Clear the screen.
Type >> dpkg-query -s linux-headers-$(uname -r)

Press Enter

Let us see the details of the kernel headers,

Type dpkg hyphen query space hyphen s space linux hyphen headers hyphen dollar in brackets uname space hyphen r.

And press Enter.

Highlight package

Highlight status

Highlight Installed-size

This field shows the package of header files.

The status field indicates that the header files are installed or not.

The Installed-size field contains the size of installed kernel header files in bytes.

Highlight Architecture

Highlight version

This field shows the architecture of our system.

The version field shows the version of the header files.

Type uname -r

Press Enter

As already learned, to see the kernel version,

Type uname space hyphen r and press Enter.

Highlight version

Highlight 5.0.0-27-generic

Highlight version: 5.0.0-27

Here, you can see that the kernel header files version and the kernel version are the same.

Make sure that both versions are the same in your system.

Type >> clear

Press Enter

Clear the screen.
Type >> lsmod.

Press Enter

Show the output

Highlight lsmod

Let us see the command that shows the kernel’s modules.

Type lsmod and press Enter.

This command shows the modules currently loaded in the kernel.

These modules extend the kernel’s functionality.

Type clear

Press Enter

Clear the screen
Type >> ls -l /dev

press Enter

Show the output

Highlight /dev


Type ls space hyphen l space slash dev and press Enter.

This command displays the list of files located under the dev directory.

All the devices are located in the dev directory.

Highlight c

Highlight b

Highlight oct 16 08:47

c indicates that it is a character device.

And block devices are indicated by b.

The last two entries shows the last modification date and time of a file.

Type clear

Press Enter

Clear the screen
Type >> ls -l /dev/tty

Press Enter

Highlight tty

Point to root, tty

Highlight rw-rw-rw-

Type ls space hyphen l space slash dev slash tty and press Enter.

The tty is a character device for the first uart serial port.

Here, the owner is root, and the group is tty.

It indicates that the owner, the group and others have read and write permissions.

Another example of a character device is a keyboard device.

Type >> ls -l /dev/sda

Press Enter

Highlight b

Point to root, disk

Highlight rw-rw-

Type ls space hyphen l space slash dev slash sda and press Enter.

It is a block device indicated by b.

All mass storage devices such as sda are block devices.

Here, the owner is root, and the group is disk

It indicates that the owner and the group have read and write permissions.

These devices support random access.

ype clear

Press Enter

Clear the screen.
Type >> ls -l /sys/class/net

Press Enter

Show the output

Type ls space hyphen l space slash sys slash class slash net and press Enter.

Here, you can see the list of network devices located in this directory.

Highlight output Network devices are also known as packet devices.

Network devices simply transmit or receive the packets.

This is normally a physical device like ethernet card.

Type clear

Press Enter

Clear the screen.
Type >> exit

Press Enter

Type exit and press Enter.

You can see the command prompt changed to regular user.

Type >> exit

Press Enter

To go back to user login,

Type exit and press Enter.

With this, we come to the end of this tutorial. Let us summarize.
Slide 6:

Summary:

  • Install the gcc compiler.
  • Install the kernel header files.
  • See the kernel version.
  • Use linux kernel command.
In this tutorial, we learnt to
  • install the gcc compiler.
  • install the kernel header files.
  • Check the installed kernel version.
  • Use linux kernel command.
Assignment:
  1. Type the below commands and see the output:

> ls -l /dev/tty2

> ls -l /dev/sda2

As an assignment,
  1. Type the below commands and see the output:

> ls -l /dev/tty2

> ls -l /dev/sda2

Slide 7:

About Spoken Tutorial Project:

* The video at the following link summarizes the Spoken Tutorial project.
  • Please download and watch it.
Slide 8:

Spoken Tutorial workshops:

The Spoken Tutorial Project Team:
  • conducts workshops and
  • gives certificates.

For more details, please write to us.

Slide 9:

Forum questions:

* Do you have questions in THIS Spoken Tutorial?
  • Please visit this site
  • Choose the minute and second where you have the question.
  • Explain your question briefly.
  • The Spoken Tutorial project will ensure an answer
  • You will have to register to ask questions
Slide 10:

Forum for specific questions:

* The Spoken Tutorial forum is for specific questions on this tutorial.
  • Please do not post unrelated and general questions on them.
  • This will help reduce the clutter.
  • With less clutter, we can use these discussions as instructional material.
Slide 11:


Forum for specific questions:

* Do you have general/technical questions on Embedded Linux Device Driver?
  • Please visit the FOSSEE forum and post your question.
Slide 12:

Acknowledgment:

* Spoken Tutorial Project is supported by MHRD, Government of India.
Slide 13:

Thank you slide:

This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

This is Mayuri Panchakshari signing off.

Thanks for watching.


Contributors and Content Editors

Nancyvarkey, Nirmala Venkat