<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Masoud Rahimi</title>
    <description>The latest articles on DEV Community by Masoud Rahimi (@masoudr).</description>
    <link>https://dev.to/masoudr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F333154%2Fa7ef253d-453c-4efe-801d-5d1eb6c42038.png</url>
      <title>DEV Community: Masoud Rahimi</title>
      <link>https://dev.to/masoudr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masoudr"/>
    <language>en</language>
    <item>
      <title>Build and Debug C++ Application with VSCode and MSVC</title>
      <dc:creator>Masoud Rahimi</dc:creator>
      <pubDate>Tue, 15 Sep 2020 13:40:13 +0000</pubDate>
      <link>https://dev.to/masoudr/build-and-debug-c-application-with-vscode-and-msvc-pfc</link>
      <guid>https://dev.to/masoudr/build-and-debug-c-application-with-vscode-and-msvc-pfc</guid>
      <description>&lt;p&gt;Using VSCode as your main development IDE is quite interesting as it offers many features with the support of most programming languages.&lt;br&gt;
To develop C/C++ applications you need to have a separate compiler installed, you can either use &lt;a href="http://www.mingw.org/"&gt;MinGW&lt;/a&gt; or Microsoft Visual C++ compiler. In this tutorial, I'm giving you a brief tutorial about using VSCode to develop C/C++ applications with MSVC on Windows.&lt;/p&gt;

&lt;p&gt;There is an official &lt;a href="https://code.visualstudio.com/docs/cpp/config-msvc"&gt;tutorial&lt;/a&gt; about setting the environment but it may be unclear in some parts (e.g. it force you to use Development Command Prompt each time you open up VSCode). So I'm adding an alternative for those parts and create a custom build configuration.&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Download and install VSCode from the official &lt;a href="https://code.visualstudio.com/download"&gt;website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install Microsoft Visual C++ toolset. You can use Visual Studio Installer and select &lt;code&gt;C++ build tools&lt;/code&gt;. To verify the installation open up Developer Command Prompt from the Start menu and check the &lt;code&gt;cl.exe&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;Install C/C++ extension for VSCode from &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Setup instructions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a directory for your project and put the required files in it. Then open the directory with VSCode. You can either use the command &lt;code&gt;code .&lt;/code&gt; in terminal or right-click inside the folder and choose &lt;code&gt;open with Code&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a simple hello world C++ file called &lt;code&gt;main.cpp&lt;/code&gt; in the root of the project.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include &amp;lt;iostream&amp;gt;
&lt;/span&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"It Works!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;cin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press F1 or &lt;code&gt;Ctrl+Shift+P&lt;/code&gt; to open Command Palette and choose &lt;code&gt;C/C++ Edit Configurations UI&lt;/code&gt;. This will open up the configuration windows. Choose the &lt;code&gt;Win32&lt;/code&gt; for configuration name and set a proper compiler path. It should automatically set the path for &lt;code&gt;cl.exe&lt;/code&gt; e.g &lt;code&gt;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe&lt;/code&gt;. You can set other options like &lt;code&gt;IntelliSense mode&lt;/code&gt;, &lt;code&gt;Include path&lt;/code&gt; and etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Create an empty &lt;code&gt;settings.json&lt;/code&gt; file in &lt;code&gt;.vscode&lt;/code&gt; directory and add the two parameters for &lt;code&gt;cl.exe&lt;/code&gt; path and build directory path (if the file already exists just add these two values). In this configuration, we are creating a build directory called &lt;code&gt;build&lt;/code&gt; to store the binaries. Also, we create a custom build command called &lt;code&gt;buildCommand&lt;/code&gt; to execute &lt;code&gt;cl.exe&lt;/code&gt; from the VS Command Prompt.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceRoot}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildCommand"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;Program^ Files^ ^(x86^)&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;Microsoft^ Visual^ Studio&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;2019&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;Enterprise&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;Common7&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;Tools&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;VsDevCmd.bat &amp;amp;&amp;amp; cl"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;We would be able to use these variables in other config files with &lt;code&gt;${config:&amp;lt;ConfigName&amp;gt;}&lt;/code&gt; syntax.&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Next, We are going to create a &lt;code&gt;tasks.json&lt;/code&gt; file and create a task for our build. Create the &lt;code&gt;tasks.json&lt;/code&gt; inside &lt;code&gt;.vscode&lt;/code&gt; directory and fill it like below:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Set dependencies for build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"if not exist ${config:buildDir} mkdir ${config:buildDir}"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C/C++: cl.exe build active file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${config:buildCommand}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/Zi"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/EHsc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/Fe:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"${config:buildDir}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;${fileBasenameNoExtension}.exe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/Fo${config:buildDir}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/Fd${config:buildDir}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"${file}"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"cwd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolder}"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"problemMatcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"$msCompile"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"isDefault"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"dependsOn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"Set dependencies for build"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The arguments for &lt;code&gt;cl.exe&lt;/code&gt; are quite standard but if you want to add more options you can add them in the &lt;code&gt;args&lt;/code&gt; section.&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To verify the installation run the build task with &lt;code&gt;Ctrl+Shift+B&lt;/code&gt;. This will create the &lt;code&gt;build&lt;/code&gt; directory and put the output.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;To debug your application create a &lt;code&gt;launch.json&lt;/code&gt; file in &lt;code&gt;.vscode&lt;/code&gt; a directory like below:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cl.exe - Build and debug active file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cppvsdbg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"launch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"program"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${config:buildDir}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;${fileBasenameNoExtension}.exe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"stopAtEntry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"cwd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${env:buildDir}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"environment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"externalConsole"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"preLaunchTask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C/C++: cl.exe build active file"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This is a default configuration and I already change the &lt;code&gt;program&lt;/code&gt; path. I also add a &lt;code&gt;preLaunchTask&lt;/code&gt; to rebuild the project before launching the debug session.&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating the debug configuration you can put your breakpoints and launch the debug session with F5.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;All resource files can be accessed from my GitHub &lt;a href="https://github.com/masoudr/vscode-cpp-development.git"&gt;repository&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Setup Docker with Windows Terminal and Oh My ZSH</title>
      <dc:creator>Masoud Rahimi</dc:creator>
      <pubDate>Thu, 02 Jul 2020 21:05:13 +0000</pubDate>
      <link>https://dev.to/masoudr/setup-docker-with-windows-terminal-and-oh-my-zsh-29j5</link>
      <guid>https://dev.to/masoudr/setup-docker-with-windows-terminal-and-oh-my-zsh-29j5</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kToYl-bC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/imog8nvcz1a1ppuu2qn1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kToYl-bC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/imog8nvcz1a1ppuu2qn1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you might know, playing with Docker in Windows is quite interesting as it gives you the ability to play with both Linux and Windows containers.&lt;br&gt;
