<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Embedded-Linux-Device-Driver%2FC3%2FKernel-Memory-Allocation%2FEnglish</id>
		<title>Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Embedded-Linux-Device-Driver%2FC3%2FKernel-Memory-Allocation%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;action=history"/>
		<updated>2026-05-13T15:46:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54287&amp;oldid=prev</id>
		<title>Nancyvarkey at 05:00, 30 October 2020</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54287&amp;oldid=prev"/>
				<updated>2020-10-30T05:00:33Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:00, 30 October 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here, I have created a directory named '''MemoryAllocation.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here, I have created a directory named '''MemoryAllocation.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In this directory, I have saved '''simple_driver dot c &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;driver &lt;/del&gt;file, user dot c''' and '''Makefile.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In this directory, I have saved '''simple_driver dot c file, user dot c''' and '''Makefile.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I’ll use these files for demonstration.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I’ll use these files for demonstration.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54115&amp;oldid=prev</id>
		<title>Nirmala Venkat at 10:31, 23 October 2020</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54115&amp;oldid=prev"/>
				<updated>2020-10-23T10:31:39Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:31, 23 October 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 418:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 418:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Mayuri Panchakshari &lt;/del&gt;signing off.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Usha &lt;/ins&gt;signing off.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Thanks for watching.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Thanks for watching.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nirmala Venkat</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54112&amp;oldid=prev</id>
		<title>Nirmala Venkat at 09:35, 23 October 2020</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=54112&amp;oldid=prev"/>
				<updated>2020-10-23T09:35:36Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:35, 23 October 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 85:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 85:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Open the '''terminal''' by pressing '''ALT+Ctrl+T '''keys simultaneously.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Open the '''terminal''' by pressing '''ALT+Ctrl+T '''keys simultaneously.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Go to the directory''' MemoryAllocation '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;as shown here&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Go to the directory &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;where &lt;/ins&gt;'''MemoryAllocation''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is saved on your system&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Press '''Enter''' key after every '''command.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Press '''Enter''' key after every '''command.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 223:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 223:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt;''' gedit Makefile'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt;''' gedit Makefile'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| To '''compile''' the '''program''', we have to create a''' Makefile'''.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| To '''compile''' the '''program''', we have to create a''' Makefile'''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Let’s create a '''Makefile.'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Type '''gedit space Makefile.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Type '''gedit space Makefile.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nirmala Venkat</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=53857&amp;oldid=prev</id>
		<title>Nancyvarkey at 02:17, 28 September 2020</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=53857&amp;oldid=prev"/>
				<updated>2020-09-28T02:17:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;amp;diff=53857&amp;amp;oldid=53842&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=53842&amp;oldid=prev</id>
		<title>Nirmala Venkat: Created page with &quot; {| style=&quot;border-spacing:0;&quot; | style=&quot;border:1pt solid #000000;padding:0.176cm;&quot;| '''Visual cue :''' | style=&quot;border:1pt solid #000000;padding:0.176cm;&quot;| '''Narration :'''  |...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Embedded-Linux-Device-Driver/C3/Kernel-Memory-Allocation/English&amp;diff=53842&amp;oldid=prev"/>
				<updated>2020-09-23T09:58:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; {| style=&amp;quot;border-spacing:0;&amp;quot; | style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &amp;#039;&amp;#039;&amp;#039;Visual cue :&amp;#039;&amp;#039;&amp;#039; | style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &amp;#039;&amp;#039;&amp;#039;Narration :&amp;#039;&amp;#039;&amp;#039;  |...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| '''Visual cue :'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| '''Narration :'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 1:&lt;br /&gt;
