tag:blogger.com,1999:blog-29472458484055132252024-02-19T06:54:41.397-08:00hackgnarRyan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-2947245848405513225.post-63898283220917328732018-06-07T19:44:00.000-07:002018-06-18T12:10:47.276-07:00Learning Bluetooth Hackery with BLE CTF<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px}
span.s1 {color: #e4af0a}
</style>
<br />
<div class="p1">
Do you want to get into tinkering and hacking Bluetooth LE devices?<span class="Apple-converted-space"> </span>Up until now, doing so was very much a DIY process.<span class="Apple-converted-space"> </span>You would have to find relevant documentation or videos, and then find various BLE devices to test on.<span class="Apple-converted-space"> </span>In order to make this learning process easier, I created a <a href="https://github.com/hackgnar/ble_ctf">Bleutooth LE CTF, named BLECTF</a>, which aims to teach the fundamentals of BLE connections, interactions, and hacking.</div>
<div class="p2">
<br /></div>
<div class="p1">
At its core, the CTF focuses on teaching BLE GATT service connection fundamentals.<span class="Apple-converted-space"> </span>The CTF runs a BLE GATT server on an ESP32 device with 20 flag based challenges.<span class="Apple-converted-space"> </span>Each challenge focuses on teaching different BLE functionality you would typically see in the wild.<span class="Apple-converted-space"> </span>Adventurous individuals who complete all 20 flags will obtain the skills needed to start exploring all things BLE in the world!</div>
<div class="p2">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw89zjWGsLZmjbWbPTVLw2-ogXDYRlzKP6KHF7Tj8bXy6OZPiGdJqmVlTKkfSlSFtWSbAXE3iY7YHcH3AhVU-9FsnFFjxgfLkxWK64hq6B3h7MogK9s6cMYZAQNHgw_sITaQkeaQ74fSM/s1600/download.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrJBuCC3q1Ov2bPBtWg2j7ZhFFmZ0DfmnbvJUJvQ6tNWbw5UOVrF0UtH3vub7yykrj7jNymH5T9UQZ09wQ-mihh1_XHNT0Td994z24vYDxL3mkKCydeu1vNGC_nPSV-LjKi2xSE0VsYzs/s1600/Screen+Shot+2018-06-07+at+7.17.49+PM.png" imageanchor="1"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrJBuCC3q1Ov2bPBtWg2j7ZhFFmZ0DfmnbvJUJvQ6tNWbw5UOVrF0UtH3vub7yykrj7jNymH5T9UQZ09wQ-mihh1_XHNT0Td994z24vYDxL3mkKCydeu1vNGC_nPSV-LjKi2xSE0VsYzs/s320/Screen+Shot+2018-06-07+at+7.17.49+PM.png" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw89zjWGsLZmjbWbPTVLw2-ogXDYRlzKP6KHF7Tj8bXy6OZPiGdJqmVlTKkfSlSFtWSbAXE3iY7YHcH3AhVU-9FsnFFjxgfLkxWK64hq6B3h7MogK9s6cMYZAQNHgw_sITaQkeaQ74fSM/s1600/download.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="225" data-original-width="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw89zjWGsLZmjbWbPTVLw2-ogXDYRlzKP6KHF7Tj8bXy6OZPiGdJqmVlTKkfSlSFtWSbAXE3iY7YHcH3AhVU-9FsnFFjxgfLkxWK64hq6B3h7MogK9s6cMYZAQNHgw_sITaQkeaQ74fSM/s1600/download.jpg" /></a></div>
</div>
<a name='more'></a><hr />
<div class="p1">
<br />
In order to get started, you will need a couple of things.<span class="Apple-converted-space"> </span>First, you have to obtain some hardware to run the CTF.<span class="Apple-converted-space"> </span>It runs on the ESP32 chipset and they can be found for <a href="https://www.amazon.com/Xiuxin-Development-Dual-Mode-Bluetooth-Antenna/dp/B079PVCF2G/ref=sr_1_1_sspa?ie=UTF8&qid=1528414752&sr=8-1-spons&keywords=esp32&psc=1">roughly $10 on amazon</a>.<span class="Apple-converted-space"> </span>If you want to skip all of the setup, <a href="https://www.ebay.com/itm/173370426012?ssPageName=STRK:MESELX:IT&_trksid=p3984.m1558.l2649">I sell them pre-flashed with the CTF for $20 here</a> or you can trade me cash/beers at DEFCON/Blackhat. I will be presenting the project at <a href="https://www.blackhat.com/us-18/arsenal/schedule/index.html#ble-ctf-project-12104">Blackhat Arsenal</a> (and likely other locations in Las Vegas this year).<span class="Apple-converted-space"> </span>Second, you will need a laptop with a bluetooth device capable of connecting to the CTF.<span class="Apple-converted-space"> </span>Some laptops come with embedded bluetooth devices which you can use.<span class="Apple-converted-space"> </span>However depending on the chipset or operating system, you may not be able to use these devices to connect to the CTF.<span class="Apple-converted-space"> </span>I prefer to use <a href="https://www.amazon.com/Sena-UD100-Bluetooth-Class1-Adapter/dp/B01BHD7WR2/ref=cm_cr_arp_d_product_top?ie=UTF8">SENA’s Bluetooth USB dongle</a> as it has an amazing range and is compatible with Linux and the Bluez Bluetooth stack.<span class="Apple-converted-space"> </span>Third, you will need an operating system and tools to interact with your laptops bluetooth device or USB dongle to connect to the CTF.<span class="Apple-converted-space"> </span>I prefer to use Linux for this as tools like gatttool and bleah run without issues.<span class="Apple-converted-space"> </span>If you are running windows or OSX, I would recommend that you just install a Linux VM and do you bluetooth hacking though the VM with a USB bluetooth device (vagrant is amazing for this).</div>
<div class="p2">
<br /></div>
<div class="p1">
Setting up the CTF is fairly easy.<span class="Apple-converted-space"> </span>As I mentioned above, you can skip this if you purchase the ESP32 pre-flashed.<span class="Apple-converted-space"> </span>However if you want to save some cash or learn the process yourself, you can follow the setup steps located <a href="https://github.com/hackgnar/ble_ctf/blob/master/docs/setup.md">here</a>.</div>
<div class="p2">
<br /></div>
<div class="p1">
Now, lets get started!<span class="Apple-converted-space"> </span>Im not going to spoil the CTF too much here!<span class="Apple-converted-space"> </span>I'll just give you a taste and help you get started!<span class="Apple-converted-space"> </span>The next few sections assume you are all setup with a CTF server running on an ESP32 and have a Linux box with blues-tools and bleah installed.</div>
<div class="p2">
<br /></div>
<div class="p1">
In order to hack the things, you must find them first.<span class="Apple-converted-space"> </span>Lets run the following command to find the BT address of the CTF device:<br />
<br />
<script src="https://gist.github.com/hackgnar/19bea5af1f0ae73fee63a575b6427156.js"></script>
<br />
<div class="p1">
Now, lets use bleah to enumerate all of its handles and characteristics.</div>
<div class="p2">
<br /></div>
<div class="p1">
<script src="https://gist.github.com/hackgnar/056ddae1f5c8e85078f5641b8b1bdb8c.js"></script>
</div>
<div class="p1">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2tqFZfZXzMTinpllHgZ1x-e2qP9jmoRpi2w3-TwfZKP7lhJhfWIvuyVDouWqUoomedCpip6HySsEEZTd8vyv7XioU8e5JhferdaAhq5b0HRMZQ8zPOj3cLdldMBqGPBq-5ZBWvWkbwTw/s1600/Screen+Shot+2018-06-07+at+7.17.49+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1012" data-original-width="1600" height="403" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2tqFZfZXzMTinpllHgZ1x-e2qP9jmoRpi2w3-TwfZKP7lhJhfWIvuyVDouWqUoomedCpip6HySsEEZTd8vyv7XioU8e5JhferdaAhq5b0HRMZQ8zPOj3cLdldMBqGPBq-5ZBWvWkbwTw/s640/Screen+Shot+2018-06-07+at+7.17.49+PM.png" width="640" /></a></div>
<br />
There are a few things to take note of here.<span class="Apple-converted-space"> </span>The first is handle 0x002a which shows your CTF score.<span class="Apple-converted-space"> </span>As you find and submit flags, this score will update accordingly.<span class="Apple-converted-space"> </span>The second tidbit to notice here is handle 0x002c.<span class="Apple-converted-space"> </span>This handle will be the one you interact with the most as it is where you will be submitting flags once you find them.</div>
<div class="p2">
<br /></div>
<div class="p1">
Now, lets find ourselves an easy flag and submit it.<span class="Apple-converted-space"> </span>The easiest one to find is one that is not even given to you by the CTF server.<span class="Apple-converted-space"> </span>It is obtained by reading <a href="https://github.com/hackgnar/ble_ctf">the documentation for the project here</a>.<span class="Apple-converted-space"> </span>If you look in the hints section, you will see that Flag #1 can only be obtained from reading <a href="https://github.com/hackgnar/ble_ctf/blob/master/docs/hints/flag1.md">this flag hint section of the documentation</a>. </div>
<div class="p2">
<br /></div>
<div class="p1">
Lets submit it!<span class="Apple-converted-space"> </span>You can use gatttool or bleah to do this, but lets follow the docs and use gatttool here.<span class="Apple-converted-space"> </span>Keep in mind, while bleah is super cool, it won’t get you through the whole CTF.<span class="Apple-converted-space"> </span>You will have to use tools like gatttool on a lot of the flags.</div>
<div class="p2">
<br /></div>
<div class="p1">
Submit it with the following:</div>
<div class="p1">
<script src="https://gist.github.com/hackgnar/56f69dfb1873516677e4f08d197cc7fc.js"></script></div>
<div class="p2">
<br /></div>
<div class="p1">
Now, lets check our score to see that it registered:</div>
<div class="p1">
<script src="https://gist.github.com/hackgnar/4f6d8d7a1c82eadf3dc041a838ffb64b.js"></script></div>
<div class="p2">
<br /></div>
<div class="p1">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg96slUS1CbhvUUhTLswuibFSaHAyhwz_ZoSZo2bnKOf4B0yP1PrpKwq5Jizzm2njeflVUdMnvsV7EM11S02qghke0zLDZqXDv1w3b4V7NKEb8rik_Hl7y6ioY-wVAhQ7BgefGyqxkhxM4/s1600/Screen+Shot+2018-06-07+at+7.22.03+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="65" data-original-width="1600" height="24" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg96slUS1CbhvUUhTLswuibFSaHAyhwz_ZoSZo2bnKOf4B0yP1PrpKwq5Jizzm2njeflVUdMnvsV7EM11S02qghke0zLDZqXDv1w3b4V7NKEb8rik_Hl7y6ioY-wVAhQ7BgefGyqxkhxM4/s640/Screen+Shot+2018-06-07+at+7.22.03+PM.png" width="640" /></a></div>
<br />
Thats it!<span class="Apple-converted-space"> </span>I've told you a bit about the project and helped you on your first flag.<span class="Apple-converted-space"> </span>Now, go forth and “responsibly”hack all the Bluetooths! <span class="Apple-converted-space"> </span></div>
<br /></div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-86452197225681468172016-02-23T14:59:00.000-08:002016-02-23T14:59:05.826-08:00Building Kali Linux for Intel Edison<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This documentation goes though the process of manually building a base Kali Linux image for the Intel Edison board. These steps were derived from frankensteining the <a href="http://www.hackgnar.com/2016/02/building-debian-linux-for-intel-edison.html">edison build scripts for Debian Jessie</a> and some of the <a href="https://github.com/offensive-security/kali-arm-build-scripts">Kali Linux ARM build scripts</a>. All of the content from this post can be found in my github repo for this project <a href="https://github.com/hackgnar/kali_intel_edison">here</a>, along with pre compiled images (coming soon!) and ansible scripts for automated building.</p>
<p>Note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.</p>
<p>This post is part of a three part series which will cover all of the following:<br />
1. Manually building and installing Kali Linux for Intel Edison<br />
2. Automatically building Kali Linux for Intel Edison with ansible<br />
3. Downloading and installing precompiled images</p>
<p>This is the first post of the series and will cover the method for manually building Kali Linux images for Intel Edison. Stay tuned for followup posts...</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_rAgtAfqZvINEXOqai24aCZJOrftkqTiCuKR-AT5WeuNzdlgUJy4bz8fuMWAD3K5k3T_TAKrJ11UU-qTYaBp_ZTg2uIbbL6NcAdjv4JQf_ug1KS1IQCg020RFVqZk-v03WCWkR3ZJcIk/s1600/IMG_0812.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_rAgtAfqZvINEXOqai24aCZJOrftkqTiCuKR-AT5WeuNzdlgUJy4bz8fuMWAD3K5k3T_TAKrJ11UU-qTYaBp_ZTg2uIbbL6NcAdjv4JQf_ug1KS1IQCg020RFVqZk-v03WCWkR3ZJcIk/s200/IMG_0812.JPG" /></a></div>
<a name='more'></a>
<hr />
<h3 id="manually-building-kali-linux-from-scratch-for-intel-edison">Manually building Kali Linux from Scratch for Intel Edison</h3>
<p>This method is the most complex of all three methods in this series for getting Kali Linux rolling on your Intel Edison board. However, this method provides the most flexibility for customization. If you are new to Intel Edison or building Linux distros, you may want to check out the follow up posts in this series (coming soon) as they are quicker and easier methods for getting Kali Linux on your Edison board.</p>
<h4 id="install-build-dependancies">Install Build Dependancies</h4>
<ul>
<li><p>Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Kali image.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get update
<span class="kw">sudo</span> apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib debootstrap u-boot-tools debian-archive-keyring dfu-util screen</code></pre></div></li>
</ul>
<h4 id="create-a-directory-for-building-the-image">Create a Directory for Building the Image</h4>
<ul>
<li><p>This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p ~/src/edison
<span class="kw">cd</span> ~/src/edison</code></pre></div></li>
</ul>
<h4 id="download-the-latest-edison-source-package">Download the Latest Edison Source Package</h4>
<ul>
<li><p>The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the source package downloads on <a href="https://software.intel.com/en-us/iot/hardware/edison/downloads">this page</a>.</p></li>
<li><p>Download the latest "Linux source files" on the page listed above. As of this documentation, the link was <a href="http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz">"Linux source files"</a>.</p></li>
<li><p>If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h4 id="uncompress-the-source-files">Uncompress the Source Files</h4>
<ul>
<li><p>If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">tar</span> xfvz edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h4 id="download-the-kali-linux-build-scripts">Download the Kali Linux Build Scripts</h4>
<ul>
<li><p>This step pulls my custom build scripts for the Intel Edison Kali Linux along with the Kali Linux debootstrap files you will need later on to build the base distro image.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">git</span> clone https://github.com/hackgnar/kali_intel_edison.git </code></pre></div></li>
</ul>
<h4 id="copy-the-kali-build-files-to-the-proper-locations">Copy the Kali build files to the proper locations</h4>
<ul>
<li><p>Before we get building, we need to copy some files from the git repo we just cloned to the proper locations.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cp</span> ./kali_intel_edison/build_script/create-kali-image.sh ./edison-src/meta-intel-edison/utils/create-kali-image.sh
<span class="kw">chmod</span> 755 ./edison-src/meta-intel-edison/utils/create-kali-image.sh
<span class="kw">sudo</span> cp ./kali_intel_edison/debootstrap_scripts/kali-rolling /usr/share/debootstrap/scripts/kali-rolling
<span class="kw">sudo</span> chmod 644 /usr/share/debootstrap/scripts/kali-rolling
<span class="kw">sudo</span> chown root:root /usr/share/debootstrap/scripts/kali-rolling</code></pre></div></li>
</ul>
<h4 id="edit-the-stock-edison-image-root-file-system-size">Edit the Stock Edison Image Root File System Size</h4>
<ul>
<li>This step is necisarry to make the root filesystem on the image you will build in later steps larger.</li>
<li><p>If you do not do this step, you will run out of space pretty quickly when installing applications in Kali Linux.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sed</span> -i -e <span class="st">'s/524288/1400000/'</span> ~/src/edison/edison-src/meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image.bb</code></pre></div></li>
</ul>
<h4 id="optional-speed-up-the-build-with-parallelization">(Optional) Speed Up The Build With Parallelization</h4>
<ul>
<li><p>Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling the build scripts to build using parallelization. By default, the Edison build configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.</p></li>
<li><p>Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build an image from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both <code>parallel_make</code> and <code>bb_number_thread</code> to a value of 40.</p>
<pre><code>export SETUP_ARGS="--parallel_make=8 --bb_number_thread=8"</code></pre></li>
</ul>
<h4 id="initialize-the-build-environment">Initialize the Build Environment</h4>
<ul>
<li><p>The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> edison-src
<span class="kw">make</span> setup</code></pre></div></li>
</ul>
<h4 id="build-the-base-edison-image-and-debian-package-dependancies">Build the Base Edison Image and Debian Package Dependancies</h4>
<ul>
<li>As Kali Linux is a Debian based system, we need this step to create the deb packages we will install to our Kali Image. It will not actually create a Debian image. It only creates the base edison image and deb packages we will need in later steps.</li>
<li>When this build process completes, ignore any output telling you to run the script <code>create-debian-image.sh</code>. That script is for building Debian images. We are simply going to replace that step with the custom <code>create-kali-image.sh</code> script.</li>
<li><p>Note, this step can take a very long time. When you are ready to kick off the build, run the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> debian_image</code></pre></div></li>
</ul>
<h4 id="build-the-kali-linux-image">Build the Kali Linux Image</h4>
<ul>
<li>This step will build the base Kali linux image from the custom <code>create-kali-image.sh</code> script. Once complete, your image will be in <code>~/src/edison/edison-src/out/current/build/toFlash</code>.</li>
<li><p>I do a lot of builds on high CPU ec2 images, so I find it useful to tar up the <code>toFlash</code> directory once this step is complete. I can then transfer the contents of toFlash to the actual system I use to flash my edison. When doing this, I dont use the directions in the following step. I simply run the <code>flashall.sh</code> script in the toFlash directory.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> ./meta-intel-edison/utils/create-kali-image.sh --build_dir=./out/current/build</code></pre></div></li>
</ul>
<h4 id="flash-the-kali-image-to-the-edison-board.">Flash the Kali Image to the Edison Board.</h4>
<ul>
<li>If you are customizing you base image filesystem before flashing, you can skip this step and just run <code>./flashall.sh</code> from the toFlash directory as you do in the manual Yacto build process.</li>
<li><p>Once the image is built, you can install it to the Edison board by running the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> flash</code></pre></div></li>
</ul>
<h4 id="logging-into-your-kali-image">Logging into your Kali Image</h4>
<ul>
<li>You can log into your Kali Image via a terminal just like Edison Yacto or Debian images</li>
<li><p>When logging into your Kali image, the login username and password is set to Username:<code>user</code> Password:<code>edison</code></p>
<pre><code>screen /dev/USBDEVICE 115200</code></pre></li>
</ul>
<h3 id="summary">Summary</h3>
<p>Hopefully this documentation proves useful in building Kali images for your Edison board. I find this method more flexible for customizations. Also note that the base build scripts used in this document are still under development. This however should not affect any of the instructions in this post.</p>
<p>If you are interested in pre built images or easier methods for building, stay tuned for the follow up posts in this series for building via ansible or installing pre built Kali images.</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-90275517818930774762016-02-16T07:37:00.000-08:002016-02-16T07:37:38.222-08:00Building Debian Linux for Intel Edison<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This documentation goes though the process of building a base Debian Linux image via simple make files for the Intel Edison board. The make file method for building Debian images is very similar to my last post for building Yocto images from Intels make file method. The make files provided by Intel in the BSP Edison source package wrap the build process with scripts to make building an extremely simple process.</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGCQ0Ewl6izdAvH4U6KVh-L7NfVUiP4ZyYz3xL_Zs3WLNwMhb5Qtvei0i2Sps2h2I0ZnFWJPy4E801PjWpmq629YGJo_KFjMlv8Lyd3Q8CeumbIYdjlV-GixrZxOuf7aJ883chzTOBdOA/s1600/IMG_0656.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGCQ0Ewl6izdAvH4U6KVh-L7NfVUiP4ZyYz3xL_Zs3WLNwMhb5Qtvei0i2Sps2h2I0ZnFWJPy4E801PjWpmq629YGJo_KFjMlv8Lyd3Q8CeumbIYdjlV-GixrZxOuf7aJ883chzTOBdOA/s200/IMG_0656.JPG" /></a></div>
<a name='more'></a>
<p>Most of the base steps found in this documentation were based on Intels Board Support Package (BSP) User Guide. The BSP User Guide can be found <a href="http://www.intel.com/content/www/us/en/support/boards-and-kits/000005616.html">here</a>.</p>
<p>Also note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.</p>
<hr />
<h3 id="create-a-directory-for-building-the-image">Create a Directory for Building the Image</h3>
<ul>
<li><p>This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p ~/src/edison
<span class="kw">cd</span> ~/src/edison</code></pre></div></li>
</ul>
<h3 id="download-the-latest-edison-source-package">Download the Latest Edison Source Package</h3>
<ul>
<li><p>The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the source package downloads on <a href="https://software.intel.com/en-us/iot/hardware/edison/downloads">this page</a>.</p></li>
<li><p>Download the latest "Linux source files" on the page listed above. As of this documentation, the link was <a href="http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz">"Linux source files"</a>.</p></li>
<li><p>If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="uncompress-the-source-files">Uncompress the Source Files</h3>
<ul>
<li><p>If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">tar</span> xfvz edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="install-build-dependancies">Install Build Dependancies</h3>
<ul>
<li><p>Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Debian image.</p></li>
<li><p>Note: There are some extra dependancies here that are not in the Yocto build documentation from my last post</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib debootstrap u-boot-tools debian-archive-keyring dfu-util</code></pre></div></li>
</ul>
<h3 id="optional-speed-up-the-build-with-parallelization">(Optional) Speed Up The Build With Parallelization</h3>
<ul>
<li><p>Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling the build scripts to build using parallelization. By default, the Edison build configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.</p></li>
<li><p>Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build an image from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both <code>parallel_make</code> and <code>bb_number_thread</code> to a value of 40.</p>
<pre><code>export SETUP_ARGS="--parallel_make=8 --bb_number_thread=8"</code></pre></li>
</ul>
<h3 id="initialize-the-build-environment">Initialize the Build Environment</h3>
<ul>
<li><p>The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> edison-src
<span class="kw">make</span> setup</code></pre></div></li>
</ul>
<h3 id="build-the-debian-image">Build the Debian Image</h3>
<ul>
<li><p>Note, this step can take a very long time. When you are ready to kick off the build, run the following:</p></li>
<li><p>This process will build the base Debian image to <code>~/src/edison/edison-src/out/linux64/build/jessie-chroot</code>. The jessie-chroot directory will then be compressed to <code>~/src/edison/edison-src/out/linux64/build/toFlash_debian.tar.gz</code>. Finally, the toFlash_debian.tar.gz file is coppied to <code>~/src/edison/edison-src/out/linux64/built/toFlash/edison-image-edison.ext4</code>. If you want to make any customizations to the file system, the edison-image-edison.ext4 file is where you want to hack before flashing you device.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> debian_image
<span class="kw">sudo</span> ./meta-intel-edison/utils/create-debian-image.sh --build_dir=~/src/edison/edison-src/out/current/build</code></pre></div></li>
</ul>
<h3 id="flash-the-debian-image-to-the-edison-board.">Flash the Debian Image to the Edison Board.</h3>
<ul>
<li><p>Once the image is built, you can install it to the Edison board by running the following:</p></li>
<li><p>If you are customizing you base image filesystem before flashing, you can skip this step and just run <code>./flashall.sh</code> from the toFlash directory as you do in the manual Yacto build process.</p></li>
<li><p>When logging into you Debian image, the login username and password is set to Username:<code>user</code> Password:<code>edison</code></p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> flash</code></pre></div></li>
</ul>
<h3 id="summary">Summary</h3>
<p>Hopefully this documentation proves useful in building Edison Debian images via the simplified make file method. I find this method more flexible for customizations than just installing a standard pre built Debian image for the Edison Board.</p>
</body>
</html>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com1tag:blogger.com,1999:blog-2947245848405513225.post-30524201249181004982016-01-25T12:46:00.000-08:002016-02-11T15:13:07.203-08:00Creating Remote APT Package Repositories on Github<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<h1 id="creating-remote-apt-repos-on-github">Creating remote apt repos on github</h1>
<p>If you read my last blog post, you would know that I am really into deploying applications and systems with deb and rpm packages whenever possible. One of the things you will eventualy want to do, to make deb and rpm package deployment easier, is to create a remote apt or yum repo to host your packages. One of the cooler tricks I have come up with in recent times is creating apt/yum repos in obscure locations.</p>
<p>This aritical will go over how to host an apt repo inside of a git repo on github. This little trick has the following benifits:</p>
<ol style="list-style-type: decimal">
<li>free hosting for you apt repo</li>
<li>publicly availability</li>
<li>provide a single location for source code and packages.</li>
</ol>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhask0YAXd2MLntFzNOIs8rhB0INSvS3CF-rr2Jx5ugBa-da9Q1f0jBoRk8E3K4PHyZzwspbLNzIOH8Cl1j0r82YDjzTMxDXoKLbPm6O00m2jiTSoeOmMiZOAe01-zifGOtLaJFlovmVEs/s1600/IMG_0659.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhask0YAXd2MLntFzNOIs8rhB0INSvS3CF-rr2Jx5ugBa-da9Q1f0jBoRk8E3K4PHyZzwspbLNzIOH8Cl1j0r82YDjzTMxDXoKLbPm6O00m2jiTSoeOmMiZOAe01-zifGOtLaJFlovmVEs/s200/IMG_0659.JPG" /></a></div>
<a name='more'></a>
<p>Yes, I am aware there are free services to host deb and rpm packages, but sometimes, for various reasons, these serices dont fit the bill. While turning github into a remote apt repo is a strange technique, I do find it to be very useful. Keep in mind, you can use this technique on various other free services which you wouldnt expect to funciton as a remote apt repository. Basicly, if you can upload a directory structure and files, you can turn it into an apt or yum repo.</p>
<h3 id="install-dependancies-for-creating-our-repo">Install Dependancies for Creating our Repo</h3>
<ul>
<li>First, on our local system, we need to install some dependancies for creating our apt repo which we will upload to github.</li>
<li><p>For this step, you will need an Debian or Ubuntu system.</p>
<pre><code>sudo apt-get install reprepro</code></pre></li>
</ul>
<h3 id="create-the-repo-directory-stucture">Create the Repo Directory Stucture</h3>
<ul>
<li><p>Feel free to change "myrepo" to whatever you like. If you do, just remember to also do so in consecutive steps.</p>
<pre><code>mkdir -p myrepo/{conf,incoming}</code></pre></li>
</ul>
<h3 id="setup-the-core-apt-repo-config-file">Setup The Core Apt Repo Config File</h3>
<ul>
<li><p>In this step we will create the main config file for our apt repo. There are many cusomization options in this step.</p></li>
<li><p>Suite is typicaly set to either <code>stable</code> or <code>unstable</code></p></li>
<li><p>Codename can be anything you wish but is typicaly set to the short name release version of the Debian or Ubuntu distribution such as <code>wheezy</code>, <code>sid</code>, <code>jessie</code>, <code>lucid</code>, <code>precise</code>, <code>trusty</code>, <code>utopic</code>, <code>vivid</code></p></li>
<li><p>Architecture is typicaly set as one of the following <code>i386</code>, <code>amd64</code> or <code>armel</code></p></li>
<li><p>If you want to include multiple architectures in your repo, just include them on the architeres line but seperate each value with a space</p></li>
<li><p>More advanced documentation on <code>conf/distributions</code> files can be found <a href="http://anonscm.debian.org/cgit/mirrorer/reprepro.git/plain/docs/manual.html">here</a></p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> myrepo
<span class="kw">cat</span> <<EOF >> conf/distributions
Origin: Hackgnar
Label: Hackgnar Github
Suite: stable
Codename: wheezy
Architectures: armel
Components: main
Description: Debian ARM packages hosted on hackgnars github repository
EOF</code></pre></div></li>
</ul>
<h3 id="add-a-deb-package-to-your-apt-repo">Add a deb package to your apt repo</h3>
<ul>
<li>Before we finish up and upload our apt repo to github, we have to add some deb packages to it.</li>
<li><p>Make sure the deb packages you use in the following step are of the same architecture you used in the previous step.</p>
<pre><code>reprepro includedeb wheezy ../my_deb_package.deb</code></pre></li>
<li><p>If you get errors with the above command, try running the following instead:</p>
<pre><code>reprepro -S utils includedeb wheezy ../my_deb_package.deb</code></pre></li>
</ul>
<h3 id="turn-your-apt-repo-into-a-git-repo-and-upload-it">Turn your Apt repo into a git repo and upload it</h3>
<ul>
<li>This step requires that you have create a new git repo on github. If you have not, you can read how to do so <a href="https://help.github.com/articles/create-a-repo/">here</a></li>
<li>Also make sure that you have setup your github ssh keys so you can properly push your repo to github.</li>
<li><p>finally, this example uses <code>git@github.com:hackgnar/myrepo.git</code> but you will replace that with your initialized github repo.</p>
<pre><code>cd ~/src/myrepo
git init
git add -A
git commit -a -m "initial commit"
git remote add origin git@github.com:hackgnar/myrepo.git
git push -u origin master</code></pre></li>
</ul>
<h3 id="optional-connect-a-system-to-your-new-apt-repo-and-install-something">(Optional) Connect a system to your new apt repo and install something:</h3>
<ul>
<li>This step shows you how to connect a new system to your newly created apt repo and install a package from it. Note that we have to install and use `<code>apt-transport-https</code> as a dependancy because apt-get does not support https by default.</li>
<li>make sure to replace <code>hackgnar</code> with the name you use for your github account</li>
<li>make sure to replace <code>myrepo</code> with the name you used for your github repo</li>
<li><p>make sure to replace <code>my-package-name</code> with the name of the deb package you installed into your repo</p>
<pre><code>sudo apt-get install apt-transport-https
cat << EOF >> /etc/apt/sources.list
deb https://raw.githubusercontent.com/hackgnar/myrepo/master main
EOF
sudo apt-get update
sudo apt-get install my-package-name</code></pre></li>
</ul>
<h3 id="summary">Summary</h3>
<p>If you have read this far, hopefully you found this weird tutorial to be useful. While this apt hosting technique may not work for everyone, I have found it to be very handy. Also, keep in mind that there are limitations to this technique. One such example is github file size limitations which will restrict the size of the deb packages you invlude in your repo. Let me know what you think and what other services you find that allow you to host deb packages using this technique.</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com1tag:blogger.com,1999:blog-2947245848405513225.post-13142376597322616922016-01-25T12:42:00.000-08:002016-02-10T12:18:11.386-08:00Simple Deb Package Creation<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<h1 id="building-a-simple-deb-package">Building a Simple Deb Package</h1>
<p>All of the hip kids today are into deploying packages and complex systems with things like Ansible, Docker, Chef, Puppet, Vagrent and Salt Stack. While these deployment tools are awesome, you should not forget about good old fashioned system packages for application deployment. I fully understand there are times when some of these newer deployment tools are a better fit, but, as time goes on, I run across more and more overly complicated and convoluted deployment procedures using these new tools when a simple deb or rpm package could be used. Maybe Im just oldschool, but whenever possible, I prefer to handle application deployment with system packages, such as debs or rpms.</p>
<p>Creating deb packages to deploy applications in Debian or Ubuntu is a fairly simple process. However, I have found that the majority of existing documentation for doing so is overly verbose or more complex than needed. This writeup aims to summaries the process of creating deb packages in just a few simple steps.</p>
<p>Here is a short summary of what this writeup covers:</p>
<ol style="list-style-type: decimal">
<li>How to create a bare bones deb package</li>
<li>How to optionally add package configuration files</li>
<li>How to optionally add package dependancies</li>
<li>How to optionally add package scripts that run before or after installation</li>
</ol>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGq7k0UcqbgzjjZCfNiwG1Lwuf1gT2FZKM_5Pb54qLoAhnKRLklInFTNWwOzqzCY9c-LSbGK3JwiiWHqrDcreXjPDBQc71Jx90WWJmIkytWuJTYWVPpVyvp2Amg1pVttpKGfjObEtgHA/s1600/IMG_0657.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxGq7k0UcqbgzjjZCfNiwG1Lwuf1gT2FZKM_5Pb54qLoAhnKRLklInFTNWwOzqzCY9c-LSbGK3JwiiWHqrDcreXjPDBQc71Jx90WWJmIkytWuJTYWVPpVyvp2Amg1pVttpKGfjObEtgHA/s200/IMG_0657.PNG" /></a></div>
<a name='more'></a>
<hr />
<h3 id="create-a-build-directory">Create a Build Directory</h3>
<ul>
<li><p>The first step is to create a build directory for the deb package.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> ~/package_build_dir
<span class="kw">cd</span> ~/package_build_dir</code></pre></div></li>
</ul>
<h3 id="create-your-base-package-directory">Create Your Base Package Directory</h3>
<ul>
<li><p>Next we will create the base directory that will house our package structure. During the following steps, you will likely want to replace references to "my_package_name" with the actual name of your package.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p my_package_name/DEBIAN</code></pre></div></li>
</ul>
<h3 id="create-the-package-control-configuration-file">Create the Package Control Configuration File</h3>
<ul>
<li><p>The control file is the core configuration file for a deb package. Its main function is to define the package name, architecture, description, version, etc. The config used below is about as bare bones as you can get. If you want to look into other options which you can define in this file, look <a href="https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-controlfile">here</a>.</p></li>
<li><p>Note: I am using <code>cat <<EOF >> filename</code> in the following code snippets. If you would rather create these config files in an editor, just open the filename, cut out the first and last lines (i.e. the lines with EOF in them) and copy the configurations into "filename".</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> my_package_name/DEBIAN/control
Package: my-package-name
Architecture: all
Maintainer: @hackgnar
Priority: optional
Version: 0.1
Description: Some description
EOF</code></pre></div></li>
</ul>
<h3 id="copy-your-binaryservicescriptapplication-into-your-package">Copy Your Binary/Service/Script/Application Into Your Package</h3>
<ul>
<li><p>In this step, we create a simple bash script that prints out "this is my package". This bash script will be included in the deb package we are creating. If you already have an application you want to include in the package, feel free to replace the bash script in this step with your application data.</p></li>
<li><p>Note: if your package includes more than binaries (i.e. libs, configs, etc), you can create a lib or etc directory in your base package directory to house these files. For more info on this, check out the optional steps listed in this tutorial.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p my_package_name/usr/bin
<span class="kw">cat</span> <<EOF >> my_package_<span class="kw">name/usr/bin/mypackage</span>
#!/bin/bash
<span class="kw">echo</span> this is my package
EOF
chm<span class="kw">od</span> 700 my_package_name/usr/bin/mypackage</code></pre></div></li>
</ul>
<h3 id="optional-add-application-configuration-files">(OPTIONAL) Add Application Configuration Files</h3>
<ul>
<li><p>If the application your deb package installs requires configuration files, this step shows how to properly include them.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p my_package_name/etc
<span class="kw">touch</span> my_package_name/etc/myconfig.conf
<span class="kw">cat</span> <<EOF >> my_package_name/DEBIAN/con<span class="kw">ffiles</span>
etc/myconfig.conf
EOF</code></pre></div></li>
</ul>
<h3 id="optional-add-dependencies-to-your-package">(OPTIONAL) Add Dependencies to Your Package</h3>
<ul>
<li><p>Adding dependancies to your deb package forces package management systems (i.e. dpkg, apt-get, aptitude) to install, or require the installation of, other packages.</p></li>
<li><p>In this example, we add the vim package as a dependency to our package. If you are using apt-get to install your custom deb, this will cause the package manager to install vim before our new custom package is installed. If you use <code>dpkg -i</code> to install our new package, this will cause dpkg to fail to install our new package until you manually install the vim package (i.e. apt-get install vim).</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> my_package_name/DEBIAN/control
Depends: vim
EOF</code></pre></div></li>
</ul>
<h3 id="optional-add-bash-scripts-that-run-before-or-after-your-package-installation">(OPTIONAL) Add Bash Scripts That Run Before or After Your Package Installation</h3>
<ul>
<li><p>Sometimes you may find a need to run bash scripts before or after your packages files are laid down on the file system. This may be needed to configure the base system before installation, start your program differently the first time it runs, etc. This can be done by including what deb packages call "preinst" and "postinst" bash scripts. The following shows how to include a postinst script that simply creates an empty file after your application is installed.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> my_package_name/DEBIAN/postinst
#!/bin/bash
touch /root/touched
EOF
chmod 755 my_package_name/DEBIAN/postinst</code></pre></div></li>
</ul>
<h3 id="finally-build-your-package">Finally, Build Your Package!</h3>
<ul>
<li><p>The following step will actually build your new package. After it finishes running, you will have a deb package named my_package_name.deb</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">dpkg-deb</span> --build my_package_name</code></pre></div></li>
</ul>
<h3 id="optional-install-your-application">(OPTIONAL) Install Your Application</h3>
<ul>
<li><p>To install your deb package directly from a deb file, you will have to use the <code>dpkg</code> command instead of <code>apt-get</code> or <code>aptitude</code> which install applications from remote apt repos.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">dpkg</span> -i my_package_name.deb</code></pre></div></li>
<li><p>if you have issues with dependancies, run the following and then run the above <code>dpkg</code> command again</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get -f install</code></pre></div></li>
</ul>
<h3 id="summary">Summary</h3>
<p>While this guide is meant to be a practical guide to creating a minimal deb package, it covers most functionality you will typically need when creating deb packages. If you need to utilize advanced package configuration options, try reading over the <a href="https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html">official deb package documentation</a>. It is a great place to start.</p>
<p>Keep and eye out on this blog for a follow up article on how to create a remote apt repo and host your newly created deb packages.</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-46833534871645484182016-01-25T11:21:00.000-08:002016-01-27T13:54:39.955-08:00Using Make for Easy Yocto Builds On Intel Edison<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This documentation goes though the process of building a Yocto Linux image via simple make files for the Intel Edison board. The make file method for building Yocto images is much simpler than the manual build methods. The make files provided by Intel in the BSP Edison source package wrap the build process with scripts to make building an extremely simple process.</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtingyoyLwDD4VLYyJO5YUhg37ZUjYK0yAH3fQzZOsnAzc0YnkCidQy1CZrsdhMMK2Cku6DDDWHNCXx1f_eV1TcC3awlrMH_olK23dKwgugkrjugZjBiRHXN0_Twmkyfqczih0nNyuGag/s1600/IMG_0654.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtingyoyLwDD4VLYyJO5YUhg37ZUjYK0yAH3fQzZOsnAzc0YnkCidQy1CZrsdhMMK2Cku6DDDWHNCXx1f_eV1TcC3awlrMH_olK23dKwgugkrjugZjBiRHXN0_Twmkyfqczih0nNyuGag/s200/IMG_0654.JPG" /></a></div>
<a name='more'></a>
<p>Most of the base steps found in this documentation were based on Intels Board Support Package (BSP) User Guide. The BSP User Guide can be found <a href="http://www.intel.com/content/www/us/en/support/boards-and-kits/000005616.html">here</a>.</p>
<p>Also note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.</p>
<hr />
<h3 id="create-a-directory-for-building-the-image">Create a Directory for Building the Image</h3>
<ul>
<li><p>This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p ~/src/edison
<span class="kw">cd</span> ~/src/edison</code></pre></div></li>
</ul>
<h3 id="download-the-latest-edison-source-package">Download the Latest Edison Source Package</h3>
<ul>
<li><p>The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the source package downloads on <a href="https://software.intel.com/en-us/iot/hardware/edison/downloads">this page</a>.</p></li>
<li><p>Download the latest "Linux source files" on the page listed above. As of this documentation, the link was <a href="http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz">"Linux source files"</a>.</p></li>
<li><p>If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="uncompress-the-source-files">Uncompress the Source Files</h3>
<ul>
<li><p>If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">tar</span> xfvz edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="install-build-dependancies">Install Build Dependancies</h3>
<ul>
<li><p>Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Yocto image.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib</code></pre></div></li>
</ul>
<h3 id="optional-speed-up-the-build-with-parallelization">(Optional) Speed Up The Build With Parallelization</h3>
<ul>
<li><p>Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling Yocto to build using parallelization. By default, the Edison Yocto configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.</p></li>
<li><p>Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build Yocto from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both <code>parallel_make</code> and <code>bb_number_thread</code> to a value of 40.</p>
<pre><code>export SETUP_ARGS="--parallel_make=8 --bb_number_thread=8"</code></pre></li>
</ul>
<h3 id="initialize-the-build-environment">Initialize the Build Environment</h3>
<ul>
<li><p>The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> edison-src
<span class="kw">make</span> setup</code></pre></div></li>
</ul>
<h3 id="build-the-yocto-image">Build the Yocto Image</h3>
<ul>
<li><p>Note, this step can take a very long time. When you are ready to kick off the build, run the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> image</code></pre></div></li>
</ul>
<h3 id="flash-the-yocto-image-to-the-edison-board.">Flash the Yocto Image to the Edison Board.</h3>
<ul>
<li><p>Once the image is built, you can install it to the Edison board by running the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get -i install dfu-util
<span class="kw">make</span> flash</code></pre></div></li>
</ul>
<h3 id="summary">Summary</h3>
<p>Hopefully this documentation proves useful in building Edison Yocto images via the simplified make file method. I find the make file build method is much less tedious than the manual Yocto build process. If you are interested in other make recipes provided by Intel, you can run:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">make</span> help</code></pre></div>
<p>The next post will cover building Debian images for the Intel Edison board. Stay tuned for more...</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com1tag:blogger.com,1999:blog-2947245848405513225.post-64853025280762892242016-01-25T09:42:00.004-08:002016-01-25T09:47:38.377-08:00Manually Building Yocto Images for the Intel Edison Board from Source<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This documentation goes though the process of manually building a Yocto Linux image for the Intel Edison hardware. The build techniques used here do not use the easier make file method which is now available in the Intel Edison Board Support Package (BSP) source. For documentation on building via the make file method, I will do a follow up post which explains that process in detail.</p>
<p>The manual build method used in this documentation allows for easier customization of the base Yocto image. Customizations can include tweaks such as changing the base kernel, adding extra kernel modules, adding base application packages, etc.</p>
<a name='more'></a>
<p>Most of the base steps found in this documentation were modeled after Intels Board Support Package (BSP) User Guide. The BSP User Guide can be found <a href="http://www.intel.com/content/www/us/en/support/boards-and-kits/000005616.html">here</a>.</p>
<p>Also note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.</p>
<hr />
<h3 id="create-a-directory-for-building-the-image">Create a Directory for Building the Image</h3>
<ul>
<li><p>This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p ~/src/edison
<span class="kw">cd</span> ~/src/edison</code></pre></div></li>
</ul>
<h3 id="download-the-latest-edison-source-package">Download the Latest Edison Source Package</h3>
<ul>
<li><p>The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the page <a href="https://software.intel.com/en-us/iot/hardware/edison/downloads">here</a>.</p></li>
<li><p>Download the latest "Linux source files" on the page listed above. As of this documentation, the link was <a href="http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz">"Linux source files"</a>.</p></li>
<li><p>If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="uncompress-the-source-files">Uncompress the Source Files</h3>
<ul>
<li><p>If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">tar</span> xfvz edison-src-ww25.5-15.tgz</code></pre></div></li>
</ul>
<h3 id="install-build-dependancies">Install Build Dependancies</h3>
<ul>
<li><p>Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Yocto image.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib libsdl1.2-dev u-boot-tools</code></pre></div></li>
</ul>
<h3 id="initialize-the-build-environment">Initialize the Build Environment</h3>
<ul>
<li><p>The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.</p></li>
<li><p>Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling Yocto to build using parallelization. By default, the Edison Yocto configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.</p></li>
<li><p>Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build Yocto from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both <code>parallel_make</code> and <code>bb_number_thread</code> to a value of 40.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> edison-src
<span class="kw">./meta-intel-edison/setup.sh</span> --parallel_make=4 --bb_number_thread=4</code></pre></div></li>
</ul>
<h3 id="enter-your-build-environment">Enter Your Build Environment</h3>
<ul>
<li><p>The Yocto build utilizes bitbake. The following command sets up your current shell to properly run bitbake for the build. If you exit your shell after running this, you will have to do it again before doing consecutive builds.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> ~/src/edison/edison-src/out/linux64
<span class="kw">source</span> poky/oe-init-build-env</code></pre></div></li>
</ul>
<h3 id="pre-download-the-build-files">Pre Download the Build Files</h3>
<ul>
<li><p>The actual build process using bitbake (in the next step) can take hours to run depending on your CPU cores and speed. Since I typically build on a laptop which may or may not have internet access during the whole build process, I typically pre download all of the source files for the build. In order to pre download the builds source files, run the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bitbake</span> -c fetchall edison-image</code></pre></div></li>
</ul>
<h3 id="build-the-yocto-image">Build the Yocto Image</h3>
<ul>
<li><p>As mentioned above, this step can take a very long time. When you are ready to kick off the build, run the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bitbake</span> edison-image</code></pre></div></li>
</ul>
<h3 id="finalize-the-build-for-device-flashing">Finalize the Build for Device Flashing</h3>
<ul>
<li><p>Before you can flash your newly created Yocto image to the Intel Edison, you must finalize the build. This process wraps the base file system, kernel, uboot files, etc into a structure where provided scripts can easily flash the Edison.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> ~/src/edison/edison-src/
<span class="kw">ln</span> -s ~/src/edison/edison-src/out/linux64/build/tmp ~/src/edison/edison-src/build/tmp
<span class="kw">./meta-intel-edison/utils/flash/postBuild.sh</span></code></pre></div></li>
</ul>
<h3 id="flash-the-yocto-image-to-the-edison-board.">Flash the Yocto Image to the Edison Board.</h3>
<ul>
<li><p>Once the image is built, you can install it to the Edison board by running the following:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> build/toFlash/
<span class="kw">sudo</span> apt-get -i install dfu-util
<span class="kw">./flashall.sh</span></code></pre></div></li>
</ul>
<h3 id="summary">Summary</h3>
<p>Hopefully this documentation proves useful in building Edison Yocto images from scratch. The manual build process is a bit more tedious than the make method, but allows for easier customizations. If you are interested in the easier make variant, I will create some documentation for that in my next Edison series blog post. Future Edison posts will also cover how to create Debian, and other Linux distributions for the Edison hardware. Stay tuned for more...</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-75799537779408045812015-03-13T14:04:00.000-07:002015-03-13T14:04:06.847-07:00Building Kali Linux for Gumstix Overo<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This writeup goes over details on how to build and install a Kali Linux image for an Overo Gumstix board. The build notes and images in this post are for a stock Kali Linux OS configured for a Gumstix Overo device. The Kali image is configured for easy SSH network access over wired, wireless or USB when the Gumstix device is powered.</p>
<div class="figure">
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU2ox4QKwcPeLbAsT4Yd5Z7x2E4XWeUHKAqVxL9YFcd8yuA0UtZIIkxrfkSet9N_1Q8DIcefrbkIbECMR0gXZGNGLSuKZjoOMU2lvY6sYLEPzuk0U-Ed2-hz2FClwjUaRUmO-gwJbiO0U/s1600/gumstix_thumbo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU2ox4QKwcPeLbAsT4Yd5Z7x2E4XWeUHKAqVxL9YFcd8yuA0UtZIIkxrfkSet9N_1Q8DIcefrbkIbECMR0gXZGNGLSuKZjoOMU2lvY6sYLEPzuk0U-Ed2-hz2FClwjUaRUmO-gwJbiO0U/s320/gumstix_thumbo.jpg" /></a></div>
</div>
<p>In order to create as Kali Linux device that resembled a USB dongle, I chose to use a Gumstix Overo Firestorm-P com with a Thumbo daughter board. The device is WiFi enabled and runs most pentest tools relatively well. As Gumstix devices are low resource ARM devices, there are obviously some CPU limitations, but considering the hardware, it runs great.</p>
<a name='more'></a>
<p>This Kali build utilizes the kernel, modules and firmware from the Gumstix Overo Yocto build. You do not have to build your own Yocto image as this documentation utilizes a precompiled version, but if you are interested in building your own, you can check our my previous post <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">"Building Yocto Linux Images for the Gumstix Overo"</a></p>
<p>Here is a short summary of what this writeup covers:</p>
<ol style="list-style-type: decimal">
<li>How to manually build a Kali Linux image for a Gumstix Overo.</li>
<li>An alternative scripted method to build a Gumstix Kali image.</li>
<li>Where to download a precompiled Kali Linux Gumstix Overo image if you are not interested in building them yourself.</li>
<li>How to install a Kali Linux image to an SD card for your Gumstix board.</li>
<li>How to access your Kali image after installation</li>
</ol>
<hr />
<h1 id="manually-building-a-gumstix-overo-kali-linux-image">Manually Building a Gumstix Overo Kali Linux Image</h1>
<ul>
<li><p>These steps build a base Kali Linux OS for the Gumstix Overo board and uses files, kernel modules, firmware obtained from a Gumstix Overo Yocto build. You do not have to build your own Yocto image as this documentation utilizes a precompiled version, but if you are interested in building your own, you can check our my previous post <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">"Building Yocto Linux Images for the Gumstix Overo"</a></p></li>
<li><p>These build steps were tested on Debian 7.7, Ubuntu 14.04 and Kali Linux 1.0.9 host system.</p></li>
<li><p><strong>NOTE: This documentation utilizes the deboostrap command so you will likely have to build this on a Debian (Kali is Debian based) or Ubuntu based system</strong>. There are some tricks to get around this, but they are not covered here.</p></li>
</ul>
<h3 id="create-your-build-directory">Create Your Build Directory</h3>
<ul>
<li><p>First we will create a build directory. It is not required that you follow the same directory build structure. However, if you do use a different directory structure, you will have to substitute your directories in my build commands.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p gumstix/kali
<span class="kw">cd</span> gumstix/kali</code></pre></li>
</ul>
<h3 id="install-build-dependancies">Install Build Dependancies</h3>
<ul>
<li><p>We must first install these following applications in order to build our base OS</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get install -y debootstrap binfmt-support qemu qemu-user-static curl</code></pre></li>
</ul>
<h3 id="download-and-install-the-kali-linux-debootstrap-config-file">Download and Install the Kali Linux Debootstrap Config File</h3>
<ul>
<li><p>Debian and Ubuntu do not include a Kali Linux debootstrap file. If you are doing this build on a Kali Linux host machine, you can skip this step.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/kali_debootstrap
<span class="kw">sudo</span> mv kali_debootstrap /usr/share/debootstrap/scripts/kali</code></pre></li>
</ul>
<h3 id="create-the-base-arm-kali-os-first-stage">Create the Base ARM Kali OS (First Stage)</h3>
<ul>
<li><p>In this step, we create our base Kali OS with deboostrap. This is often called "First Stage" build.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> debootstrap --foreign --arch armel --include=vim-nox,openssh-server,ntpdate,less,wireless-tools,wpasupplicant,dnsmasq,psmisc,locales,locales-all,screen --exclude=nano kali ./kali http://archive.kali.org/kali</code></pre></li>
</ul>
<h3 id="download-a-yocto-image-to-utilize-its-kernel-modules-and-firmware">Download a Yocto Image to Utilize its Kernel Modules and Firmware</h3>
<ul>
<li><p>This step utilizes a precompiled Yocto image I created. Optionally, you can obtain one directly from Gumstix <a href="https://www.gumstix.com/software/software-downloads/">here</a> or build your own using the steps I provide <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">here</a>.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/gumstix-console-image-overo-20141218160757.rootfs.tar.bz2
<span class="kw">mkdir</span> yocto
<span class="kw">tar</span> xaf gumstix-console-image-overo-20141218160757.rootfs.tar.bz2 -C ./yocto</code></pre></li>
</ul>
<h3 id="copy-over-your-yocto-kernel-modules-firmware-and-core-system-files">Copy Over Your Yocto Kernel Modules, Firmware and Core System Files</h3>
<ul>
<li><p>In this step, we copy over our Yocto kernel modules and system files we downloaded or built from the previous step.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> mkdir -p kali/lib/modules
<span class="kw">sudo</span> mkdir -p kali/lib/firmware
<span class="kw">sudo</span> cp -r yocto/lib/modules/3.5.7-custom kali/lib/modules
<span class="kw">sudo</span> cp -r yocto/lib/firmware/* kali/lib/firmware
<span class="kw">sudo</span> cp yocto/etc/fstab kali/etc/fstab
<span class="kw">sudo</span> cp yocto/etc/network/interfaces kali/etc/network/</code></pre></li>
</ul>
<h3 id="configure-the-base-arm-kali-os-second-stage">Configure the Base ARM Kali OS (Second Stage)</h3>
<ul>
<li>This is typically called "Second Stage" build.</li>
<li><p>Here we configure all of the packages we installed from the First Stage</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> cp /usr/bin/qemu-arm-static kali/usr/bin
<span class="kw">sudo</span> chroot kali ./debootstrap/debootstrap --second-stage</code></pre></li>
</ul>
<h3 id="more-configuration-for-the-debian-arm-os-third-stage">More Configuration for the Debian ARM OS (Third Stage)</h3>
<ul>
<li>During this configuration stage, we set up more personal configurations such as passwords, hostnames, network addresses, etc</li>
<li>this section is broken up into smaller subsections.</li>
<li>During this stage, you may choose to customize network interfaces, passwords, etc.</li>
</ul>
<h4 id="set-the-system-password">Set the System Password</h4>
<ul>
<li><p>Feel free to set your own password here, but remember it so you can ssh into your system after installation.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> chroot kali /bin/bash -c <span class="st">'echo "root:toor" | chpasswd'</span></code></pre></li>
</ul>
<h4 id="set-up-our-remote-apt-repository">Set Up Our Remote Apt Repository</h4>
<ul>
<li><p>Feel free to add more apt repositories if you like.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> sources.list
deb http://http.kali.org/kali kali main contrib non-free
deb http://security.kali.org/kali-security kali/updates main contrib non-free
EOF
sudo mv sources.list kali/etc/apt/sources.list
sudo chown root:root kali/etc/apt/sources.list
sudo chmod 644 kali/etc/apt/sources.list</code></pre></li>
</ul>
<h4 id="set-the-hostname-for-the-kali-system">Set the Hostname for the Kali System</h4>
<ul>
<li><p>Feel free to change this if you want something else</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> hostname
kali
EOF
sudo mv hostname kali/etc/hostname
sudo chown root:root kali/etc/hostname
sudo chmod 644 kali/etc/hostname</code></pre></li>
</ul>
<h4 id="setup-the-wifi-configuration-for-the-debian-arm-system">Setup the WiFi Configuration for the Debian ARM System</h4>
<ul>
<li><p>Here we set up our WiFi networks and passwords for the WiFi networks you would like your external interface to connect to.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> wpa_supplicant.conf
network={
ssid="MyWiFiNetwork1"
psk="MyPassword"
priority=5
}
EOF
sudo mv wpa_supplicant.conf kali/etc/wpa_supplicant/wpa_supplicant.conf
sudo chown root:root kali/etc/wpa_supplicant/wpa_supplicant.conf
sudo chmod 644 kali/etc/wpa_supplicant/wpa_supplicant.conf</code></pre></li>
</ul>
<h4 id="setup-the-ip-address-and-settings-for-the-usb-network-interface">Setup the IP Address and Settings for the USB Network Interface</h4>
<ul>
<li>In this step we setup our internal (USB) network interface. Feel free to use a different static IP address and CIDR block if you prefer something different.</li>
<li><p>You can also change eth0 or mlan0 to be a static IP instead of dhcp</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto usb0
iface usb0 inet static
address 172.16.1.2
netmask 255.255.255.0
allow-hotplug mlan0
iface mlan0 inet dhcp
pre-up wpa_supplicant -Dwext -imlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
down killall wpa_supplicant
EOF
sudo mv interfaces kali/etc/network/interfaces
sudo chown root:root kali/etc/network/interfaces
sudo chmod 644 kali/etc/network/interfaces</code></pre></li>
</ul>
<h4 id="setup-the-dhcp-settings-for-the-usb-network-interface">Setup the DHCP Settings for the USB Network Interface</h4>
<ul>
<li><p>In this step we setup our internal (USB) network DHCP. If you changed your IP address information in the step above, you will have to change the DHCP settings to match.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> dnsmasq.conf
dhcp-range=usb0,172.16.1.10,172.16.1.50,12h
EOF
sudo mv dnsmasq.conf kali/etc/dnsmasq.conf
sudo chown root:root kali/etc/dnsmasq.conf
sudo chmod 644 kali/etc/dnsmasq.conf</code></pre></li>
</ul>
<h4 id="finalize-the-third-stage">Finalize the Third Stage</h4>
<ul>
<li>In this section we will finalize the third stage configuration.</li>
<li><p>Set some environment variable for upcomming steps</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">export</span> <span class="ot">MALLOC_CHECK_=</span>0 <span class="co"># workaround for LP: #520465</span>
<span class="kw">export</span> <span class="ot">LC_ALL=</span>C
<span class="kw">export</span> <span class="ot">DEBIAN_FRONTEND=</span>noninteractive</code></pre></li>
<li><p>Mount some of the host mounts to the chroot environment</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> mount -t proc proc kali/proc
<span class="kw">sudo</span> mount -o bind /dev/ kali/dev/
<span class="kw">sudo</span> mount -o bind /dev/pts kali/dev/pts</code></pre></li>
<li><p>Configure our debconf for the Kali system</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> debconf.set
console-common console-data/keymap/policy select Select keymap from full list
console-common console-data/keymap/full select en-latin1-nodeadkeys
EOF
sudo mv debconf.set kali/debconf.set
sudo chown root:root kali/debconf.set
sudo chmod 644 kali/debconf.set</code></pre></li>
<li>This step bundles a lot of Kali Linux configurations into a large blob. It could likely be broken up into smaller steps to make it more readable. Unfortunately for now, it is how it is.</li>
<li><p>Copy, paste, cross your fingers and close your eyes... Your almost to the finish line.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> third-stage
#!/bin/bash
dpkg-divert --add --local --divert /usr/sbin/invoke-rc.d.chroot --rename /usr/sbin/invoke-rc.d
cp /bin/true /usr/sbin/invoke-rc.d
apt-get update
apt-get install locales-all
#locale-gen en_US.UTF-8
update-rc.d -f ssh remove
update-rc.d -f ssh defaults
update-rc.d -f dnsmasq remove
update-rc.d -f dnsmasq defaults
debconf-set-selections /debconf.set
rm -f /debconf.set
apt-get update
apt-get -y install git-core binutils ca-certificates initramfs-tools uboot-mkimage
apt-get -y install locales console-common less nano git
sed -i -e 's/KERNEL\!=\"eth\*|/KERNEL\!=\"/' /lib/udev/rules.d/75-persistent-net-generator.rules
rm -f /etc/udev/rules.d/70-persistent-net.rules
rm -f /usr/sbin/invoke-rc.d
dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
rm -f /third-stage
EOF
sudo mv third-stage kali/third-stage
sudo chown root:root kali/third-stage
sudo chmod 744 kali/third-stage
sudo chroot kali /third-stage</code></pre></li>
</ul>
<h4 id="set-the-system-locale">Set the System Locale</h4>
<ul>
<li><p>If you prefer a different locale, then change it accordingly.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> locale
LANG=en_US.UTF-8
EOF
sudo mv locale kali/etc/default/locale
sudo chown root:root kali/etc/default/locale
sudo chmod 644 kali/etc/default/locale</code></pre></li>
</ul>
<h4 id="clean-up-our-new-kali-os">Clean Up Our New Kali OS</h4>
<ul>
<li>This step cleans some logs and unmounts partitions from our stage three steps.</li>
<li><p>First we will clean the logs</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> << EOF >> cleanup
#!/bin/bash
rm -rf /root/.bash_history
apt-get update
apt-get clean
rm -f cleanup
EOF
sudo mv cleanup kali/cleanup
sudo chown root:root kali/cleanup
sudo chmod 744 kali/cleanup
sudo chroot kali /cleanup</code></pre></li>
<li><p>Then we unmount our host partitions from the chroot environment</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> umount kali/proc
<span class="kw">sudo</span> umount kali/dev/pts
<span class="kw">sudo</span> umount kali/dev/</code></pre></li>
</ul>
<h4 id="bundle-the-root-file-system-for-your-new-kali-os">Bundle the Root File System for Your New Kali OS</h4>
<ul>
<li><p>Finally, we tar up our configured Kali filesystem. This filesystem will be used during the install stage for our Gumstix SD card.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> kali
<span class="kw">sudo</span> tar -cjf ../kali.tar.bz2 *
<span class="kw">cd</span> ..</code></pre></li>
</ul>
<hr />
<h1 id="gumstix-overo-kali-linux-scripted-build">Gumstix Overo Kali Linux Scripted Build</h1>
<ul>
<li>In order to speed up the Kali Gumstix build process, I have composed a bash script from all of the manual build steps described above. The script can be found <a href="https://github.com/hackgnar/gumstix-overo-images/blob/master/kali/build_gumstix_kali.sh">here</a>. This script was tested on a base Debian 7.7 , Ubuntu 14.04 and Kali Linux 1.0.9 system. The script contains sudo commands so it will prompt you periodically for a root password when it needs to run privileged commands.</li>
</ul>
<h3 id="download-the-build-script">Download the Build Script</h3>
<ul>
<li><p>The build script that encapsulates all of the manual build steps can be obtained from by github repo as shown below.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/kali_scripted_build.sh</code></pre></li>
</ul>
<h3 id="run-the-build-script">Run the Build Script</h3>
<ul>
<li>Note this script assumes you are running as a normal user and will prompt you for a sudo password.</li>
<li><p>You may find it useful to alter my bash script if you want custom configurations on your OS like root password, different network addresses, different hostname, etc</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bash</span> kali_scripted_build.sh</code></pre></li>
</ul>
<hr />
<h1 id="precompiled-kali-linux-image-build">Precompiled Kali Linux Image Build</h1>
<p>If you are not interested in building Kali from scratch, you can always download and install precompiled images. The image provided below was generated by myself from the steps listed above.</p>
<h3 id="download-the-base-image-and-uboot-files">Download the Base Image and Uboot Files</h3>
<pre><code>mkdir -p gumstix/kali
cd gumstix/kali
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/MLO
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/uImage
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/u-boot.img
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/kali.tar.bz2.split-aa
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/kali.tar.bz2.split-ab
cat kali.tar.bz2.split* > kali.tar.bz2</code></pre>
<hr />
<h1 id="install-the-image-to-an-sd-card">Install the Image to an SD Card</h1>
<p>Once you have built or downloaded your Kali Linux Gumstix image, you can use the steps listed in this section to flash the image to an SD card. You can then use the SD card to boot your Gumstix board.</p>
<ul>
<li>These steps require a Linux machine</li>
</ul>
<h3 id="insert-your-sd-card">Insert Your SD Card</h3>
<ul>
<li>Make sure to note the device block it gets mapped to. In most instances it will /dev/sdb</li>
</ul>
<h3 id="format-your-sd-card">Format Your SD card</h3>
<ul>
<li><p>In the command below, replace sdX with the device your SD card was mapped to which you noted in the previous step</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/mk2partsd
<span class="kw">sudo</span> umount /dev/sdX*
<span class="kw">sudo</span> ./mk2partsd /dev/sdX</code></pre></li>
</ul>
<h3 id="download-uboot-files-if-you-dont-already-have-them.">Download Uboot Files if you Don't Already Have Them.</h3>
<ul>
<li><p>If you built your image manually and did not download it, you will have to obtain a MLO, uImage and u-boot.img file. To get these you can grab them from a Yocto build or download them with the following commands.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/MLO
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/uImage
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/kali/uboot_image/u-boot.img</code></pre></li>
</ul>
<h3 id="copy-uboot-files-and-os-filesystem-to-the-sd-card">Copy Uboot Files and OS Filesystem to the SD Card</h3>
<ul>
<li>On a Debian system your SD card partitions should automatically get mounted to /media/boot and /media/root. If this is not the case then make sure your SD cards are mounted and substitute the mount directory referenced in the instructions below.</li>
<li><p>On ubuntu 14.04 you may have to unplug and replug your SD card to make it remount after running mk2partsd from the step above. Also on Ubuntu 14.04 your mount locations may be /media/username/{boot,rootfs}</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cp</span> MLO /media/boot
<span class="kw">cp</span> uImage /media/boot
<span class="kw">cp</span> u-boot.img /media/boot
<span class="kw">sudo</span> tar xaf kali.tar.bz2 -C /media/rootfs
<span class="kw">sudo</span> sync
<span class="kw">sudo</span> umount /media/boot
<span class="kw">sudo</span> umount /media/rootfs</code></pre></li>
</ul>
<hr />
<h1 id="how-to-access-the-kali-linux-image-running-on-a-gumstix">How to Access the Kali Linux Image Running on a Gumstix</h1>
<p>The manual build steps above and the precompiled images set up the base Kali OS to be easily accessed via ssh over wifi, ethernet or USB networking.</p>
<p><strong>NOTE:</strong> USB serial console support for the Kali image is not setup so you will not be able to log in via minicom, etc</p>
<h3 id="recommended-method-for-accessing-precompiled-images">Recommended Method for Accessing Precompiled Images</h3>
<ul>
<li>The easiest way to access your Kali system is via SSH over the USB network interface it provides.</li>
<li>Plug in your Gumstix board which is attached to a daughter board with a usb device port (Tobi, Thumbo, etc) to your host computer.</li>
<li><p>Once the Gumstix board finishes booting the OS you can ssh to it over USB with username:root password:toor</p>
<pre><code>ssh root@172.16.1.2</code></pre></li>
</ul>
<h3 id="credentials-and-ip-addresses-for-the-kali-image">Credentials and IP Addresses for the Kali Image</h3>
<ul>
<li>The precompiled image (or images created with the build script) is setup with the password "toor" for the root user.</li>
<li>The ipaddress for the Gumstix USB network interface is 172.16.1.2</li>
</ul>
<h3 id="other-methods-for-accessing-the-installed-kali-image">Other Methods for Accessing the Installed Kali Image</h3>
<p>Here are all of the methods that you can use to access the image running on your Gumstix Board</p>
<ul>
<li>SSH to the usb network interface located at the address listed above. The Kali image is configured to serve your host computer a DHCP address in the 172.16.1.0/24 block.</li>
<li>SSH to the ethernet interface if you are using a daughter board with ethernet capabilities (Tobi, etc). The eth0 interface will pull a DHCP address.</li>
<li>SSH to the WiFi interface. This will require that you setup your wpa supplicant file located at /etc/wpa_supplicatnt/wpa_supplicant.conf prior to flashing your SD card.</li>
<li>NOTE: USB serial console support for the Kali image is not setup so you will not be able to log in via minicom, etc</li>
</ul>
<h1 id="summary">Summary</h1>
<p>Hopefully you have found this document for installing Kali Linux on a Gumstix Overo useful. Many of the steps can be altered to install different operating systems. With a little alteration of the debootstrap command, you should be able to install any OS supported by debootstrap. This document can also be altered to install Kali based operating systems to different hardware such as the Gumstix DuoVero series. As the only Gumstix product I own is an IronStorm-P COM with a Thumbo and Tobi board, this document only focuses on this hardware.</p>
<p>If you have any comments or questions please feel free to send them my way. You can post comments here or contact me via Twitter <span class="citation">@hackgnar</span>.</p>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-75023314224090046842015-03-12T09:08:00.002-07:002015-03-13T05:45:46.636-07:00Building Debian Wheezy for Gumstix Overo<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This writeup goes over details on how to build and install a Debian Wheezy Linux image for an Overo Gumstix board. The build notes and images in this post are for a stock Debian Wheezy OS configured for a Gumstix Overo device. The Debian image is configured for easy SSH network access over wired, wireless or USB when the Gumstix device is powered.</p>
<p>This Debian build utilizes the kernel, modules and firmware from the Gumstix Overo Yocto build. You do not have to build your own Yocto image as this documentation utilizes a precompiled version, but if you are interested in building your own, you can check our my previous post <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">"Building Yocto Linux Images for the Gumstix Overo"</a></p>
<p>Here is a short summary of what this writeup covers:</p>
<ol style="list-style-type: decimal">
<li>How to manually build a Debian Wheezy image for a Gumstix Overo.</li>
<li>An alternative scripted method to build a Gumstix Debian image.</li>
<li>Where to download precompiled Debian Wheezy Gumstix Overo image if you are not interested in building them yourself.</li>
<li>How to install a Debian Wheezy image to an SD card for your Gumstix board.</li>
<li>How to access your image after installation</li>
</ol>
<a name='more'></a>
<hr />
<h1 id="manually-building-a-gumstix-overo-debian-image">Manually Building a Gumstix Overo Debian Image</h1>
<ul>
<li><p>These steps build a base Debian Wheezy OS for the Gumstix Overo board and uses files, kernel modules, firmware obtained from a Gumstix Overo Yocto build. You do not have to build your own Yocto image as this documentation utilizes a precompiled version, but if you are interested in building your own, you can check our my previous post <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">"Building Yocto Linux Images for the Gumstix Overo"</a></p></li>
<li><p>These steps were tested on Debian 7.7, Ubuntu 14.04 and Kali Linux 1.0.9 system.</p></li>
<li><p><strong>NOTE: This documentation utilizes the deboostrap command so you will likely have to build this on a Debian or Ubuntu based system</strong>. There are some tricks to get around this, but they are not covered here.</p></li>
</ul>
<h3 id="create-your-build-directory">Create Your Build Directory</h3>
<ul>
<li><p>First we will create a build directory. It is not required that you follow the same directory build structure. However, if you do use a different directory structure, you will have to substitute your directories in my build commands.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p gumstix/debian
<span class="kw">cd</span> gumstix/debian</code></pre></li>
</ul>
<h3 id="install-build-dependancies">Install Build Dependancies</h3>
<ul>
<li><p>We must first install these following applications in order to build our base OS</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get install -y debootstrap binfmt-support qemu qemu-user-static curl</code></pre></li>
</ul>
<h3 id="create-the-base-arm-debian-os-first-stage">Create the Base ARM Debian OS (First Stage)</h3>
<ul>
<li><p>In this step, we create our base Debian OS with deboostrap. This is often called "First Stage" build.</p>
<pre><code>sudo debootstrap --foreign --verbose --arch=armel --include=vim-nox,openssh-server,ntpdate,less,wireless-tools,wpasupplicant,dnsmasq,psmisc,locales,locales-all,screen --exclude=nano wheezy ./wheezy http://ftp.debian.org/debian/</code></pre></li>
</ul>
<h3 id="download-a-yocto-image-to-utilize-its-kernel-modules-and-firmware">Download a Yocto Image to Utilize its Kernel Modules and Firmware</h3>
<ul>
<li><p>This step utilizes a precompiled Yocto image I created. Optionally, you can obtain one directly from Gumstix <a href="https://www.gumstix.com/software/software-downloads/">here</a> or build your own using the steps I provide <a href="http://www.hackgnar.com/2015/03/building-yocto-linux-images-for-gumstix.html">here</a>.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/gumstix-console-image-overo-20141218160757.rootfs.tar.bz2
<span class="kw">mkdir</span> yocto
<span class="kw">tar</span> xaf gumstix-console-image-overo-20141218160757.rootfs.tar.bz2 -C ./yocto</code></pre></li>
</ul>
<h3 id="copy-over-your-yocto-kernel-modules-firmware-and-core-system-files">Copy Over Your Yocto Kernel Modules, Firmware and Core System Files</h3>
<ul>
<li><p>In this step, we copy over our Yocto kernel modules and system files we downloaded or built from the previous step.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> mkdir -p wheezy/lib/modules
<span class="kw">sudo</span> mkdir -p wheezy/lib/firmware
<span class="kw">sudo</span> cp -r yocto/lib/modules/3.5.7-custom wheezy/lib/modules
<span class="kw">sudo</span> cp -r yocto/lib/firmware/* wheezy/lib/firmware
<span class="kw">sudo</span> cp yocto/etc/fstab wheezy/etc/fstab
<span class="kw">sudo</span> cp yocto/etc/network/interfaces wheezy/etc/network/</code></pre></li>
</ul>
<h3 id="configure-the-base-arm-debian-os-second-stage">Configure the Base ARM Debian OS (Second Stage)</h3>
<ul>
<li>This is typically called "Second Stage" build.</li>
<li><p>Here we configure all of the packages we installed from the First Stage</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> cp /usr/bin/qemu-arm-static wheezy/usr/bin
<span class="kw">sudo</span> chroot wheezy ./debootstrap/debootstrap --second-stage</code></pre></li>
</ul>
<h3 id="more-configuration-for-the-debian-arm-os-third-stage">More Configuration for the Debian ARM OS (Third Stage)</h3>
<ul>
<li>During this configuration stage, we set up more personal configurations such as passwords, hostnames, network addresses, etc</li>
<li>this section is broken up into smaller subsections.</li>
<li>During this stage, you may choose to customize network interfaces, passwords, etc.</li>
</ul>
<h4 id="set-the-system-password">Set the System Password</h4>
<ul>
<li><p>Feel free to set your own password here, but remember it so you can ssh into your system after installation.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> chroot wheezy /bin/bash -c <span class="st">'echo "root:hackgnar" | chpasswd'</span></code></pre></li>
</ul>
<h4 id="set-up-our-remote-apt-repository">Set Up Our Remote Apt Repository</h4>
<ul>
<li>Feel free to use a different core apt repository if you like.</li>
<li><p>If you want backports, you can also add this line <strong>deb http://http.debian.net/debian wheezy-backports main</strong></p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> sources.list
deb http://http.debian.net/debian wheezy main non-free
EOF
sudo mv sources.list wheezy/etc/apt/sources.list
sudo chown root:root wheezy/etc/apt/sources.list
sudo chmod 644 wheezy/etc/apt/sources.list</code></pre></li>
</ul>
<h4 id="setup-the-wifi-configuration-for-the-debian-arm-system">Setup the WiFi Configuration for the Debian ARM System</h4>
<ul>
<li><p>Here we set up our WiFi networks and passwords for the WiFi networks you would like your external interface to connect to.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> sed -i -e <span class="st">"s/wlan/mlan/g"</span> wheezy/etc/network/interfaces
<span class="kw">sudo</span> sed -i -e <span class="st">"s/wpa_supplicant.conf/wpa_supplicant\/wpa_supplicant.conf/g"</span> wheezy/etc/network/interfaces
<span class="kw">cat</span> <<EOF >> wpa_<span class="kw">supplicant.conf</span>
network={
ssid="MyWiFiNetwork1"
psk="MyPassword"
priority=5
}
EOF
sudo mv wpa_supplicant.con<span class="kw">f</span> <span class="kw">wheezy/etc/wpa_supplicant/wpa_supplicant.conf</span>
sudo chown root:root wheezy/etc/wpa_supplicant/wpa_supplicant.con<span class="kw">f</span>
sudo chmod 644 wheezy/etc/wpa_supplicant/wpa_supplicant.con<span class="kw">f</span></code></pre></li>
</ul>
<h4 id="setup-the-ip-address-and-settings-for-the-usb-network-interface">Setup the IP Address and Settings for the USB Network Interface</h4>
<ul>
<li><p>In this step we setup our internal (USB) network interface. Feel free to use a different static IP address and CIDR block if you prefer something different.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> wheezy/etc/network/interfaces <span class="kw">>></span> interfaces
<span class="kw">cat</span> <<EOF <span class="kw">>></span> <span class="kw">interfaces</span>
auto u<span class="kw">sb0</span>
iface usb<span class="kw">0</span> <span class="kw">inet</span> static
address 172.16.1.2
ne<span class="kw">tmask</span> 255.255.255.0
EOF
sudo mv interfaces wheezy/etc/networ<span class="kw">k/interfaces</span>
<span class="kw">sudo</span> chown root:root wheezy/etc/network/interfaces
<span class="kw">sudo</span> chmod 644 wheezy/etc/network/interfaces</code></pre></li>
</ul>
<h4 id="setup-the-dhcp-settings-for-the-usb-network-interface">Setup the DHCP Settings for the USB Network Interface</h4>
<ul>
<li><p>In this step we setup our internal (USB) network DHCP. If you changed your IP address information in the step above, you will have to change the DHCP settings to match.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> dnsmasq.conf
dhcp-range=usb0,172.16.1.10,172.16.1.50,12h
EOF
sudo mv dnsmasq.conf wheezy/etc/dnsmasq.conf
sudo chown root:root wheezy/etc/dnsmasq.conf
sudo chmod 644 wheezy/etc/dnsmasq.conf</code></pre></li>
</ul>
<h4 id="set-the-system-locale">Set the System Locale</h4>
<ul>
<li><p>If you prefer a different locale, then change it accordingly.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cat</span> <<EOF >> locale
LANG=en_US.UTF-8
EOF
sudo mv locale wheezy/etc/default/locale
sudo chown root:root wheezy/etc/default/locale
sudo chmod 644 wheezy/etc/default/locale</code></pre></li>
</ul>
<h4 id="bundle-the-root-file-system-for-your-new-debian-os">Bundle the Root File System for Your New Debian OS</h4>
<ul>
<li><p>Finally, we tar up our configured Debian filesystem. This filesystem will be used during the install stage for our Gumstix SD card.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> wheezy
<span class="kw">sudo</span> tar -cjf ../wheezy.tar.bz2 *
<span class="kw">cd</span> ..</code></pre></li>
</ul>
<hr />
<h1 id="gumstix-overo-debian-wheezy-scripted-build">Gumstix Overo Debian Wheezy Scripted Build</h1>
<ul>
<li>In order to speed up the Debian Gumstix build process, I have composed a bash script from all of the manual build steps described above. The script can be found <a href="https://github.com/hackgnar/gumstix-overo-images/blob/master/debian/build_gumstix_debian.sh">here</a>. This script was tested on a base Debian 7.7 , Ubuntu 14.04 and Kali Linux 1.0.9 system. The script contains sudo commands so it will prompt you periodically for a root password when it needs to run privileged commands.</li>
</ul>
<h3 id="download-the-build-script">Download the Build Script</h3>
<ul>
<li><p>The build script that encapsulates all of the manual build steps can be obtained from by github repo as shown below.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/debian_scripted_build.sh</code></pre></li>
</ul>
<h3 id="run-the-build-script">Run the Build Script</h3>
<ul>
<li>Note this script assumes you are running as a normal user and will prompt you for a sudo password.</li>
<li><p>You may find it useful to alter my bash script if you want custom configurations on your OS like root password, different network addresses, different hostname, etc</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bash</span> debian_scripted_build.sh</code></pre></li>
</ul>
<hr />
<h1 id="precompiled-debian-wheezy-image-build">Precompiled Debian Wheezy Image Build</h1>
<p>If you are not interested in building Debian from scratch, you can always download and install precompiled images. The image provided below was generated by myself from the steps listed above.</p>
<h3 id="download-the-base-image-and-uboot-files">Download the Base Image and Uboot Files</h3>
<pre><code>mkdir -p gumstix/debian
cd gumstix/debian
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/MLO
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/uImage
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/u-boot.img
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/wheezy.tar.bz2.split-aa
curl -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/wheezy.tar.bz2.split-ab
cat wheezy.tar.bz2.split* > wheezy.tar.bz2</code></pre>
<hr />
<h1 id="install-the-image-to-an-sd-card">Install the Image to an SD Card</h1>
<p>Once you have built or downloaded your Debian Wheezy Gumstix image, you can use the steps listed in this section to flash the image to an SD card. You can then use the SD card to boot your Gumstix board.</p>
<ul>
<li>These steps require a Linux machine</li>
</ul>
<h3 id="insert-your-sd-card">Insert Your SD Card</h3>
<ul>
<li>Make sure to note the device block it gets mapped to. In most instances it will /dev/sdb</li>
</ul>
<h3 id="format-your-sd-card">Format Your SD card</h3>
<ul>
<li><p>In the command below, replace sdX with the device your SD card was mapped to which you noted in the previous step</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/mk2partsd
<span class="kw">sudo</span> umount /dev/sdX*
<span class="kw">sudo</span> ./mk2partsd /dev/sdX</code></pre></li>
</ul>
<h3 id="download-uboot-files-if-you-dont-already-have-them.">Download Uboot Files if you Don't Already Have Them.</h3>
<ul>
<li><p>If you built your image manually and did not download it, you will have to obtain a MLO, uImage and u-boot.img file. To get these you can grab them from a Yocto build or download them with the following commands.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/MLO
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/uImage
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/debian/uboot_image/u-boot.img</code></pre></li>
</ul>
<h3 id="copy-uboot-files-and-os-filesystem-to-the-sd-card">Copy Uboot Files and OS Filesystem to the SD Card</h3>
<ul>
<li>On a Debian system your SD card partitions should automatically get mounted to /media/boot and /media/root. If this is not the case then make sure your SD cards are mounted and substitute the mount directory referenced in the instructions below.</li>
<li><p>On ubuntu 14.04 you may have to unplug and replug your SD card to make it remount after running mk2partsd from the step above. Also on Ubuntu 14.04 your mount locations may be /media/username/{boot,rootfs}</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cp</span> MLO /media/boot
<span class="kw">cp</span> uImage /media/boot
<span class="kw">cp</span> u-boot.img /media/boot
<span class="kw">sudo</span> tar xaf wheezy.tar.bz2 -C /media/rootfs
<span class="kw">sudo</span> sync
<span class="kw">sudo</span> umount /media/boot
<span class="kw">sudo</span> umount /media/rootfs</code></pre></li>
</ul>
<hr />
<h1 id="how-to-access-the-debian-wheezy-image-running-on-a-gumstix">How to Access the Debian Wheezy Image Running on a Gumstix</h1>
<p>The manual build steps above and the precompiled images set up the base Debian OS to be easily accessed via ssh over wifi, ethernet or USB networking.</p>
<p><strong>NOTE:</strong> USB serial console support for the Debian image is not setup so you will not be able to log in via minicom, etc</p>
<h3 id="recommended-method-for-accessing-precompiled-images">Recommended Method for Accessing Precompiled Images</h3>
<ul>
<li>The easiest way to access your Debian system is via SSH over the USB network interface it provides.</li>
<li>Plug in your Gumstix board which is attached to a daughter board with a usb device port (Tobi, Thumbo, etc) to your host computer.</li>
<li><p>Once the Gumstix board finishes booting the OS you can ssh to it over USB with username:root password:hackgnar</p>
<pre><code>ssh root@172.16.1.2</code></pre></li>
</ul>
<h3 id="credentials-and-ip-addresses-for-the-debian-image">Credentials and IP Addresses for the Debian Image</h3>
<ul>
<li>The precompiled image (or images created with the build script) is setup with the password "hackgnar" for the root user.</li>
<li>The ipaddress for the Gumstix USB network interface is 172.16.1.2</li>
</ul>
<h3 id="other-methods-for-accessing-the-installed-debian-image">Other Methods for Accessing the Installed Debian Image</h3>
<p>Here are all of the methods that you can use to access the image running on your Gumstix Board</p>
<ul>
<li>SSH to the usb network interface located at the address listed above. The Debian image is configured to serve your host computer a DHCP address in the 172.16.1.0/24 block.</li>
<li>SSH to the ethernet interface if you are using a daughter board with ethernet capabilities (Tobi, etc). The eth0 interface will pull a DHCP address.</li>
<li>SSH to the WiFi interface. This will require that you setup your wpa supplicant file located at /etc/wpa_supplicatnt/wpa_supplicant.conf prior to flashing your SD card.</li>
<li>NOTE: USB serial console support for the Debian image is not setup so you will not be able to log in via minicom, etc</li>
</ul>
<h1 id="summary">Summary</h1>
<p>Hopefully you have found this document for installing Debian on a Gumstix Overo useful. Many of the steps can be altered to install different operating systems. With a little alteration of the debootstrap command, you should be able to install any OS supported by debootstrap. This document can also be altered to install Debian based operating systems to different hardware such as the Gumstix DuoVero series. As the only Gumstix product I own is an IronStorm-P COM with a Thumbo and Tobi board, this document only focuses on this hardware.</p>
<p>My next post will cover installing a Kali Linux OS to the Gumstix Overo board. I have already tested this setup extensively and just need to finalize some documentation. Other upcoming posts will cover other various operating systems such as the latest Ubuntu, Fedora, etc.</p>
<p>If you have any comments or questions please feel free to send them my way. You can post comments here or contact me via Twitter <span class="citation">@hackgnar</span>.</p>
</body>
</html>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-20645569510228801092015-03-11T10:14:00.001-07:002015-03-18T13:06:05.447-07:00Building Yocto Linux Images for the Gumstix Overo<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
<p>This writeup goes over some basics on how to build and install a Yocto Linux image for an Overo Gumstix board. The Yocto build described in this document can be directly installed on a Gumstix board or you can utilize the kernel, modules and firmware it creates to construct other Linux distributions (Debian, Kali, Ubuntu, Fedora, etc) for your Gumstix board.</p>
<p>Here is a short summary of what this writeup covers:</p>
<ol style="list-style-type: decimal">
<li>How to manually build and compile a Yocto image for a Gumstix Overo.</li>
<li>A quick alternative way to build a Gumstix Yocto image.</li>
<li>Where to download Yocto images if you are not interested in building them yourself.</li>
<li>How to install a Linux image to an SD card for your Gumstix board.</li>
<li>How to access your image after installation</li>
</ol>
<a name='more'></a>
<h3 id="overview">Overview</h3>
<p>The Yocto Project is a framework for building custom Linux distributions for embedded systems. As I come from a Linux background, I like to think of Yocto as the Gentoo for ARM systems. These custom Linux distributions are typically stripped down to the bare necessities and configured to run as efficient as possible on the target hardware. Hardware vendors that create ARM devices capable of supporting Linux typically recommend Yocto builds and provide full Yocto configurations for their hardware. These Yocto configurations provided by hardware vendors typical include kernel configurations, kernel modules, kernel firmware and base system packages.</p>
<p>Gumstix provides a few different Yocto configurations for building different Linux images. This documentation focuses on building the Gumstix Yocto console (command line only) image but the process for building their other images (such as the desktop XFCE image) is relatively similar.</p>
<p>Another extremely helpful use for vendor supplied Yocto builds and configurations is using the kernel, modules and firmware produced by their Yocto builds with other Linux distributions. If you are reading this article because of my work on the SEWiFi project, this is something I take advantage of in the project. The Gumstix Yocto uBoot files, kernel, modules and firmware files are used to create a functioning Debian ARM distribution for the Gumstix Overo. The follow up to this documentation will show how to use these Yocto files to run a Debian OS on the Gumstix Overo board. Alternatively, these files can also be use to create other operating systems other than Debian.</p>
<p>There are two methods to obtain a Yocto build for the Gumstix Overo. The first method is to download a pre compiled build directly from Gumstix. The second method is to build it yourself. The majority of this documentation focuses on manually building the Gumstix Overo Yocto build manually which has added benefits such as customization or adding additional binary packages to your base image. I have also composed a bash file which scripts the manual build process which is referenced and explained at the end of this documentation.</p>
<p>Finally, if you are interested in installing the Yocto Linux build on your Gumstix Overo board, I will briefly cover this process as well. Installation of the Yocto image is not necessary if you are looking to use the Yocto kernel, modules and firmware to build a Debian (or other OS) image for your Gumstix board. However, the Yocto image installation is almost identical to installing a Debian OS (which I will cover in future documentation), so you make find it useful to review.</p>
<h1 id="manually-building-a-gumstix-overo-yocto-image">Manually Building a Gumstix Overo Yocto Image</h1>
<ul>
<li>If you decided to not to Download the pre-built Yocto images and want to build it yourself from scratch, this section describes the process in detail. Manually building the Yocto system has many benefits such as base image customizations and the ability to add your own packages. I am not going to cover customization or package addition via bitbake (bitbake is very similar to Gentoo's ebuild package management system) here. However, if you are interested in adding your own packages to the base system via bitbake, I will cover that process in a future post. The process takes some time to complete but consecutive builds can be done much faster. Most of this is derived from the docs found <a href="https://github.com/gumstix/Gumstix-YoctoProject-Repo">here</a></li>
<li><p>Also note, that if you want to build the Yocto system but don't want to manually type in all of the following commands, I provide a bash script which automatically runs all of these commands which is covered in the following section.</p></li>
<li><p>Finally, this manual build process was tested on a minimal install Debian 7.7 system. I also successfully tested the build on Kali Linux 1.0.9 but it will likely also build on past revisions.</p></li>
</ul>
<h3 id="download-the-required-packages-for-building">Download the required packages for building</h3>
<ul>
<li><p>These packages are needed to build our base Yocto image</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath libsdl1.2-dev xterm curl</code></pre></li>
</ul>
<h3 id="create-a-build-directory-and-go-there">Create a build directory and go there</h3>
<ul>
<li><p>I like to create a directory structure to house my source code and projects. You do not have to abide by my directory structure, but keep in mind that I will reference these directories throughout this and future documentation.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> -p ~/source/gumstix/yocto
<span class="kw">cd</span> ~/source/gumstix/yocto</code></pre></li>
</ul>
<h3 id="download-the-repo-command-and-add-it-to-your-system">Download the repo command and add it to your system</h3>
<ul>
<li>In order to download the Yocto configurations for the project, we must first install the repo command. In short, repo is basically a wrapper around git which provides a simple way to bundle a bunch of different git repositories into one project.</li>
<li><p>If you are interested in learning more about the repo command, this <a href="http://xda-university.com/as-a-developer/repo-tips-tricks">link is a good start</a></p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O http://commondatastorage.googleapis.com/git-repo-downloads/repo <span class="kw">></span> repo
<span class="kw">chmod</span> a+x repo
<span class="kw">sudo</span> mv repo /usr/local/bin</code></pre></li>
</ul>
<h3 id="initialize-your-yocto-repo-project">Initialize your yocto repo project</h3>
<ul>
<li><p>Now that repo is installed, we are going to download all of the Yocto configs for our project. The init command will take some time as it downloads all of the git repositories associated with the project. The sync command is used to make sure all of your repos are up to date and is useful for updating your Yocto configs if you do a build at a later date.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">repo</span> init -u git://github.com/gumstix/Gumstix-YoctoProject-Repo.git
<span class="kw">repo</span> sync</code></pre></li>
</ul>
<h3 id="change-into-your-yocto-build-environment">Change into your yocto build environment</h3>
<ul>
<li><p>Now that we have our base Yocto configs, we are going to enter our build environment. If for some reason, you exit your bash shell before finishing your Yocto build, you will need to execute this command each time before being able to run all of the consecutive steps. Keep in mind that this also applies to doing builds at a future date.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">export</span> <span class="ot">TEMPLATECONF=</span>meta-gumstix-extras/conf
<span class="kw">source</span> ./poky/oe-init-build-env</code></pre></li>
</ul>
<h3 id="build-with-bitbake">Build with bitbake</h3>
<ul>
<li><p>Yocto projects utilize bitbake in order to compile your Yocto Linux image. Bitbake basically just compiles your base OS, kernel, modules and all of the packages included in your target Linux OS. A Yocto project contains a bunch of recipes (files with the extension bb) which define how each package gets downloaded and compiled. Bitbake recipes are extremely similar to Gentoo ebuild files. If you are interested in adding extra or custom applications to your base Yocto Linux OS you can add and link bitbake recipes to the Gumstix console image. I will not cover adding and customizing bitbake here but it is something I plan to cover in future documentation.</p></li>
<li><p>(Optional) If you are familiar with compiling via make, you can speed up the following compile process by telling bitbake to compile with more threads. This step is not needed but if you are compiling on a system with a high end CPU with many cores, this will speed up your compile time. Keep in mind that the rule of thumb here is you should not specify a -j value greater than the amount of CPU cores present on your build machine.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">export</span> <span class="ot">PARALLEL_MAKE=</span><span class="st">"-j 8"</span></code></pre></li>
<li><p>(Optional) Before we kick off the build, I typically find it useful to download all of the build sources first incase I lose network connectivity. As a Yocto build can take a few hours, I find this extremely useful if I am going to be doing a build on my laptop.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bitbake</span> -c fetchall gumstix-console-image</code></pre></li>
<li><p>Now to build build the Yocto image. Depending on the speed of your computer and how many threads you specified to build with, this step can take a few hours to complete. When the build completes, you can use the image it creates in ~/source/gumstix/yocto/build/tmp/deploy/images/overo/ to either install the Yocto system or use the kernel, modules, firmware contained in the gumstix-console-image-overo-XXXXXXXXXXXXX.rootfs.tar.bz2 file to build a Debian (or other OS) Gumstix image.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bitbake</span> gumstix-console-image</code></pre></li>
</ul>
<h1 id="gumstix-overo-yocto-scripted-build">Gumstix Overo Yocto Scripted Build</h1>
<ul>
<li>In order to speed up the Yocto Gumstix build process, I have composed a bash script from all of the manual build steps described above. The script can be found <a href="https://github.com/hackgnar/gumstix-overo-images/blob/master/yocto/build_gumstix_yocto.sh">here</a>. This script was tested on a base Debian 7.7 and Kali Linux 1.0.9 system. The script should be run as a non root user but it will prompt you periodically for a root password when it needs to run privileged commands. Because of this you should make sure that your root user has a password set. The automated script provides very useful for building Yocto images on a clean system or of if you want to spin up a temporary EC2 instance for building.</li>
</ul>
<h3 id="download-the-build-script">Download the Build Script</h3>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/build_gumstix_yocto.sh</code></pre>
<h3 id="run-the-build-script">Run the Build Script</h3>
<ul>
<li><p>The script should not be run as root. Note however that you will be asked for the root password multiple times during the build process since the script utilizes the su command.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">bash</span> build_gumstix_yocto.sh</code></pre></li>
</ul>
<h1 id="precompiled-image-build">Precompiled Image Build</h1>
<p>If you are not interested in building Yocto from scratch, you can always download and install precompiled images. The image provided below was generated by myself from the steps listed above.</p>
<h3 id="download-the-base-image-uboot-files">Download the base image uboot files</h3>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">mkdir</span> myimage
<span class="kw">cd</span> myimage
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/MLO
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/uImage
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/u-boot.img
<span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/yocto/uboot_image/gumstix-console-image-overo-20141218160757.rootfs.tar.bz2</code></pre>
<h1 id="install-image-to-sd-card">Install image to SD Card</h1>
<p>Once you have built or downloaded your image, you can use the steps listed in this section to flash the image to an SD card. You can then use the SD card to boot your Gumstix board.</p>
<ul>
<li>requires a linux machine</li>
</ul>
<h3 id="insert-your-sd-card">Insert your SD Card</h3>
<ul>
<li>note the device block it gets mapped to. In most instances it will /dev/sdb</li>
</ul>
<h3 id="format-your-sd-card">Format your SD card</h3>
<ul>
<li><p>in the command below, replace sdX with the device your SD card was mapped to which you noted in the previous step</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">curl</span> -O https://raw.githubusercontent.com/hackgnar/gumstix-overo-images/master/mk2partsd
<span class="kw">./mk2partsd</span> /dev/sdX</code></pre></li>
</ul>
<h3 id="copy-uboot-files-to-the-sd-card">Copy uboot files to the SD card</h3>
<ul>
<li><p>On a Debian system your SD card partitions should automatically get mounted to /media/boot and /media/root. If this is not the case then make sure your SD cards are mounted and substitute the mount directory referenced in the instructions below.</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cp</span> MLO /media/boot
<span class="kw">cp</span> uImage /media/boot
<span class="kw">cp</span> u-boot.img /media/boot
<span class="kw">tar</span> xaf yocto.tar.bz2 -C /media/rootfs
<span class="kw">sync</span>
<span class="kw">umount</span> /media/boot
<span class="kw">umount</span> /media/rootfs</code></pre></li>
</ul>
<h1 id="how-to-access-your-image-running-on-a-gumstix">How to Access your image running on a Gumstix</h1>
<p><strong>NOTE:</strong> there is no simple way to access a stock Yocto image via a networked USB interface. In the future, Ill create some documentation on how to add USB network access to a stock Yocto Gumstix build prior to installation. I will also update the stock image provided in this repository to have network access via USB by default.</p>
<h3 id="recommended-method-for-accessing-precompiled-images">Recommended Method for Accessing Precompiled Images</h3>
<ul>
<li>Access your Gumstix device via the USB console using a daughterboard such as the Tobi or Janus with minicom</li>
</ul>
<h3 id="credentials-and-ip-addresses-for-the-yocto-image">Credentials and IP Addresses for the Yocto Image</h3>
<ul>
<li>The stock Yocto image has no password for the root user so you can simply log in via the USB console</li>
<li>You may also SSH in if you are using a daughterboard with an ethernet adapter.</li>
</ul>
<h3 id="accessing-the-installed-yocto-image">Accessing the Installed Yocto Image</h3>
<p>Here are the methods that you can use to access the image running on your Gumstix Board</p>
<ul>
<li>SSH to the ethernet interface if you are using a daughter board with ethernet capabilities (Tobi, etc). The eth0 interface will pull a DHCP address.</li>
<li>You may also alter the /etc/network/interfaces file before flashing your SD card. If you are doing this, you can set network interface usb0 to a static IP address so you can ssh to it. Note however, your base system will not pull a DHCP address unless you set up a DHCP service on the base OS. Here is an example of how you could access your system via USB if you include usb0 with a static ip in your network interfaces file.</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># assume you set usb0 to static IP 172.16.1.2</span>
<span class="co"># after your Gumstix which is connected via usb boots up, run this on your host computer</span>
<span class="kw">ifconfig</span> eth0 172.16.1.3
<span class="kw">ssh</span> root@172.16.1.2</code></pre>
</body>
</html>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com4tag:blogger.com,1999:blog-2947245848405513225.post-87169514335743444482015-03-06T13:22:00.001-08:002015-03-10T11:27:11.991-07:00How to get started with OneGet on Windows 10 Technical Preview<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<style type="text/css">
pre {background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;}
code {background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;}
</style>
</head>
<body>
Ill start this post off by saying, I am not a huge Windows fan, but due to my line of work, I must keep up with Windows as much as possible. One of the newest features which actually excites me is the addition of the windows command line package management system called OneGet which can be found in the latest versions of Powershell and Windows. If you are familiar with Linux based package management systems such as apt, yum, and ebuild then you can think of OneGet as the Windows version of these systems.<br /><br />
As of now, OneGet is available in Powershell version 5 which comes with Windows 10 Technical Preview. You can also utilize OneGet on Windows 8.1 if you upgrade Powershell to version 5 with the Windows Management Framework Preview which is available <a href="http://go.microsoft.com/fwlink/?LinkId=398175">here</a>.<br /><br/>
In this tutorial, I will assume you are going the Windows 10 route as I find updating Windows to 8.1 to be too time consuming for my tastes.<br /><br/>
<a name='more'></a>
<h3 id="obtain-a-free-copy-of-windows-10-tp">
Obtain a free copy of Windows 10 TP</h3>
At the time of writing (3/6/15) you can head over to <a href="http://windows.microsoft.com/en-us/windows/preview-iso">their download page</a> and download a free copy of Windows 10 TP. Go ahead and install this to a virtual manchine or to a test box.<br /><br/>
<h3 id="enable-the-ability-to-run-powershell-scripts">
Enable the Ability to run Powershell Scripts</h3>
Before we get started, we must first enable the ability to run Powershell scripts in your Windows environment. By default, Windows will allow you to run Powershell but will not allow externally generated Powershell scripts to be run. Oneget and Chocolaty typically run Powershell scripts to finalize the installation of applications installed from OneGet.<br /><br/>
<h4 id="open-up-an-administrator-powershell-console">
Open up an administrator Powershell console</h4>
<ul>
<li>type Win + r to pop open a run command window and type <code>powershell</code></li>
</ul>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3xEhOBq9KOdaqzO0M2X4RWOkfz2gmoQe99Zm-MHohcAIszGQCxQNF7ekB8vOjhDeGwG5S3A4CYi8cC_crnRay_fks7ayNbVdggKo6_vydFBbgwtdGZzgeoSI-RmDtGpWTkX-SXFoQ7_4/s1600/startps.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3xEhOBq9KOdaqzO0M2X4RWOkfz2gmoQe99Zm-MHohcAIszGQCxQNF7ekB8vOjhDeGwG5S3A4CYi8cC_crnRay_fks7ayNbVdggKo6_vydFBbgwtdGZzgeoSI-RmDtGpWTkX-SXFoQ7_4/s1600/startps.png" /></a>
</div>
<ul>
<li>Either right click on the Powershell icon on your taskbar and click "Run as Administrator" or type the following into your current Powershell console</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">Start-Process</span> powershell -Verb runas</code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7a41Q6kDwbou6ysePuEHFa1rfn9gzocVQwBKTKKRfDNx3fyxCG2Yeukq4RDJvWsThU1war1qe5WfR-SMQ-SxlNfrlPpA_ALr8fwCsOPcIXjywW5HvpYWaAVw3kxt7cANd6bJGAD68UPg/s1600/runas.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7a41Q6kDwbou6ysePuEHFa1rfn9gzocVQwBKTKKRfDNx3fyxCG2Yeukq4RDJvWsThU1war1qe5WfR-SMQ-SxlNfrlPpA_ALr8fwCsOPcIXjywW5HvpYWaAVw3kxt7cANd6bJGAD68UPg/s1600/runas.png" /></a>
</div>
<h4 id="enable-powershell-scripts">
Enable Powershell scripts</h4>
<ul>
<li>in the administrator powershell window, run the following</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">Set-ExecutionPolicy</span> Unrestricted </code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht9DmQ0ccedSvlE9Zb_pHXp80sZo6_yl1QRFr2qtPHFvVm4kcJ7_4RN7lARFkI6V-1eJu0B8-hUr3yFFbqLdNZshXFeV3b2pY7Ye7t6GQZiIr6JMSWzdxXFP00kzky7JKy6mexvUHPrqY/s1600/executionpolicy.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht9DmQ0ccedSvlE9Zb_pHXp80sZo6_yl1QRFr2qtPHFvVm4kcJ7_4RN7lARFkI6V-1eJu0B8-hUr3yFFbqLdNZshXFeV3b2pY7Ye7t6GQZiIr6JMSWzdxXFP00kzky7JKy6mexvUHPrqY/s1600/executionpolicy.png" /></a>
</div>
<ul>
<li>In the above command, I set the execution policy to unrestricted. If you want to be more secure, you can chose a more restricted execution level. Details on the execution policy settings can be found <a href="https://technet.microsoft.com/en-us/library/ee176961.aspx">here</a></li>
</ul>
<h4 id="close-your-admin-window">
Close your admin window</h4>
<ul>
<li>For the rest of this tutorial, we will be using the non-administrator Powershell console. If you have closed it, go ahead and open it again and close the admin console by clicking the close button in the top right corner or by typing <code>exit</code></li>
</ul>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6pwAtXBK8FqH2LJdx6Z94ORpjif3Diuct1WS6I2kKgUAwdrXBiEfv7mcYzKuNRd7mjKPaLg5fqpar41dFp6M-bP0Wy6c-1QGktcGMm2TizJvDfkdpHPtlbNtBBKMJ2Tkcckgj2pRzoV4/s1600/exitadmin.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6pwAtXBK8FqH2LJdx6Z94ORpjif3Diuct1WS6I2kKgUAwdrXBiEfv7mcYzKuNRd7mjKPaLg5fqpar41dFp6M-bP0Wy6c-1QGktcGMm2TizJvDfkdpHPtlbNtBBKMJ2Tkcckgj2pRzoV4/s1600/exitadmin.png" /></a>
</div>
<h3 id="install-the-nuget-package">
Install the NuGet package</h3>
<ul>
<li>Before we start installing packages, we have to install the NuGet package. The NuGet package management tool is used to manage software dependancies of all of the packages we will be installing. You can find more about NuGet <a href="https://www.nuget.org/">here</a>.</li>
<li>Note: during the nuget.vs install step, you may see an error. Just go ahead and install it and ignore the error. I have not found a solution for properly avoiding the error in this step. The error does not seem to affect anything.</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">install-package</span> nuget.vs</code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPFQjjGbdgcjJdxOUTKczL6Q1Mc1Zm4lwi999WlFdC3uwWO4Gq6tZvVJgJVEiB3aVDDkehdgwThOv41Z4Ojax6bmqfwUxam_oh-_b3j-iT8sWT1lAkNeMIl2YxCj1muFBx3gZl3J8EbKo/s1600/nuget.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPFQjjGbdgcjJdxOUTKczL6Q1Mc1Zm4lwi999WlFdC3uwWO4Gq6tZvVJgJVEiB3aVDDkehdgwThOv41Z4Ojax6bmqfwUxam_oh-_b3j-iT8sWT1lAkNeMIl2YxCj1muFBx3gZl3J8EbKo/s1600/nuget.png" /></a>
</div>
<h3 id="find-a-package-to-install">
Find a package to install:</h3>
<ul>
<li>This step is optional, but it shows how we can search for packages with OneGet. In this example, we are looking for the Windows SSH package named Putty.</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">find-package</span> putty</code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUzGvHqgFTabd9wl6TNNvq9YVG06kTeDCrMWbmVgBB-VJvgZ9PREWvO5QhJSyQ7OEWSfpCefSYBqXOr_VvnTs8uGsCC5w3lMjNRTsWJiWkcD49WDys5o0AessKh7wHxK2l_WXAeLT_eys/s1600/find.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUzGvHqgFTabd9wl6TNNvq9YVG06kTeDCrMWbmVgBB-VJvgZ9PREWvO5QhJSyQ7OEWSfpCefSYBqXOr_VvnTs8uGsCC5w3lMjNRTsWJiWkcD49WDys5o0AessKh7wHxK2l_WXAeLT_eys/s1600/find.png" /></a>
</div>
<h3 id="install-a-package">
Install a package:</h3>
<ul>
<li>Once we know our package exists in our application repositories, we can install it with the following command.</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">install-package</span> putty</code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiifqPN5G37LM1GCCUQcg5wBK1RlnwrruuKa1VXeHsvONh3p017V-ROXn_L34cLvya210qq1f8kt8ddLfF57mmOnyeAJU45HOT6ZS80rwwx5DYozDh4W9qbn4DYWDH25oVaEosYQLe5BXk/s1600/install.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiifqPN5G37LM1GCCUQcg5wBK1RlnwrruuKa1VXeHsvONh3p017V-ROXn_L34cLvya210qq1f8kt8ddLfF57mmOnyeAJU45HOT6ZS80rwwx5DYozDh4W9qbn4DYWDH25oVaEosYQLe5BXk/s1600/install.png" /></a>
</div>
<h3 id="run-your-newly-installed-application">
Run your newly installed application</h3>
<ul>
<li>That's it!!! Most applications get installed to the directory . To start up the example putty application we installed in the previous step, run the following:</li>
</ul>
<pre class="sourceCode bash"><code class="sourceCode bash">\<span class="kw">chocolatey</span>\bin\putty.bat</code></pre>
<div class="figure">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibb6_9TDEHgC_FL5cqHroVRN1NPQhymUjoFENdCjYLz7sRUKRwmB_kq7_7tjjpjGCJDtTNyLsqRS_x-mjmTAOnDJ82yl9jr4pUl2afLpnfcVY6V1tPzQK9Mau9743hWPsLIuT_JU0qU5M/s1600/run.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibb6_9TDEHgC_FL5cqHroVRN1NPQhymUjoFENdCjYLz7sRUKRwmB_kq7_7tjjpjGCJDtTNyLsqRS_x-mjmTAOnDJ82yl9jr4pUl2afLpnfcVY6V1tPzQK9Mau9743hWPsLIuT_JU0qU5M/s1600/run.png" /></a>
</div>
</body>
</html>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-22459030365806091042014-03-05T19:13:00.002-08:002014-03-05T19:36:26.292-08:00Bluetoothdatabase.com is now retired...In 2013 I released the "Bluetooth Device Database" project and spoke about it at DEFCON 21. Recently, I grew tired of paying my EC2 bill and decided to retire the project. All of the source code used to create the clients and server is still available in my <a href="https://github.com/hackgnar/bluetoothdatabase">bluetoothdatabase github repo</a>.<br />
<br />
The slides and videos from the DEFCON 21 talk can be found <a href="https://www.defcon.org/html/links/dc-archives/dc-21-archive.html#Holeman">here</a>.<br />
<br />
If you have any questions about the project feel free to contact me.Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-24876899824006455092014-01-02T08:25:00.000-08:002015-03-06T13:47:01.781-08:00Using Pure Python to Interact With an Ubertooth and Parse Bluetooth Baseband DataIn mid 2013 I gave a talk at a conference called Lockdown in Wisconsin. During the talk I released a pure python library for parsing rudimentary bluetooth baseband data and interacting with an Ubertooth USB device.<br />
<br />
The core Ubertooth C libraries and tools are much more robust (and faster), but the pure python implementation provided the following:<br />
<br />
<ul>
<li>Quick deployment with no need for compiling.</li>
<li>Rapid prototyping of new and custom Ubertooth tools in python.</li>
<li>Quick and easy way to hook up an Ubertooth to mobile phones and other ARM devices.</li>
<li>Ubertooth data integration into my favorite python analytic libraries</li>
<li>An excuse for me to better understand the baseband layer and pyusb</li>
</ul>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a name='more'></a></h5>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
Quick Notes:</h5>
<div>
<ul>
<li>you will need the pure python <a href="http://sourceforge.net/projects/pyusb/">pyusb library</a> installed to use pyubertooth </li>
</ul>
</div>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
Setup:</h5>
<div>
<ul>
<li>download the pyubertooth source code via git</li>
<li>the cli pyubertooth.py is in the pyubertooth/pyubertooth directory</li>
</ul>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><span style="font-size: 12px;">git clone https://github.com/hackgnar/pyubertooth.git</span></pre>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><span style="font-size: 12px;">cd pyubertooth/pyubertooth</span></pre>
</div>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
For usage help:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --help
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-log-ubertooth-data-to-a-file-usable-with-ubertooth-rx--i-filename" name="to-log-ubertooth-data-to-a-file-usable-with-ubertooth-rx--i-filename" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To log ubertooth data to a file (usable with ubertooth-rx -i filename):</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --outfile=dump_filename.dump
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-log-ubertooth-data-directly-to-a-file-from-bluetooth-channel-60" name="to-log-ubertooth-data-directly-to-a-file-from-bluetooth-channel-60" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To log ubertooth data directly to a file from bluetooth channel 60:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --outfile=dump_filename.dump --channel 60
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-log-30-seconds-worth-of-ubertooth-data-directly-to-a-file-" name="to-log-30-seconds-worth-of-ubertooth-data-directly-to-a-file-" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To log 30 seconds worth of ubertooth data directly to a file :</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --outfile=dump_filename.dump -t 30
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-log-300-ubertooth-usb-data-packets-directly-to-a-file-" name="to-log-300-ubertooth-usb-data-packets-directly-to-a-file-" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To log 300 ubertooth usb data packets directly to a file :</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --outfile=dump_filename.dump -n 300
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-read-raw-ubertooth-usb-data-from-a-dump-file-to-std-out" name="to-read-raw-ubertooth-usb-data-from-a-dump-file-to-std-out" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To read raw ubertooth usb data from a dump file to std out:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --infile=dump_filename.dump
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-display-bluetooth-packet-information-from-a-dump-file-lap-uap-channel-etc" name="to-display-bluetooth-packet-information-from-a-dump-file-lap-uap-channel-etc" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To display bluetooth packet information from a dump file (LAP, UAP, channel, etc):</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --infile=dump_filename.dump --btbb
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-display-bluetooth-packet-information-from-a-live-stream-lap-uap-channel-etc" name="to-display-bluetooth-packet-information-from-a-live-stream-lap-uap-channel-etc" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To display bluetooth packet information from a live stream (LAP, UAP, channel, etc):</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">python ubertooth.py --btbb
</code></pre>
<h3 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#sample-python-library-usage" name="sample-python-library-usage" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Sample python library usage:</h3>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-open-a-connection-to-an-ubertooth-device" name="to-open-a-connection-to-an-ubertooth-device" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To open a connection to an ubertooth device:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-access-5-data-blocks-from-an-ubertooth-device-as-a-python-iterator" name="to-access-5-data-blocks-from-an-ubertooth-device-as-a-python-iterator" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To access 5 data blocks from an ubertooth device as a python iterator:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
for data in ut.rx_stream(count=5):
print data
ut.close()
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-access-data-blocks-from-an-ubertooth-device-as-a-python-iterator-for-30-seconds" name="to-access-data-blocks-from-an-ubertooth-device-as-a-python-iterator-for-30-seconds" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To access data blocks from an ubertooth device as a python iterator for 30 seconds:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
for data in ut.rx_stream(secs=30):
print data
ut.close()
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#to-access-data-from-an-ubertooth-device-until-ctrl-c-is-pressed" name="to-access-data-from-an-ubertooth-device-until-ctrl-c-is-pressed" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>To access data from an ubertooth device until ctrl-C is pressed:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
try:
for data in ut.rx_stream():
print data
except KeyboardInterrupt:
pass
ut.close()
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#an-example-of-directly-streaming-ubertooth-data-to-a-file-for-60-seconds" name="an-example-of-directly-streaming-ubertooth-data-to-a-file-for-60-seconds" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>An example of directly streaming ubertooth data to a file for 60 seconds:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
f = open("dump_filename.dump", 'wb')
for data in ut.rx_stream(secs=60):
f.write(data)
f.close()
ut.close()
</code></pre>
<h5 style="box-sizing: border-box; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1em; line-height: 25.5px; margin: 1em 0px 15px; padding: 0px; position: relative;">
<a class="anchor" href="https://github.com/hackgnar/pyubertooth#changing-the-channel-on-an-ubertooth-device" name="changing-the-channel-on-an-ubertooth-device" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Changing the channel on an ubertooth device:</h5>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: middle; word-wrap: normal;">import ubertooth
ut = Ubertooth()
ut.set_channel(66)</code></pre>
<br />
<br />
The libraries for this project only provide a fraction of Ubertooth's capabilities, and the baseband parser only provide LAP address and address parsing on baseband data. As time goes on, I will try to expand the functionality and speed of the library. I have also considered creating a python ctypes variant of the library to take advantage of the core Ubertooth C libaries. A ctypes variant would be much faster while still providing a python API for interacting with the Ubertooth and its data.<br />
<br />
The pure python libraries can be found in <a href="https://github.com/hackgnar/pyubertooth">this github repo</a>, but be warned, the code is ugly and needs some serious refactoring.Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com1tag:blogger.com,1999:blog-2947245848405513225.post-76722910655493733512014-01-01T07:49:00.000-08:002014-03-06T07:50:35.264-08:00My 2013 DEFCON 21 Video and Audio on the Bluetooth Database project are now avalableAt DEFCON 21 I gave a talk about tracking bluetooth devices on a large scale. The videos from this presentation are now available <a href="https://www.defcon.org/html/links/dc-archives/dc-21-archive.html#Holeman">here</a>.<br />
<br />
During the presentation I released an IOS tool which sideloaded bluetooth functionality to allow an iphone to track other bluetooth devices. The tool then sent the data to a web service for storage & analysis. The code used to create the IOS sensor node and the corresponding server code can be found <a href="https://github.com/hackgnar/bluetoothdatabase">here</a>.<br />
<br />
The data gathered from this project showed:<br />
<br />
<ul>
<li>Tracking of bluetooth devices over time via geolocation</li>
<li>The percentage of stationary to moving devices in a large sample set</li>
<li>What were the most popular deployed devices at the time (vendor, os, device type, etc)</li>
<li>Provided a mechanism for statistically deriving NAP addresses when doing passive monitoring</li>
</ul>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-12148958763465605912013-08-01T20:45:00.000-07:002014-03-05T20:46:20.392-08:00Passive Aggressive Bluetooth Scanning with PythonI will be giving a talk titled "Passive Aggressive Bluetooth Scanning with Python" at BSides LA on 8/22/13. Here is a summary of the talk:<br />
<br />
<i>Bluetooth devices can be scanned either though active or passive techniques. Active scanning is done with commodity bluetooth hardware and utilizes fundamental bluetooth features whereas passive scanning techniques require specialized hardware and software libraries to consume and interpret the lowest levels of the bluetooth stack. The aim of this talk is to show how both techniques can be used together to obtain more thorough scan results. During this talk, I will go over some of the newly released python libraries I created for passive bluetooth monitoring and present demos and sample tools which combine both passive and active scanning techniques.</i><br />
<i><br /></i>
All slides and content related to this talk can be found in <a href="https://github.com/hackgnar/BSidesLA_2013">this github repo</a>.Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-29214951977923922282013-07-01T20:53:00.000-07:002014-03-05T21:04:44.882-08:00The Bluetooth Device DatabaseI will be speaking at DEFCON 21 this year about a project of mine titled "The Bluetooth Device Database". In short, this is a fun project of mine that shows how track-able people are by discoverable bluetooth devices. Here is a summary of the talk:<br />
<br />
<i>As of 2013, it is estimated that there are now billions of bluetooth devices deployed worldwide. The goal of the Bluetooth Database Project is to track and freely distribute real time sightings and statistics of these wide spread devices. The data collected from these devices can be used to answer questions pertaining to various topics, such as device geolocation, device proliferation, population analysis, device misconfigurations, and an assortment of other security related analytics.</i><br />
<i><br /></i>
<i>During this presentation I will go over the current community driven, distributed, real time, client/server architecture of the project. I will show off some of analytics that can be leveraged from the projects data sets. Finally, I will be releasing various open source open source bluetooth scanning clients (Linux, iOS, OSX). These clients are easily installable across various operating systems and can be used to systematically contribute data to the project. </i><br />
<i><br /></i>
All content related to this project which includes slides, client code, and server code can be found in <a href="https://github.com/hackgnar/bluetoothdatabase">this github repo.</a><br />
<br />
<br />
<div>
<br /></div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-6939996938841408352013-06-03T21:02:00.000-07:002014-03-05T21:03:09.712-08:00Passive Bluetooth Monitoring with Scapy and Pandas @ Lockdown 2013I will be giving a talk titled "Passive Bluetooth Monitoring with Scapy and Pandas" at Lockdown 2013. During this talk, I will be boring the audience with some Pandas data analytics as well as releasing some new tools. Included in these tools is a rough proof of concept pure python bluetooth baseband library for use with the Ubertooth dongle.<br />
<br />
The slides, demo code and other content will be available at <a href="https://github.com/hackgnar/lockdown_2013">this github repo</a>.<br />
<br />Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-35315564127036562832013-01-10T18:58:00.000-08:002014-03-05T18:58:56.182-08:00My 2012 Blackhat Ubertooth/Scapy slides, videos and content is now avalableThe video, slides and content from my Ubertooth/Scapy talk at Blackhat USA 2012 is now available <a href="https://www.blackhat.com/html/bh-us-12/bh-us-12-archives.html#Holeman">here</a>. This talk was a shorter version of my DEFCON 20 talk.<br />
<br />
Here is a summary of the content:<br />
<br />
<i>Recognizing a need to support passive bluetooth monitoring in Scapy, Python's interactive monitoring framework, a project was launched to produce this functionality. Through this functionality, a new means for interactively observing bluetooth was created along with Python APIs to assist in the development of bluetooth auditing, pentesting and exploitation tools.</i><br />
<i><br /></i>
<i>The project supplements the work of Michael Ossman et al by providing Python extensions and Scapy modules which interact with an Ubertooth dongle. The project also provides support for other passive bluetooth techniques not present in the current Ubertooth core software such as NAP identification, vendor lookup, extended logging and more.</i><br />
<i><br /></i>
<i>In conjunction with this presentation, the source for this project will be released along with distribution packages for easy installation.</i>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-60443523397831451232013-01-06T13:57:00.000-08:002014-03-05T13:58:02.520-08:00My Defcon 2012 audio and slides<span style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px;">If you are interested in Defcon 2012 content on Scapy and Ubertooth... My Defcon 2012 audio and slides can be found </span><a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="background-color: white; color: #4183c4; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;">here</a><span style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px;"> .</span>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-9687985289596036692012-07-31T13:55:00.000-07:002014-03-05T13:55:43.087-08:00A nice writeup of my Defcon 20 Scapy/Ubertooth talk<span style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px;">There is a nice writeup of my Scapy/Ubertooth talk over at </span><a href="http://www.lavamunky.com/" style="background-color: white; color: #4183c4; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;">lavamonky.com</a><span style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px;">. Ive gotten a lot of great feedback on the project and love hearing what others have to say about it. </span><a href="http://www.lavamunky.com/2012/08/defcon-20-thoughts-on-10-days-in-vegas.html" style="background-color: white; color: #4183c4; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin: 0px; padding: 0px; text-decoration: none;">Here</a><span style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px;"> is a direct link to the article if you are interested.</span>Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-92086350202511766002012-07-26T13:53:00.000-07:002014-03-05T20:36:28.387-08:00Slides, libraries and tutorials from my Defcon and Blackhat talks on Scapy and Bluetooth Baseband.<h4 style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 26px; margin: 0px; padding: 18px 0px 4px; text-transform: uppercase;">
SUMMARY</h4>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; padding: 0px;">
Well, I had a great time presenting my talk at Blackhat and Defcon this year. I got some great feedback and met some awesome people. If you were not at the conference or want the most up to date versions of my content, here are links to everything...</div>
<h4 style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 26px; margin: 0px; padding: 18px 0px 4px; text-transform: uppercase;">
SLIDES</h4>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; padding: 0px;">
<a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">Here</a> is a link to the slides from my talks. These are more up to date then the ones on the conference media and are the ones I actually used for the presentations.</div>
<h4 style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 26px; margin: 0px; padding: 18px 0px 4px; text-transform: uppercase;">
SCAPY BTBB LIBRARY</h4>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; padding: 0px;">
<a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">Here</a> is the latest version of the scapy bluetooth baseband layer I wrote. This is the module you need in order to populate bluetooth baseband data into scapy via pcap files. I will be committing an updated version of this library into the scapy community repository in the near future. The version being committed to scapy community has a few more btbb utility functions and has the pcap stream class separated from the layer code. The stream class will be moved to a more appropriate location.</div>
<h4 style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 26px; margin: 0px; padding: 18px 0px 4px; text-transform: uppercase;">
DEMOS AND TUTORIALS</h4>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; padding: 0px;">
I wrote some in depth tutorials and demos for my talk. The first demo (<a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">pdf</a> | <a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">ipython notebook</a>) goes into great detail on how to use btbb pcap data in scapy. The second (<a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">pdf</a> | <a href="https://www.defcon.org/html/links/dc-archives/dc-20-archive.html#Holeman" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">ipython notebook</a>) demo shows how to do some basic number crunching and basic plotting on scapy bluetooth baseband data. Both demos are in ipython notebook and pdf format. If you are unfamiliar with ipython notebook, keep an eye on my site as I am working on a few tutorials or just check out their <a href="http://ipython.org/" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">main site</a>.</div>
<h4 style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 26px; margin: 0px; padding: 18px 0px 4px; text-transform: uppercase;">
PROJECT ROADMAP</h4>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; padding: 0px;">
The next major milestone for this project will be to clean up the code and commit it to the Scapy community repo. After this occurs, I will create a few more tutorials and demos and host them here at <a href="http://hackgnar.com/" style="color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;">hackgnar.com</a>. These tutorials will demo how to use my library as part of scapy community as opposed to the standalone module I presented at the conferences. I also have a rough implementation of a direct Scapy ubertooth interface. Once this is finished, it will be merged into the project. The best way to receive updates and news on my work is to follow me on twitter or keep an eye on this site.</div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-13030592614018488542012-06-05T13:45:00.000-07:002014-03-05T13:45:37.411-08:00Installing the latest bluez software in ubuntu 12.04 along with the test suite tools<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Compiling the bluez software in linux is fairly straight forward, but getting getting the bluez test applications to build can be a pain your first time doing it. The test tools included with the source give us many cool applications not typically installed with ubuntus binary bluez package (i.e. apt-get install bluez). One of the applications included in the test tools that I use all the time is bdaddr. The bluez bdaddr tool allows users to change thier bluetooth mac address which can be useful for mitm attacks on bluetooth devices.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
This tutorial is really short, but it should save you tons of time if you have never done this before. The thing that hung me up my first time was the build dependancy in the test tools called "check". If check is not installed, the test tools build fails, but the rest of the bluez source is compiled. This can lead to some frustration if you cant figure out why your test tools are not being compiled. Lets get started...</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
First, lets install some required tools.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">sudo apt-<span class="keyword" style="font-weight: bold; margin: 0px; padding: 0px;">get</span> install build-essential libdbus-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">1</span>-dev check
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now, lets download the latest bluez software.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">wget http:<span class="comment" style="color: #999988; font-style: italic; margin: 0px; padding: 0px;">//www.kernel.org/pub/linux/bluetooth/bluez-4.101.tar.gz</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now lets untar it.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">tar xfvz bluez-4.101.tar.gz
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Finally, lets build our package.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">cd bluez-4.101
./configure --enable-test
make
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
If you want, you can now run "sudo make install" to install the binaries to your distro packages. I typically dont do this. Also, if you are looking for the bdaddr tool, it is built in the bluez source's "test" directory</div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com1tag:blogger.com,1999:blog-2947245848405513225.post-26807482759802496802012-06-03T13:41:00.000-07:002014-03-05T13:44:21.858-08:00Installing the latest Kismet client and server with uberooth support in ubuntu 12.04<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
The following tutorial is a step by step guide on how I go about setting up Kismet with uberooth support on a fresh ubuntu 12.04 install. The guide will work on both 32 and 64 bit OS variants and can also be altered to work on other distros.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
This tutorial assumes you already have a working ubertooth setup. If you do not, please follow my other guides on this site for setting up your ubertooth device.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
First, I like to create a work directory for all my Source code, so lets create it and change to that directory:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="javascript" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">mkdir ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source
cd ~/</span>Source
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
We will need to install some packages for the task.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">sudo apt-<span class="keyword" style="font-weight: bold; margin: 0px; padding: 0px;">get</span> install build-essential git subversion libncurses-dev libpcap-dev libnl-dev libpcre3-dev
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Lets grab the latest Ubertooth source code and store it in a directory labeled ubertooth-latest:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">svn co https:<span class="comment" style="color: #999988; font-style: italic; margin: 0px; padding: 0px;">//ubertooth.svn.sourceforge.net/svnroot/ubertooth ubertooth-latest</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now, lets download the latest kismet release:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">wget http:<span class="comment" style="color: #999988; font-style: italic; margin: 0px; padding: 0px;">//www.kismetwireless.net/code/kismet-2011-03-R2.tar.gz</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now we can untar our kismet source and cd into the source directory.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">tar xfvz kismet-2011-03-R2.tar.gz
cd cd kismet-2011-03-R2
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
We can now configure and compile and install our latest kismet code.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">./configure
make
sudo make install
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
We must now compile our ubertooth kismet plugin. Assuming you checked out the latest ubertooth source in the same directory listed above, run the following.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ruby" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="identifier" style="margin: 0px; padding: 0px;">cd</span> ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source/ubertooth</span>-<span class="identifier" style="margin: 0px; padding: 0px;">latest</span>/<span class="identifier" style="margin: 0px; padding: 0px;">trunk</span>/<span class="identifier" style="margin: 0px; padding: 0px;">host</span>/<span class="identifier" style="margin: 0px; padding: 0px;">kismet</span>/<span class="identifier" style="margin: 0px; padding: 0px;">plugin</span>-<span class="identifier" style="margin: 0px; padding: 0px;">ubertooth</span>
<span class="identifier" style="margin: 0px; padding: 0px;">sudo</span> <span class="constant" style="color: teal; margin: 0px; padding: 0px;">KIS_SRC_DIR</span>=~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source/kismet</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">2011</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">03</span>-<span class="constant" style="color: teal; margin: 0px; padding: 0px;">R2</span> <span class="identifier" style="margin: 0px; padding: 0px;">make</span> <span class="identifier" style="margin: 0px; padding: 0px;">install</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
The next steps are optional, but without them, you will not have bluetooth baseband pcap files and you will have to manually setup your uberooth device each time you start kismet server and client.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
In your kismet conf file, find the "logtypes" line and append pcapbtbb to the end. The line in my conf file for logtypes is as follows.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ini" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="setting" style="margin: 0px; padding: 0px;">logtypes=<span class="value" style="margin: 0px; padding: 0px;">pcapdump,gpsxml,netxml,nettxt,alert,pcapbtbb</span></span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
I also like to include my ubertooth device in my conf file so it is up and working each time I fire up kismet. In order to do this, find the ncsource section of your kismet configuration file and add the following line.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ini" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="setting" style="margin: 0px; padding: 0px;">ncsource=<span class="value" style="margin: 0px; padding: 0px;">uberooth</span></span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
There you have it, you should now be on your way to viewing bluetooth traffic in kismet with your uberooth device</div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-40299779639777638252012-06-02T13:40:00.000-07:002014-03-05T13:43:53.047-08:00Compiling the newest firmware for the Ubertooth on Ubuntu 12.04<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Keeping the firmware on your Ubertooth up to date with the latest code changes will give you access to the newest fixes and features available for the device. It is not clearly evident to all uses that the software for this device is in constant growth and not automatically updated, so this tutorial will help you quickly learn how you can sync your firmware with the latest greatest device code.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Learning how to do this for the first time can prove to be a daunting task if you have never compiled code with the gcc arm embedded compiler. This tutorial will walk you though step by step on the process for ubuntu 12.04 variants and should also work with minimal changes for other OS versions and variants. Also note, this tutorial will work for both 32 and 64 bit ubuntu operating systems.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
First, I like to create a work directory for all my Source code, so lets create it and change to that directory:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="javascript" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">mkdir ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source
cd ~/</span>Source
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
We will need to install some packages for the task.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">sudo apt-<span class="keyword" style="font-weight: bold; margin: 0px; padding: 0px;">get</span> install python-dev build-essential git subversion libusb-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">1.0</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">0</span>-dev python-pip
sudo pip install pyusb
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
If you are on a 64 bit OS you will also need to install the following:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">sudo apt-<span class="keyword" style="font-weight: bold; margin: 0px; padding: 0px;">get</span> install ia32-libs
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Grab the latest gcc arm source code:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ruby" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="identifier" style="margin: 0px; padding: 0px;">wget</span> <span class="identifier" style="margin: 0px; padding: 0px;">https</span><span class="symbol" style="color: #0086b3; margin: 0px; padding: 0px;">:</span>/<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/launchpad.net/gcc</span>-<span class="identifier" style="margin: 0px; padding: 0px;">arm</span>-<span class="identifier" style="margin: 0px; padding: 0px;">embedded</span>/<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">4.6</span>/<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">4.6</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">2012</span>-<span class="identifier" style="margin: 0px; padding: 0px;">q1</span>-<span class="identifier" style="margin: 0px; padding: 0px;"><span class="keymethods" style="color: #0086b3; margin: 0px; padding: 0px;">update</span></span>/+<span class="identifier" style="margin: 0px; padding: 0px;">download</span>/<span class="identifier" style="margin: 0px; padding: 0px;">gcc</span>-<span class="identifier" style="margin: 0px; padding: 0px;">arm</span>-<span class="identifier" style="margin: 0px; padding: 0px;">none</span>-<span class="identifier" style="margin: 0px; padding: 0px;">eabi</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">4_6</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">2012</span><span class="identifier" style="margin: 0px; padding: 0px;">q1</span>-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">20120316</span>.<span class="identifier" style="margin: 0px; padding: 0px;">tar</span>.<span class="identifier" style="margin: 0px; padding: 0px;">bz2</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Lets grab the latest Ubertooth source code and store it in a directory labeled ubertooth-latest:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="cs" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">svn co https:<span class="comment" style="color: #999988; font-style: italic; margin: 0px; padding: 0px;">//ubertooth.svn.sourceforge.net/svnroot/ubertooth ubertooth-latest</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
We also need to grab the latest libbtbb source code. This is a library that supplies the ubertooth with datastructures and methods for housing and deriving information from bluetooth baseband packets:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ruby" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="identifier" style="margin: 0px; padding: 0px;">git</span> <span class="identifier" style="margin: 0px; padding: 0px;"><span class="keymethods" style="color: #0086b3; margin: 0px; padding: 0px;">clone</span></span> <span class="identifier" style="margin: 0px; padding: 0px;">git</span><span class="symbol" style="color: #0086b3; margin: 0px; padding: 0px;">:</span>/<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/git.code.sf.net/p</span><span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/libbtbb/code</span> <span class="identifier" style="margin: 0px; padding: 0px;">libbtbb</span>-<span class="identifier" style="margin: 0px; padding: 0px;">latest</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now, lets untar the gcc arm source code file we downloaded earlier:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">tar xfvj gcc-arm-none-eabi-4_6-2012q1-20120316.tar.bz2
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
For compiling the ubertooth arm architecture source code, we will also need to specify where our new compiler lives. I typically do this each time before I compile the source, but if you like you could also add this line to your .bashrc file or install the arm gcc copiler to a bin (i.e. /usr/local/bin) directory in your base operating system.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="bash" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">export PATH=~/Source/gcc-arm-none-eabi-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">4</span>_6-<span class="number" style="color: #40a070; margin: 0px; padding: 0px;">2012</span>q1/bin:<span class="variable" style="color: teal; margin: 0px; padding: 0px;">$PATH</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now, lets compile our libbtbb source code and install its shared libraries in our base operating system.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">cd libbtbb-latest
make
sudo make install
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now lets compile our latest ubertooth firmware and host tools</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">cd uberooth-latest/trunk/firmware
make
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
And if you want, we can compile our latest ubertooth host code. These are the applications you can run in ~/Source/uberooth-latest/trunk/host/bluetooth_rxtx in order to use some of the ubertooths features. Note, the latest revisions of the uberooth code now uses shared libraries so we must now do a make install when compiling the uberooth toolset.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ruby" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="identifier" style="margin: 0px; padding: 0px;">cd</span> ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source/uberooth</span>-<span class="identifier" style="margin: 0px; padding: 0px;">latest</span>/<span class="identifier" style="margin: 0px; padding: 0px;">trunk</span>/<span class="identifier" style="margin: 0px; padding: 0px;">host</span>/<span class="identifier" style="margin: 0px; padding: 0px;">bluetooth_rxtx</span>
<span class="identifier" style="margin: 0px; padding: 0px;">make</span>
<span class="identifier" style="margin: 0px; padding: 0px;">sudo</span> <span class="identifier" style="margin: 0px; padding: 0px;">make</span> <span class="identifier" style="margin: 0px; padding: 0px;">install</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Now, lets update our devices firmware. Make sure to plug in your uberooth device for this step. Note, these next few steps require sudo or root access. However, if you have setup your ubertooth device be accessible with non root privileges, you can do this as a less privileged user without sudo. For instructions on how to set up your device to be accessible without root privileges check out my other tutorials on this blog.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="javascript" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">cd ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source/</span>ubertooth-latest/trunk/host/bluetooth_rxtx
sudo .<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/uberooth-util -f
cd ~/</span>Source/ubertooth-latest/trunk/host/usb_dfu
sudo .<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/ubertooth-dfu write ../</span>..<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/firmware/</span>bluetooth_rxtx/bluetiith_rxtx.bin
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Wait a few minutes for the firmware to finish writing, the lights on the ubertooth device will indicate that the transfer is complete although I can not remember what the actual indication looks like. When the transfer is complete, you can disconnect your ubertooth and then reconnect it.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
If you want to verify the firmware version on the device, run the following:</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">cd ~/Source/ubertooth-latest/trunk/host/bluetooth_rxtx
sudo ./uberooth-util -v
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
You can then check it against you latest ubertooth svn revision code</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ruby" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="identifier" style="margin: 0px; padding: 0px;">cd</span> ~<span class="regexp" style="color: #009926; margin: 0px; padding: 0px;">/Source/ubertooth</span>-<span class="identifier" style="margin: 0px; padding: 0px;">latest</span>
<span class="identifier" style="margin: 0px; padding: 0px;">svn</span> <span class="identifier" style="margin: 0px; padding: 0px;">info</span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Congratulations, you now have an ubertooth with the latest firmware.</div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0tag:blogger.com,1999:blog-2947245848405513225.post-1337069641989013632012-06-01T13:36:00.000-07:002014-03-05T13:43:27.003-08:00Setting udev usb permissions to use your Ubertooth (or usb) device as a regular user.<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
NOTE: The latest ubertooth source builds now instruct you on how to do this. You can follow their steps or use this if you like. The config changes in this tutorial are also helpful if you want non root access to your other usb devices.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
I try to avoid running arbitrary software as root whenever possible. By applying this simple udev rule, you will not have to worry about running your ubertooth software with escalated privileges.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Also note, this tweak will work for all usb devices. This is helpful for me so my hcitool and hciconfig commands no longer require root.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
This tutorial is for ubuntu 12.04, but will most likely work on older versions and similar distros.</div>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
To start, fire up your favorite editor and create a usb rules file in the /etc/udev/rules.d directory if id does not exist.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="undefined" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;">sudo vi /etc/udev/rules.d/45-usb.rules
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Add this single line to the file. Replace USER_NAME with your users name. In ubuntu, each user has a group named after them, so this may differ on non ubuntu systems.</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); color: #444444; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px;"><code class="ini" style="background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: black; display: block; margin: 0px; padding: 0.5em;"><span class="setting" style="margin: 0px; padding: 0px;">SUBSYSTEM=<span class="value" style="margin: 0px; padding: 0px;">=<span class="string" style="color: #dd1144; margin: 0px; padding: 0px;">"usb"</span>, ENV{DEVTYPE}==<span class="string" style="color: #dd1144; margin: 0px; padding: 0px;">"usb_device"</span>, MODE=<span class="string" style="color: #dd1144; margin: 0px; padding: 0px;">"0664"</span>, GROUP=<span class="string" style="color: #dd1144; margin: 0px; padding: 0px;">"USER_NAME"</span></span></span>
</code></pre>
<div style="background-color: white; color: #444444; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22.399999618530273px; margin-bottom: 1em; margin-top: 1em; padding: 0px;">
Thats it, plug in your ubertooth device and you should now be able to use its corresponding tools without root access.</div>
Ryan Holemanhttp://www.blogger.com/profile/08923494422318692725noreply@blogger.com0