For newcomers to Docker, it may become frustrating to play with the Docker command line because of using Windows Command Prompt or PowerShell as both have not a quite user-friendly terminal and they don't support autocompletion of Docker commands.&lt;br&gt;
I'm giving a brief tutorial to set up Docker to use the new Windows terminal and your favorite Linux distribution to create a nice terminal environment for play with Docker Desktop. I also added the Zsh shell for making it more functional and handy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Windows 10 with the latest build 2004.&lt;/li&gt;
&lt;li&gt;Install WSL2 and a Linux Distribution (I've used Ubuntu 20.04 LTS) You can follow the &lt;a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10"&gt;official docs&lt;/a&gt; for installation.
Don't forget to execute &lt;code&gt;wsl --set-version &amp;lt;distribution name&amp;gt; 2&lt;/code&gt; to set WSL 2 for your Linux distribution.&lt;/li&gt;
&lt;li&gt;Install Windows Terminal (Not the preview version) from &lt;a href="https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab"&gt;Microsoft Store&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install Powerline font for Windows along with Cascadia Code monospaced font to support Unicode symbols of Oh my ZSH.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Grab the Cascadia Code font from its Github &lt;a href="https://github.com/microsoft/cascadia-code/releases"&gt;release page&lt;/a&gt; and install it like regular fonts.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the Windows Terminal and choose settings. Then it will pop up the &lt;code&gt;settings.json&lt;/code&gt; file in your default IDE. I recommend you to use VSCode as it gives you the autocompletion of settings parameters. In the &lt;code&gt;list&lt;/code&gt; section you will see each terminal configuration. We will use the Linux Distro (Ubuntu-20.04 for me) to apply the specific settings. You may also add your custom parameters to the &lt;code&gt;defaults&lt;/code&gt; section to apply to all existing terminals.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Grab your favorite Windows Terminal theme for &lt;a href="https://atomcorp.github.io/themes/"&gt;here&lt;/a&gt; and it will copy the json configuration to your clipboard. Then paste it into the &lt;code&gt;schemes&lt;/code&gt; of the configuration file. Finally add &lt;code&gt;"colorScheme": "&amp;lt;YourThemeName&amp;gt;"&lt;/code&gt; to the terminal profile section.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can also add your favorite background image to the background of the terminal. Just copy your image (either jpg, png, or gif) to this path &lt;code&gt;%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState&lt;/code&gt; then add below settings to the configuration. You can find more info about these parameters in &lt;a href="https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-settings#background-image-settings"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImage"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ms-appdata:///local/&amp;lt;YourImageName&amp;gt;"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImageOpacity"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImageStretchMode"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fill"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Your final configuration file would look something like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://aka.ms/terminal-profiles-schema"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"defaultProfile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{SomeGUID}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"copyOnSelect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"copyFormatting"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nl"&gt;"profiles"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"defaults"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"cursorShape"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vintage"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"fontFace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Cascadia Code PL"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"list"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"guid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{SomeGUID}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"hidden"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ubuntu-20.04"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Windows.Terminal.Wsl"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImage"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ms-appdata:///local/background.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImageOpacity"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"backgroundImageStretchMode"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fill"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"colorScheme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"3024 Day"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="err"&gt;//...&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nl"&gt;"schemes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"3024 Day"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"black"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#090300"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="err"&gt;//...&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your Linux distro IDE in Windows Terminal and install Docker as usual. You can follow the &lt;a href="https://docs.docker.com/engine/install/"&gt;official docs&lt;/a&gt;. During the installation it may ask about installing GRUB you can just skip it. You may see an error after installing Docker, this is because Docker can't run on a separate daemon so open your Docker Desktop settings, navigate to &lt;code&gt;Resources &amp;gt; WSL INTEGRATION&lt;/code&gt; and enable the integration for your Linux distro.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install Zsh and Oh my Zsh.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt install -y git fonts-powerline zsh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;After installation, the wizard would ask you to set zsh as your default shell, so accept it.&lt;/li&gt;
&lt;li&gt;Edit the &lt;code&gt;~/.zshrc&lt;/code&gt; file and set the proper theme for your zsh.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight conf"&gt;&lt;code&gt;    &lt;span class="n"&gt;ZSH_THEME&lt;/span&gt;=&lt;span class="s2"&gt;"agnoster"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Restart the terminal and you should see the new shell applied. Remember that the Docker on your Linux distro will use your Docker host daemon so the data like images, containers, and volumes would save on your host.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Contribution
&lt;/h2&gt;

&lt;p&gt;The project source code can be found in my &lt;a href="https://github.com/masoudr/docker-windows-terminal"&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>windowsterminal</category>
    </item>
    <item>
      <title>Create embedded Linux images with Docker from scratch</title>
      <dc:creator>Masoud Rahimi</dc:creator>
      <pubDate>Fri, 10 Apr 2020 08:03:48 +0000</pubDate>
      <link>https://dev.to/masoudr/create-embedded-linux-image-from-scratch-18d4</link>
      <guid>https://dev.to/masoudr/create-embedded-linux-image-from-scratch-18d4</guid>
      <description>&lt;p&gt;Embedded Linux systems are so common these days and they can be found in set-top boxes, smart TVs, network devices (like routers, 3G/4G USB modems), etc. For the developers, a major concern with these systems is to create their own custom Linux distribution based on their needs. This includes creating the image for the development or the final product. Making the image usually consists of compiling the Linux kernel, device tree binaries, compiling bootloader, and customizing the Linux file system. These steps may become frustrating if you want to test something or trying to rebuild the image over and over. On the other side creating the environment for cross-compiling is a little complicated as you need to set a special environment for the ARM toolchain.&lt;/p&gt;

&lt;p&gt;There are many automated tools to achieve this like &lt;a href="https://buildroot.org/"&gt;Buildroot&lt;/a&gt; and &lt;a href="https://www.yoctoproject.org/"&gt;Yocto Project&lt;/a&gt;. They usually give you a minimal version of the Linux image and are a good choice for the final image that intended to use in the production environment, but for the development environment, they are not always the best choice because of lacking package manager or external tools.&lt;br&gt;
Another choice is to create your own custom Linux image by compiling the kernel, bootloader, file system, and finally bring them all together and put it into the device SD card or flash storage. With the &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt;, you can do this very straight forward and you don't need to mess around with your host. Moreover, it can be used even on Mac or Windows machines.&lt;/p&gt;

&lt;p&gt;I created a simple Docker project to achieve this. It can be customized to use with any embedded Linux board and can be developed easily. I've tested it with &lt;a href="https://beagleboard.org/black"&gt;BeagleBone Black&lt;/a&gt; but with a little change can be used on other educational development boards like &lt;a href="https://www.raspberrypi.org/"&gt;Raspberry Pi&lt;/a&gt;, &lt;a href="http://nanopi.io/"&gt;Nano Pi&lt;/a&gt;, etc. You can also use it on your own customized embedded Linux board but you need to provide your configuration file for the kernel or bootloader.&lt;br&gt;
All you need to do is to provide the resource binaries for Linux kernel, Bootloader, and filesystem then start the build with a single command &lt;code&gt;docker-compose up&lt;/code&gt;. The output is a standard image file that can be written on the SD card easily. Also, it uses Linaro toolchain for cross-compilation so it is fast and reliable.&lt;/p&gt;

&lt;p&gt;Although the use of the project is quite easy and straight forward I've made a step by step guide. So let's go into details and how to set it up.&lt;/p&gt;

&lt;p&gt;To use this project there is no need to set up any special environment or meet any special requirements.&lt;br&gt;
I've used BeagleBone Black as the target system with Ubuntu 18.04 and Ti's Linux Kernel 4.19.94.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Based on Docker so can be run on any machine without any requirements.&lt;/li&gt;
&lt;li&gt;Build Kernel, DTS, modules, and headers from scratch.&lt;/li&gt;
&lt;li&gt;Build Bootloader (u-boot) from the source.&lt;/li&gt;
&lt;li&gt;Can be combined with any Linux distro filesystem.&lt;/li&gt;
&lt;li&gt;Create image file (.img) as output file for easy writing to SD card.&lt;/li&gt;
&lt;li&gt;High-speed build with help of using Linaro toolchain and Docker engine.&lt;/li&gt;
&lt;li&gt;Can be used with any Embedded Linux system with little configuration change.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/install/"&gt;Docker&lt;/a&gt; and &lt;a href="https://docs.docker.com/compose/install/"&gt;Docker Compose&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Download resource files and put them in &lt;code&gt;resources&lt;/code&gt; directory:

&lt;ul&gt;
&lt;li&gt;Linaro cross compile toolchain.&lt;/li&gt;
&lt;li&gt;You can get the binaries from &lt;a href="https://www.linaro.org/downloads/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Linux Kernel source for your board.&lt;/li&gt;
&lt;li&gt;For BeagleBone Black you can use the official &lt;a href="https://github.com/beagleboard/linux"&gt;kernel&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;u-boot &lt;a href="https://github.com/u-boot/u-boot"&gt;source code&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;A base rootfs Linux distro.&lt;/li&gt;
&lt;li&gt;You can grab Ubuntu or Debian distro from &lt;a href="https://rcn-ee.com/rootfs/eewiki/minfs/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-18.04.3-minimal-armhf-2020-02-10.tar.xz"&gt;Ubuntu 18.04.3&lt;/a&gt; used in this project.&lt;/li&gt;
&lt;li&gt;As the compile process may take longer, you need to increase the Docker engine resources:&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/docker-for-windows/#advanced#resources"&gt;Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/docker-for-mac/#memory#resources"&gt;Mac&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Make sure that you meet the requirements and put the necessary files into the &lt;code&gt;resources&lt;/code&gt; directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  project
  └───resources
  │   │   armhf-rootfs-ubuntu-bionic.tar
  │   │   gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar
  │   │   linux-4.19.94-ti-rt-r41.tar.gz
  │   │   u-boot-2020.04-rc3.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure that you decompress the Linux rootfs to get the right compressed file. The files that contain all the Linux rootfs inside its root directory (e.g. &lt;code&gt;armhf-rootfs-ubuntu-bionic.tar&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set the Dockerfile parameters in &lt;code&gt;docker-compose.yml&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;kernel_version&lt;/code&gt;: kernel version in X.Y.Z format&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kernel_filename&lt;/code&gt;: kernel source file path&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kernel_defconfig&lt;/code&gt;: kernel configuration file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;uboot_filename&lt;/code&gt;: u-boot source file path&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;uboot_defconfig&lt;/code&gt;: u-boot configuration file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rootfs_filename&lt;/code&gt;: Linux Root file system path&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linaro_filename&lt;/code&gt;: Linaro toolchain file path&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bring up the console and navigate to project root directory and execute &lt;code&gt;docker-compose up --build&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the process complete successfully you should get the image file &lt;code&gt;sd_image.img&lt;/code&gt; in the &lt;code&gt;output&lt;/code&gt; directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Contribution
&lt;/h2&gt;

&lt;p&gt;Project source code can be found &lt;a href="https://github.com/masoudr/embedded-linux-image-builder"&gt;here&lt;/a&gt;. Reporting any bugs or suggestions for improvement would be appreciated. &lt;/p&gt;

</description>
      <category>linux</category>
      <category>embedded</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