&lt;br /&gt;
Welcome slide:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Welcome to the spoken tutorial on''' Kernel Memory Allocation.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 2:&lt;br /&gt;
&lt;br /&gt;
Learning objectives:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| In this tutorial, we will learn how to&lt;br /&gt;
&lt;br /&gt;
* Dynamically allocate the''' kernel memory''' using '''kmalloc'''() '''function '''and&lt;br /&gt;
* '''kfree() function''' to free the memory allocated by '''kmalloc().'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 3:&lt;br /&gt;
&lt;br /&gt;
System Requirements:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| To record this tutorial, I am using,&lt;br /&gt;
&lt;br /&gt;
* '''VirtualBox 5.2.'''&lt;br /&gt;
* '''Ubuntu Linux 18.04 LTS''' operating system.&lt;br /&gt;
* '''Linux kernel version 5.0.0-31 generic.'''&lt;br /&gt;
* '''gedit text editor.'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 4:&lt;br /&gt;
&lt;br /&gt;
Prerequisites:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| To follow this tutorial, you should be familiar with:&lt;br /&gt;
&lt;br /&gt;
* '''C programming language '''&lt;br /&gt;
* Basics of''' Linux kernel'''&lt;br /&gt;
&lt;br /&gt;
If not, then go through the '''C/C++''' and''' Linux spoken tutorials''' on this website.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 5:&lt;br /&gt;
&lt;br /&gt;
'''Kernel Memory Allocation.'''&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * Linux handles memory allocation by creating a set of memory objects of fixed sizes&lt;br /&gt;
* It will dynamically allocate portions of memory to programs at their request&lt;br /&gt;
* When the memory is no longer needed,we have to free it for reuse&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Let us see the commonly used '''kernels functions''' to allocate its memory. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 6:&lt;br /&gt;
&lt;br /&gt;
'''Kernel Memory Allocation functions.'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * '''kmalloc()''' and '''vmalloc() '''functions dynamically allocates the '''kernel memory.'''&lt;br /&gt;
* '''kmalloc() '''is similar to the '''malloc function''' in''' c programs.'''&lt;br /&gt;
* '''kmalloc() '''allocates contiguous''' physical memory '''and '''virtual memory.'''&lt;br /&gt;
* '''vmalloc()''' allocates contiguous '''virtual memory '''but not the '''physical memory. '''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Point to the '''folder''' and''' file''' in '''desktop'''&lt;br /&gt;
&lt;br /&gt;
Point to the '''files.'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Go to the '''DeviceDriver folder''' in the '''desktop''' which we have created earlier.&lt;br /&gt;
&lt;br /&gt;
Here, I have created a directory named '''MemoryAllocation.'''&lt;br /&gt;
&lt;br /&gt;
In this directory, I have saved '''simple_driver dot c driver file, user dot c and Makefile.'''&lt;br /&gt;
&lt;br /&gt;
I’ll use these files for demonstration.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide 7:&lt;br /&gt;
&lt;br /&gt;
'''Code files''':&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * The files used in this tutorial are available in the '''Code Files '''link on this tutorial page.&lt;br /&gt;
* Please download and extract them&lt;br /&gt;
* Make a copy and then use them while practising&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Open the '''terminal'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''cd Desktop/DeviceDriver/ MemoryAllocation'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Open the '''terminal''' by pressing '''ALT+Ctrl+T '''keys simultaneously.&lt;br /&gt;
&lt;br /&gt;
Go to the directory''' MemoryAllocation '''as shown here.&lt;br /&gt;
&lt;br /&gt;
Press '''Enter key''' after every '''command.'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt; '''gedit simple_driver.c'''&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type''' gedit space simple driver dot c.'''&lt;br /&gt;
&lt;br /&gt;
I have used the same file ''' simple_driver dot c '''which we used earlier.&lt;br /&gt;
&lt;br /&gt;
In this file, I have used the '''kmalloc() function''' to allocate the memory.&lt;br /&gt;
&lt;br /&gt;
Let me explain the code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| '''Highlight &amp;lt;nowiki&amp;gt;&amp;lt;linux/slab.h&amp;gt; &amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
'''static char &amp;lt;nowiki&amp;gt;*ptr&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Here, we have to include the '''slab dot h''' '''kernel header file'''.&lt;br /&gt;
&lt;br /&gt;
The '''kmalloc() function''' is declared in the''' slab dot h header file.'''&lt;br /&gt;
&lt;br /&gt;
To use the '''string functions''' in the driver, include the '''string dot h header file.'''&lt;br /&gt;
&lt;br /&gt;
Here, the '''ptr character pointer''' is defined with '''NULL '''value.&lt;br /&gt;
&lt;br /&gt;
We will use it to store the address return by the '''kmalloc() function.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''init_function()'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''void *kmalloc(size_t size, int flags);'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''size'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| In the''' initialisation function''', we have used the '''kmalloc() function.'''&lt;br /&gt;
&lt;br /&gt;
Use the dynamic allocation way when you don’t know how much '''memory''' will be needed.&lt;br /&gt;
&lt;br /&gt;
Now let us see the prototype of the''' kmalloc() function.''' &lt;br /&gt;
&lt;br /&gt;
'''size''' specifies the size of '''memory''' to be allocated.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''flag'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''GFP_ATOMIC'''.&lt;br /&gt;
&lt;br /&gt;
Highlight''' void* '''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| '''flag''' denotes the behavior of '''kmalloc''' call. &lt;br /&gt;
&lt;br /&gt;
The two most widely used flags are '''GFP_KERNEL''' and '''GFP_ATOMIC'''.&lt;br /&gt;
&lt;br /&gt;
It returns the '''virtual address''' of the first page allocated.&lt;br /&gt;
&lt;br /&gt;
If there is any error, it returns''' NULL.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight''' kmalloc()'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''GFP_ATOMIC'''&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Here, '''kmalloc()''' dynamically allocates 8 bytes of the '''kernel memory'''.&lt;br /&gt;
&lt;br /&gt;
We will use this allocated '''kernel memory '''space as a buffer.&lt;br /&gt;
&lt;br /&gt;
It is also referred to as a virtual''' device.'''&lt;br /&gt;
&lt;br /&gt;
'''GFP_ATOMIC flag''' will not put the '''current process''' in sleep state if memory is low.&lt;br /&gt;
&lt;br /&gt;
This flag''' '''is mostly used in the '''interrupt handler''' to allocate memory.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight''' char *'''&lt;br /&gt;
&lt;br /&gt;
Highlight''' ptr'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| The '''kmalloc()''' returns an address which can be used to store any type of data.&lt;br /&gt;
&lt;br /&gt;
Here, you can typecast it to store the data of respective data type.&lt;br /&gt;
&lt;br /&gt;
I have typecast it as a '''character pointer '''to store a string in it.&lt;br /&gt;
&lt;br /&gt;
The '''ptr '''contains the start address of the allocated '''kernel''' '''memory'''.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''printk messages'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Depending upon its success or failure, the corresponding messages will be printed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''open()'''&lt;br /&gt;
&lt;br /&gt;
Highlight''' strcpy()''' and '''printk'''&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| '''open function''' will execute when a user program opens the '''device'''.&lt;br /&gt;
&lt;br /&gt;
We will use a '''strcpy''' '''function''' to copy the data to the buffer.&lt;br /&gt;
&lt;br /&gt;
Here, the''' strcpy() function''' will copy a '''string IITB''' to the buffer. &lt;br /&gt;
&lt;br /&gt;
This message will be printed in the '''kernel log level.'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Let us see the''' kernel function''' to release the dynamically allocated''' memory.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''exit_function.'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''ptr'''&lt;br /&gt;
&lt;br /&gt;
Highlight''' void kfree(const void *ptr)'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| As we allocated the''' kernel '''memory dynamically, it's our responsibility to release it.&lt;br /&gt;
&lt;br /&gt;
We have to use the '''kfree() function''' in the '''exit function''' as shown here.&lt;br /&gt;
&lt;br /&gt;
'''The kfree function '''is used to free the memory allocated by '''kmalloc().'''&lt;br /&gt;
&lt;br /&gt;
'''ptr '''specifies''' '''the address returned by '''kmalloc'''(). &lt;br /&gt;
&lt;br /&gt;
It is mostly used in the''' cleanup function''' and avoids the leakage of memory. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight''' kfree(ptr)'''&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Here''', the kfree() function''' will release the memory whose '''address''' is stored in the '''pointer.'''&lt;br /&gt;
&lt;br /&gt;
It will avoid the wastage of the '''kernel memory''' as its '''memory''' or '''stack''' is limited.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Highlight '''ptr'''&lt;br /&gt;
&lt;br /&gt;
Highlight''' NULL'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Now, '''ptr''' is a '''dangling pointer''' as it points to '''freed memory.'''&lt;br /&gt;
&lt;br /&gt;
If you try to access it again, the''' program '''could''' crash '''and may lead to''' memory fault'''.&lt;br /&gt;
&lt;br /&gt;
To avoid such problems''', '''assign the '''NULL''' value to it which is a '''valid address'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Save and close the''' file.'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Save and close the '''file.'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt;''' gedit Makefile'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| To compile the '''program''', we have to create a''' Makefile'''.&lt;br /&gt;
&lt;br /&gt;
Let’s create a '''Makefile.'''&lt;br /&gt;
&lt;br /&gt;
Type '''gedit space Makefile.'''&lt;br /&gt;
&lt;br /&gt;
Type the '''code '''as shown or you can use the downloaded '''Makefile.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Switchback to the '''terminal'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Save and close the file&lt;br /&gt;
&lt;br /&gt;
Now let us see a simple '''user program''' which will open and close a '''device.'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt; '''gedit user.c'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''open()''' and '''close().'''&lt;br /&gt;
&lt;br /&gt;
Save and close the file&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt;''' clear'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type '''gedit space user dot c.'''&lt;br /&gt;
&lt;br /&gt;
I have used the same user program''' user dot c '''which we used earlier.&lt;br /&gt;
&lt;br /&gt;
This program opens and closes the '''new_device''' using respective '''system calls.'''&lt;br /&gt;
&lt;br /&gt;
When the '''user program''' tries to open a '''device''', the specified data will copy to the '''buffer'''. &lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt; '''sudo su'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt;''' system password.'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''make all'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt;''' clear'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt;''' insmod simple_driver.ko'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''clear'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Let us compile the '''driver.'''&lt;br /&gt;
&lt;br /&gt;
Type '''sudo space su''' to be a superuser and then type the system password.&lt;br /&gt;
&lt;br /&gt;
Type '''make space all.'''&lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
&lt;br /&gt;
Now load the '''driver '''into the''' kernel.'''&lt;br /&gt;
&lt;br /&gt;
Type '''insmod space simple_driver dot ko.'''&lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt; '''dmesg | grep simple_driver'''&lt;br /&gt;
&lt;br /&gt;
Highlight the''' output'''&lt;br /&gt;
Highlight '''printk '''messages.&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''clear'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Let’s see the loaded '''printk '''messages.&lt;br /&gt;
&lt;br /&gt;
Type '''dmesg space pipe space grep space simple_driver.'''&lt;br /&gt;
&lt;br /&gt;
Here, this''' '''message shows that the''' kmalloc() function '''executed successfully.&lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Now let us compile the user program to open the device.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt;''' gcc -c user.c'''&lt;br /&gt;
Type &amp;gt;&amp;gt; '''gcc -o user user.o'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''./user'''&lt;br /&gt;
&lt;br /&gt;
Highlight output.&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; clear&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type''' gcc space hyphen c space user dot c'''&lt;br /&gt;
&lt;br /&gt;
Type '''gcc space hyphen o space user space user dot o'''&lt;br /&gt;
&lt;br /&gt;
To execute the program type '''dot slash user.'''&lt;br /&gt;
&lt;br /&gt;
The output shows that the device file opened and closed successfully.&lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type &amp;gt;&amp;gt; '''dmesg | grep simple_driver'''&lt;br /&gt;
&lt;br /&gt;
Highlight the''' output'''&lt;br /&gt;
&lt;br /&gt;
Highlight '''printk '''message.&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt; '''clear'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Let’s see the '''printk '''messages from the''' open function''' of a '''driver.'''&lt;br /&gt;
&lt;br /&gt;
Type '''dmesg space pipe space grep space simple_driver.'''&lt;br /&gt;
&lt;br /&gt;
This''' '''message shows the''' IITB string''' is stored in the allocated''' kernels''' memory. &lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Type''' rmmod simple_driver'''&lt;br /&gt;
&lt;br /&gt;
'''.ko'''&lt;br /&gt;
&lt;br /&gt;
Type '''dmesg | grep simple_driver'''&lt;br /&gt;
&lt;br /&gt;
Highlight the '''message'''&lt;br /&gt;
&lt;br /&gt;
Type &amp;gt;&amp;gt;''' clear'''&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Now lets unload the '''driver.'''&lt;br /&gt;
&lt;br /&gt;
Type '''rmmod space simple_driver'''&lt;br /&gt;
&lt;br /&gt;
'''dot ko'''&lt;br /&gt;
&lt;br /&gt;
To see the unloaded '''printk '''messages type this '''dmesg '''command.&lt;br /&gt;
&lt;br /&gt;
This message indicates that the '''kfree() function''' releases the memory.&lt;br /&gt;
&lt;br /&gt;
Clear the screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| &lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| With this, we come to the end of this tutorial. Let us summarise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Summary:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| In this tutorial, we learnt how to&lt;br /&gt;
&lt;br /&gt;
* Dynamically allocate the kernel memory using '''kmalloc() function '''and&lt;br /&gt;
* '''kfree() function''' to free the memory allocated by '''kmalloc().'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Assignment : &lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| As an assignment:&lt;br /&gt;
&lt;br /&gt;
# Open the '''simple_driver.c file'''&lt;br /&gt;
# Allocate the memory space using '''kmalloc''' in the '''driver''' as per your choice&lt;br /&gt;
# Store a different data to the '''kernel buffer'''&lt;br /&gt;
# Load the '''driver''' and then execute the '''user program'''&lt;br /&gt;
# See the output using '''dmesg''' command and then unload the '''driver'''.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
About Spoken Tutorial Project:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * The video at the following link summarizes the Spoken Tutorial project.&lt;br /&gt;
&lt;br /&gt;
* Please download and watch it.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Spoken Tutorial workshops :&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| The''' Spoken Tutorial Project''' Team:&lt;br /&gt;
&lt;br /&gt;
* conducts workshops and&lt;br /&gt;
* gives certificates.&lt;br /&gt;
&lt;br /&gt;
For more details, please write to us.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Forum questions :&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * Please post your timed queries in this forum&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Forum for specific questions :&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| * Do you have any general or technical questions on Embedded Linux Device Driver?&lt;br /&gt;
* Please visit the FOSSEE forum and post your question.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Acknowledgment:&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| The Spoken Tutorial Project is funded by MHRD, Government of India.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| Slide :&lt;br /&gt;
&lt;br /&gt;
Thank you slide:&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border:1pt solid #000000;padding:0.176cm;&amp;quot;| This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay. &lt;br /&gt;
&lt;br /&gt;
This is Mayuri Panchakshari signing off.&lt;br /&gt;
Thanks for watching.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Nirmala Venkat</name></author>	</entry>

	</feed>