Adventurist.me: Letters into the voidhttps://adventurist.me/feed.xmlAdventurist.me: Letters into the voidhttp://www.rssboard.org/rss-specificationpython-feedgenenFri, 23 Feb 2024 17:22:42 +0000 Presentations with mdphttps://adventurist.me/posts/00<p> It feels like <a href="https://erg.abdn.ac.uk"> work </a> is just a constant stream of preparing, travelling for and giving presentations. Brief words and pictures is an excellent for conveying information between small groups of humans. All of these presentations I write in <a href="keynote"> keynote </a> , keynote manages to be light weight, powerful and not horrific to use. As a bonus, my boss feels at home in keynote and is happy to make edits there. </p> <p> The keynote workflow does not match well to how I think. When dreaming up a presentation I want to shit of a stream of conciousness and have it magically become slides in the right shape. </p> <p> I might write a series of headings like: </p> <pre><code># intro # who # meat # details # questions? </code></pre> <p> I will iterate on these to add bodies, details and more slides. </p> <p> For quite a while I have wanted a system where I could write plain text and have it become slides. I <a href="sent blog post"> wrote </a> about the <a href="sent link"> sent </a> tool from suckless, but in the end I found it wanting. I have also considered just showing screens of text, but a nightmare DEFCON wireess village talk by Hak5 scared me away. They attempted to just present using just a plain text file and less, but the window size got out of whack and it all fell apart. </p> <h2> Enter mdp </h2> <p> <code> mdp </code> is a terminal presentation program, it takes slides it approximately markdown and takes over the entire terminal as its presentation surface. </p> <p> Intrigued I used an opportunity to speak at a <a href="techmeetup aberdeen"> local tech event </a> to try out <code> mdp </code> . <a href="mdp slides"> The slides </a> from that presentation can be found on <a href="talks page"> my talks page </a> and overall I thought <code> mdp </code> worked quite well. </p> <p> I was able to draft in the stream of conciousness style I want, getting the bulk of the slides written very quickly. Adding diagrams required resorting to ASCII art which isn't so bad, <a href="campgnd.com"> I </a> <a href="draft-plpmtud"> like </a> <a href="ietf ascii art guidelines"> ascii </a> <a href="draft cco"> art </a> . <code> mdp </code> worked great in practice, I had to find readable dimensions for the text by trial and error, but overall it went well. </p> <p> Plain text as a format does have some major downsides, <code> mdp </code> has a way to encode builds for text (see below), but I couldn't use it with my tools. ASCII art diagrams also meant that the builds I did use were eggregious to maintain, any modification required manual propigation through the build chain. </p> <p> <code> mdp </code> does not support a portable output format. You may say the source markdown is an excellent format for portability, but I find it lacks the crispness of having a single slide in view at once. </p> <p> I wanted to be able to point at a viewable copy of my slides and so I hacked together some tools to export the <code> mdp </code> presentation to html, but for this I had to sacrifice the built in build mechanism of <code> mdp </code> </p> <p> Finally there was no way to include images in the <code> mdp </code> presentation let alone the sacride gif format required to correctly convey nyan cat. I played with some terminal graphics viewers, but none of them worked well and after a while I started to think 'what is the point of reinventing everything'. </p> <p> Drafting the presentation in markdown fit very well with my work flow, but the difficulties in getting a complete presentation with <code> mdp </code> meant that I didn't want to use it for future presentations. </p> <h2> Exporting to html </h2> <p> Getting html of the <code> mdp </code> presentation hinged on a complete hack. There is a tool I had seen in the past that can output a html dump of a <code> tmux </code> session unsurprisingly called <a href="tmux to html"> tmux2html </a> . With some playing around I was able to automate a tmux session to work through the slides and use <code> tmux2html </code> to grab each slide as a frame. </p> <p> Finding the number of slides in the deck required splitting on the slide seperator from the markdown, this ruled out using the built in build mechanism as I would end up with the wrong number of slides. </p> <p> The output script runs through the markdown to find the number of slides then uses <code> tmux send-keys </code> to control moving through the deck. </p> <pre><code>#!/bin/sh set -e command -v tmux &gt;/dev/null 2&gt;&amp;1 || { echo &gt;&amp;2 "I require tmux but it's not installed. Aborting."; exit 1; } command -v tmux2html &gt;/dev/null 2&gt;&amp;1 || { echo &gt;&amp;2 "I require tmux2html but it's not installed. Aborting."; exit 1; } command -v mdp &gt;/dev/null 2&gt;&amp;1 || { echo &gt;&amp;2 "I require mdp but it's not installed. Aborting."; exit 1; } if [ -z "$1" ] then echo "tohtml presentatin.md [outfile.html]" exit fi file=$1 outfile=outfile.html if [ ! -z "$2" ] then outfile=$2 fi javascript="&lt;script&gt;function page(){var e=!1,n=document.getElementsByClassName('tmux-html'),l=0; document.onkeydown=function(t){if(t=t||window.event,key=t.keyCode,e)if(13==key){e=!1,l=0;for(var i=0;i&lt;n.length;i++)n[i].style.display='inline'}else{37==key&amp;&amp;--l&lt;0&amp;&amp;(l=0),39==key&amp;&amp;++l&gt;=n.length&amp;&amp;(l=n.length-1);for(i=0;i&lt;n.length;i++)n[i].style.display='none';n[l].style.display='inline'}else if(13==key){e=!0,n[0].style.display='inline',l=0;for(i=1;i&lt;n.length;i++)n[i].style.display='none'}}}window.onload=function(){page()};&lt;/script&gt;" tmpfile=tmpfilenamefilething tmux='mdptohtmlconverstionsession' slides=`grep -e "^---" $file | wc -l` tmux new-session -s $tmux -d -x 96 -y 25 tmux send-keys -t $tmux "mdp $file" tmux send-keys -t $tmux "Enter" tmux send-keys -t $tmux 'g' tmux2html -o $tmpfile $tmux 1&gt;/dev/null # insert javascript lines=`cat $tmpfile | wc -l` styleend=`cat -n $tmpfile | grep -e "&lt;/style&gt;" | awk '{print \$1}'` head -n $styleend $tmpfile &gt; $outfile echo $javascript &gt;&gt; $outfile tail -n $((lines-styleend)) $tmpfile &gt;&gt; $outfile mv $outfile $tmpfile # remove closing tag lines=`cat $tmpfile | wc -l ` end=`tail -n 1 $tmpfile` head -n $((lines-1)) $tmpfile &gt; $outfile echo turning $file into $((slides+1)) slides i=1 while [ $i -lt $((slides+1)) ] do printf "\rSlide $i" tmux send-keys -t $tmux 'j' tmux2html -o $tmpfile $tmux 1&gt;/dev/null grep -e "^&lt;div" $tmpfile &gt;&gt; $outfile (( i++ )) done echo $end &gt;&gt; $outfile tmux kill-session -t $tmux rm $tmpfile printf "\rwritten to $outfile \n" </code></pre> <p> <a href="mdp slides"> If you view the presentation page </a> you will see the entire slide deck, this was the first output I got from this script. All the slides in a nice order. After a little pondering I wrote up some javascript to give controls, if you hit enter it will go from all slides to single slide. Arrow keys in single slide mode will allow you to move through the slide deck. The unminified javascript for this is below. </p> <pre><code>function page() { var presenting = false var elements = document.getElementsByClassName('tmux-html'); var current = 0; document.onkeydown = function(evt) { evt = evt || window.event; key = evt.keyCode if (presenting) { if (key == 13) { presenting = false; current = 0; for (var i = 0; i &lt; elements.length;i++) elements[i].style.display='inline' } else { if (key == 37) { //left current--; if (current &lt; 0) current = 0; } if (key == 39) { //right current++; if (current &gt;= elements.length) current = elements.length-1; } for (var i = 0; i &lt; elements.length;i++) elements[i].style.display='none' elements[current].style.display='inline' } } else { if (key == 13) { presenting = true; elements[0].style.display='inline' current = 0; for (var i = 1; i &lt; elements.length;i++) elements[i].style.display='none' } } }; } window.onload = function () { page(); } </code></pre> https://adventurist.me/posts/00Sat, 03 Oct 2020 00:00:00 +0000 Presentations with remarkjshttps://adventurist.me/posts/00<p> <a href="mdp post"> I enjoyed using </a> <code> mdp </code> to write slides, being able to hammer in markdown gave a satisfying sense of flow and I felt like I was able to get the slides out of my head in a straightforward manner. But I knew <a href="https://2018.eurobsdcon.org/talks-speakers/#TomJones"> for my </a> <a href="https://2018.eurobsdcon.org/"> eurobsdcon </a> presentation I was going to have to include photos of equipment and maybe even demo videos. </p> <p> Shelling out to vlc or feh for pictures and video wouldn't do, it would throw off both me and the audience. That ruled out using <code> mdp </code> for making slides and it also ruled out using <code> sent </code> <a href="sent"> from suckless </a> </p> <p> I canvassed around on mastodon and tried out a bunch of other tools, the main factor in ruling out most of the tools was there handling of very long titles. Something I couldn't avoid when the title of my talk was 84 charactars. </p> <p> <a href="remarkjs"> remarkjs </a> was the tool I settled on. </p> <p> <code> remarkjs </code> can take slides either as an external markdown file if you have a way to serve them to the js, or embedded into a html file. I ended up embedded the slides into the markdown as this was the fastest way to get from nothing to having some slides appearing. <code> remarkjs </code> has a boat of documentation, which I thourghouly ignored until after the presentation, in fact in the days after when I was toying with implementing a presentation view I found <code> remarkjs </code> already has one built in! </p> <p> <code> remarkjs </code> was great for authoring into, the ability to add style to documents was a big bonus for me too. The fact there was style did mean I had to write some css to get videos into the right place in the slide was annoying, but it worked out well. </p> <h2> Integrating diagrams </h2> <p> My <code> mdp </code> slides included diagrams as most slide decks do, I wanted to add diagrams to this slide deck. The <code> mdp </code> diagrams are just ASCII art, showing ASCII art in a web page is fine, that is show I made a sharable version of the page, but I felt I could do better. </p> <p> <a href="goat"> goat </a> can render ascii art diagrams in a restricted set into svg diagrams. </p> <p> example example example </p> <p> Gives an svg diagram like: </p> <p> svg </p> <p> The svg output is very verbode and really not something you would want to embed in the middle of a slide deck. </p> <p> svg quoted cut off </p> <p> For this to be managable I wrote a python script to 'render' the document. The script searches the input for lines starting with 'diagram:' and takes the remainder of the line as a file name to render and substitute. </p> <pre><code>import sys import subprocess filename = sys.argv[1] infile = open(filename, 'r') outfile = open('out.html', 'w') cmd = "cat" cmd = "goat" for l in infile: if l.startswith('diagram:'): if len(l.split(' ')) != 2: print('bad line {}'.format(l)) diagram = 'diagrams/{}'.format(l.split(' ')[1].strip()) result = subprocess.run([cmd, diagram], stdout=subprocess.PIPE, encoding='utf-8') if result.returncode == 0: count = 0 outfile.write('.center[\n') for o in result.stdout.split('\n'): # print(' ' + o) outfile.write(o + '\n') outfile.write(']\n') else: for o in result.stdout: print(o, end='') outfile.write(l) else: outfile.write(l) infile.close() outfile.close() </code></pre> <h2> I really like remarkjs </h2> <p> I was happy enough using <code> remarkjs </code> that I was considering adding a presentation mode. However there are some downsides, firefox really struggled when rendering slides, when I had 40MB mp4 video files firefox would peg all cpus, as the slides were just a page the autoplaying video pulled firefox down all the time. </p> <p> <code> remarkjs </code> "supports" exporting to pdf via chromes print preview, but all I could get chrome to do was hang. Someone else managed to get an export from safari, overall not the best. </p> https://adventurist.me/posts/00Sat, 03 Oct 2020 00:00:00 +0000 Joining two sets with LINQhttps://adventurist.me/posts/0014<p> Dealing with a horrible database this last week, I found the need to combine things in a reasonable way. It took a lot of searching to find out how to query on multiple sets. So thought I would put it here. </p> <pre><code>var roles = (from x in userRoles from y in editUser.UserRoles where y.SOXRole &amp;&amp; y.Id == x.RoleId select x).ToList&lt;DBModel.UserToRoles&gt;(); </code></pre> <p> I was pretty happy with it. </p> https://adventurist.me/posts/0014Sun, 02 Feb 2014 00:00:00 +0000 FreeBSD USB Installerhttps://adventurist.me/posts/0015<p> Years ago I got a copy of <a href="http://www.nostarch.com/rootkits.htm"> Designing BSD RootKits </a> by Joseph Kong. A combination of lack of hardware and probably my own ability has stopped me from working through the book so far. But now with <a href="http://57North.co"> 57 North </a> up and running and an influx of free machines I have everything I need. </p> <p> The machine I have been given is part of an old biomed cluster and is really over powered for what I need. As a 2U server it doesn't have a floppy or CD drive to easily install an OS, but it does have the ability to boot off of a USB stick. </p> <p> The first thing I tried to get a FreeBSD installer running was burning an ISO image to a USB stick with UNetBootin. I think the project might actually be dead as the newest version of FreeBSD it supports is 8.0. UNetBootin takes forever to set up the USB stick and after the second failed attempt I couldn't stomach another. </p> <p> I dug around the FreeBSD install guides for a while and then found something that should have been really obvious. FreeBSD supports installation from USB and provides a pre packaged .IMG file to dd to the USB. </p> <p> All the information is <a href="http://www.freebsd.org/doc/handbook/bsdinstall-pre.html#bsdinstall-installation-media"> here </a> with the USB stuff near the bottom. FreeBSD is nice enough to include simple instructions that work even from windows. This meant I could test the new media from work and all seems good. </p> https://adventurist.me/posts/0015Wed, 12 Feb 2014 00:00:00 +0000 Wot Happened; The break inhttps://adventurist.me/posts/0016<p> <a href="/images/breakin2.jpg"> <img src="/imagessmall/breakin2.jpg"/> </a> </p> <p> by Tom Jones age 23 and 1/4 </p> <p> On Saturday the 8th march 2014 we did a run through of the MakeIt-Glo workshop. Afterwards I went to the pub, leaving my bag(laptop and camera) in the space. Ed and Calum stayed in the space. </p> <p> Charlene text me and awoke the hangover at 0500 on the 9th. Unable to sleep I headed into the space to get my laptop and bag and shit. The time lock was disabled at 0657 when I came in and the main door was open for the world. </p> <p> I came up the stairs and saw that the door to the kitchen area had been pried open and all round damaged. I saw a guy that I thought was a lock smith(hungover head is optimistic), he pointed at our door and said something like "It is locked". I unlocked the door and walked up to him, I fumbled questions about his name and what was going on. He went to leave, but I saw my (United Pixel Workers) laptop sticker sticking out of the bag. </p> <p> <a href="/images/breakin1.jpg"> <img src="/imagessmall/breakin1.jpg"/> </a> </p> <p> I said it was my laptop, he put the bag down and I grabbed it, my camera and laptop charger. He placed both the bags he was holding on the floor. I walked across the lab and put my stuff in my bag then pulled out my phone. He said "I've called the police already" my witty retort was "Well I'm doing it again". As the police call center answered he disappeared down the stairs. </p> <p> Police came and took immediate details and put out a bulletin. Anther robbery happened on king st while the officers where talking with my. Logic ties the two together to both me and the officers. A crime scene officer came and printed the broken door and the items we were sure he had touched. </p> <p> This bloke didn't wear gloves, tried to break through an unlocked door and didn't manage to grab our beer money jar. He broke into a dentist, I have no idea what he was expecting to steal. The bastard tried to steal our drinks cupboard. </p> <p> <a href="/images/breakin3.jpg"> <img src="/imagessmall/breakin3.jpg"/> </a> <a href="/images/breakin4.jpg"> <img src="/imagessmall/breakin4.jpg"/> </a> <a href="/images/breakin5.jpg"> <img src="/imagessmall/breakin5.jpg"/> </a> <a href="/images/breakin6.jpg"> <img src="/imagessmall/breakin6.jpg"/> </a> </p> https://adventurist.me/posts/0016Sun, 09 Mar 2014 00:00:00 +0000 Atari used to 'make' printershttps://adventurist.me/posts/0017<ul> <li> <a href="https://news.ycombinator.com/item?id=7471550"> Atari used to 'make' printers </a> </li> <li> <a href="http://www.macworld.com/article/1144929/apple_printers.html"> Apple will never make printers again </a> </li> <li> <a href="http://notch.net/2014/03/virtual-reality-is-going-to-change-the-world/"> Virtual Reality is going to change the world </a> </li> </ul> <p> It is a rare day that I remember markdown link syntax. </p> https://adventurist.me/posts/0017Wed, 26 Mar 2014 00:00:00 +0000 These guys are lucky they can walk.https://adventurist.me/posts/0018<ul> <li> <a href="https://www.youtube.com/watch?v=JGdRKIA2nzc"> Some of these guys are lucky to be able to walk </a> </li> <li> <a href="https://www.youtube.com/watch?v=eIOsL8tumMU"> Danny MacAskill is a Scottish Hero </a> </li> <li> <a href="http://gaasedelen.blogspot.co.uk/2014/03/depackaging-nintendo-3ds-cpu.html"> Depackaging the Nintendo 3DS CPU </a> </li> </ul> <p> The decapping of the 3DS chip is the sort of reverse engineer that just amazes me. The author mentions <a href="http://www.nostarch.com/xboxfree"> Bunnie's Book </a> as a source of inspiration and I have to agree. Bunnie's book operates well above the level of chip decapping, but it gives you a window into an entire world of engineering that is usually hidden. Last year Bunnie released his book for free in memory of Aaron Swartz. </p> <p> Bunnie is really cool guy and a hero of hackers around the world. Amoung other projects he is making the <a href="http://www.bunniestudios.com/blog/?p=2686"> ultimate engineers laptop </a> . </p> https://adventurist.me/posts/0018Thu, 27 Mar 2014 00:00:00 +0000 Stripe now takes Bitcoinshttps://adventurist.me/posts/0019<ul> <li> <a href="https://stripe.com/bitcoin"> Stripe now takes bitcoins </a> </li> <li> <a href="http://www.daemonology.net/blog/2014-03-27-tarsnap-bitcoin.html"> Tarsnap is taking bitcoins in stripes pilot </a> </li> </ul> <p> I am a big fan of stripe, recently using them for <a href="http://57north.co"> 57north's </a> <a href="57north.co/wiki/MakeIt-Glo"> MakeIt-Glo workshop </a> . The payment was smooth and easy to use, we didn't hear about any issues with stripe from any of the attendee's either. </p> <p> Bitcoin I am still unsure of. I would love to make £1000's from idle speculation, but I haven't been able to buy it from anywhere other than people in the real world. </p> <p> Being able to use both together can only be seen as a good thing, the more services that start to take bitcoin the better. Services like stripe that are genuinely legitimate and have good standing go a way to remove a lot of the alarmism around the currency. </p> <p> <a href="http://www.tarsnap.com/"> Tarsnap </a> is one of my favourite services on the internet. If you are looking for secure small scale off site backup I can't think of anything better. </p> https://adventurist.me/posts/0019Thu, 27 Mar 2014 00:00:00 +0000 Printing code with Enscripthttps://adventurist.me/posts/0020<p> I need to read some complicated tcp code. Being able to scribble all over code makes it a lot easier for me to follow the flow of what is happening. </p> <pre><code>enscript -2 -r -Ec -o - tcp_cong.c | ps2pdf - tcp_cong.pdf </code></pre> <p> I tried, but I couldn't get colour to work. In the end I don't really care if it is on paper. </p> https://adventurist.me/posts/0020Fri, 28 Mar 2014 00:00:00 +0000 Computer are very complexhttps://adventurist.me/posts/0021<ul> <li> <a href="https://wiki.openstreetmap.org/wiki/Openlayers_POI_layer_example"> Creating layers with OpenStreetMap </a> </li> <li> <a href="http://www.anandtech.com/show/7910/apples-cyclone-microarchitecture-detailed"> Apple's Cyclone Microarchitecture Detailed </a> </li> <li> <a href="http://lwn.net/Articles/592543/"> Linux 3.14 out </a> </li> </ul> <p> Maps are cool. </p> <p> Computers are now very complex, that Anandtech article really blew my mind. <a href="http://mikeash.com"> Mike Ash's </a> article on <a href="https://mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and-you.html"> 64bit arm </a> has this the same insane sort of detail that the Anand Tech article does. Computers are cool. </p> https://adventurist.me/posts/0021Mon, 31 Mar 2014 00:00:00 +0000 This is the worst day of the yearhttps://adventurist.me/posts/0022<ul> <li> <a href="http://gtf.org/garzik/ecn/"> This webpage was lost in a harddrive storm crash </a> </li> <li> <a href="http://indiestatik.com/2014/03/31/most-expensive-game-jam/"> You can really fuck up a game jam </a> </li> <li> <a href="http://linuxgizmos.com/intel-unveils-tiny-x86-minnowboard-max-open-sbc/"> Intel unveils tiny $99 board, I have no idea what it is for </a> </li> <li> <a href="http://thenextweb.com/google/2014/03/31/can-now-find-catch-wild-pokemon-inside-google-maps/"> Pokemon in Google maps </a> </li> <li> <a href="http://1024monkeys.wordpress.com/2014/04/01/game-servers-udp-vs-tcp/"> UDP vs TCP for Game Servers </a> </li> </ul> <p> This is the worst day of the year for the internet. Terrible internet holiday you can't really trust anything you read and most of it is really just quite annoying. A part from Google Pokemon, that was cool. </p> <p> There is a lot of misinformed dialog about TCP and UDP for gaming. The 1024 Monkey's article covers a lot of real issue with using TCP and doesn't fall on the normal argument "Well I am pretty much reimplementing TCP". If that was the case you probably wouldn't get much of your game done. </p> https://adventurist.me/posts/0022Tue, 01 Apr 2014 00:00:00 +0000 Imprecisionhttps://adventurist.me/posts/0023<ul> <li> <a href="http://www.chrisstucchio.com/blog/2014/why_xkcd_style_graphs_are_important.html"> XKCD Style Charting </a> </li> <li> <a href="http://napkinlaf.sourceforge.net/"> Napkin UI Features </a> </li> <li> <a href="http://frombothsidesofthetable.com/post/68769162899/im-an-idiot"> I am an idiot </a> </li> </ul> https://adventurist.me/posts/0023Wed, 02 Apr 2014 00:00:00 +0000 Silly time changeshttps://adventurist.me/posts/0024<p> For some reason we change the time zone throughout the year. It doesn't make any sense to me and it makes it hard when I am using applications on my vps. </p> <p> To avoid confusion it is nice to have irrsi running at local time. </p> <pre><code>$ TZ="UTC-1" irssi </code></pre> https://adventurist.me/posts/0024Sat, 05 Apr 2014 00:00:00 +0000 Raspberry Pi Compute boardhttps://adventurist.me/posts/0025<ul> <li> <a href="http://www.raspberrypi.org/raspberry-pi-compute-module-new-product/"> Raspberry Pi becomes modularised </a> </li> <li> <a href="http://danlynch.org/blog/2009/12/rw44/"> Puzzle Box </a> </li> <li> <a href="http://phrack.org/papers/fall_of_groups.html"> The Fall of Hacker Groups </a> </li> </ul> <p> It took me ages to find Dan's box puzzle, the puzzle box was an awsome marketing tool that really shows how Nokia was. </p> https://adventurist.me/posts/0025Mon, 07 Apr 2014 00:00:00 +0000 Resize VDIhttps://adventurist.me/posts/0026<pre><code># /Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB </code></pre> <p> Where SIZE <em> IN </em> MB is the new size for the drive </p> https://adventurist.me/posts/0026Wed, 16 Apr 2014 00:00:00 +0000 Use tcpdump to save wireless bridgehttps://adventurist.me/posts/0027<p> For <a href="http://campGND.com"> campGND </a> we need to extend a wireless network about 500m from the farm down to the site. We have been trying to salvage some equipment but where having trouble getting control of a pair of Senao wireless bridges (Senao Long Rage Multi-Client Bridge). </p> <p> <a href="/images/wirelessbridge.jpg"> <img src="/imagessmall/wirelessbridge.jpg"/> </a> </p> <p> The devices has previously been configured by someone else to bridge a network between two buildings. Problem being we have no idea how these boxes have been setup. Looking online there was nothing helpful about factory resetting these boxes unless you already had access. </p> <p> I decided to put a box on our ethernet and use tcpdump to scan for any traffic coming from the MAC Address on the bottom of the bridge. </p> <pre><code># tcpdump -e -i en0 ether src 00:02:6F:45:C9:83 </code></pre> <p> After a reboot of bridge the following appeared in my terminal. </p> <pre><code>115:48:15.741750 00:02:6f:45:c9:83 (oui Unknown) &gt; Broadcast, ethertype ARP (0x0806), length 60: Request who-has 10.0.2.66 tell 10.0.2.1, length 46 </code></pre> <p> Bingo, exactly what I was looking for. That arp request tells us where the bridge thinks it is 10.0.2.1 . </p> <p> Now I could navigate to the bridges web interface, but I was still locked out. I read through the manufactures guide for the bridge, but I still couldn't see anything that looked like a factory reset. The guide did mention that the default ip for the bridge was 192.168.1.1 and it used a admin:admin as the login. </p> <p> I decided to try powering on the bridge with the hardware button held down. I left tcpdump running so if there was any change on the bridges interface. I held down the reset switch and powered the bridge on, counting to 30 seconds. I then toggled the power and finally saw </p> <pre><code>15:48:17.750222 00:02:6f:45:c9:83 (oui Unknown) &gt; Broadcast, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.66 tell 192.168.1.1, length 46 </code></pre> <p> The bridge had reset to the factory default. </p> https://adventurist.me/posts/0027Sat, 03 May 2014 00:00:00 +0000 Videos I have watched from BSDCan 2014https://adventurist.me/posts/0028<p> Videos from BSDCan that have jumped out to me so far. </p> <ul> <li> <a href="https://www.youtube.com/watch?v=13LiyjnTGsQ&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn&amp;index=23"> BSDCan 2014 Keynote by Karl Lehenbauer, FlightAware </a> </li> <li> <a href="https://www.youtube.com/watch?v=GnBbhXBDmwU"> LibreSSL: The first 30 days, and what the Future Holds </a> </li> <li> <a href="https://www.youtube.com/watch?v=LZjoFSfIv3k&amp;index=14&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn"> MIPS router hacking </a> </li> <li> <a href="https://www.youtube.com/watch?v=cP8AW111IKg&amp;index=16&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn"> OpenBGPD turns 10 years </a> </li> <li> <a href="https://www.youtube.com/watch?v=ZAM7fqhGRr8&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn&amp;index=17"> BSD/ARM Kernel Internals </a> </li> <li> <a href="https://www.youtube.com/watch?v=WZoQzUZKaeo&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn&amp;index=6"> IPv6 Transitioning mechanisms on the BSDs </a> </li> <li> <a href="https://www.youtube.com/watch?v=jZp-ciB6mAg&amp;index=10&amp;list=PLWW0CjV-TafYjgr2GqTVAvTnHJ9BWVevn"> Keeping Current </a> </li> </ul> https://adventurist.me/posts/0028Wed, 04 Jun 2014 00:00:00 +0000 Announcing Buildshttps://adventurist.me/posts/0029<p> I have been building kernels on my imac in virtual machines. This can take a while and I wanted notifications when the build had finished running. </p> <p> On my imac </p> <pre><code>$ while true nc -l 4000 | say done </code></pre> <p> This makes netcat(1) wait in a loop for any connections then pipes the output into say(1). </p> <p> On the vm </p> <pre><code>$ make buildkernel; echo "Build Complete" | nc -N imac 4000 </code></pre> <p> Replace imac with the hostname or ip of your machine. </p> <p> I have seen the build side hang and not close the connection until killed, I am not sure why. </p> https://adventurist.me/posts/0029Fri, 06 Jun 2014 00:00:00 +0000 Minimal R plotshttps://adventurist.me/posts/0030<p> For my new business cards I wanted to impose data from an experiment onto the background of an image. For the best results I wanted to render the plot of data onto a transparent png without any axis, values or the standard box. </p> <p> After a while I got to </p> <pre><code>&gt; png(filename="transplot.png",width=900,height=400,bg="transparent") &gt; plot(timestamp[0:1000],snd_cwnd[0:1000],type="h",yaxt="n",xaxt="n",ann="F",frame.plot="F") &gt; dev.off() </code></pre> <p> Which generates the following image. </p> <p> <a href="/images/transplot.png"> <img src="/images/transplot.png"/> </a> </p> https://adventurist.me/posts/0030Fri, 13 Jun 2014 00:00:00 +0000 It is actuallyhttps://adventurist.me/posts/0031<p> <a href="/images/rocketscience.png"> <img src="/images/rocketscience.png"/> </a> </p> <p> <a href="http://campGND.com"> campGND </a> is coming up and it is time to start talking about my projects for the weekend. With our remote location I thought it would be fun to play with something flaming and dangerous. </p> <p> Rockets were the first thing that came to mind, I haven't done much with rockets beyond launching fireworks a couple of times. Doing my first launches at campGND would probably slow everything down somewhat. I got myself a starter kit from <a href="http://modelrockets.co.uk"> Model Rocket Shop </a> and some extra motors, for a bigger bang. </p> <p> Iain and myself went out to <a href="https://www.google.com/maps/place/Aberdeen/@57.1924293,-2.0731921,890m/data=!3m1!1e3!4m2!3m1!1s0x4884054c1fd77549:0xe8bb05da5cf4c472"> Balmedie Beach </a> to have a test run with my new toy. We got a couple of videos of the rockets going up, excuse the portrait slow-mo. </p> <p> <video controls="" src="/videos/rocket1.webm"> </video> <video controls="" src="/videos/rocket2.webm"> </video> </p> <p> On the first launch the recovery canopy got slightly melted by the rocket motor. This meant we didn't really have any recovery mechanism for the rest of the launches. The beach was pretty deserted in the dunes so this wasn't a big deal. At campGND loosing recovery could make things a little tricky. </p> <p> For campGND I am planning on adding some telemetric data to the rockets, using an Arduino and some sensors. I also want to try adding a camera to the nose cone on a rocket. </p> https://adventurist.me/posts/0031Tue, 17 Jun 2014 00:00:00 +0000 campGND networkhttps://adventurist.me/posts/0032<p> One of the facilities at <a href="http://campGND.com/"> campGND </a> is going to be a wireless network. The hope is to have the network running for the majority of the time. I have built a wireless network at a campsite before, that was made easier by having guaranteed bandwidth from a satellite terminal. </p> <p> The plan is to have a wireless network for the campsite served by a <a href="http://routerboard.com/RBSXTG2HnD"> MikroTik </a> . Using a wireless bridge to reach to the farmhouse. The farmhouse is out of site of the fields we are planning to use. Instead of having wifi doing the full jump I am going to run ethernet as far as possible. </p> <p> At <a href="http://campGND.com/"> campGND </a> we are depending on a few things that could be fickle. </p> <ul> <li> BT Home Broadband </li> <li> A long run of ethernet </li> <li> Solar Cells and a battery for network power. </li> </ul> <p> Our final back haul is the BT network the site is pretty off the grid for phone reception so we are stuck with BT. We have to be able to make a long hop form the farmhouse before we can do a wireless link down to the site. The solar cells will provide enough to run wireless access points during the day. I think at night we might be a little drunk to care. </p> <p> I still need to do some testing of the wireless hardware but the plan is to use the following. </p> <ul> <li> 100M run of Ethernet. </li> <li> Injected POE, then split POE. </li> <li> 2x WRT54G's. </li> <li> A <a href="http://routerboard.com/RBSXTG2HnD"> MikroTik </a> access point. </li> <li> Solar Cells for with battery backing for night time. </li> </ul> https://adventurist.me/posts/0032Thu, 19 Jun 2014 00:00:00 +0000 pvhttps://adventurist.me/posts/0033<p> I found a tool called <a href="http://www.ivarch.com/programs/pv.shtml"> pv </a> via a Hacker News thread. pv or pipe viewer allows you to view data as it is pulled out of a Unix pipe. This is really helpful when dealing with long running commands. I used it today to check on the progress of encrypting a large tar archive. </p> <pre><code>$ pv archive.tar.xz | gpg --sign --symmetric - &gt; archive.tar.xz.gpg 6.51GiB 0:08:52 [6.23MiB/s] [======================&gt; ] 70% ETA 0:03:47 </code></pre> <p> While pv is running you get a progress, time elapsed, speed, a progress bar, 70% complete and an estimation of time until complete. </p> https://adventurist.me/posts/0033Mon, 14 Jul 2014 00:00:00 +0000 GPGME with Mutt on OS Xhttps://adventurist.me/posts/0034<p> I found it quite difficult to get <a href="https://www.gnupg.org/related_software/gpgme/"> GPGME </a> working with <a href="http://www.mutt.org/"> Mutt </a> in OS X, I was using <a href="http://brew.sh/"> Homebrew </a> to install mutt. I could see the option in the brew build file to use GPGME, but it was set as an optional dependency. I fought with it for a while then jumped across to #homebrew on freenode to get an answer. </p> <p> I had to force brew to build mutt from source to get the dependency included. You will have to uninstall mutt if you have already installed it. </p> <pre><code>brew install mutt --build-from-source --with-gpgme </code></pre> <p> You will need to add the correct bits to your .muttrc to get mutt to use. </p> <pre><code>set crypt_use_gpgme = yes set crypt_autosign = yes set pgp_sign_as = 0xYOURGPGKEYGOESHERE***** </code></pre> https://adventurist.me/posts/0034Wed, 30 Jul 2014 00:00:00 +0000 urtwn on FreeBSD ARMhttps://adventurist.me/posts/0035<p> This weekend I got FreeBSD on my Chromebook Snow in a usable state. Getting wifi going was a bit of a bother. I have an <a href="http://www.amazon.co.uk/Edimax-EW-7811UN-150Mbps-Wireless-Adapter/dp/B003MTTJOY%3FSubscriptionId%3DAKIAILSHYYTFIVPWUY6Q%26tag%3Dduc08-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB003MTTJOY"> Edimax Wifi Adapter </a> , but the default kernel config builds out support for wifi and the urtwn device driver. </p> <p> The Beaglebone Black page on the <a href="https://wiki.freebsd.org/FreeBSD/arm/BeagleBoneBlack"> FreeBSD wiki </a> has a kernel config that includes the drivers I need. I took the wifi config and added them to a CHROMEBOOK-WIFI config so I could build a kernel for the Chromebook with support. </p> <pre><code>#USB WiFi # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth device firmware # Required to load firmware device urtwnfw # Firmware for RTL driver below device urtwn # Realtek RTL8188CU/RTL8192CU </code></pre> <p> After building the new kernel and moving it over to the USB stick I use for the Chromebook I needed tell FreeBSD to accept the license terms for the wifi firmware. </p> <pre><code>Add to loader.conf legal.realtek.license_ack=1 </code></pre> <p> After that it was pretty norm wifi setup. </p> <pre><code># ifconfig wlan0 create wlandev urtwn0 # wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B # dhclient wlan0 </code></pre> https://adventurist.me/posts/0035Wed, 24 Sep 2014 00:00:00 +0000 Strange Masthttps://adventurist.me/posts/0036<p> Walking home from the hackerspace last night I came across this interesting mast behind a car parked on the pavement. I had to grab a picture of this strange thing on Union Street. </p> <p> <a href="/images/4gmast.jpg"> <img src="/imagessmall/4gmast.jpg"/> </a> </p> <p> The guy operating the mast spotted me taking the picture and came down for a chat. This mast was acting as a 4G base station, there was a second vehicle driving around the city, listening for this mast to map 4G propagation. It turns out that Aberdeen city council are planning to roll out 4G across the entire city, with free access. The council want to use this for fleet management and I think it is probably part of their initiative to improve bandwidth in the city. </p> <p> According to the operator of this mast the 4G won't just cover the city center, they have been mapping industrial estates in Altens and out towards the edges of the Bridge of Don </p> https://adventurist.me/posts/0036Wed, 26 Nov 2014 00:00:00 +0000 31c3https://adventurist.me/posts/0037<p> 31c3 Finished 21 days, probably enough for me to get past the conference high, but also enough time for me to catch up on almost all of the talks. All of the talks from 31c3 and most of the other congresses have been put online at <a href="http://media.ccc.de"> media.ccc.de </a> . </p> <p> I took notes during Congress, but I had a hard time turning them into a post. If anyone wants to see my notes I am sure they could appear. Instead here are some thoughts. </p> <p> Congress is Europe's largest temporary art installation. The CCH is a simply massive building, after 5 days of wandering around the I am still not sure I saw everything. It wasn't until day 4 of Congress that I realised the floor numbers were not floor numbers, but actually the Saal you were closest to. The ones and twos I could see around me were not helpful directions. </p> <p> The building was augmented by the CCC to make it a home for hackers. The lights were dimmed, there were <a href="http://blinkenlights.net/sites/all/themes/blinkenlights/images/uberheader_800x50.png"> blinkenlights </a> in every corner and just to make things even better there seemed to be a pop up interactive installation at random intervals. A pneumatic tube system was run around the ground floor of the building. </p> <p> Of course there were talks 12 hours of the day, but the talks were streamed later. There were too many things that could only be found in the 4 days of Congress to sit in a full lecture theatre. </p> <p> Instead we held court at our table in the international hackerspace village. Hung around with the crazy cooks in the <a href="http://events.ccc.de/congress/2014/wiki/Assembly:Food_Hacking_Base"> Food Hacking Base </a> , argued politics in <a href="https://noisysquare.com/"> Noisy Square </a> and wandered the cavern is a daze. </p> <p> At night(due to the lighting it was hard to tell when that was) we would be at our table hacking on something super cool, or hiding in the amazing nightclub. </p> <p> It is probably impossible to describe congress, there is just too much happening. It is probably unfair to try and give someone else a picture, the only real way to know what it is like is to experience it. </p> <p> Join us next year. </p> https://adventurist.me/posts/0037Tue, 20 Jan 2015 00:00:00 +0000 User SPI Adventureshttps://adventurist.me/posts/0038<p> Last year I started working on a project in the space that I thought would be pretty cool, a Mystery Box. I made a box out of foam board, mounted a servo as a catch. Inside I wired up an Arduino to control the servo. The Arduino connected to a Raspberry Pi over SPI, I used SPI because it was a nice simple protocol to implement on both the Arduino and the Raspbery Pi. </p> <p> The Mystery Box was going to run a BBS which had control over the servo. My idea was to use the box as a simple CTF target, with the servo giving instant and substantial feedback for success. </p> <p> Around this time I had been asked to port <a href="https://tools.ietf.org/html/draft-ietf-tcpm-newcwv-08"> NewCWV </a> to FreeBSD, we wanted to have more than one implementation of the proposed standard available. Doing some development in the FreeBSD kernel made me want to look at using the operating system in other places. </p> <p> Up to this point I had been using Linux on the Pi in the Mystery box, but I thought it would be fun to try FreeBSD. FreeBSD on the Pi was in a reasonable state, I didn't have trouble getting the Pi to boot. When it came to controlling the Arduino over SPI I hit a snag. </p> <p> There wasn't (and still isn't) user space SPI support in FreeBSD. This means that I can control devices to connected to SPI from a kernel driver, but I can't do so from user space. Kernel code is harder to write, not portable and means I can't reuse Linux code. User space code is easier to write and if the interface is similar to existing ones I can reuse a lot of other code. </p> <p> I was enjoying writing the NewCWV port and I thought to myself: "I should make the world a better place and write a user space SPI layer". And that is exactly what I set out to do over the next few months. </p> <hr/> <p> This week, well over 9 months later I finally have a working SPI layer. I can issue, read(2), write(2) and ioctl(2) commands and see the bus burst into life with data flowing across. </p> <p> <a href="/images/spiscope.jpg"> <img src="/imagessmall/spiscope.jpg"/> </a> </p> <p> On the other end of the bus I have a <a href="https://www.adafruit.com/product/2000"> Trinket Pro </a> (Adafruit arduino clone). The Trinket acts as a SPI slave, when there is activity on the bus it spits on the values from the master over UART and writes the SPI values back onto the bus with 10 added. </p> <p> The Arduino seems to struggle at the default bus speed of 500KHz, but runs fine when I lower the speed with a sysctl down to 50KHz. </p> <hr/> <p> Speaking to the Arduino is okay, but it doesn't make a very exciting demo. I had a couple of devices that can be controlled over SPI, a SSD1306 <a href="https://www.adafruit.com/products/326"> OLED Screen </a> and a <a href="https://dangerousthings.com/shop/simple-pn532/"> PN532 NFC Reader </a> . </p> <p> The NFC Reader is supported by <a href="https://code.google.com/p/libnfc/"> libnfc </a> , a quick look shows that libnfc is available in the FreeBSD ports tree. I looked at the libnfc code while writing the user space layer and it seemed pretty straight forward. libnfc opens the SPI device and calls the SPI <em> IOC </em> MESSAGE ioctl to send spi <em> ioc </em> transfer structs to the driver. </p> <p> The interface I have written is a little different, using an object to describe the transfer similar to the way iic(4) works. To add FreeBSD support I need to create the struct and swap the ioctl(2) call, this should be straight forward. </p> <p> Using the OLED is a little different. Adafruit have provided a <a href="https://github.com/adafruit/Adafruit_Python_SSD1306"> python library </a> to speak to the screen using either i2c or SPI. The python library imports a module to speak to SPI and seems to mostly use read(2) to control the screen. This is going to be harder to port across and get working. </p> <p> There is also an Adafruit <a href="https://github.com/adafruit/Adafruit_SSD1306"> Arduino library </a> for the SSD1306 and Arduino compatible boards. This is C++ that has been written to run on an Arduino rather than on a unix machine. This code could probably be slimmed down, with the calls to fastspiwrite swapped out to calls to the kernel interface. </p> <hr/> <p> My implementation is still a little rough around the edges, the code needs to be tidied up, moved into the kernel directly and tested on the latest head. I think that getting user space code working with it will show up any bugs, it will certainly make for more meaningful test cases. </p> <p> My next step is to get the NFC reader working with libnfc and the raspberry pi, then I can start work on the screen. Once I have some SPI examples working I might even get back to setting up the Mystery Box for a CTF in the space. </p> https://adventurist.me/posts/0038Sat, 28 Feb 2015 00:00:00 +0000 libnfc i2c usagehttps://adventurist.me/posts/0039<p> I have been working on applications using the SPI user space api. One of the devices I have been playing with is a <a href="https://dangerousthings.com/shop/simple-pn532/"> PN523 </a> NFC reader. The reader is supported by <a href="https://code.google.com/p/libnfc/"> libnfc </a> and can communicate using serial, SPI, i2c or usb depending on device support. </p> <p> I wanted to get the nfc reader working over i2c, to form a baseline to compare it against SPI. I couldn't get the nfc-list to show any NFC devices connected to the Pi. I then tried to use the i2c -s command to scan the i2c bus, but instead of device detection the command threw an error. </p> <p> It <a href="https://vzaigrin.wordpress.com/2014/04/28/working-with-i2c-in-freebsd-on-raspberry-pi/"> turns out </a> that the iic driver for the Pi only supports one ioctl, I2CRDWR. That neuters most of the FreeBSD i2c tools as they use other ioctl's and error out on failure. </p> <p> Learning that I looked at the Makefile for libnfc, this time realising that the i2c and the SPI device options are both commented out. I missed this the first time I looked at the FreeBSD port, there is still the option to use a serial device once I dig out a usb serial adapter. </p> <p> It is looking a lot harder than I thought to get devices working with user space SPI on FreeBSD. It doesn't help that Linux has been the only operating system with user space SPI support for quite a long time. </p> https://adventurist.me/posts/0039Sun, 01 Mar 2015 00:00:00 +0000 msp430 hello worldhttps://adventurist.me/posts/0040<p> A couple of years ago the TI Launchpad made quite a splash when TI released the boards for just $5 each. The Launchpad uses the msp430 low power microcontroller from TI, these microcontrollers don't have the same pretty face as the avr microcontrollers in the AVR world. </p> <p> This means the code is a little harder to read and write. It is a lot closer to assembly language than the high level Arduino C/C++. While it looks worse I find it more fun to write and it will leave you with a much better understanding of how the controller is working. </p> <p> So lets load up a simple blinking light program(no more of that sketch nonesense), fire up the debugger and stop the code as it is executing. Grab the following code and make file and compile up the main.elf target. If you are using a different microcontroller then you should change the g2553 to the microcontroller you are using. </p> <p> Blink Program </p> <pre><code>#include &lt;msp430g2553.h&gt; int i = 0; int j = 0; int main(void) { WDTCTL = WDTPW + WDTHOLD; //Stop the watch dog timer P1DIR |= 0x41; //Set the direction bit of P1(0x01) as an output P1OUT = 0x40; //Set P1.6 high, P1.0 low for(;;) { P1OUT ^= 0x41; //Toggle both P1.1 and P1.6 for(i = 0; i &lt; 20000;i++){ //Loop for a while to block nop(); } } return 0; } </code></pre> <p> Makefile </p> <pre><code>CC=msp430-gcc CFLAGS=-Os -Wall -g -mmcu=msp430g2231 OBJS=main.o all: $(OBJS) $(CC) $(CFLAGS) -o main.elf $(OBJS) %.o: %.c $(CC) $(CFLAGS) -c $&lt; clean: rm -fr main.elf $(OBJS) </code></pre> <p> We use the mspdebug program to flash the program to the msp430 like so. </p> <pre><code>$ mspdebug -q rf2500 Trying to open interface 1 on 006 rf2500: warning: can't detach kernel driver: No data available fet: FET returned error code 4 (Could not find device or device not supported) fet: command C_IDENT1 failed Device: MSP430G2xx3 fet: FET returned NAK warning: device does not support power profiling (mspdebug) prog main.elf Erasing... Programming... Done, 152 bytes total (mspdebug) run Running. Press Ctrl+C to interrupt... ^C ( PC: 0c068) ( R4: 0dff7) ( R8: 0ffbb) (R12: 0fdf7) ( SP: 00400) ( R5: 05a08) ( R9: 0dcff) (R13: 0fd67) ( SR: 00004) ( R6: 0b775) (R10: 0dddf) (R14: 0dfff) ( R3: 00000) ( R7: 0ff1f) (R11: 0dfff) (R15: 00000) main+0x2a: 0c068: f9 3b JL 0xc05c 0c06a: f2 3f JMP 0xc050 0c06c: 32 d0 f0 00 BIS #0x00f0, SR 0c070: fd 3f JMP 0xc06c 0c072: 30 40 76 c0 BR #0xc076 0c076: 00 13 RETI (mspdebug) exit </code></pre> <p> There you have it, your first hello world on the msp430. </p> https://adventurist.me/posts/0040Mon, 02 Mar 2015 00:00:00 +0000 Tech seen debugging bus signhttps://adventurist.me/posts/0041<p> In Aberdeen we have digital displays mounted in most of the bus stops, in fact most major cities in the world probably have similar signs. The signs get their data via radio broadcasts, these broadcasts have in fact been <a href="http://www.windytan.com/2013/11/decoding-radio-controlled-bus-stop.html"> captured before </a> and reverse engineered. </p> <p> For a long time I have been thinking about doing a similar thing and figuring out the bus information that is in the air. I am sure I will get to it one day. </p> <p> <a href="/images/bussigntech.jpg"> <img src="/imagessmall/bussigntech.jpg"/> </a> </p> <p> Well this morning as I headed off to work I caught a technician in the act of debugging one of these signs. I grabbed a quick picture of the guy working, but I didn't want to bother him. </p> <p> It looked like the tech was using a serial cable from his laptop up to the display. The antenna on the bus shelter looked much larger than the normal ones. </p> https://adventurist.me/posts/0041Tue, 03 Mar 2015 00:00:00 +0000 Attaching a debugger to mspdebughttps://adventurist.me/posts/0042<p> The cool thing we get with the msp430 and the Launchpad is on chip debugging. This goes a long way to pave over the warts of writing straight C for the 430. We will load up the blink program from <a href="http://adventurist.me/posts/0040"> last time </a> , run it with the debugger and pause execution. </p> <p> Start up mspdebug as before, this time we pass a command for mspdebug to run directly. The "gdb" command will cause mspdebug to listen on port 2000, gdb can then connect and control the debugger. </p> <pre><code>$ mspdebug rf2500 "gdb" </code></pre> <p> Next we are going to start up msp430-gdb, load the program from before and start it running. </p> <pre><code>$ msp430-gdb (gdb) target remote localhost:2000 (gdb) file led.elf (gdb) load led.elf (gdb) continue ^C (gdb) break main.c:14 (gdb) c #We can shorthand commands Now between each continue we will see the LED's toggle, red then green. (gdb) continue </code></pre> <p> From gdb we can send mspdebug directly with the monitor command. </p> https://adventurist.me/posts/0042Wed, 04 Mar 2015 00:00:00 +0000 Reading analog values on the msp430https://adventurist.me/posts/0043<p> I finally got all the components to use the bag of electret microphones I got last year. Using a LM36 audio amp I set up a <a href="http://www.arduino-hacks.com/arduino-vu-meter-lm386electret-microphone-condenser/"> simple circuit </a> to read values from the microphone and set LED's corresponding to the value read. </p> <p> I had trouble finding a solid example of doing analog reads in a loop for the msp430. This program, sets up LED's(On P1.1 and P1.6), sets up the ADC, then sits in a loop. If the value on the ADC is grater than 512 the LED will go red. </p> <p> I tested this by shouting at the micro controller, something I have done many times before, but never with such satisfying results. </p> <pre><code>#include &lt;msp430g2553.h&gt; unsigned int adcvalue = 0; void configureADC(void); int main(void) { WDTCTL = WDTPW + WDTHOLD; //Stop the Watch dog P1DIR |= 0x41; //Enabled P1.0 and P1.6 P1OUT = 0x41; BCSCTL1 = CALBC1_1MHZ; //Set range BCSCTL2 &amp;= CALBC1_1MHZ; //SMCLK = DCO = 1MHz P1SEL |= BIT3; configureADC(); __enable_interrupt(); while(1) { __delay_cycles(20000); ADC10CTL0 |= ENC + ADC10SC; //Sampling and conversion start adcvalue = ADC10MEM; //Read from the ADC if(adcvalue &gt; 512) P1OUT = 0x40; else P1OUT = 0x01; } return 0; } void configureADC(void) { ADC10CTL1 = INCH_3 + ADC10DIV_3; ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE; ADC10AE0 |= BIT3; } </code></pre> https://adventurist.me/posts/0043Thu, 05 Mar 2015 00:00:00 +0000 Using portmaster to bulk install portshttps://adventurist.me/posts/0044<p> As I write this there are not any packages available for FreeBSD arm. That means on the Raspberry Pi I have to build the things I need from ports. Ports gives a lot of control about how the software is built, but right now I just want the tools I need installed. </p> <p> It is hard to set up ports to install a collection of tools in a oner, but we can use portmaster to do this for us. The Pi is quite slow and will take a long time to build a small number of tools and their dependencies. </p> <p> Normally portmaster will prompt for configuration for each package as it builds, it will then build a list of packages and prompt again to install these. The following line will install the listed tools without any prompting. </p> <pre><code>$ portmaster -mBATCH=yes --no-confirm -y sysutils/tmux editors/vim </code></pre> <ul> <li> The -m flag will pass options to make </li> <li> --no-confirm will disable the 'install' prompt </li> <li> -y will answer yes to any prompts </li> </ul> https://adventurist.me/posts/0044Fri, 06 Mar 2015 00:00:00 +0000 Controlling keyboard ledshttps://adventurist.me/posts/0045<p> I have just finished reading <a href="http://cryptonomicon.com"> Cryptonomicon </a> , without any spoilers I can say that at a certain point a character controls the led's on his keyboard. This morning I found the <a href="https://github.com/t6/kbdled"> kbdled </a> utility via a forum post. It looks like a nice simple way to make the keyboard do something useful. </p> https://adventurist.me/posts/0045Mon, 09 Mar 2015 00:00:00 +0000 wait_onhttps://adventurist.me/posts/0046<p> I have been working on stuff in latex recently and wanted something to trigger regeneration of pdfs without manual intervention. At first I thought about doing so in a loop every so often, but it didn't seem like the best approach. </p> <p> Knowing about the cool <a href="https://www.freebsd.org/cgi/man.cgi?query=kqueue&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+10.1-RELEASE&amp;arch=default&amp;format=html"> kqueue </a> framework I looked to see if there was a utility to watch files for me. I found the <a href="http://www.freshports.org/sysutils/wait_on"> wait_on </a> command via a FreeBSD forums post. </p> <p> The wait <em> on command will wait until the watched file has been changed and then exit. It is meant to be used within a loop. I through this together in zsh. Now when I :wq in vim wait </em> on exists and my document rebuilds, evinces picks up on this and refreshes the display. </p> <pre><code>$ while true; do wait_on pres.tex; xelatex pres.tex; sleep 5; done </code></pre> <p> I have the sleep at the end to stop the document being built too often. </p> https://adventurist.me/posts/0046Mon, 16 Mar 2015 00:00:00 +0000 Adding a TrueType fonthttps://adventurist.me/posts/0047<p> I needed to add a .ttf font for a presentation I was working on, it turned out to be a lot more hassle than it needed to be. </p> <pre><code>$ mkdir ~/.font $ cp font.ttf ~/.font/ $ mkfontdir ~/.font $ fc-cache </code></pre> <p> I read a lot about editing xorg.conf to change font paths, in the end it was a matter of refreshing the font cache and restarting evince. </p> https://adventurist.me/posts/0047Thu, 19 Mar 2015 00:00:00 +0000 Screenshotting in i3https://adventurist.me/posts/0048<p> It took me a while to find a screenshot tool as useful as the built in screenshotting tool in OS X. I looked again today and found the import tool that comes as part of ImageMagick. </p> <pre><code>$ import screenshot.png </code></pre> <p> You can use it to capture an area on the screen with the above command or you can capture a whole window. </p> <pre><code>$ import -window root screenshot.png </code></pre> <p> I will probably throw this into a script and bind it to a key for ease of use. </p> https://adventurist.me/posts/0048Tue, 31 Mar 2015 00:00:00 +0000 rtl_sdr and OpenWRThttps://adventurist.me/posts/0050<p> Using a <a href="http://wiki.openwrt.org/toh/tp-link/tl-wr703n"> TP-Link WR703N </a> and a <a href="http://sdr.osmocom.org/trac/wiki/rtl-sdr"> RTLSDR </a> I decided to make a small dedicate SDR box. Using <a href="http://sdr.osmocom.org/trac/wiki/rtl-sdr#rtl_tcp"> rtl_tcp </a> I can set up the box and a suitable antenna and use it to receive IQ values over a wifi or ethernet link. Using the wifi means I can do this without pluggin a ton of crap into my laptop. </p> <h2> WR703N </h2> <p> The WR703N has been really well documented, with a full section of mods on its wiki page. I have add <a href="http://wiki.villagetelco.org/index.php?title=Building_a_Serial_Port_for_TL-WR703N"> serial console headers </a> and a <a href="https://app.box.com/s/cispknq8b9zgog8k5vxn"> rp-sma antenna connector </a> on the box I used for this project. </p> <p> These were fun to do, the serial connector makes debricking the WR703N a lot easer, the rp-sma connector allows different antennas to be used with the router. With some more gain behind it, I should be able to place the sdr box somewhere high and out of the way and still be able to connect to it. </p> <p> For getting OpenWRT onto the WR703N you can follow the <a href="http://wiki.openwrt.org/doc/howto/generic.flashing"> generic flashing </a> instructions. Make sure to install <a href="https://lists.openwrt.org/pipermail/openwrt-devel/2014-October/028346.html"> Barrier Breaker </a> or later, BB has a prebuilt package for rtl_sdr. </p> <p> I installed the rtl_sdr software via the web interface, but it can be done from the command line with something like the following. </p> <pre><code># opkg update # opkg install rtl_sdr </code></pre> <h2> rtl_tcp </h2> <p> Once you have the rtl <em> sdr packages installed, connect your rtl </em> sdr dongle to the usb port then run the following. </p> <pre><code>$ rtl_tcp -a 192.168.1.1 -n 8 -b 8 </code></pre> <p> This command will start rtl_tcp and have it listen on the 192.168.1.1 address for external connections, without this it will only listen on localhost. If you have configured your network differently you will want to change the listen address. </p> <p> I had a lot of trouble running rtl <em> tcp for more than a few seconds with a client connected, this was fixed by configuring the buffer options. The -n option configures the number of linked lists rtl </em> tcp will use, -b configures the number of buffers it will use. I have had a quick look at the <a href="https://github.com/steve-m/librtlsdr/blob/master/src/rtl_tcp.c"> rtl_tcp </a> source, but I couldn't really figure out why this helped so much. </p> <h2> Viewing the data </h2> <p> The last thing to do to test this is connect a client. The rtl <em> sdr tools can't connect to a rtl </em> tcp source, but we can connect and grab some data using netcat. </p> <pre><code>$ nc 192.168.1.1 &gt; capture.iq </code></pre> <p> <a href="/images/fftscope.png"> <img src="/images/fftscope.png"/> </a> </p> <p> This might be enough if you have a process for dealing with iq data, but I like to look at things. The GrOsmoSDR package comes with a couple of tools for viewing ffts and waterfalls using GNURadio. </p> <pre><code>$ osmocom_fft -W -s 2000000 -f 144000000 -a 'rtl_tcp=192.168.4.1:1234' Without any of the following it will show an fft -W Show a waterfall -S Show a scope -F Show the cool fosphor display </code></pre> https://adventurist.me/posts/0050Fri, 03 Apr 2015 00:00:00 +0000 Setting serial baud rate on FreeBSDhttps://adventurist.me/posts/0051<p> I have a <a href="http://www.navspark.com.tw/"> navspark </a> gps microcontroller board I backed on indiegogo last year. The board has been sat in my desk for a year so I decided to just use it as a dumb gps and not bother with the microcontroller part of the board. </p> <p> The default firmware sends nmea strings over a usb serial controller at 115200 baud, this was easy to test with cu. I wanted to use gpsd with the gps, I am planning to integrate it into a wardriving box in the next few weeks. </p> <pre><code>cu -l /dev/ttyU0 -s 115200 </code></pre> <p> <a href="http://www.catb.org/gpsd/faq.html#baud"> gpsd is unable to accept baud rate </a> changes, instead there is workaround in the faq. The faq is probably wildly out of date, I couldn't get stty to change the baud rate on FreeBSD. I found that FreeBSD offers .init files for each of the serial devices and they should be used for configuring the serial device. </p> <p> Using the following command worked for me and allowed gpsd to speak to the navspark. </p> <pre><code># stty -f /dev/ttyU0.init speed 115200 # gpsd </code></pre> <p> I could then connect to the gpsd and make sure it is working with cgps. </p> <pre><code>$ cgps -s -u m </code></pre> <p> I am not really happy with the navspark, the indiegogo made the board look really cool, but so far there no community has formed around the board. This has led to a lack of approachable documentation and an ide only available with Linux and Windows bulds. </p> <p> <a href="/images/cgps.png"> <img src="/images/cgps.png"/> </a> </p> <p> I would love to find a cheap gps that emits data over serial. The closest thing is the <a href="https://www.adafruit.com/products/746"> Adafruit Ultimate gps </a> , but it is far too expensive for what it is. I have a pair of <a href="http://denialmedia.ca/a-cheap-functioning-gps/"> U-Blox PCI GPS cards </a> , so far I haven't been able to get them working with anything. </p> https://adventurist.me/posts/0051Tue, 07 Apr 2015 00:00:00 +0000 Talks from BSDCan2015https://adventurist.me/posts/0052<p> Like <a href="http://adventurist.me/posts/0028"> last year </a> , here are from BSDCan that have stood out to me. I don't think all of the videos have been posted yet so there are probably some gems left to watch. All of the videos are <a href="https://www.youtube.com/playlist?list=PLWW0CjV-TafY0NqFDvD4k31CtnX-CGn8f"> here </a> </p> <ul> <li> <a href="https://youtu.be/K2pnf1YcMTY"> Molecular Evolution, Genomic Analysis and FreeBSD </a> </li> <li> <a href="https://youtu.be/KtV_SfSvRpU"> Fighting Harassment with Open Source Tools </a> </li> <li> <a href="https://youtu.be/XDIcD4LR5HE"> What happens when a dwarf and a daemon start dancing by the light of the silvery moon? </a> </li> <li> <a href="https://youtu.be/YSVFnM3_2Ik"> A stitch in time: jhbuild </a> </li> <li> <a href="https://youtu.be/DwCg-51vFAsttps"> CheriBSD: A research fork of FreeBSD </a> </li> </ul> https://adventurist.me/posts/0052Wed, 24 Jun 2015 00:00:00 +0000 The laddie and the Tramphttps://adventurist.me/posts/0053<p> The best way to get around Paris is to use the metro, if you are coming into CGD you can take the train to Gard du Nord then hop onto the metro from there. Metro stations seem to be dense enough that there will be one near to your destination, I didn't see more than a 10 minute walk. </p> <p> Using the metro fulfilled every Parisian stereotype I had, lovers kissing, gypsies begging, men busking with accordions. The metro was a brilliant way to get around very entertaining. </p> <p> Just as entertaining for me(though some might not enjoy it) was my pre metro knowledge walk across Paris to reach my hotel. On the map before traveling the walk didn't look every long. I didn't have any frame of reference for Paris, but a similar distance around the Thames in London would be a reasonable walk. Well reasonable to people that like to walk through cities. </p> <p> <a href="/images/pariswalk.png"> <img src="/images/pariswalk.png"/> </a> </p> <p> With the 30°C heat at 1800 it was probably a little long for a 6Km walk through the city. But the walk was very fortuitous if I had been down in the metro I wouldn't have seen the stunning sights of Paris, large buildings, street gangs, passed out tramps that have pissed them selves and the myriad of cheap suit shops. Shiny silver suits are a steal at 50€. </p> <p> After a couple of bouts of despair I reached my hotel in once piece, only loosing about 5 kilos in water. </p> https://adventurist.me/posts/0053Sun, 28 Jun 2015 00:00:00 +0000 The fox in the cityhttps://adventurist.me/posts/0054<p> The Mega Charity Mozilla keeps offices for their staff in many major cities. I think most of their staff work from home, but some must visit offices and the require space to hold meetings. Hopefully Mozilla Space Paris is the most decant of them all. </p> <p> <a href="/images/mozilla.jpg"> <img src="/imagessmall/mozilla.jpg"/> </a> </p> <p> The space has all the trappings you would expect from a hip and trendy startup, mozilla sort of is. They have a big airy space, a fancy cateries kitchen and the most insane meeting room I have ever seen. You can see from the pictures why the French Revolution started. </p> <p> <a href="/images/mozillameetingroom.jpg"> <img src="/imagessmall/mozillameetingroom.jpg"/> </a> </p> <p> I should probably apoligize to anyone that has donated to mozilla in the past. I took full use of their stocked kitchen and to avoid the ridiculous parisian beer prices drank more than my share of mozilla beer. Yum yum. </p> https://adventurist.me/posts/0054Mon, 29 Jun 2015 00:00:00 +0000 Paris loves the theatrehttps://adventurist.me/posts/0055<p> Paris loves the theatre, they have world renowned plays enjoyed by douchy teenage girls the world around. They love no theatre more than Security Theatre. To transit through Paris CDG and make it to the departure lounge you need to show your passport twice and your boarding pass at least six times. </p> <p> In fact one agent of the airport was enjoying her role more than anyone I have seen at work. She scanned my boarding pass and scrutinized my passport before sending me through the metal discoverer. </p> <p> At the other side I waited and waited expecting my bag. Instead I hear a shriek! 'You did not show me your pass'. I am dragged back through the magnetic arch to show my passport once again. This this with the agent shouting as if I had stripped half naked. </p> <p> Oh fun. </p> <p> BHX is a strange airport, security are trying to stay in business and keep manning up. They manage this by directing transfer passengers back through security to redo the dance, I did get set on the priority track though. </p> <p> Of course, with a flights worth of passengers transferring this wasn't quick. </p> <p> Past security and a worm whole takes you to a mall in the center of the city. A shopping horror exists until you overcome the forces of capitalism and resign your self to sit in the uncomfortable long. </p> https://adventurist.me/posts/0055Tue, 30 Jun 2015 00:00:00 +0000 Radio day to Balmedie Beachhttps://adventurist.me/posts/0056<p> Planning a radio field day was all it took to ruin a week of perfect weather. Instead of the glorious sunshine and high temperatures of the previous days the North Sea took revenge and summoned an <a href="https://en.wikipedia.org/wiki/Haar_%28fog%29"> mighty Haar </a> to punish us for our hubris. </p> <p> <a href="/images/balmediesetup.jpg"> <img src="/imagessmall/balmediesetup.jpg"/> </a> </p> <p> We hit the beach with a bbq, food and a couple of radios. Hibby had his new toy, a clansman set including a 5m mast. The mast was light to carry, easy to slot together actually really easy to put up. I think with some practice it could be erected by one person by pegging in the guy lines first. </p> <p> <a href="/images/clansmanmast.jpg"> <img src="/imagessmall/clansmanmast.jpg"/> </a> </p> <p> The bands were relatively quiet considering it was a Friday afternoon, but Hibby and Derecho had a couple of good contacts from across Europe. This radio nonsense was what interested me though, I was more interested in the playing in the dune system. </p> <p> <a href="/images/balmediedipole.jpg"> <img src="/imagessmall/balmediedipole.jpg"/> </a> </p> https://adventurist.me/posts/0056Fri, 03 Jul 2015 00:00:00 +0000 More BSDCan Videoshttps://adventurist.me/posts/0057<p> The final set of videos from BSDCan 2015 have been released. </p> <ul> <li> <a href="https://youtu.be/LE4wMsP7zeA"> Measure Twice, Code Once </a> </li> <li> <a href="https://youtu.be/2kEJoWfobpA"> Early Days of Unix and Design of sh </a> </li> <li> <a href="https://youtu.be/P3vB_FWtyIs"> Multipath TCP for FreeBSD </a> </li> <li> <a href="https://youtu.be/JaufZ7yCrLU"> Adding AES-ICM and AES-GCM to OpenCrypto </a> </li> </ul> https://adventurist.me/posts/0057Mon, 06 Jul 2015 00:00:00 +0000 Open Screenshottinghttps://adventurist.me/posts/0058<p> There are a number of services out there that allow you to take a screenshot and upload it to a website. All of these tools that I have seen(I didn't look, at all) used have involved a proprietary service and uploading your images to someone else's hosting. </p> <p> That isn't good enough for me, I needed an open tool I could use anywhere (FreeBSD support) with the ability to drop the resulting png into a directory on a webserver I control. </p> <p> Here is my tool to solve this problem, screenshot. Screenshot can capture either the entire window or offer a picker to grab a certain area. I used import from ImageMagick to handle the capturing and some glue to upload the image. There is another option to open the image with feh if required. </p> <pre><code>$ screenshot open $ screenshot upload $ screenshot pick upload </code></pre> <p> The script also dumps file names and url into a log file, this makes it easy to track down the last taken screen shots. I have some awk magic to pull out the last url and throw it onto my clipboard. </p> <pre><code>#!/bin/sh shotdir=$HOME/screenshots site="mysite.me" uploaddir="webdir/screenshots/" if [ ! -d $shotdir ]; then mkdir $shotdir fi one=`word` two=`word` word=$one-$two.png file=$shotdir/$word name=`basename $file` url=$site/screenshots/$name pick=false open=false upload=false for var in "$@" do if [ "$var" = "pick" ]; then pick=true continue; fi if [ "$var" = "upload" ]; then upload=true continue; fi if [ "$var" = "open" ]; then open=true continue; fi file=$var done echo "File:" $file echo $file "http://"$url &gt;&gt; $shotdir/screenshot.log if $pick; then import $file; else import -window root $file; fi if $upload; then scp $file $site:$uploaddir/$name fi if $open; then feh $file fi </code></pre> <p> I use another shell script to generate a random word. This script uses my local system dictionary, /dev/random and some glue to get a random word. The glue uses three bytes read from /dev/random and uses od to format those bytes into something useful. I then use sed to seek to the line in the dictionary to get the word. </p> <pre><code>#!/bin/sh words="/usr/share/dict/words" num=`od -An -N3 -i /dev/random` line=$(($num % `wc -l &lt; $words`)) word=`sed -n "$line"p $words` echo -n $word </code></pre> https://adventurist.me/posts/0058Mon, 13 Jul 2015 00:00:00 +0000 Touch Screen and Tablet on x220 Tablet and FreeBSDhttps://adventurist.me/posts/0059<p> My main laptop is a Lenovo x220 Tablet with an an awesome swivel screen. The screen on the laptop is a touch screen and wacom tablet which uses a pen that hides in the side of the laptop. </p> <p> I had quite a bit of trouble getting this all setup. Wacom touch and pen devices are supported by <a href="http://www.selasky.org/hans_petter/video4bsd/"> webcamd </a> in FreeBSD. I set up webcamd as documented elsewhere on the internet and while I could see webcamd grabbing the input devices the touch screen or pen didn't work at all under X. </p> <p> Eventually I figured out the problem was xorg not detecting the hid device nodes. To solve this I had to manually create an xorg.conf and the following sections. </p> <pre><code>Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen0" 0 0 Screen 1 "Screen1" RightOf "Screen0" InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "stylus" "SendCoreEvents" InputDevice "touch" "SendCoreEvents" EndSection ... Section "InputDevice" Driver "wacom" Identifier "stylus" Option "Device" "/dev/input/event0" Option "Type" "stylus" Option "USB" "on" # USB ONLY Option "Mode" "Absolute" # other option: "Absolute" Option "Vendor" "WACOM" Option "tilt" "off" # add this if your tablet supports tilt Option "Threshold" "5" # the official linuxwacom howto advises this line EndSection Section "InputDevice" Driver "wacom" Identifier "touch" Option "Device" "/dev/input/event1" Option "Type" "touch" Option "USB" "on" # USB ONLY Option "Mode" "Absolute" # other option: "Absolute" Option "Vendor" "WACOM" Option "tilt" "off" # add this if your tablet supports tilt Option "Threshold" "5" # the official linuxwacom howto advises this line EndSection </code></pre> <p> With the now xorg.conf dropped into /etc I could now restart the server and boom, touch screen and tablet working quite well. </p> <p> When I sniveled the screen I wanted to to be able to rotate my display and input devices to the correct orientation. I wrote a little shell script that can either advance the screen rotation by 90 degrees or set it back to the default orientation. </p> <pre><code>#!/bin/sh output=LVDS1 rotation="normal"; stylus="stylus" touch="touch" if [ "normal" == "$1" ]; then rotation="left"; else rotation=`xrandr --query --verbose | grep $output | awk '{print $5}'` fi case $rotation in normal) xrandr --output $output --rotation right xsetwacom --set "$stylus" Rotate cw xsetwacom --set "$touch" Rotate cw ;; right) xrandr --output $output --rotation inverted xsetwacom --set "$stylus" Rotate half xsetwacom --set "$touch" Rotate half ;; inverted) xrandr --output $output --rotation left xsetwacom --set "$stylus" Rotate ccw xsetwacom --set "$touch" Rotate ccw ;; left) xrandr --output $output --rotation normal xsetwacom --set "$stylus" Rotate none xsetwacom --set "$touch" Rotate none ;; esac </code></pre> <p> I bound the script in my .i3/config to the two screen rotation buttons on the fron of the bezzel. I found the keycodes by using xev. </p> <pre><code>bindcode 198 exec rotate normal bindcode 204 exec rotate </code></pre> <p> Overall the touch screen and tablet work quite well. When webcamd starts it doesn't always detect both the touch screen and tablet and sometimes in places them at different event points. If I could figure out a way to make these predictable or if a later xorg detects the input devices correctly then this setup would be perfect. </p> https://adventurist.me/posts/0059Mon, 19 Oct 2015 00:00:00 +0000 gimme pcbshttps://adventurist.me/posts/0060<p> With the launch of the <a href="http://greatscottgadgets.com/yardstickone/"> yardstick one </a> I remembered the <a href="https://hackaday.com/tag/im-me/"> im-me </a> I bought earlier this year. Not wanting to risk destroying one of the last available im-me's in the world I decided to get pcbs made of Michael Ossmann's <a href="http://ossmann.blogspot.co.uk/2012/10/programming-pink-pagers-in-style.html"> gimme </a> . </p> <p> I found <a href="https://oshpark.com/shared_projects/Z9cUDOkk"> a link to the OSH Park </a> board page an ordered a small batch(3 boards) for less than £10. They came in about 3 weeks and seem to be reasonable quality, I will try them when my goodfet appears this week. </p> <p> <a href="/images/gimmepcb.jpg"> <img src="/imagessmall/gimmepcb.jpg"/> </a> </p> https://adventurist.me/posts/0060Tue, 20 Oct 2015 00:00:00 +0000 rfcat on FreeBSDhttps://adventurist.me/posts/0061<p> My <a href="http://greatscottgadgets.com/yardstickone/"> Yardstick One </a> appeared yesterday, time to set up RFCat. </p> <p> RFCat has not yet been packaged on FreeBSD so I had to install it manually. I pulled the <a href="https://bitbucket.org/atlas0fd00m/rfcat"> RFCat source from bitbucket </a> which includes both the firmware and the client tools. To play with the stock firmware on the YSO I just had to install the client tools. </p> <p> The client tools depends on <a href="https://www.freebsd.org/cgi/man.cgi?query=usb&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+10.2-RELEASE&amp;arch=default&amp;format=html"> libusb-1.0 </a> , which ships in FreeBSD and on <a href="http://walac.github.io/pyusb/"> pyusb </a> . Pyusb is offered by the py27-usb port. </p> <pre><code>$ sudo pkg install py27-usb </code></pre> <p> Then I built the rfcat client tools: </p> <pre><code>$ cd code $ hg clone ssh://hg@bitbucket.org/atlas0fd00m/rfcat $ cd rfcat $ sudo python setup.py install </code></pre> <p> I had to set up devfs rules to access the usb devices, with my account in the usb group I have the following: </p> <pre><code># /etc/devfs.rules [localrules=10] add path 'usb/*' mode 0660 group usb #/etc/rc.conf devfs_system_ruleset="localrules" devd_enable="YES" </code></pre> <p> With that all set up I can now try the rfcat tools </p> <pre><code>$ rfcat -r 'RfCat, the greatest thing since Frequency Hopping!' Research Mode: enjoy the raw power of rflib currently your environment has an object called "d" for dongle. this is how you interact with the rfcat dongle: &gt;&gt;&gt; d.ping() &gt;&gt;&gt; d.setFreq(433000000) &gt;&gt;&gt; d.setMdmModulation(MOD_ASK_OOK) &gt;&gt;&gt; d.makePktFLEN(250) &gt;&gt;&gt; d.RFxmit("HALLO") &gt;&gt;&gt; d.RFrecv() &gt;&gt;&gt; print d.reprRadioConfig() </code></pre> <p> The r flag tells the client to throw me into the research prompt and I get left in something that looks sufficiently like ipython. To test that everything was working I decided to transmit some bytes in a loop in the ism 433 band. </p> <pre><code>In [1]: d.setFreq(433920000) In [2]: d.setMdmModulation(MOD_ASK_OOK) In [3]: d.makePktFLEN(4) In [4]: d.setMdmDRate(4800) In [5]: for i in range(0,15):d.RFxmit('\xDE\xAD\xBE\xEF'); In [6]: for i in range(0,15):d.RFxmit('\xDE\xAD\xBE\xEF'); In [7]: quit() </code></pre> <p> <a href="/images/sdrtouchyso.png"> <img src="/images/sdrtouchyso.png"/> </a> </p> <p> I used an rtlsdr dongle and <a href="http://sdrtouch.com/"> sdrtouch </a> on my phone to get a quick demod of the spectrum and to see a waterfall. I tried this a few times, but I wasn't seeing the expected signal. Right off to the far right edge of the screen I was seeing a jump in strength, tuning around a bit while transmitting I eventually caught my burst packet. It seems that my rtl dongle is about 400KHz off the actual observed frequency. </p> https://adventurist.me/posts/0061Wed, 21 Oct 2015 00:00:00 +0000 IM-ME Specanhttps://adventurist.me/posts/0062<p> Just before I left work yesterday I built one of the gimme boards I got earlier this week and connected it up to a <a href="http://goodfet.sourceforge.net/"> goodfet </a> . I had to do a little source editing to let the goodfet run and connect to the correct serial port. If you need to change the serial port from the default it is a quick grep through the source tree to find literal string "/dev/ttyU0" to change. </p> <p> <a href="/images/immespecscan.jpg"> <img src="/imagessmall/immespecscan.jpg"/> </a> </p> <p> I followed the instructions on the <a href="https://github.com/mossmann/im-me/tree/master/specan"> git repo for the specan code </a> . The first time I ran the flasher the IM-ME booted into the stock firmware again. I erased the flash, tried again and it all worked. I am not sure how long the flashing took, but if you will be holding gimmme expect it to be a few minutes. </p> <p> To flash the IM-ME I did: </p> <pre><code>$ goodfet.cc erase $ goodfet.cc flash specan.hex </code></pre> <p> This turned out to be a lot easier than I expected, everything seems to be well documented. If you can get an IM-ME and want to flash it with a goodfet and a gimme, send me an email and I will send you one of my spare(partially assembled) boards. </p> https://adventurist.me/posts/0062Thu, 22 Oct 2015 00:00:00 +0000 57N Stupid Shit No One Needs Hackathonhttps://adventurist.me/posts/0063<p> Hibby and I were happy to announce the first <a href="http://lists.57north.co/pipermail/57north-announce/2015-October/000174.html"> 57N Stupid Shit No One Needs Hackathon </a> this week. It isn't often that you come across a <a href="http://stupidhackathon.github.io/"> strange link </a> in your search history and it turns into an awesome event, we seem to have beaten the odds. </p> <p> The first Stupid hackathon I read about produced some of the coolest ideas for pointless things I have ever seen. The best one to make the event clear has to be <a href="http://endless.horse"> endless.horse </a> . </p> <p> <strong> So what are you going to do Tom? </strong> </p> <p> Of the many terrible ideas I have each day, only a few are worth spending 48 hours polishing to death. This coming weekend I have decided to take two technologies I have been gradually learning, mirco controllers and DSP, and build the most terrifyingly bad things I can think of. </p> <p> So tomorrow prepare yourself to see the start of a paper cup and string telegraph being forged in 57North Hacklab. </p> https://adventurist.me/posts/0063Fri, 23 Oct 2015 00:00:00 +0000 57N Stupid Shit No One Needs Hackathon - Resultshttps://adventurist.me/posts/0064<p> <a href="/images/stringscope.jpg"> <img src="/imagessmall/stringscope.jpg"/> </a> </p> <p> This weekend was the first <a href="http://adventurist.me/posts/0063"> 57N Stupid Shit No One Needs Hackathon </a> . I tried this weekend to perform serial comms over a string and cup using the msp430 based TI Launchpad. </p> <p> I had the tone generation working really quickly and then spent 15 hours trying to demod and tones and find a byte stream using a microphone. I had no chance, it didn't work at all. </p> <p> I was able to transmit the tone a long the string over 3 meters of room. So the core idea does work. I think I will try this project again after reading some more dsp. </p> <p> <a href="/images/stringscopelong.jpg"> <img src="/imagessmall/stringscopelong.jpg"/> </a> </p> https://adventurist.me/posts/0064Mon, 26 Oct 2015 00:00:00 +0000 FreeBSD on a pi with a small screenhttps://adventurist.me/posts/0066<p> For the past month or two the uboot on the FreeBSD RPI-B images has been unable to boot on most sd cards. This weekend a new version of uboot was released and new images were created. The new images boot no problem and I am finally able to try this cheap 5 inch screen I got on ebay. </p> <p> <a href="/images/fbsdpiscreen.jpg"> <img src="/imagessmall/fbsdpiscreen.jpg"/> </a> </p> https://adventurist.me/posts/0066Tue, 27 Oct 2015 00:00:00 +0000 Super simple presentations https://adventurist.me/posts/0067<p> This weekends <a href="https://www.dragonflydigest.com/2015/11/21/17104.html"> In The Other BSD's </a> section had a link to a <a href="http://lists.nycbug.org/pipermail/talk/2015-November/016406.html"> nycbug thread </a> about presentation software. That was strangely apropos, last week I made slides for a <a href="http://adventurist.me/winkekatze.pdf"> lightning talk </a> using my own template and beamer just exploded. I fixed the issue with beamer, I was pretty upset, upset enough to try looking for other software to use when I can. </p> <p> At the start of the nycbug thread <a href="http://tools.suckless.org/sent/"> suckless sent </a> is mentioned. sent is a really simple presentation tool that, it takes some input files and shows them as a slideshow. No pdf output, no templates, just a presentation. </p> <p> sent isn't packaged in FreeBSD, suckless make it rather easy to build their tools(you normally edit a header and rebuild to do config) so I <a href="http://git.suckless.org/sent"> grabbed the source </a> and built it. </p> <p> I had to add some search paths to get it to build: </p> <pre><code>$ git diff diff --git a/config.mk b/config.mk index ed08199..6f5f3e4 100644 --- a/config.mk +++ b/config.mk @@ -11,8 +11,9 @@ X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # includes and libs -INCS = -I. -I/usr/include -I/usr/include/freetype2 -I${X11INC} -LIBS = -L/usr/lib -lc -lm -L${X11LIB} -lXft -lfontconfig -lX11 -lpng +INCS = -I. -I/usr/include -I/usr/include/freetype2 -I${X11INC} -I/usr/local/include -I/usr/local/include/freetype2 + +LIBS = -L/usr/lib -L/usr/local/lib -lc -lm -L${X11LIB} -lXft -lfontconfig -lX11 -lpng # flags CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600 </code></pre> <p> Sent just expects paragraphs of text. </p> <p> <a href="/images/sent.gif"> <img src="/images/sent.gif"/> </a> </p> https://adventurist.me/posts/0067Wed, 25 Nov 2015 00:00:00 +0000 Quick gifshttps://adventurist.me/posts/0068<p> In the <a href="http://adventurist.me/posts/0067"> last post </a> I showed an animated gif of the of the post source run through sent. </p> <p> <a href="/images/sent.gif"> <img src="/images/sent.gif"/> </a> </p> <p> This gif was super easy to make manually, I ran sent on the post source file, then I ran <a href="http://adventurist.me/posts/0058"> my screenshot tool </a> from dmenu on each slide. I stepped through each slide manually. </p> <p> For a long presentation, or if I might do this more often I would probably automate this in some way. </p> <p> I was left with a directory of files call 1.png, 2.png, for each of the slides. I used the convert tool from imagemagick to turn these into an animated gif. </p> <pre><code>$ convert -delay 100 -loop 0 *.png sent.gif </code></pre> <p> Animated gifs can be played with the animated tool from imagemagick to see how the delay is working. </p> https://adventurist.me/posts/0068Thu, 26 Nov 2015 00:00:00 +0000 Tamogotchi Hivehttps://adventurist.me/posts/0070<p> <a href="http://spritesmods.com/?art=main"> spritesmod </a> has returned, this time making <a href="https://youtu.be/3_-e_cJ1-Gs"> the matrix for tamogotchis </a> </p> <p> <a href="http://imgs.xkcd.com/comics/tamagotchi_hive.png"> <img src="/images/tamagotchi_hive.png"/> </a> </p> https://adventurist.me/posts/0070Fri, 27 Nov 2015 00:00:00 +0000 Happy Hackmas from 57Northhttps://adventurist.me/posts/0071<p> We have two old Black and White CRT monitors in the hackerspace, they look really cool. I put together a Card and gif for the holidays: </p> <p> <a href="/images/57North-HackmasCard.gif"> <img src="/images/57North-HackmasCard.gif"/> </a> </p> <p> I used a raspberry pi running FreeBSD for each monitor. The bottom monitor is running aafire which gives a nice fireplace effect. I did some big text in figlet for the message. </p> <p> I also put together a paper card by using the gcard package in latex to put together some cards. This relies on double sided printing to get the message inside the cards. It was a bit of trouble(I had to trim the cards down), but the cards came out quite well for an hours work. </p> <p> Card Outside </p> <pre><code>\documentclass[]{article} \usepackage{gcard} \usepackage{fontspec} \setmainfont{Ubuntu Light} \begin{document} \begin{frontcover} \centering \makebox[0pt]{\includegraphics[width = .5\paperwidth, height=13.9cm]{card.jpg}} \end{frontcover} \begin{insideright} \centering \makebox[0pt]{\includegraphics[width = .5\paperwidth, height=13.9cm]{card.jpg}} \end{insideright} \begin{insideleft} \end{insideleft} \begin{backcover} \end{backcover} \end{document} </code></pre> <p> Card Inside </p> <pre><code>\documentclass[]{article} \usepackage{gcard} \usepackage{fontspec} \setmainfont{Ubuntu Light} \begin{document} \begin{frontcover} \centering{ {\large{Happy Hacking}} {\large{From Everyone at 57North Hacklab}} } \end{frontcover} \begin{insideright} \centering{ {\large{Happy Hacking}} {\large{From Everyone at 57North Hacklab}} } \end{insideright} \begin{insideleft} \end{insideleft} \begin{backcover} \end{backcover} \end{document} </code></pre> <p> This generates two pdf files, I used pdfjoin to join them together into one file: </p> <pre><code>pdfjoin inside.pdf outside.pdf -o hackmascard.pdf </code></pre> <p> <a href="http://adventurist.me/hackmascard.pdf"> pdf is here </a> </p> https://adventurist.me/posts/0071Thu, 17 Dec 2015 00:00:00 +0000 DSO138 Kithttps://adventurist.me/posts/0072<p> <a href="/images/dso138rawkit.jpg"> <img src="/imagessmall/dso138rawkit.jpg"/> </a> </p> <p> Around the December holidays I received three sets of the <a href="http://www.jyetech.com/Products/LcdScope/e138.php"> jyetech lcd scope </a> kit. This cheap kit (~£10) builds a small low frequency (1Msps) oscilloscope. </p> <p> <a href="/images/dso138resistors.jpg"> <img src="/imagessmall/dso138resistors.jpg"/> </a> </p> <p> In all it took me about 2 hours to solder everything together, that includes me misplacing a resistor and a capacitor. I wish I had sorted the resistors with a multimeter that scales automatically before starting. </p> <p> <a href="/images/dso138complete.jpg"> <img src="/imagessmall/dso138complete.jpg"/> </a> </p> <p> I am planning to build these kits into some audio projects later in the year, getting three of them was great luck. The kit was really straightforward to build and didn't take too long, there are serial logging features on the board as well. This kit could be built into a portable work bench without much thought. </p> https://adventurist.me/posts/0072Tue, 05 Jan 2016 00:00:00 +0000 The Thirty Second Chaos Communication Congresshttps://adventurist.me/posts/0073<p> I still can't describe CCC, you have to go. </p> <p> <a href="/images/32c3rocket.jpg"> <img src="/imagessmall/32c3rocket.jpg"/> </a> </p> <p> I wrote a post about how to survive congress, but didn't publish it. It contained a list a little like this: </p> <ul> <li> All of the talks are recorded, streamed and put online at media.ccc.de. </li> <li> The self organised sessions are not recorded. </li> <li> The most interesting things are happening at the assemblies. </li> </ul> <p> These points hold true, my original suggestion because the talks are available after the fact there isn't much point sitting in the lectures. At 32c3 I didn't attend any of the talks, this was a mistake. I really regret not going to any talks. </p> <p> <a href="/images/lasergrid2.gif"> <img src="/images/lasergrid2.gif"/> </a> </p> <p> Going to the talks gives you something to talk about with the people at CCC. </p> <p> The self organised sessions I went to were great and hanging out with people at their assemblies and at the Scottish Consulate was great. If I had been in a lecture instead of at our table I definitely would have missed <a href="https://twitter.com/search?q=%23toiletparty&amp;src=typd"> #toiletparty </a> . But I think if I had gone to some of the talks early each day I would have gotten much more out of the event. </p> <p> Next CCC I will head to the event with more of a plan. I don't think there is a right way to do congress, it is just too insane, but I will try to go to each one in a different way. </p> <p> <a href="/images/lasergrid3.gif"> <img src="/images/lasergrid3.gif"/> </a> </p> https://adventurist.me/posts/0073Thu, 07 Jan 2016 00:00:00 +0000 Making GIFS with FFMPEGhttps://adventurist.me/posts/0074<p> <a href="/images/lasergrid1-basic.gif"> <img src="/images/lasergrid1-basic.gif"/> </a> </p> <p> ffmpeg can now make gifs in a single step, no longer do you have to generate frames then pass them into ImageMagick. For most of the videos I have tried the initial gif from ffmpeg hasn't been very good. </p> <p> I found a <a href="http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality"> stackoverflow post </a> that describes a two step process for generating gifs with ffmpeg that has great results. The first step generates a palette from the source video, then this palette is used as a filter when converting the video into a gif. </p> <pre><code>ffmpeg -i input.mov -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png </code></pre> <p> Output the GIF using the palette: </p> <pre><code>ffmpeg -i input.mov -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif </code></pre> <p> <a href="/images/lasergrid1.gif"> <img src="/images/lasergrid1.gif"/> </a> </p> <p> The improvement is more evident if you click and watch the full size gifs side by side. The stackoverflow post links a blog post with even more information on <a href="http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html"> generating high quality gifs from video </a> . </p> <pre><code>#!/bin/sh if [ "$#" -ne 1 ]; then echo "usage: makegif filename.mp4" exit 1 fi input=$1 filename="${input%.*}" ffmpeg -y -i $input -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png ffmpeg -y -i $input -i palette.png -filter_complex "fps=10,scale=0:-1:flags=lanczos[x];[x][1:v]paletteuse" $filename.gif </code></pre> https://adventurist.me/posts/0074Tue, 12 Jan 2016 00:00:00 +0000 Setting up xorg on the pihttps://adventurist.me/posts/0075<p> The <a href="https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi"> Raspberry Pi page on the FreeBSD Wiki </a> links to <a href="http://blog.cochard.me/2013/03/xorg-for-freebsd-on-raspberry-pi.html"> a blogpost </a> about setting up xorg on the Pi. That post was written back in 2013 and most of the information there seems to be out of date. </p> <p> I set up X on a Pi at the end of December 2015, this information is up to date for r292413. pkg is now available on arm images so there is no need to build everything from ports, considering tools like tmux could take 6 hours to build on the pi itself this is a huge improvement. I installed the following packages to get X up and running on the Pi: </p> <pre><code># pkg install xorg xf86-video-scfb i3 </code></pre> <p> The Pi isn't able to auto detect the X configuration, I looked for a while for a config that would work. Eventually I dug the following one from a mailing list post. Place the following into /etc/xorg.conf: </p> <pre><code>Section "Device" Identifier "Generic FB" Driver "scfb" EndSection Section "Screen" Identifier "Screen" Device "Generic FB" Monitor "Monitor" SubSection "Display" Depth 16 #24 32 EndSubsection EndSection </code></pre> <p> With a minimal .xinitrc I was then able to start an X server with i3: </p> <pre><code>exec i3 </code></pre> <p> <a href="/images/fbsdpixorgscreen.jpg"> <img src="/imagessmall/fbsdpixorgscreen.jpg"/> </a> </p> https://adventurist.me/posts/0075Thu, 14 Jan 2016 00:00:00 +0000 Glitch Cardshttps://adventurist.me/posts/0076<p> Great news today about <a href="http://www.theguardian.com/world/2016/jan/19/terrorism-act-incompatible-with-human-rights-court-rules-in-david-miranda-case"> David Miranda's Case </a> , but I can't help but feel down with the direction of the country. I can see British law being deemed incompatible with the ECHR being used to strengthen arguments against being a signatory to ECHR and part of the EU. </p> <p> At home we have <a href="https://www.benthamsgaze.org/2016/01/19/insecure-by-design-protocols-for-encrypted-phone-calls/"> GCHQ dismantling secure communications </a> at every turn. The low price of oil is causing a down turn up here and it doesn't look like there is bright future. Sometimes it is hard to stay positive when you let the real world seep in. </p> <p> While I sit numbly at my desk I like to restlessly fumble with anything at hand. This week it has been <a href="https://www.kickstarter.com/projects/457846685/glitch-20-art-playing-cards-0"> this awesome mind bending deck of cards </a> . I have already had many visitors complain my cards are misprinted and hurt their head, this real world glitch is doing well. The <a href="https://www.reddit.com/r/glitch_art"> glitch_art sub reddit </a> contains many more examples of images like these. None quite as satisfying as holding these 'broken' playing cards. </p> <p> <a href="/images/glitchcards.jpg"> <img src="/imagessmall/glitchcards.jpg"/> </a> </p> https://adventurist.me/posts/0076Tue, 19 Jan 2016 00:00:00 +0000 Unreasonable Podcasthttps://adventurist.me/posts/0077<p> <a href="http://yakamo.org"> Yakamo </a> and I have started a <a href="http://unreasonable.computer/"> podcast </a> , the <a href="http://unreasonable.computer/casts/unreasonable0x00.flac"> first episode </a> was released yesterday. The website is still very simple and I don't think there is an rss feed setup yet. But, we have managed to put out the first episode and the second episode is lined up to be released on Monday. </p> <p> Give it a listen if you like podcasts, any feed back should be directed to stuff@yakamo.org or /dev/null. Thats where I send your emails anyway. </p> https://adventurist.me/posts/0077Thu, 21 Jan 2016 00:00:00 +0000 Recording Audio on FreeBSDhttps://adventurist.me/posts/0078<p> <a href="http://unreasonable.computer"> For some reason </a> I have been recording a lot of audio on my desktop recently. I also saw a conversation in irc about how to simply record audio from a microphone on FreeBSD. </p> <p> I hoped I was going to find a super simple <a href="http://www.openbsd.org/faq/faq13.html#recordaudio"> OpenBSD style </a> solution to capturing samples, but I wasn't able to dig anything out. I did play with cat for a little while, but nothing useful came from it. </p> <p> <a href="http://www.freshports.org/audio/audacity/"> <em> Audacity </em> </a> is the tool I have been using to record long sessions the most. Audacity is now probably the foss standard for doing audio editing/production and it has been really stable for me. On FreeBSD it has been rock solid so far if a little heavy weight. </p> <p> <a href="http://www.freshports.org/multimedia/ffmpeg/"> <em> ffmpeg </em> </a> is an audio and video swiss army knife and can be used to capture video from webcams and audio from capture devices. The only issue I have had with ffmpeg on FreeBSD is that lame support is not built into the default packages. </p> <p> ffmpeg can be used to caputure audio from a source: </p> <pre><code>ffmpeg -f oss -i /dev/dsp -vn -ab 128k test.wav </code></pre> <p> <a href="http://www.freshports.org/audio/sox/"> <em> Sox </em> </a> is the ultimate tool for handling audio, a long with the two front ends play and rec you can do most operations on an audio stream. Sox can built with codec support for a ton of formats. It is quite simple to use sox to convert different bit formats of sdr capture files with sox. </p> <p> Rec can be used to caputure audio from a source: </p> <pre><code>rec -c 2 test.wav </code></pre> https://adventurist.me/posts/0078Tue, 26 Jan 2016 00:00:00 +0000 How to do(bad) encryption in vimhttps://adventurist.me/posts/0079<p> <a href="https://www.reddit.com/r/ReverseEngineering"> Via the ReverseEngineering subreddit </a> I found that vim's built in <a href="https://github.com/wjlandryiii/crackvim"> :X encryption mode </a> can be pretty easily broken. I didn't know that vim had anything built in to encrypt files, in hindsight I should have expected some functionality. </p> <p> Looking into the <a href="http://vim.wikia.com/wiki/Encryption"> vim documentation </a> on on Encryption shows that most of these methods aren't recommended for use. It also looks really easy to accidentally destroy a file using vim. If you do not decrypt the correctly you get a vim buffer filed with encrypted noise, if you save that buffer you destroy the original file. </p> <p> I have been using <a href="https://github.com/vimwiki/vimwiki"> vimwiki </a> in a git repo since August last year. Vimwiki is a really simple markdown style wiki, the features are really limited. There is some markup, links and that is all. It has been filling all of my needs perfectly. I would like to be able to encrypt the wiki files so I could have a little more peace of mind, but with a little searching I haven't found anything that has the utility I need. </p> <p> I could write something myself that worked well with both git and vimwiki, but I don't really want to subject my personal files to my own bugs. If you know of a solution to encrypting files in git repo or integrating with vimwiki that would be really helpful. </p> https://adventurist.me/posts/0079Thu, 28 Jan 2016 00:00:00 +0000 Command line notificationshttps://adventurist.me/posts/0080<p> <a href="https://jcs.org/"> JCS </a> was interviewed on the <a href="http://garbage.fm/episodes/11"> latest episode </a> of <a href="http://garbage.fm/"> Garbage </a> , he spoke about <a href="https://pushover.net/"> his app pushover </a> . Pushover is an Android, iOS and mac app that works with a service backend. You can send notifications to pushover via simple api (you can just use curl) and the notifications are delivered to your devices. </p> <p> This is awesome, I can set up pushover on my phone, a client on my build machine and get alerts when builds are complete. No more checking while a build finishes, instead I can get notifications directly on my pebble via pushover and the pebble app. </p> <p> Looking through the <a href="https://pushover.net/apps"> app directory </a> I found the command line tool <a href="https://github.com/dschep/ntfy"> ntfy </a> . ntfy is really easy to set up and use, for pushover you need a simple <strong> .ntfy.json </strong> (with a real user_key) like: </p> <pre><code>{ "backends": ["pushover"], "pushover": { "user_key": "fjaudfaufjkjdufdaskufdaskfjads"} } </code></pre> <p> <a href="/images/pebble-ntfy.jpg"> <img src="/imagessmall/pebble-ntfy.jpg"/> </a> </p> <p> You can then send messages with ntfy or send the result of a command: </p> <pre><code>$ ntfy -t "Test" send "This is a test message" $ ntfy done false </code></pre> <p> By default ntfy will set the message title to the user@host, but the -t flag can override this. ntfy supports other backend services and a 'linux' backend. I though the linux backend would tie into the same thing as notify-send, but that wasn't the case. I need to figure out how those tie in. </p> <p> <a href="/images/pushover.png"> <img src="/images/pushover.png"/> </a> </p> <p> I have to run FreeBSD builds with root privileges, I didn't want to give a tool like ntfy root access. I wrote a small alias to send the result of the previous command. </p> <pre><code>alias buildres="if [ $? -eq 0 ]; then ntfy send 'Build passed'; else ntfy send 'Build failed'; fi" </code></pre> https://adventurist.me/posts/0080Tue, 02 Feb 2016 00:00:00 +0000 Unreasonable Podcast Episode 0x02https://adventurist.me/posts/0081<p> So far <a href="http://yakamo.org"> yakamo </a> and I have been consistently able to record our <a href="http://unreasonable.computer"> unreasonable podcast </a> , the <a href="http://unreasonable.computer/?p=2"> third episode, 0x02 </a> came out on Monday. </p> <p> Recording for the show has been okay so far, we have been using mumble to run our call while producing local recordings with audacity and a backup recording with mumble itself. </p> <p> The back up recording has already been useful, I selected the wrong channel in audacity and didn't notice the flat waveform coming out of my mic. There has been a lot of trouble with the audio streams going out of sync making it bothersome to edit in audacity. I hope that is related to my own rate issues on my local recordings. I will see when I get to editing 0x03. </p> <p> I think the show will probably get closer in structure to other shows as we go, I have already given in and you will hear intro noise in <a href="http://unreasonable.computer/?p=2"> episode 0x02 </a> . You will probably also hear us saying the name of the podcast a lot, that should remind people what they are listening to. </p> https://adventurist.me/posts/0081Wed, 03 Feb 2016 00:00:00 +0000 Fixing rate issues with audio on FreeBSDhttps://adventurist.me/posts/0082<p> It has been mentioned by a <a href="http://hibby.info"> friend </a> that my voice in the <a href="http://unreasonable.computer/?p=0"> recent </a> <a href="http://unreasonable.computer/?p=1"> unreasonable </a> <a href="http://unreasonable.computer/?p=2"> podcast </a> episodes is much higher than it is in reality. Of course for the first few episodes he just said 'your audio is fucked' which didn't help me resolve the issue at all. </p> <p> With the detail that pitch was off I knew where to start looking, the pitch issue was present on both the audacity recording and the mumble back up. The audio rate for the microphone and audacity where both the same, 44.1kHz. </p> <p> The last thing to check was the audio sub system on FreeBSD. I read the <a href="https://www.freebsd.org/cgi/man.cgi?query=snd&amp;sektion=4"> snd </a> man page and it pointed me to a few sysctl knobs that I might be able to tweak. I also checked the man page for <a href="https://www.freebsd.org/cgi/man.cgi?query=snd_uaudio&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+11-current&amp;arch=default&amp;format=html"> usb audio </a> and found this little notice in the bugs section: </p> <p> BUGS The PCM framework in FreeBSD only supports synchronous device detach. That means all mixer and DSP character devices belonging to a given USB audio device must be closed when receiving an error on a DSP read, a DSP write or a DSP IOCTL request. Else the USB audio driver will wait for this to happen, preventing enumeration of new devices on the parenting USB controller. </p> <pre><code> Some USB audio devices might refuse to work properly unless the sample rate is configured the same for both recording and playback, even if only simplex is used. See the dev.pcm.%d.[play|rec].vchanrate sysctls. The PCM framework in FreeBSD currently doesn't support the full set of USB audio mixer controls. Some mixer controls are only available as dev.pcm.%d.mixer sysctls. </code></pre> <p> vchanrate is a per device sample rate that can be controlled by a sysctl, toggling the value showed me the problem. With the rate at the correct 44100 my deep voice poured out of my microphone and into a file. </p> <pre><code>$ sudo sysctl dev.pcm.4.rec.vchanrate=44100 dev.pcm.4.rec.vchanrate: 48000 -&gt; 44100 </code></pre> https://adventurist.me/posts/0082Thu, 04 Feb 2016 00:00:00 +0000 Unreasonable Podcast Episode 0x03https://adventurist.me/posts/0083<p> So <a href="http://yakamo.org"> yakamo </a> and I have been managed to do it again, the most recent episode of the <a href="http://unreasonable.computer"> unreasonable podcast </a> , <a href="http://unreasonable.computer/?p=3"> episode 0x03 </a> appeared yesterday. </p> <p> This episode should now be missing large chunks of silence and features a much deeper sexier voice for me. Turns out there were some config issues with my microphone. There were also some observation issues, I didn't actually listen to the whole show or check the waveform before doing the renders. </p> <p> Should all be fixed now and it will sound silky smooth. </p> <p> Or something. </p> https://adventurist.me/posts/0083Tue, 09 Feb 2016 00:00:00 +0000 More Unreasonable Podcast Stuffhttps://adventurist.me/posts/0084<p> I was hit pretty hard the last few weeks with the standard issue winter cold. I was quite surprised to see how little energy I had for working on anything after work. I certainly see the value in taking time of work even if it just means more energy for side projects. </p> <p> <a href="http://yakamo.org"> Yakamo </a> and I have continued to push out our <a href="http://unreasonable.computer/"> podcast </a> , with <a href="http://unreasonable.computer/casts/unreasonable0x05.flac"> another episode </a> appearing today. Our audio is getting better though you won't hear it in the most recent show as I did all of the editing with my backup audio. </p> <p> Editing the backup audio showed some of the issues with mumbles recorder. It was a lot of trouble to keep my levels balanced, there seems to be gain correction on the mumble feed so my starting audio is super loud and it just tampers off. </p> https://adventurist.me/posts/0084Tue, 23 Feb 2016 00:00:00 +0000 Finding package build optionshttps://adventurist.me/posts/0085<p> I am making my email setup better. I have moved hosts to <a href="http://www.fastmail.com/?STKI=15542458"> Fastmail </a> (referrer link) and I am setting up mutt to work with folders correctly. There is a patch for mutt called <a href="http://www.lunar-linux.org/mutt-sidebar/"> mutt-sidebar </a> which gives a list of folders in a side pane in mutt, much like the interface would be on the web. </p> <p> Looking at <a href="https://www.freshports.org/mail/mutt/"> Freshports </a> it looks like the sidebar patch is part of the FreeBSD port, but it isn't setup by default. I wanted to check this and looked for the option in <a href="https://www.freebsd.org/cgi/man.cgi?query=pkg&amp;sektion=8&amp;apropos=0&amp;manpath=FreeBSD+10.2-RELEASE"> pkg </a> to list the build options. There is the pkg query command that will show information about installed packages, but it is a little mental to use. </p> <p> I found how to use pkg query to list the build options for a pkg in the <a href="https://wiki.freebsd.org/pkgng#query"> wiki </a> . </p> <pre><code>$ pkg query "%n is compiled with option %Ok set to %Ov" mutt mutt is compiled with option ASPELL set to off mutt is compiled with option COMPRESSED_FOLDERS set to on mutt is compiled with option DEBUG set to off ... mutt is compiled with option SIDEBAR_PATCH set to off ... </code></pre> <p> That tells me that I new to build mutt from the port and turn sidebar patch on. </p> https://adventurist.me/posts/0085Thu, 25 Feb 2016 00:00:00 +0000 Ubuntu Touch, Nowhere near ready yethttps://adventurist.me/posts/0086<p> I dropped my android phone at congress, I was trying to figure out which direction to walk in the compass was spinning wildly being absolutely no help. I slide the phone into my pocket missed and the screen cracked on contact with the ground. The phone had a terminal diagnosis then, but I soldered on for as long as I could. </p> <p> Eventually the nexus 5 dropped the cellular network and I travelled 40 minutes to a vet when I didn't need to. The next day I jumped on to the bq site and ordered my ubuntu edition E5. </p> <p> The BQ sales process was just terrible, it didn't help that my email provider decided I didn't need to receive email that weekend. The BQ site is really badly laid out, confusing and proactively difficult to login to and view your orders. They don't offer tracking number, so I don't know where the extra €10 'international' shipping went. </p> <p> The ubuntu touch os out of the box is annoying as any other smart phone, you are run through the standard dialog that asks mostly pointless questions. The version of ubuntu touch that ships on the E5 is "really old" (with really old being may 2015, 9 months prior). I was unable to install anything from the ubuntu app store (well I installed a hex colour picker, but that doesn't count). </p> <p> I tried to check for updates, but the phone was happy believing it was all up to date. I searched for a while, but any search term with 'ubuntu touch' results in ubuntu users having issues with their touch screen laptops. Eventually I fell into the #ubuntu-touch irc channel and asked. </p> <p> And I waited...three hours later on my third time asking someone suggested I try updating. There isn't wifi at work, I wondered if the ubuntu touch os is so broken it won't acknowledge user settings and will only <em> look </em> for updates on wifi. I tried at the hackerspace later that night and I managed to update to OTA9.1. This is the latest release version. </p> <p> </p> <p> I don't know how this operating system is for. I have been using free unix desktops for a decade, I can't see anything in ubuntu touch that I want. The default system shows a collections of scopes, scopes are an advertisers dream. </p> <p> There are default scopes like, weather, music, video, news and the scopes are populated by scope apps that create a feed for each theme. There are loads of different input services for them as well, so if you use facebook, instagram, flicker, 500px you will have a nice full feed. If you use one, or none of them you won't have anything. I saw the scopes and thought of windows crap wear. </p> <p> I turned off all of the scopes as soon as I could. </p> <p> Here is a short list of issues I encounter: </p> <h2> Out of the box </h2> <ul> <li> No updates were shown as available on 3G </li> <li> Updates became available to download on wifi </li> <li> Unable to download apps from the ubuntu app store </li> <li> Unable to run any software other than browser </li> <li> No way to find out the phone was an entire naming scheme behind without wifi </li> <li> The UK (and English) support site doesn't mention the Ubuntu Editions at all. The Austrian one does. </li> </ul> <h2> General System issues </h2> <ul> <li> All advice assumes you are running ubuntu on the desktop </li> <li> Phones always seems to be low on memory </li> <li> You are stuck looking at the apps scope </li> <li> No way to have a phone wallpaper, just apps </li> <li> If you turn off all of the scopes there is no way to add them back in </li> <li> No way to import contacts into the phonebook, yes on a phone </li> <li> There isn't a calendar </li> <li> There is no count down alarm timer (make noise in 20 minutes) </li> <li> Bluetooth volume is massively reduced (unable to hear anything out side) </li> <li> Removing wired headphones doesn't pause playback </li> <li> Volume transfers when plugging/unplugging head phones. Play music full volume on speakers, plug in headphones, go deaf. </li> <li> Headphone buttons don't work </li> <li> It can take still running paged out apps 10 seconds to become active. This was seen on the alarm clock app </li> <li> No security </li> <li> No encrypted storage </li> <li> No way to hide notification bodies on lock screen </li> <li> <p> Default lock screen leaks data (how many calls, how many messages) </p> </li> <li> <p> UI Bugs everywhere </p> </li> <li> There is gravity scrolling sometimes, I can't tell you when though </li> <li> The alarm time picker has gravity scroll when you don't want it and doesn't when you want it. </li> <li> When you switch to paged out apps, sometimes they will be out of focus. This is your only idicator they app isn't actually running. Don't worry it will restart entirely within 10 seconds </li> <li> There edge swipe gestures, but they only seem to work at the most annoying times </li> <li> The left swipe menu is useless when the default screen is a page of apps </li> <li> In the browser you access multiple tabs with a bottom up gesture, scroll in landscape mode is nearly impossible. </li> </ul> <h2> General App usage </h2> <ul> <li> The apps are either written by Canonical or some random person, these apps wants my login credentials </li> <li> <p> There are loads of apps available, as long as you want a news app from a minor regional newspaper </p> </li> <li> <p> Nobody wants scopes </p> </li> <li> Built in apps (twitter, youtube, etc,) are just web views and they are terrible. </li> <li> Can't tweet photos from twitter app </li> <li> Can't send photos on telegram app </li> <li> The Canonical provided apps have led to no good alternatives for apps (youtube, twitter, etc) </li> </ul> <h2> Specific Apps </h2> <ul> <li> Podbird looses progress in podcasts </li> <li> podbird redownloads podcasts on new wifi networks </li> <li> podbird doesn't have any play back indicator for podcasts other than the currently playing </li> <li> podbird can't handle many rss feed urls </li> <li> <p> podbird can't bulk import podcast urls </p> </li> <li> <p> Ureadit can't show the first item in the list in portrait </p> </li> <li> ureadit has no touch area for gifs </li> <li> No way to refresh feed without a long scroll up </li> <li> On out of memory feed/message thread is reset or cleared away </li> </ul> <p> Other <a href="http://a25.co/ubuntu-phone/"> people agree </a> , I have <a href="http://a25.co/ubuntu-phone-how-to-install-android/"> installed android </a> and life is better. </p> https://adventurist.me/posts/0086Thu, 24 Mar 2016 00:00:00 +0000 Light terminal theme https://adventurist.me/posts/0087<p> For about as along as I have been using terminals I have had them set to a dark theme, for a while at the beginning I had my terminal set up to be green text on a black background. I might have been the l33test mutherfucker around. </p> <p> <a href="/images/zenburn.png"> <img src="/images/zenburn.png"/> </a> </p> <pre><code>! Zenburn theme ! black + red urxvt*color0: #101010 urxvt*color1: #705050 ! green + yellow urxvt*color2: #60b48a urxvt*color3: #f0dfaf ! blue + purple urxvt*color4: #506070 urxvt*color5: #dc8cc3 ! cyan + white urxvt*color6: #8cd0d3 urxvt*color7: #dcdccc ! bright-black + bright-red urxvt*color8: #000000 urxvt*color9: #dca3a3 ! bright-green + bright-yellow urxvt*color10: #c3bf9f urxvt*color11: #f0dfaf ! bright-blue + bright-purple urxvt*color12: #94bff3 urxvt*color13: #ec93d3 ! bright-cyan + bright-white urxvt*color14: #93e0e3 urxvt*color15: #ffffff </code></pre> <p> I moved to <a href="https://gist.github.com/cqpx/1436584"> Zenburn </a> from the unreasonably popular <a href="http://ethanschoonover.com/solarized"> solarized </a> at some point last year. When I moved I went through a few themes trying things out. I found that .Xresources supports cpp macros making it easy to swap themes. </p> <pre><code>!.Xresources urxvt*scrollBar: false urxvt*matcher.button: 1 urxvt.transparent: false urxvt*allow_bold: true Xft*dpi: 96 Xft*antialias: true Xft*hinting: full URxvt*geometry: 85x16 URxvt*fading: 0 URxvt*tintColor: #ffffff URxvt*shading: 0 URxvt*inheritPixmap: False #include ".papercolour" URxvt.urlLauncher: firefox URxvt.matcher.button: 1 URxvt*font: xft:Source Code Pro:size=8 </code></pre> <p> I tried to work outside quite a few times last year. Dark themes for terminals are really hard to see in bright sunlight. For some reason yeahconsole doesn't like the way I include themes and stayed with a default light theme. The light theme is really easy to see in sunlight. The contrast in readability made me really question using a dark theme at all. </p> <p> At camp last year most of the daylight hours I spent on my laptop were inside our super tent, direct sunlight made my screen hard to read and the sun seems to melt my skin. My dark theme was okay to read in the tent, but it was no good outside, with the sun melting I just hid away until it was night time. </p> <p> The sun being bad, I am grateful I live in Scotland, we don't have to put up with the sun very often(this is a joke, it is always fucking sunny, I want a refund). </p> <p> When the sun isn't around I do quite like to sit in darkened rooms when I am hacking. If you too are a vampire you might have noticing the eyeball explosion that happens when you switch from your friendly terminal to the light explosion that is a web browser. Pretty much every web page has a light theme, I actually dislike dark themed web pages, I always think the designer is being up front with how much of a douchebag they are. </p> <p> Anyway, this is a lot of words for <a href="https://nlknguyen.com/2015/05/21/vim-paper-color-theme/"> "I have moved </a> <a href="https://www.reddit.com/r/vim/comments/36xzbs/vim_paper_color_theme_inspired_by_googles/crqbfpa"> to a light theme" </a> </p> <p> <a href="/images/papercolour.png"> <img src="/images/papercolour.png"/> </a> </p> <pre><code>! PaperColour Theme URxvt.foreground: #4D4D4C URxvt.background: #EEEEEE ! black URxvt.color0: #EDEDED URxvt.color8: #969694 ! red URxvt.color1: #D7005F URxvt.color9: #D7005F ! green URxvt.color2: #718C00 URxvt.color10: #718C00 ! yellow / orange URxvt.color3: #D75F00 URxvt.color11: #D75F00 ! blue URxvt.color4: #4271AE URxvt.color12: #4271AE ! magenta URxvt.color5: #8959A8 URxvt.color13: #8959A8 ! cyan URxvt.color6: #3E999F URxvt.color14: #3E999F ! white URxvt.color7: #4D4D4C URxvt.color15: #F5F5F5 </code></pre> https://adventurist.me/posts/0087Thu, 14 Apr 2016 00:00:00 +0000 What do those XXX blocks meanhttps://adventurist.me/posts/0088<p> From <a href="http://www.amazon.com/TCP-IP-Illustrated-Implementation-Vol/dp/020163354X"> Stevens TCP/IP Illustrated Vol 2 </a> : </p> <pre><code>We will see the comment /* XXX */ throughout Net/3. It is a warning to the reader that the code is obscure, contains nonobvious side effects, or is quick solution to a more difficult problem. </code></pre> <p> The second volume of that series might be one of the best networking books ever written. Not because it is a good tome to learn networking from, it is instead a guide into the heart of a real system. It is close enough today to use as a starting point for finding out where things are and a step to finding out why they are. </p> <p> It is where I go when I want to find out how my current machines get bytes from an application to packets on the wire. </p> https://adventurist.me/posts/0088Thu, 12 May 2016 00:00:00 +0000 Personal Area WiFI networkshttps://adventurist.me/posts/0089<p> The first step to getting my devices working for me is to set up a consistent network for them to use. To do this I am going to use a small pocket sized router that can be run from a usb battery to act as a hot spot for my devices, but also as a bridge to an internet connected wifi network. </p> <p> The network I want to setup looks something like this: </p> <pre><code> + +---------+ | | phone &lt;&lt;-------+ | +---------+ | | | | +---------+ | DHCP PANWIFI | DHCP PUBLIC WIFI | laptop &lt;&lt;-------+ +-----------------+ | +-----------------+ +---------+ | | | | | | +----&gt;&gt;&gt; OpenWRT &lt;&lt;&lt;-----&gt;&gt;&gt; +----&gt; INTERNET +---------+ | | | | | | | camera &lt;&lt;-------+ +-----------------+ | +-----------------+ +---------+ | 192.168.x.x/xx | |10.10.10.0/24 | +---------+ | | | pda &lt;&lt;-------+ | +---------+ | | Personal area wifi network | Upstream wifi network +--------------------------------------------------+---------------------------------------+ </code></pre> <p> I struggled to find a network configuration like this in the OpenWRT wiki. I wondered for a while if it was because the network was an impossible (seemed unlikely) or if it was so obvious to not be worth documenting. </p> <p> Eventually google turned up a <a href="https://bitbucket.org/pklaus/openwrt-configurations/branches/compare/TP-Link_TL-MR3020%2Fwisp%0DTP-Link_TL-MR3020%2Fdefault#diff"> bitbucket page </a> with a config that worked perfectly. </p> <p> I need to find a method which makes it straight forward to configure a new outgoing network. I think at the moment I am going to have to edit the wifi config files to make any changes. On the road that will be less than ideal. </p> https://adventurist.me/posts/0089Sat, 14 May 2016 00:00:00 +0000 Writing this takes a little too much efforthttps://adventurist.me/posts/0090<p> Writing blog posts and getting them out takes far too much effort. With a streamlined publishing system the author still has to manage to write something down. </p> <p> I do not have a streamlined publishing system. Instead the tools I use sit in a balance between the ideal thing I want and the hacked together scripts I have. It has been 4 months since my last post, so you can join me on a refresher. </p> <p> The web side of the software is written in nodejs using express (and python with flask, but that isn't finished). The node program starts up and parses in a configured directory containing the blogposts. </p> <pre><code>$ cd blogposts $ git pull Already up-to-date. </code></pre> <p> The blog posts live in git and are written in markdown. Images for the posts are kept in the images subdir. The blog posts themselves live in year folders (2014,2014, etc). The year folders are provided as configuration to the node web process as well, which implies there is work to do when the calendar flips around. </p> <pre><code>$ ls 2013 2014 2015 2016 drafts images newid.sh old $ ls 2016 32c3.md glitchcards.md unreasonable0x02.md acuratefbsdaudio.md lighttheme.md unreasonable0x03.md dso138kit.md more-unreasonable.md update.md fbsdpixorg.md notifications.md vimcrypt.md ffmpeggif.md pan.md xxx.md freebsdbuildflags.md ubuntu-touch.md freebsdrecaudio.md unreasonable.md </code></pre> <p> blogposts have an id, which is used to sort and sequence them and is used for the post url. It was needed in earlier pieces of software I wrote and I would like it to go away. Until I move to something else I have a helper script to tell me what the next id is. </p> <pre><code>$ sh ./newid last post id: 0089 next post id: 0090 </code></pre> <p> blogposts use an email style header, each line is a key value pair separated by the first colon on the line. The header block is terminated with two newlines '\n\n'. I can type out the header, but normally I copy it from a blogpost. That's the sort of lazy person I am. </p> <pre><code>$ copy 2016/somepost.md to 2016/newpost.md $ vim 2016/newpost.md Title: Some post Tags: meta Date: 2016-01-01 Preview: Some post Permalink: 0001 Hurr durr I am a blogpost I am totally inciteful and full of useful information, like how nat punch through works and the secret to everlasting life. </code></pre> <p> Now we have to edit all of the fields in the header, and content for the body of the blogpost. This is a great time to add the correct post id value we got way up top. </p> <pre><code>Title: Writing this takes a little too much effort Tags: blog Date: 2016-09-26 Preview: Writing this takes a little too much effort Permalink: 0090 Writing blogposts takes far too much effort... </code></pre> <p> Okay, we have now written the blogpost, maybe even spell checked, we can upload it to the web server. </p> <pre><code>$ git add 2016/newpost.md $ git commit -m "blogpost" $ git push </code></pre> <p> On the remote web server we need to pull from the master blogposts branch to get the new article we wrote. </p> <pre><code>$ ssh webserver $ cd sites/blogposts $ git pull </code></pre> <p> Now we have the updates we have to restart the node process. There is code to reload dynamically, but I could never get nodejs to behave here. I would like to use kqueue to watch posts dir, but when I last looked this wasn't supported on the platform. </p> <pre><code>$ cd ../register $ forever restart server.js </code></pre> <p> Phew, there we go. </p> <p> We are serving up the new blogpost from the site. This seems like a lot of work, but I think post of the component stages would be required with a static site generator. </p> <p> I want to write some tools to help with schduling posts. At the moment I can write a post for future release, but I have to specify the date for release. </p> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace, 802.11 Wireless Networks 2nd Edition. </p> https://adventurist.me/posts/0090Mon, 26 Sep 2016 00:00:00 +0000 Ex Machinahttps://adventurist.me/posts/0091<p> I think I really enjoyed <a href="http://gb.imdb.com/title/tt0470752/"> Ex Machine </a> , it has a great mixture of near scifi and technology. There is enough mystery and conspiracy in the film to keep me engaged, I am glad my world doesn't have so much intrigue. If it did I would probably be in some Billionaires dungeon for following the wrong lead. </p> <p> The <a href="https://www.youtube.com/watch?v=7jZ0AaUM6v8"> Ex Machina Soundtrack </a> is even better than the film. It reminds me of the ambient music that plays in GTAV when you wander around with the radio off. A podcast with similar drones and loops would be an excellent thing to add to my work music mix. </p> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace, 802.11 Wireless Networks 2nd Edition, MOONCOP! </p> https://adventurist.me/posts/0091Tue, 27 Sep 2016 00:00:00 +0000 Cybersofahttps://adventurist.me/posts/0092<p> Yesterday I wrote about the <a href="http://adventurist.me/posts/0091"> Ex Machina </a> soundtrack, but linked to an hour long loop of one of its tracks. Whoops. The whole soundtrack is equally great, go find it. Similar stuff on youtube lead to <a href="https://ultimae.bandcamp.com/album/9980"> 9980 by CONNECT.OHM </a> . </p> <p> The Science Fiction podcast magazine I listed to, <a href="http://www.starshipsofa.com/"> StarShipSofa </a> has had some great CyberPunk stories recently. </p> <ul> <li> Humans are going to become augmented, this is an inevitablity, we won't be able to resist making our selves better by merging computers and machinery into our body. <a href="http://www.starshipsofa.com/blog/2016/09/21/starshipsofa-no-452-malcolm-delvin/"> "Must Supply Own Workboots" </a> considers what happens when our jobs rely on expensive augmentations, but the augmentations become out of date. </li> <li> <a href="http://www.starshipsofa.com/blog/2016/08/17/starshipsofa-no-448-hugo-nominee-part-1-brooke-bolander/"> “And You Shall Know Her By The Trail of Dead” </a> is a Gibsonesque Cyber Cowboys fighting with the mob story. Really well timed with the article about the excellent <a href="http://n-o-d-e.net/post/130139019901/how-to-create-a-gibsonshadowrun-inspired"> CyberdeckC64 </a> </li> </ul> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace, 802.11 Wireless Networks 2nd Edition, RFC6347! </p> https://adventurist.me/posts/0092Wed, 28 Sep 2016 00:00:00 +0000 Denial of Toastershttps://adventurist.me/posts/0093<p> The news on this weeks <a href="http://risky.biz/RB429"> Risky Business Podcast </a> mentioned the record breaking DDOS against <a href="https://krebsonsecurity.com/2016/09/krebsonsecurity-hit-with-record-ddos/"> Krebs </a> . <strong> 665 Gigabits of traffic per second </strong> is a lot of traffic, but that is probably only the start of such massive attacks. </p> <p> While wondering how these attacks manifest an article about the <a href="https://gkbrk.com/2016/09/about-slowloris/"> slowloris </a> attack popped up. This is a different sort of denial of service to the network traffic sent to Krebs and one that should be rather easy to mitigate against at the protocol layer. </p> <p> The Krebs attack is the first I am aware of with a large IoT component. I think we have all been waiting for the hordes of vulnerable devices to appear in abuse logs. Maybe we can move to ipv6 and leave the Internet of Shit on a blackholed v4 Internet. </p> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace, 802.11 Wireless Networks 2nd Edition, Packet Captures </p> https://adventurist.me/posts/0093Thu, 29 Sep 2016 00:00:00 +0000 Software Updateshttps://adventurist.me/posts/0094<p> Listening to <a href="http://atp.fm/episodes/189"> this weeks ATP </a> on the bus, they speak about the latest Mach OS release SomthingCali. It reminded me how little I really care for software updates. Of course I want things to get faster, more secure and less buggy so I have to endure updates. Most updates don't just bring clear improvements instead they bring feature updates. </p> <p> I write software for fun and for a living and for a while I even wrote products that people used. I even provided training for our users on product updates. I saw first hand how annoying changes can be. </p> <p> Most of the changes we delivered were customer driven (in fact, they were all paid for by individual customers). When we trained a customers users on the new software there were normally a whole bunch of changes to off path functionality that someone else had asked for. </p> <p> I can't remember anyone ever being happy with <a href="https://xkcd.com/1172/"> changes to their workflow </a> . </p> <p> They were happy that bugs had been fixed and UI had gotten a little cleaner, they loved that the software was better on the crappy machine IT or we supplied them. But they didn't want change for changes sake. </p> <p> I have been using <a href="https://play.google.com/store/apps/details?id=com.wroclawstudio.puzzlealarmclock&amp;hl=en_GB"> Puzzle Alarm Clock </a> to make me get up. It is great it can make you solve puzzles, quizzes, or it can use the NFC reader or camera to scan a QR code to turn the alarm off. Puzzle Alarm Clock updated this week. The UI was improved or something, all I can tell is that it is white instead of black now. But they also removed features, making the app much worse. </p> <hr/> <p> <strong> Reading: </strong> TLE Files </p> https://adventurist.me/posts/0094Fri, 30 Sep 2016 00:00:00 +0000 Satellite Pirateshttps://adventurist.me/posts/0095<p> Due to a <a href="http://www.wired.co.uk/article/satellites-vulnerable-hacking-chatham-house"> Chatham House </a> report on the latest dangers of Satellite hacking <a href="https://twitter.com/uhf_satcom"> uhf_satcom </a> was on this <a href="http://risky.biz/RB429"> weeks risky business </a> talking about Satellite pirates and exploit possibilities on the birds. </p> <p> Not <a href="http://www.wired.com/1994/08/satellite-3"> the Satellite Pirates </a> of the 90s trying to access free TV and not arrgg Pirates out at sea(though maybe), but people taking advantage of the great accessible repeater in the sky. </p> <p> A terrestrial repeater takes in a signal on an input frequency and rebroadcasts it on an output frequency. The repeater normally has better antennas system and is situation in a physical position to give the best area coverage. </p> <p> A satellite repeater does the same thing, from its vantage point in space it can cover a much larger area. There are amateur radio satellites that provide this functionality, but from low earth orbit. </p> <p> The pirates on Risky Business are probably using a satellite in geostationary orbit and taking advantage of it being a dumb pipe pointing back at earth. </p> <hr/> <p> <strong> Reading: </strong> TLE Files </p> https://adventurist.me/posts/0095Sat, 01 Oct 2016 00:00:00 +0000 This article will still be here when you're done, and blogs are dumb.https://adventurist.me/posts/0096<p> The excellent <a href="http://newsbeuter.org/"> newsbeuter </a> says I have 80 rss feeds that I pay occasional attention to. There are habit sites I visit like reddit and hackernews, but I fall back on the rss feeds when want to focus and read. </p> <p> I put the rss feeds from peoples blogs in my reader, normally when I read an awesome article via HN or reddit. People don't normally post more than 3 times a month. This means there isn't so much I can't read it, but just enough that I can process it when I want to. </p> <p> <strong> " <a href="http://jeff-vogel.blogspot.co.uk/2016/09/a-very-long-post-about-how-to-become.html"> This article will still be here when you're done, and blogs are dumb. </a> " </strong> </p> <hr/> <p> <a href="http://adventurist.me/posts/0090"> It </a> <a href="http://adventurist.me/posts/0091"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0092"> makes </a> <a href="http://adventurist.me/posts/0093"> seven </a> <a href="http://adventurist.me/posts/0094"> days </a> of <a href="http://adventurist.me/posts/0095"> writing </a> . </p> <p> <strong> Reading: </strong> Butter from my Feed Reader </p> https://adventurist.me/posts/0096Sun, 02 Oct 2016 00:00:00 +0000 First SO-50 Passhttps://adventurist.me/posts/0097<p> I managed my first SO-50 pass yesterday. Using a tape measure 70cm yagi I made last year and my baofeng I was able to hear chatter on the repeater for about 30 seconds. </p> <p> <a href="/images/20161001-SO50.png"> <img src="/images/20161001-SO50.png"/> </a> </p> <p> <audio controls="" src="/videos/20161001SO-50.mp3"> </audio> </p> <p> As mediocre as it is I am really happy with success on my first try, I did attempt to listen to another pass of SO-50, but only heard a two second chirp. I used <a href="http://gpredict.oz9aec.net/"> gpredict </a> on my stream 7 for satellite tracking, and a cheap compass app on android to verify which way the building pointed. </p> <p> Next I am going to try using an sdr for the downlink capture. I am hoping it will be a little easier to get the yagi pointed the correct way and give me a chance of finding the signal mid pass. </p> https://adventurist.me/posts/0097Sun, 02 Oct 2016 00:00:00 +0000 Malwarehttps://adventurist.me/posts/0098<p> <a href="https://www.reddit.com/r/VitaPiracy/comments/55farx/community_warning_there_have_been_two_separate/"> There are reports </a> of Malware in the PS Vita Piracy scene. When you have to pursue shady enterprises to use the hardware you own this is always the risk you take. Consoles have the coolest security hardware, but it is aimed at stopping piracy rather than protecting users. </p> <p> The Grey area jailbreak tools live in make it really hard for users to find the real tools. Instead the end up with malware. </p> <p> <a href="http://craphound.com/news/2016/08/25/talking-about-the-pro-security-anti-drm-business-model-on-the-oreilly-radar-podcast/"> Here </a> is 50 minutes on why this was going to happen. </p> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace </p> https://adventurist.me/posts/0098Mon, 03 Oct 2016 00:00:00 +0000 Hacking Gameshttps://adventurist.me/posts/0099<p> I read this awesome <a href="https://www.rockpapershotgun.com/2016/09/27/hackmud-review/"> review of hackmud </a> , it made me think of other games about hacking or games that involve actual hacking. </p> <ul> <li> <a href="https://www.hackmud.com/"> Hackmud </a> </li> <li> <a href="https://www.introversion.co.uk/uplink/"> Uplink </a> </li> <li> <a href="http://hacknet-os.com/"> HackNet </a> </li> <li> <a href="http://blendogames.com/qc/"> Quadrilateral Cowboy </a> </li> <li> <a href="http://elseheartbreak.com/"> Else Heart.Break() </a> </li> <li> <a href="http://www.zachtronics.com/tis-100/"> TIS-100 </a> </li> </ul> <p> I have only played Uplink and TIS-100, I have heard the others are pretty great. You should play them and tell me how they are. </p> https://adventurist.me/posts/0099Mon, 03 Oct 2016 00:00:00 +0000 WPA IS BROKEN!!!https://adventurist.me/posts/0100<p> <a href="http://www.kitploit.com/2016/10/fluxion-wpawpa2-security-hacked-without.html"> WPA IS BROKEN!!!1 </a> </p> <p> Okay it isn't, that attack is awesome, but it is a social one rather than a break of WPA. I bet it would work in a load of environments, I would be surprised if pentesters didn't already have it in their toolkits. </p> <p> Really the OS should be doing much more to protect users from this class of attacks. WPA written today would not be vulnerable to this class of attack at all. </p> <hr/> <p> <strong> Reading: </strong> The Puzzle Palace, 802.11 Wireless Networks 2nd Edition, Packet Captures </p> https://adventurist.me/posts/0100Tue, 04 Oct 2016 00:00:00 +0000 About Electron Gnomes https://adventurist.me/posts/0101<p> As an aside form talking about the <a href="http://embedded.fm/episodes/170"> Electron Gnomes on the latest Embedded FM </a> podcast Elecia and Christopher implored us to talk to people about their awesome podcast to everyone we know. </p> <p> So, go and listen to the <a href="http://embedded.fm/"> Embedded FM </a> Podcast featuring <a href="http://embedded.fm/episodes/53"> excellent interviews </a> , professional advice and something about Electron Gnomes. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> <p> 5th post </p> https://adventurist.me/posts/0101Wed, 05 Oct 2016 00:00:00 +0000 Metadatahttps://adventurist.me/posts/0102<p> Recently <a href="http://www.starshipsofa.com/"> StarShipSofa </a> has been delivering podcast files to me that contain 3rd party ads. It is their hosting provider that is inserting the ads, but both times I have been aksed if this my client is to blame. </p> <p> I am certain <a href="https://play.pocketcasts.com/"> PocketCasts </a> would never do this. </p> <p> Maybe there is something in the file that would indicate who did the encoding? </p> <p> <strong> play </strong> (from the sox package) </p> <pre><code>$ play starshipsofa-454-ads.mp3: starshipsofa-454-ads.mp3: File Size: 33.7M Bit Rate: 64.0k Encoding: MPEG audio Channels: 1 @ 16-bit Samplerate: 44100Hz Album: StarShipSofa Replaygain: off Artist: StarShipSofa Duration: 01:10:10.78 Title: StarShipSofa No 454 Alex Shvartsman and Stephen S. Power In:0.05% 00:00:02.04 [01:10:08.74] Out:90.1k [ -===|===- ] Clip:0 </code></pre> <p> Just the file name and year, lets try ffprobe from the ffmpeg tools: </p> <p> <strong> ffprobe </strong> </p> <pre><code>$ ffprobe starshipsofa-454-ads.mp3: [mp3 @ 0x809691000] Skipping 0 bytes of junk at 159. [mp3 @ 0x809691000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'starshipsofa-454-ads.mp3': Metadata: title : StarShipSofa No 454 Alex Shvartsman and Stephen S. Power album : StarShipSofa artist : StarShipSofa date : 2016 Duration: 01:10:10.39, start: 0.000000, bitrate: 64 kb/s Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 64 kb/s </code></pre> <p> Nothing more there, a google says there is something called mp3info: </p> <p> <strong> mp3info </strong> </p> <pre><code>$ mp3info starshipsofa-454-ads.mp3: starshipsofa-454-ads.mp3 does not have an ID3 1.x tag. </code></pre> <p> Well that was no good at all. </p> <p> I don't have a ton of time to find the mp3 metadata might be, none of these tools show anything. I guess that means I can be happy I am not leaking info when I encode an mp3, or I can't find it with normal tools. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> https://adventurist.me/posts/0102Thu, 06 Oct 2016 00:00:00 +0000 Porting a WiFi Driverhttps://adventurist.me/posts/0103<p> To win this bet I have with Ed I need a WiFi adapter that can do 80211n in the 5GHz band. There aren't a lot of these around and n in 2.4GHz band makes it hard to find adapters with the right support. </p> <p> I got pair of AC600 generic adapters on ebay for about a tenner, a quick look showed promising Linux support. This indicated I could use one for the bet without too much hassle. </p> <p> I got a second so I could work on a wireless driver for FreeBSD, what else am I to do with my time? </p> <p> The adapter is a MediaTek MT7610U device, there is a whole load of information about it on <a href="https://wikidevi.com/wiki/MediaTek_MT7610U"> Wikidevi </a> and there are a family of <a href="https://github.com/adventureloop/mt7610u_wifi_sta_v3002_dpo_20130916"> forks </a> of the vendor code on github. </p> <p> Wikidevi says the MT7610U is similar to the <a href="https://wikidevi.com/wiki/Rt2800usb"> RT28xx series </a> , which are supported by <a href="https://www.freebsd.org/cgi/man.cgi?run%284%29"> run </a> in FreeBSD. I started last night by taking the run driver, getting it to build as a module, then turning everything off apart from probe, attach and detach. </p> <p> This is the first time I have tried to port a driver, to help I collated everything I could find written about doing it. </p> <p> There is straight up FreeBSD stuff: </p> <ul> <li> <a href="http://adrianchadd.blogspot.co.uk/2015/09/porting-wifi-driver-from-openbsd-ar9170.html"> http://adrianchadd.blogspot.co.uk/2015/09/porting-wifi-driver-from-openbsd-ar9170.html </a> </li> <li> <a href="https://people.freebsd.org/~jmg/drivers"> https://people.freebsd.org/~jmg/drivers </a> </li> <li> <a href="https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/"> https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/ </a> </li> </ul> <p> There are load of little posts where people have ported drivers from FreeBSD to somewhere else: </p> <ul> <li> <a href="https://wiki.smartos.org/display/DOC/Porting+Network+Device+Drivers+from+FreeBSD"> https://wiki.smartos.org/display/DOC/Porting+Network+Device+Drivers+from+FreeBSD </a> </li> <li> <a href="http://cnds.eecs.jacobs-university.de/archive/bsc-2011-pvaibhav.pdf"> http://cnds.eecs.jacobs-university.de/archive/bsc-2011-pvaibhav.pdf </a> </li> <li> <a href="https://www.dan.me.uk/blog/2010/01/25/ndis-wifi-drivers-in-freebsd-project-evil/"> https://www.dan.me.uk/blog/2010/01/25/ndis-wifi-drivers-in-freebsd-project-evil/ </a> </li> <li> <a href="http://www.netbsd.org/docs/kernel/porting-freebsd-net.html"> http://www.netbsd.org/docs/kernel/porting-freebsd-net.html </a> </li> <li> <a href="http://stackoverflow.com/questions/32156173/porting-pcie-driver-from-linux-to-freebsd"> http://stackoverflow.com/questions/32156173/porting-pcie-driver-from-linux-to-freebsd </a> </li> </ul> <p> And there are a load of articles about building wifi drivers for android, these are worth read, but they are worth pointing out: </p> <ul> <li> <a href="http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html"> http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html </a> </li> <li> <a href="https://community.nxp.com/docs/DOC-93603"> https://community.nxp.com/docs/DOC-93603 </a> </li> <li> <a href="https://befinitiv.wordpress.com/2015/04/18/porting-wifibroadcast-to-android/"> https://befinitiv.wordpress.com/2015/04/18/porting-wifibroadcast-to-android/ </a> </li> </ul> <hr/> <p> <strong> Reading: </strong> Little Brother </p> <p> I had an argument with some Germans about the pronunciation of WiFi, apparently it is WeeFii using the sounds of wireless and fidelity. They also pronounced HiFi incorrectly, English is a strange language. </p> https://adventurist.me/posts/0103Fri, 07 Oct 2016 00:00:00 +0000 Cold Brewhttps://adventurist.me/posts/0104<p> My Cold Brew Recipe requires: </p> <ul> <li> 128g of Coarse ground coffee (I guess 125g is okay, if you aren't cool) </li> <li> 1L Vessel (I use a nalgene) </li> <li> 1L of potable water </li> <li> Fridge </li> <li> v60 </li> <li> Jug </li> </ul> <p> Method: </p> <ul> <li> Put the ground coffee in the vessel. </li> <li> Fill the vessel with cold water </li> <li> Place vessel in fridge </li> </ul> <p> I use tap water because I live in a place with excellent drhinking water. If that isn't the case for you, you will have to figure something else out. Make sure the ground is well soaked, it will swell. I give it a good shake then add a little more water to make sure the nalgene is good and full. </p> <p> After about a day take the nalgene out of the fridge. </p> <ul> <li> Pour the coffee/concentrate blend into the jug. </li> <li> Clean the nalgene. </li> <li> using the v60 filter the concentrate back into the nalgene. </li> </ul> <p> I normally end up with about 700ml of concentrated coffee. I mix it with boiling water to drink, about 120ml of concentrate to 200ml. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> https://adventurist.me/posts/0104Sat, 08 Oct 2016 00:00:00 +0000 Coding Sundayhttps://adventurist.me/posts/0105<p> The tortoise needs an improved heating setup, now have a 'night time' buld that just puts out heat. Before I change anything I want to have numbers so I can try and quantify the change. </p> <p> I knocked up a micropython script and ran it on a nodemcu board with a couple of dht11's. It looks like this: </p> <pre><code>def temperatureclient(sensors,addr="255.255.255.255"): print(" sending to: {} {} every {} seconds" .format(addr , PORT, DELAY)) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: pkt = takereading(sensors) sock.sendto(pkt, (addr, PORT)) time.sleep(DELAY) def takereading(sensors): readings = [] for sensor in sensors: sensor.measure() reading = {} reading["sensor"] = str(sensor.pin) reading["pin"] = str(sensor.pin) reading["temp"] = sensor.temperature() reading["humditiy"] = sensor.humidity() readings.append(reading) print(reading) return json.dumps(readings) </code></pre> <p> It doesn't have to live for long, just a day or two. </p> <p> The always on machine on my network doesn't seem to have anything useful installed and without internet at home that wasn't going to be a simple fix. Instead I used tcpdump to capture the json packets. </p> <p> Tcpdump works really well in this situation, the micopython board doesn't have a RTC, but the pcap from tcpdump will have acurate timestamps for each field. I did something like: </p> <pre><code>$ tcpdump -w tempreadings.pcap udp and port 6969 </code></pre> <p> Later I can process this out with a shell script or scapy or something. </p> <hr/> <p> <a href="http://adventurist.me/posts/0099"> It </a> <a href="http://adventurist.me/posts/0100"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0101"> makes </a> <a href="http://adventurist.me/posts/0102"> seven </a> <a href="http://adventurist.me/posts/0103"> days </a> of <a href="http://adventurist.me/posts/0104"> writing </a> . </p> <p> <strong> Reading: </strong> Butter from my Feed Reader </p> https://adventurist.me/posts/0105Sun, 09 Oct 2016 00:00:00 +0000 Network Analysishttps://adventurist.me/posts/0106<p> I read this <a href="https://www.evilsocket.net/2016/10/09/IoCOFFEE-Reversing-the-Smarter-Coffee-IoT-machine-protocol-to-make-coffee-using-terminal/"> excellent post </a> by <a href="https://www.evilsocket.net/"> Simone Margaritelli </a> on hacking a network connected coffee machine. Simone reverse engineered the Android app that controls the coffee machine and wrote a command line tool for getting the machine going. </p> <p> Simone took a completely different angle to solving the problem than I would. Being a network person I would have gone straight to tcpdump, grabbed some traces from the app/coffee machine and worked from that. </p> <p> Instead Simone used a tool to dump a disassembly of the Android apk. I haven't done that before, I don't think it would be my first thought when I had to take something apart. From this post I think I might give it a shot on the local bus app. </p> <p> The <a href="http://smarter.am/coffee/"> coffee machine </a> looks awesome, you might not want an internet connected coffee machine, but I think it is an awesome idea. Coffee is a great reward for solving a problem, the machine could automate teaching people how to reverse network protocols. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> https://adventurist.me/posts/0106Mon, 10 Oct 2016 00:00:00 +0000 Flashing AI-Think NodeMCU Boardshttps://adventurist.me/posts/0107<p> I ordered a handful of the cheapest nodemcu boards I could find from ebay. A couple of weeks later I got a <a href="http://en.ai-thinker.com/html/2016/WIFI_0419/42.html"> nodemcu 'like' board from a company callsed AI-THINKER </a> . The boards following instructions written on the back of them: </p> <pre><code>1. Install CH340G driver. 2. Use 9600bps baud rate. 3. Connect to WiFi. </code></pre> <p> I tried playing with two of the boards, powering them up and searching for wifi networks showed a network with a name like: </p> <pre><code>AI-THINKER_238810 AI-THINKER_23A9BF </code></pre> <p> Connecting to the wifi was fine, but I didn't really know what they expected me to do. nmap'ing the device has no results and an hour googling didn't really show up anything. Connecting over serial resulted in some noise then nothing. </p> <p> I was going to flash micropython anyway, so lets do that. </p> <h2> Flash micropython </h2> <p> Connecting to the nodemcu board over serial spits out some gibberish no matter the baud rate I pick. </p> <pre><code>$ sudo cu -l /dev/ttyU1 -s 76800 Connected Sd3²ì{£P:ýCê ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x40100000, len 1856, room 16 tail 0 chksum 0x63 load 0x3ffe8000, len 776, room 8 tail 0 chksum 0x02 load 0x3ffe8310, len 552, room 8 tail 0 chksum 0x79 csum 0x79 2nd boot version : 1.5 SPI Speed : 40MHz SPI Mode : DIO SPI Flash Size &amp; Map: 8Mbit(512KB+512KB) jump to run user1 @ 1000 êñ+Pr-r+§(r SD«¢hJëÙ-$xùÊkPx\)§k ¢ÀjtNü </code></pre> <p> Some time with a scope reveals the board is starting up at one rate then switching to another. The rate switch means the esptool is unable to do automatic baud rate detection. </p> <p> With that we can flash the boards: </p> <pre><code>erase the flash esptool.py --port /dev/tty.wchusbserial1420 erase_flash flash the image esptool.py --port /dev/tty.wchusbserial1420 --baud 76800 write_flash --flash_size=8m 0 esp8266-2016-05-03-v1.8.bin reset the board cu -l /dev/tty.wchusbserial1420 -s 115200 MicroPython v1.8.2 on 2016-08-05; ESP Module with ESP8266 Type "help()" for more information. &gt;&gt;&gt; </code></pre> https://adventurist.me/posts/0107Mon, 10 Oct 2016 00:00:00 +0000 13cm Simplexhttps://adventurist.me/posts/0108<p> Fresh of great weekend at the <a href="https://foxk.it/blog/2016%20RSGB%20Convention%20Day%201/"> RSGBConvention </a> my good friend <a href="https://foxk.it/"> hibby </a> was talking about doing point to point line of sight lines with 400MHz and up. He is super eager to do giant 50Km links and was suggesting hills to climb at the weekend. </p> <p> I thought maybe we could try something a little easier to debug when it doesn't work. We settled to try point to point between my house and something the other side of the valley. </p> <p> <a href="/images/13cmrx.png"> <img src="/images/13cmrx.png"/> </a> </p> <p> <audio controls="" src="/videos/20161010-13cmfm.mp3"> </audio> </p> <p> We did some local test and I was able to hear clear audio out to about 500m. At that distance we ran out of road to walk down. I can see the <a href="https://www.google.co.uk/maps/place/Newhills+Parish+Church,+Aberdeen+AB21+9SS/@57.1757686,-2.2066495,17z/data=!4m2!3m1!1s0x488413e1b3f389a3:0x25bd478991f021c?hl=en"> Newhills Parish Church </a> from a rear window of my house, it is probably a little under a mile away line of sight. </p> <p> While Hibby headed out there and I set up the yagi, we used 70cm as a return channel as the portapack can't transmit with the current firmware. </p> <p> We ended up using the <a href="https://rad1o.badge.events.ccc.de/"> rad1o badge </a> from cccamp last year as a 2.4GHz transmitter and a wifi yagi I had lying around. We played with settings for a while and eventually figured out the right combination of settings to do WFM voice! </p> <p> Next we need to find a pair of points with los that are far enough apart to test range. </p> https://adventurist.me/posts/0108Mon, 10 Oct 2016 00:00:00 +0000 Are you awake?https://adventurist.me/posts/0109<p> <a href="https://twitter.com/HannahRKeyser/status/785737828273496064"> It said </a> </p> <pre><code>Are you awake? Read a blog! </code></pre> <p> And I was awake, so I opened the blog. It was about baseball. </p> <p> Instead <a href="https://foxk.it/blog/2016%20RSGB%20Convention%20Day%202/"> I read an actual blog post </a> , another one about the RSGB convention. Then I looked at this <a href="https://github.com/isislovecruft/patternsinthevoid/blob/master/content/hacking/pytebeats.md"> bytebeat album </a> . Fuck baseball. </p> <hr/> <p> <strong> Reading: </strong> Litte Brother, Transmetropolitan </p> https://adventurist.me/posts/0109Tue, 11 Oct 2016 00:00:00 +0000 Parsing data from pcapshttps://adventurist.me/posts/0110<p> On <a href="http://adventurist.me/posts/0105"> Sunday </a> I set up some quick and dirty temperature monitoring. At that point I didn't have any server code lying around to recieve the readings from the sensors. I set up tcpdump on a fileserver to capture the packets, tcpdump has the benefit of loggin a timestamp with each packet helping me get around limitations of the nodemcu hardware. </p> <p> A day later I have to try and process the pcap files. </p> <pre><code>$ tcpdump -A -r temperaturevalues.pcap-1 | head -n 4 reading from file temperaturevalues.pcap-1, link-type EN10MB (Ethernet) 12:20:55.766057 IP 10.4.4.160.4097 &gt; 10.4.4.187.acmsoda: UDP, length 134 E........... ... ......9....[{"humditiy": 47, "temp": 23, "pin": "Pin(4)", "sensor": "Pin(4)"}, {"humditiy": 45, "temp": 21, "pin": "Pin(5)", "sensor": "Pin(5)"}] </code></pre> <p> The -A flag for tcpdump will show me the packet payload as ascii, I was pushing json from the server so this is rather easy to see. I could use some shell magic to pull this out, but I wanted to play with scapy. </p> <p> <a href="http://www.secdev.org/projects/scapy/"> Scapy </a> is a python library for dealing with packets, it does everything tcpdump will with packet injection to boot. Scapy will happily take in the pcap files. </p> <pre><code>#!/usr/bin/env python from scapy.all import rdpcap import json if __name__ == "__main__": pcapfiles = [ "temperaturevalues.pcap-1", "temperaturevalues.pcap-2"] readings = [] for files in pcapfiles: pkts = rdpcap(files) for p in pkts: time = p.time readings = json.loads(p.load) print("%s,%s,%s,%s,%s" % (time, readings[0]["sensor"],readings[0]["temp"],readings[0]["humidity"], readings[1]["sensor"],readings[1]["temp"],readings[1]["humidity"], ) ) </code></pre> <p> Running </p> <pre><code>$ python process.py &gt; readings.csv </code></pre> <p> Gives me a csv file with the temperature and humidity data from the sensors. Feeding this to gnuplot with something like the below results in a nice(albeit noisy) plot of the temperature from the two sensors. </p> <pre><code>set datafile sep ',' set timefmt "%s" set format x "%m/%d/%Y %H:%M:%S" set xdata time set terminal png size 3000,500 set output 'data.png' plot 'temperaturedata.csv' using 1:3 with lines, 'temperaturedata.csv' using 1:6 with lines </code></pre> <p> <a href="/images/24hourstemperature.png"> <img src="/images/24hourstemperature.png"/> </a> </p> https://adventurist.me/posts/0110Tue, 11 Oct 2016 00:00:00 +0000 Triangles are my favourite shapehttps://adventurist.me/posts/0111<p> Damn, today has been a hard fucking start up sequence ( <a href="https://en.wikipedia.org/wiki/TCP_congestion_control#Slow_start"> slow starts punk brother </a> ). TCP jokes are the best, if you don't get them we can keep retrying until you do. </p> <p> <a href="https://twitter.com/dwf/status/785347767992541184"> This tweet </a> by <a href="https://twitter.com/dwf"> dwf </a> </p> <pre><code>Possibly the most unbelievable thing about Star Trek is how different alien civilizations maintain cross-compatible video calling software. </code></pre> <p> It's a funny joke. Current humans are still competing in the name of capitalism, there is little to no incentive to build interoperable system when you can control a market sector. Of course no one actually can, but that doesn't stop facetime not being available on android. </p> <p> Rants aside; We are going to solve this set of problems with automation, machine learning and AI. Here is a great talk on <a href="https://youtu.be/UsCOVF0vDe8"> transport layer improvements </a> , it talks about machine learning approaches to optimise delay/bandwidth for live streaming video connections. </p> <p> It is entirely feasible that we could run similar approaches to coordinate video communication, especially if we are a civilisation that spends all of its time exploring and finding new people to speak to. Automate the boring stuff, you know? </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmet </p> <p> The BBC have an excellent rendition of <a href="http://www.bbc.co.uk/programmes/b007jqv3"> Burning Chrome </a> by William Gibson. I am sure a neighbour will help you out if you are geographically impaired. </p> https://adventurist.me/posts/0111Wed, 12 Oct 2016 00:00:00 +0000 Red Team Newsletterhttps://adventurist.me/posts/0112<p> I was pretty much dead yesterday, I didn't do anything interesting. </p> <p> I signed up for an <a href="https://docs.google.com/forms/d/e/1FAIpQLScFLrI7aWksQFeXRKSRO61q4-93Nwq6QE2TjoM20xkafdKfeA/viewform?c=0&amp;w=1"> Offensive Security Newsletter </a> from <a href="https://phobos.io/"> Phobos Group </a> . I don't normally take corporate output directly, the <a href="https://twitter.com/Viss"> people behind </a> Phobos have a track record of doing awesome things. The first issue appeared today, certainly worth a read. </p> <p> I have been thinking about adding more automation into my...I dunno life? This morning I was thinking about using post tags to automatically cross blog to reddit. I think that might work for well for <a href="http://adventurist.me/tag/hacking"> hacking </a> , <a href="http://adventurist.me/tag/radio"> radio </a> definitely has a home in the ham subreddits. </p> <p> I am not sure if there is somewhere that will welcome the daily <a href="http://adventurist.me/tag/morning"> morning </a> posts. <a href="https://www.reddit.com/r/Blogging/"> /r/Blogging </a> has a <a href="https://www.reddit.com/r/Blogging/comments/56lt9t/weekly_rblogging_discussion_check_out_my_blog_post/"> weekly 'Check out my blog' </a> thread, but it is limited to one post per blog per week. I wonder if there is somewhere I can feed my daily ritual, like a <a href="http://lifehacker.com/281626/jerry-seinfelds-productivity-secret"> don't break the chain place </a> . </p> <p> I will automate everything to go out the <a href="https://twitter.com/adventureloop"> twitter hole </a> , I would like to do the tag thing to irc channels to. That might be a bit insane and self promotional though. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmet </p> https://adventurist.me/posts/0112Thu, 13 Oct 2016 00:00:00 +0000 I hate it herehttps://adventurist.me/posts/0113<p> It is raining so hard I can hear it over my music and the rumble of the bus. It is raining in the book I am reading. Completely unconnected events, but humans have this thing for making patterns where they don't exist. </p> <p> <a href="http://www.vertigocomics.com/graphic-novels/transmetropolitan-vol-8-dirge"> In this book </a> over centralisation leads to a complete media blackout. Decentralisation is a core <a href="https://en.wikipedia.org/wiki/Hacker_ethic"> ethical tenant </a> , of course I enjoy the collapse of the media in the story. </p> <p> But what can you do about centralisation? </p> <p> Until the singularity you are going to be stuck as a centralised human being. I know it sucks, but one day we will be able to move past this. </p> <p> The <a href="https://indieweb.org/"> indieweb movement </a> has <a href="https://jeena.net/media/2016/IndieWeb-Jeena.pdf"> great advice </a> for <a href="https://indieweb.org/Getting_Started"> getting started </a> . The biggest single step you can take to decentralise yourself on the internet is to have another machine to represent you. </p> <p> Once you have a VPS running somewhere in the internet, you have access to an constantly running, near permanent version of yourself. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> https://adventurist.me/posts/0113Fri, 14 Oct 2016 00:00:00 +0000 Saturday HF Radiohttps://adventurist.me/posts/0114<p> <a href="/images/radioday.gif"> <img src="/images/radioday.gif"/> </a> </p> <p> Weather is horrible againg, looks like we are getting the tail end of some dramatic weather. </p> <p> <a href="http://foxk.it"> Hibby </a> and I planned ot try some more <a href="http://adventurist.me/posts/0108"> line of sight microwave </a> , neither of us fancied climbing a hill in this storm. Instead we did a bit hf from my QTH. Radio power meter looks mental when doing <a href="https://en.wikipedia.org/wiki/Hellschreiber"> hell </a> . </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> https://adventurist.me/posts/0114Sat, 15 Oct 2016 00:00:00 +0000 Sundayhttps://adventurist.me/posts/0115<p> Today has been a very slow start, most of yesterday was spent drinking shows and playing with radios. I wanted to post a gif from twitter, but my brain isn't work well enough to figure out how on earth to get hold of one.: </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/O6m93MgvAW"> pic.twitter.com/O6m93MgvAW </a> </p> — 豊井 (@1041uuu) <a href="https://twitter.com/1041uuu/status/775759550670475264"> September 13, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> I can embed a tweet here using the code twitter gives me, but the media preview doesn't seem to work. There aren't any errors in the console or in the network debugger in firefox. </p> <hr/> <p> <a href="http://adventurist.me/posts/0109"> It </a> <a href="http://adventurist.me/posts/0110"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0111"> makes </a> <a href="http://adventurist.me/posts/0112"> seven </a> <a href="http://adventurist.me/posts/0113"> days </a> of <a href="http://adventurist.me/posts/0114"> writing </a> . </p> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> https://adventurist.me/posts/0115Sun, 16 Oct 2016 00:00:00 +0000 Android Reverse Engineeringhttps://adventurist.me/posts/0116<p> I seem to have a knack for finding the hardest problems to start with. Anyway I thought I would have a look at doing some android reverse engineering on a local transit app. </p> <p> First you will need to get the apk application bundle for the app you want to have a look at. If you have the app installed on your phone this is really easy to do with <a href="https://developer.android.com/studio/command-line/adb.html"> adb </a> . </p> <pre><code>$ adb shell anddroid$ pm list packages package:com.google.android.youtube package:com.android.providers.telephony ... package:com.android.documentsui package:com.android.externalstorage package:com.test.testapp anddroid$ pm list packages | grep testapp package:com.test.testapp anddroid$ pm path com.test.testapp package:/data/app/com.test.testapp/base.apk anddroid$ exit $ adb pull /data/app/com.test.testapp/base.apk </code></pre> <p> Now you will have the apps apk as <code> base.apk </code> and feed it to <a href="https://github.com/skylot/jadx"> jadx </a> . jadx is a dex to java decompiler with a pretty gui and the ability to deobfuscate code. When you fire up jadx with the apk you will get a complete break down of the apk bundle and decompiled classes. </p> <p> <a href="/images/jadx.png"> <img src="/images/jadx.png"/> </a> </p> <p> At this point you should see the decomiled classes, but as I said I am great at picking hard targets. There is some decompiled java here, but there are also mono packages and a load of dlls shipped in the assemblies directory. </p> <p> As I said, great at picking hard targets. To get further with this I shall have to find a c# decompiler, they seem to be quite common. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> https://adventurist.me/posts/0116Mon, 17 Oct 2016 00:00:00 +0000 bytebeathttps://adventurist.me/posts/0117<p> I am struggling for something to write today. I spent last night working on the second stage of a <a href="http://adventurist.me/posts/0116"> reverse engineering </a> project, but I haven't made much progress yet and there isn't anything to show. Windows tools seem determined to be as alien as possible to use. </p> <iframe allowfullscreen="" frameborder="0" height="480" src="https://www.youtube.com/embed/tCRPUv8V22o" width="854"> </iframe> <p> I had a look through my browser tabs, I still have what I consider the canonical <a href="http://canonical.org/~kragen/bytebeat/"> bytebeat </a> reference open. bytebeat is a sort of <a href="https://en.wikipedia.org/wiki/Code_golf"> code golf </a> based algorithmic music generation, the tiny snippets of code can manage to create some awesome sounds. </p> <p> There are quite a few people working on audio from crazy systems. <a href="http://captaincredible.com/"> Captain Credible's </a> excellent album <a href="https://meau.bandcamp.com/album/dead-cats"> Dead-Cats </a> is generated with an attiny85. I have <a href="https://meau.bandcamp.com/merch/captain-credible-blooper-eel-kit"> Blooper Eel </a> mini synth kit from him that I have toyed with a ton at my desk. </p> <p> And this is just the start of the rabbit hole, if you want to go up a level you should read the excellent <a href="https://noisepedals.com/"> noisepedals blog </a> . </p> <hr/> <p> <strong> Reading: </strong> Litte Brother, Transmetropolitan </p> https://adventurist.me/posts/0117Tue, 18 Oct 2016 00:00:00 +0000 HyperNormalisationhttps://adventurist.me/posts/0118<iframe allowfullscreen="" frameborder="0" height="480" src="https://www.youtube.com/embed/nz6u7xRznjY" width="854"> </iframe> <p> I watched the latest documentary from <a href="http://www.bbc.co.uk/blogs/adamcurtis"> Adam </a> <a href="https://en.wikipedia.org/wiki/Adam_Curtis"> Curtis </a> , <a href="http://www.bbc.co.uk/iplayer/episode/p04b183c/adam-curtis-hypernormalisation"> HyperNormalisation </a> , instead of anything of the things I planned to do last night. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> <p> If you are geographically or temporally challenged I am sure a neighbour has a copy you can borrow. </p> https://adventurist.me/posts/0118Wed, 19 Oct 2016 00:00:00 +0000 Driving Cypherpunkhttps://adventurist.me/posts/0119<p> I spent last night working on the <a href="https://github.com/adventureloop/mt7610u_wifi_sta_v3002_dpo_20130916"> mt7610 driver </a> and by that I mean I was reading the open linux source trying to work through it's general insanity. Look I found the register access isn't really meaty enough to write about. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Thanks to <a href="https://twitter.com/adventureloop"> @adventureloop </a> I've added the <a href="https://t.co/oog7dmXgtK"> https://t.co/oog7dmXgtK </a> archive, <a href="https://t.co/IZHLZUgrSn"> https://t.co/IZHLZUgrSn </a> </p> — Mike Dank (@Famicoman) <a href="https://twitter.com/Famicoman/status/788682002530721792"> October 19, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> <a href="https://twitter.com/Famicoman"> @Famicoman </a> is attempting to create a full archive of the <a href="http://www.activism.net/cypherpunk/"> Cypherpunks mailing list </a> . I tried to read the mailing list last year and made by own copy of an archive. My copy has been add to the <a href="https://github.com/Famicoman/cypherpunks-mailing-list-archives"> github repo </a> that is trying to capture this. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Autumn 2600 </p> https://adventurist.me/posts/0119Thu, 20 Oct 2016 00:00:00 +0000 Moshhttps://adventurist.me/posts/0120<p> I have to ssh proxy to get to my main machine, everything is filtered on the network my machine is on, apart from the ssh access box. This makes using mosh a little troublesome. </p> <pre><code> +-------+ +------+ |ssh | +-----------+ |laptop|-------ssh-------&gt;|gateway|--ssh----&gt;| | +------+&lt;-- +-------+ |dev machine| \---------mosh-------------------&gt;| | +-----------+ </code></pre> <p> dev can only be reached via an ssh proxy, but thankfully there is an open UDP port range that works. Mosh seems to have trouble figuring out the correct ip/port pair to select in this setup, mosh is quite simple so it is easy to deal with. </p> <pre><code>Host dev Hostname dev.domain.tld User tj ProxyCommand ssh -w 30 -q gateway.domain.tld nc %h 22 </code></pre> <p> The <code> mosh </code> command is just a shell script, it sshs to the remote machine and runs <code> mosh-server </code> . Mosh server generates an AES session key and starts the mosh server process on the machine. <code> mosh-client </code> takes the session key via an environmental variable, ip address and port the server is listening on. </p> <p> With that we can run mosh by hand: </p> <pre><code>[laptop] $ ssh dev [dev] $ mosh-server setsockopt( IP_RECVTOS ): Invalid argument MOSH CONNECT 40001 pv2jeN0MJ1N4gCd1V0i21g mosh-server (mosh 1.2.5) [build mosh 1.2.5] Copyright 2012 Keith Winstein &lt;mosh-devel@mit.edu&gt; License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [mosh-server detached, pid = 19100] Warning: termios IUTF8 flag not defined. Character-erase of multibyte character sequence probably does not work properly on this platform. [dev] $ exit [laptop] $ MOSH_KEY="pv2jeN0MJ1N4gCd1V0i21g" [laptop] $ mosh-client 143.100.67.5 40001 </code></pre> <p> Once you know how to do mosh by hand there are other things we can try. I don't think it would be impossible to work around certain types of NAT using nc. It requires a third party box, but a lot of STUN can be done with just UDP packets. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> <p> I am sure I have written this down before, google couldn't find it. </p> https://adventurist.me/posts/0120Fri, 21 Oct 2016 00:00:00 +0000 Decentralise as Defaulthttps://adventurist.me/posts/0121<p> <a href="http://hackaday.com/2016/10/21/you-might-not-be-able-to-read-this/"> Yesterday </a> <a href="https://www.dynstatus.com/incidents/nlr4yrr162t8"> featured </a> a <a href="http://gizmodo.com/this-is-probably-why-half-the-internet-shut-down-today-1788062835"> massive </a> <a href="https://news.ycombinator.com/item?id=12759520"> ddos </a> attack against DynDNS. For me, in the north of Scotland, this meant an entire shutdown of the web. ssh and mosh connections stayed, but everything from twitter to google were unreachable. </p> <p> Name discovery in decentralised networks is a really hard problem, I am not aware of any really solid solutions. There is probably a large capitalist factor involved here, you really can't centralise profits from a decentralised system. </p> <p> I spent some time reading about name systems for adhoc mesh networks, before I gave up on trying to build this out. It is hard and would require a load of other people to test. </p> <p> A quick search of my in brain cache returns: </p> <ul> <li> <a href="https://en.wikipedia.org/wiki/Multicast_DNS"> Multicast </a> or <a href="https://tools.ietf.org/html/rfc6762"> mdns </a> </li> <li> <a href="https://bit.namecoin.info/"> namecoin </a> </li> </ul> <p> mdns is probably already running on your local network, it won't scale well and certainly not to internet sizes. namecoin is something I am just sort of aware of, I think worry of blockchain buzzword bingo has stopped me looking too hard. </p> <p> I would love to know about more interesting and diverse systems, if you know of any drop me a line. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> https://adventurist.me/posts/0121Sat, 22 Oct 2016 00:00:00 +0000 Late night Cyberinghttps://adventurist.me/posts/0122<p> <a href="/images/storm.gif"> <img src="/images/storm.gif"/> </a> </p> <p> Last night I finally read this <a href="http://www.theparisreview.org/interviews/6089/the-art-of-fiction-no-211-william-gibson"> giant interview in the Paris review with William Gibson </a> . The interview is full of great quotes, insights and gems like Gibsons <a href="http://adventurist.me/posts/0111"> first published story </a> . </p> <p> The second part of <a href="http://www.bbc.co.uk/programmes/b007jqv3"> Burning Chrome </a> is available on iplayer about now, <a href="http://adventurist.me/posts/0111"> the first part </a> was excellent. </p> <hr/> <p> <a href="http://adventurist.me/posts/0118"> It </a> <a href="http://adventurist.me/posts/0117"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0118"> makes </a> <a href="http://adventurist.me/posts/0119"> seven </a> <a href="http://adventurist.me/posts/0120"> days </a> of <a href="http://adventurist.me/posts/0121"> writing </a> . </p> <p> <strong> Reading: </strong> Little Brother, Transmetropolitan </p> <p> If you are geographicaly impaired, I am sure a neighbour help you out. </p> https://adventurist.me/posts/0122Sun, 23 Oct 2016 00:00:00 +0000 Bookcase Pihttps://adventurist.me/posts/0123<p> Last night, I drilled some holes in a book case and bricked a pi. That isn't so interesting, unless you really like holes in wood, and it leaves me at a loss what write about. </p> <p> <a href="/images/einkpiandframe.jpg"> <img src="/imagessmall/einkpiandframe.jpg"/> </a> </p> <p> Okay, fine. I have this <a href="https://www.pi-supply.com/product/papirus-epaper-eink-screen-hat-for-raspberry-pi/"> awesome eink screen </a> for the pi, I got it to do something like this <a href="https://hackaday.io/project/10573-tide-clock-in-micropython"> tide clock </a> . I don't want single purpose things lying around, the same pi is going to be running <a href="https://www.musicpd.org/"> mpd </a> my music player of choice. It will be using the screen to show cool effects (like the thing on it now) and probably stats about things. </p> <p> What things, I have no idea. Maybe: * bus times * output from the house sensors * whats playing * network uptime </p> <p> See, it isn't really fleshed out yet. I do have all the code to write stuff to the screen, it took ages to get working using python, cairo and pango. Now I have holes drilled and audio cables routed through the book case, I need to get the pi up and doing music. </p> <p> It is not ready yet. </p> <hr/> <p> <strong> Reading: </strong> Little Brother </p> https://adventurist.me/posts/0123Mon, 24 Oct 2016 00:00:00 +0000 OTG USB Hubhttps://adventurist.me/posts/0124<p> For my silly little tablet I got this awesome usb otg hub thing. It has 3 usb ports, a microusb hole and an otg cable, you can you it to connect 3 devices to your phone or tablet and power them all at the same time. </p> <p> <a href="/images/otghub.jpg"> <img src="/imagessmall/otghub.jpg"/> </a> </p> <p> I got this thing so I could install something other than windows on my stream 7, to do that I need power, usb storage, usb networking and io stuff all at once. </p> <p> <a href="/images/otghubinstructions.jpg"> <img src="/imagessmall/otghubinstructions.jpg"/> </a> </p> <p> It also comes with the most mental instructions I have seen. I am trying to figure out what it says, but man, who knows. I think there was a deal on 3 postition swtiches and they put it in instead of a 2 position one. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Seveneves </p> https://adventurist.me/posts/0124Tue, 25 Oct 2016 00:00:00 +0000 Boxes and lineshttps://adventurist.me/posts/0125<p> Osmocom can do 3G voice! <a href="https://projects.osmocom.org/news/59"> Look at this awesome article </a> about the new support, it builds on this <a href="http://osmocom.org/news/30"> equally awesome article </a> that gives a status update on the 3G stack. This is excellent news, as we move through LTE into whatever the 5G tech will be called, the open source community is starting to catch up with commercial hardware. </p> <p> Look at those awesome diagrams: </p> <pre><code> +--------+ ,--&gt;| MGCPGW |&lt;--RTP--... / | | | | |&lt;--MGCP | +--------+ \ / | +------------+&lt;--RTP +--------+ `-&gt;+----------+ UE &lt;--&gt;| hNodeB | | HNB-GW | | OsmoCSCN | UE &lt;--&gt;| |&lt;--Iuh----&gt;| |&lt;--IuCS--&gt;| | | | ...--&gt;| | ...--&gt;| | | | | | +----------+ +------------+&lt;--GTP-U | | \ | | +------+ +------+ | | |&lt;--IuPS--&gt;| SGSN |&lt;--GTP-C--&gt;| GGSN | | +--------+ ...--&gt;| | GTP-U--&gt;| | | +------+ / +------+ \_______________________________/ </code></pre> <p> I mean, look at the awesome curved line: </p> <pre><code> +--------+ ,--&gt;| MGCPGW | / | | | | | | +--------+ / -+&lt;--RTP </code></pre> <p> I cannot draw lines like that, I <strong> can </strong> draw lines like this: </p> <pre><code> +--------+ &gt; | -/| | / | | / +--------+ -/ -----/ </code></pre> <p> [DrawIT][2], the vim plugin I use for ascii boxes and lines just can't do those amazing curved lines. I bet it is a emacs plugin or something else I can't use making those awesome lines. Man am I jealous. </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Seveneves </p> https://adventurist.me/posts/0125Wed, 26 Oct 2016 00:00:00 +0000 Hacktoberfesthttps://adventurist.me/posts/0126<p> I finished <a href="https://hacktoberfest.digitalocean.com"> Hacktoberfest Last night </a> !!!! Hacktoberfest is a month long hackathon thing run by DigitalOcean and github, in exchange for some open source Pull Requests DO will send you stickers and a tshirt. I tried to do this last year, but found it is really hard to do small commits against projects, I ended only managed 1 commit, but DO still sent me a sticker. </p> <p> This year I was determined to manage the 4 commits required to get a tshirt, silly me I thought that working on an <a href="https://github.com/NEAT-project/neat"> open source github hosted project </a> for <a href="https://www.neat-project.org/"> $work </a> would make that easy. Instead I really struggled to manage the four PR's, I only got two via the work project, small commits are hard things to find. </p> <p> For the other two pull requests I looked at open source software. </p> <p> <a href="https://github.com/csete/gpredict/"> gpredict </a> is a cross platform open source satellite tracker, I have used to for following amateur satellites. gpredict has always been super buggy for me, the current packaged build for FreeBSD dumped core when I tried to open the 'sat info screen'. Firing up gpredict with debug symbols and within in gdb made it really easy to find the use after free that was the culprit. </p> <p> There were a pile of issues like this, I ran the build through llvm's <a href="http://clang-analyzer.llvm.org/scan-build.html"> scanbuild tool </a> and it showed up a bunch of potential bugs. They too went into the PR for gpredict. </p> <p> Last night an email came from DO stating there was still time to get the necessary PR's in. Dern, I had only manage three of the four pull requests so far. </p> <p> <a href="https://github.com/kaitai-io/kaitai_struct"> Kaitai Struct </a> is an awesome project for generating code from binary formats, it is a compiler, a visualizer and a declarative language. There is a set of <a href="https://github.com/kaitai-io/kaitai_struct_formats"> example formats </a> of images, games, media, compression and network packets. I noticed that UDP was missing from the network set and <a href="https://github.com/kaitai-io/kaitai_struct_formats/pull/6"> shamelessly added it </a> . </p> <hr/> <p> <strong> Reading: </strong> Little Brother, Autumn 2600 </p> https://adventurist.me/posts/0126Thu, 27 Oct 2016 00:00:00 +0000 Modern Gonzohttps://adventurist.me/posts/0127<p> Maybe because there is an election on or maybe just because I wanted a use for my new stream 7 tablet thing, I read through all of <a href="https://en.wikipedia.org/wiki/Transmetropolitan"> Transmetropolitan </a> . Transmet (as I am told the cool kids call it) is a Cyberpunk comic book series written by Warren Ellis, featuring a Gonzo journalist reporting on an Election from 'The City'. </p> <p> I am a huge fan of Gonzo as written by Hunter S. Thompson, but Hunter is long dead and this has limited his journalistic output severely. So here I have a problem, I would be very happy to read more high quality pieces in the Gonzo style, but I have found finding such writing to be an absolute nightmare. </p> <p> Here is a list of people I know writing great stuff: </p> <ul> <li> <a href="https://theintercept.com/staff/freebarrett_/"> Barrett Brown </a> has <a href="https://freebarrettbrown.org/2016/10/26/wrongdoing-in-the-prison-system/"> been writing </a> from prison, his stay is nearly up, it seems they want to kick him out for some reason. </li> </ul> <p> I might have to look harder. </p> <hr/> <p> <strong> Reading: </strong> ELEKTROGRAD </p> <p> I couldn't finish Little Brother, it became <strong> too </strong> YA and it just annoyed me. I did read all of it when it came out so I am not that bothered. </p> https://adventurist.me/posts/0127Fri, 28 Oct 2016 00:00:00 +0000 Follow that robothttps://adventurist.me/posts/0128<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/DSD8e44xZJ"> pic.twitter.com/DSD8e44xZJ </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/792214392964276224"> October 29, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> This robot is excellent, you should follow it. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0128Sat, 29 Oct 2016 00:00:00 +0000 Coffee routinehttps://adventurist.me/posts/0129<p> Went to a friends and carved some pumpkins last night, that means I didn't manage to do anything interesting yesterday. Weekends are when I <a href="http://adventurist.me/posts/0104"> make coffee </a> , Sunday is filtering day which looks something like this: </p> <p> <a href="/images/coffeefiltering.jpg"> <img src="/imagessmall/coffeefiltering.jpg"/> </a> </p> <p> I have to run out to meet someone for lunch, tonight I am going to have a play with Scapy. I think I will try to pull an image out of a http stream, that seems like a small enough task to be doable. </p> <hr/> <p> <a href="http://adventurist.me/posts/0123"> It </a> <a href="http://adventurist.me/posts/0124"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0125"> makes </a> <a href="http://adventurist.me/posts/0126"> seven </a> <a href="http://adventurist.me/posts/0127"> days </a> of <a href="http://adventurist.me/posts/0128"> writing </a> . </p> <p> <strong> Reading: </strong> Abaddon's' Gate </p> https://adventurist.me/posts/0129Sun, 30 Oct 2016 00:00:00 +0000 Getting Certs Out of Wiresharkhttps://adventurist.me/posts/0130<p> Packet capture tools are oscilloscopes to network programmers, I couldn't get anything done without near continual use of <code> tcpdump </code> and <code> wireshark </code> . In a pinch <a href="http://adventurist.me/posts/0110"> tcpdump can </a> <a href="http://adventurist.me/posts/0105"> be used instead of writing server code </a> . </p> <p> Wireshark has support for a load of protocols and can really help with debugging. Recently I added <a href="https://github.com/NEAT-project/neat/pull/169"> dtls support </a> to <a href="https://github.com/NEAT-project/neat"> NEAT </a> . DTLS is a protocol enhancement to TLS to support datagram traffic, when it is working all of the traffic is basically random noise. </p> <p> <a href="/images/wiresharkdtlscert.png"> <img src="/images/wiresharkdtlscert.png"/> </a> </p> <p> I had trouble gettting server certs to work correctly with DTLS, thankfully <a href="https://www.wireshark.org/lists/wireshark-users/201003/msg00080.html"> Wireshark can reassemble the datagrams </a> into a coherent certificate and export the data out to a file. I can use this to manually check the cert is being sent correctly. </p> <p> The process is something like this: </p> <pre><code>1. Import pcap 2. Find the full reassembled server hello 3. Expand the DTLS body 4. Expand the DTLS Record, Certificate (Reassembled) 5. Right click on 'Handshake Protocol: Certificate(Reassembled)' 6. Select Export Packet Bytes </code></pre> <p> After than I had a TLS Cert in <a href="https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them"> DER format </a> , DER is just he raw cert bytes. With this I could then verify using <code> openssl </code> that the cert chain was valid. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0130Mon, 31 Oct 2016 00:00:00 +0000 Getting Images Out of Wiresharkhttps://adventurist.me/posts/0131<p> While <a href="http://adventurist.me/posts/0129"> researching extracting images with scapy </a> I found a page <a href="https://wiki.wireshark.org/TCP_Reassembly"> describing image extraction </a> with Wireshark, I am not sure why I didn't think to try this first. Of course Wireshark can do this super useful network task, their mission is to make the ultimate network diagnostic tool. </p> <p> The information on that page seems to be a little out of date, on my Wireshark build the PDU tracing and http follow options were already selected. </p> <p> Grab a dump of a http session, then feed it into Wireshark: </p> <pre><code># tcpdump -w webimage.pcap host adventurist.me and port 80 </code></pre> <p> I visited <a href="http://adventurist.me/posts/0125"> this page </a> which I know has an image on it in FireFox's porn mode. </p> <p> <a href="/images/wiresharkimage.png"> <img src="/images/wiresharkimage.png"/> </a> </p> <pre><code>http.response.code==200 </code></pre> <p> In Wireshark I used a http 200 response code to find all of the assets in the stream. This left only three items, the page itself, the css style sheet and the image. Expand out the TCP block in Wireshark, right click on the JPEG block and choose 'Export Packet Bytes'. I saved this as .bin, moved it to a .jpeg and was able to open the image. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0131Mon, 31 Oct 2016 00:00:00 +0000 Spooky Art-Net Pumpkinshttps://adventurist.me/posts/0132<p> <a href="/images/artnetpumpkin.jpg"> <img src="/imagessmall/artnetpumpkin.jpg"/> </a> </p> <p> Last night was <a href="https://en.wikipedia.org/wiki/Halloween"> All Hallows' Eve </a> , I wanted to do something cool with the decorations. I repurposed an rgb neopixel board driven by a nodemcu board and gave one of our pumpkins a network controlled candle instead of the old analog kind. </p> <p> I also spent some time building out a motion sensor, but I wasn't able to integrate that with the network code in time to use it. In the end the weather seems to have kept everyone at home and we didn't have any visitors. </p> <p> <video controls="" src="/videos/rgbpumpkin.webm"> </video> </p> <p> I am going to try and get everything together tonight at the <a href="https://57north.org.uk"> hackerspace </a> , if I do I will write up what all the parts are. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0132Tue, 01 Nov 2016 00:00:00 +0000 Extract Images from a TCP Flowhttps://adventurist.me/posts/0133<p> <a href="http://adventurist.me/posts/0129"> On Sunday </a> I thought I would try to extract images from a TCP Flow with <a href="http://www.secdev.org/projects/scapy/"> scapy </a> . Initial searches should <a href="http://adventurist.me/posts/0131"> how to do this with wireshark </a> , but the idea is to do this programatically and try to learn something about scapy. At the <a href="https://57north.org.uk"> hackerspace </a> tonight, not wanting to work on anything I said I would, I thought I would have a play with scapy. </p> <h2> A little bit on TCP </h2> <p> A TCP Flow is how we refer to the stream of packets that make what you might call TCP Connection. The connection bit is just the start. A Flow is defined in IP by 5 numbers: </p> <pre><code>* protocol (TCP or UDP for the most part) * source - address (ip address of the initiator of the connection - port (normally a randomly chosen emphemeral port number) * destination - address (ip address of the host) - port (normally a well known service number, http is 80) </code></pre> <p> A lot of time we call this the 5 tuple, or 4 tuple if we know the protocol. At any one point in a time a given 5-tuple defines the connection(Flow). </p> <p> To a programmer TCP presents a reliable byte orientated stream interface. This means any bytes we write into our TCP socket, will come out of the other end in order and they are guaranteed to arrive (or an error is generated). </p> <p> Data written into a TCP socket is broken into chunks the network can support (normally, without fragmentation), we call these chunks of data segments. Each segment has a sequence number, which tells the remote end where it is in the stream, there can be a large number of these segments in the air at a time, the flight size. </p> <p> Segments can get lost in the network (well dropped by routers), reordered or delayed. </p> <h2> Extracting Images </h2> <p> To extract images from a network capture we need to separate out the packets into flows; reassemble TCP flows into a byte stream taking into account loss and reordering; reconstruct the segments into a coherent byte stream; search the byte stream for image headers and try to extract them. </p> <p> This is a none trivial amount of work for a Tuesday night. </p> <p> Before writing any code I did some searching, scapy might have support for flow reconstruction(nope). I came across some references to a tool called <code> tcpflow </code> , <a href="http://www.circlemud.org/jelson/software/tcpflow/"> tcpflow </a> claims to be a tool for extracting TCP Flows from either a live capture interface or a pcap file. </p> <p> That looked great to me, I would grab a pcap with <code> tcpdump </code> , process out the flows with <code> tcpflow </code> and then drop that into scapy and start looking for some images. </p> <p> Reading the <code> tcpflow </code> man page I instead found a single option that would do all the work for me. </p> <h2> Images with <code> tcpflow </code> </h2> <p> It is really easy to extract images from a http TCP Flow using <code> tcpflow </code> , you can do this live, but I used a pcap file. </p> <pre><code># tcpdump -w webimage.pcap host adventurist.me and port 80 </code></pre> <p> I started up the dump then visited <a href="http://adventurist.me/posts/0129"> http://adventurist.me/posts/0129 </a> in FireFox's porn mode. </p> <p> <code> tcpflow </code> will read in a pcap file with the -r flag, the -e flag will apply magic to the flow and find you fun stuff. </p> <pre><code>$ tcpflow -r webimage.pcap -e http </code></pre> <p> <code> tcpflow </code> will spit out a file for each flow, to boot it will throw in extracted data for everything it understands. </p> <pre><code>$ ls 093.095.228.091.00080-172.031.005.168.58914 093.095.228.091.00080-172.031.005.168.58914-HTTPBODY-001.jpg 093.095.228.091.00080-172.031.005.168.58914-HTTPBODY-002.ico 093.095.228.091.00080-172.031.005.168.60028 093.095.228.091.00080-172.031.005.168.60028-HTTPBODY-001.html 093.095.228.091.00080-172.031.005.168.60028-HTTPBODY-002.css 172.031.005.168.58914-093.095.228.091.00080 172.031.005.168.60028-093.095.228.091.00080 report.xml webimage.pcap </code></pre> <p> <code> tcpflow </code> also seems to be spitting out a <code> report.xml </code> , it seems to describe what it has just done. I image that is super useful when running <code> tcpflow </code> against a live capture. I haven't managed to get very far using scapy to pull images out of flows, I am starting to wonder if there is really any point when all these tools are available. </p> https://adventurist.me/posts/0133Tue, 01 Nov 2016 00:00:00 +0000 Making webm fileshttps://adventurist.me/posts/0134<p> <a href="http://adventurist.me/posts/0132"> Yesterday </a> I posted a stupidly large gif of some pumpkins flashing different colours. Then a couple of minutes later after suffering through the upload I replaced it with a teeny webm. </p> <p> <video autoplay="" controls="" loop="" src="/videos/coffee.webm"> </video> </p> <p> <code> ffmpeg </code> now has excellent webm support, for me it will happily pick it up with automatic detection. To make videos like the one above I use <code> ffmpeg </code> and let it choose its own options. I drop the audio from the video to give it a nicer gif like effect, I think from today I will tell browsers to autoplay the video snippets so they look like awesome gifs. </p> <p> I do something like this: </p> <pre><code>$ ffmpeg -i VID_20161030_112003.mp4 -ss 00:00:02.0 -an coffee.webm </code></pre> <ul> <li> <code> -i </code> is the input video </li> <li> <code> -ss </code> tells <code> ffmpeg </code> to start the encoding at this time stamp <ul> <li> we could pass -t to tell ffmpeg to extract a t length section of the video </li> </ul> </li> <li> <code> -an </code> tells us to the use no audio </li> <li> <code> coffee.webm </code> is the output video and format, <code> ffmpeg </code> will do the right thing here </li> </ul> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0134Wed, 02 Nov 2016 00:00:00 +0000 Rotator Controller https://adventurist.me/posts/0135<p> <code> gpredict </code> is able to signal a rotator controller over TCP. This is awesome, I want to track satellites and I am not going to pay for a rotator controller. I am going to build something to get my antenna pointed, using servos and a wifi microcontroller board. </p> <p> I have tried searching a few times, but like everything amateur radio hard facts are hard to come by, the scam artists and windows developers protecting their sacred lore abound. I was at a bit of loss until I thought to try seeing what <code> gpredict </code> spits out over the network. </p> <p> First I created a test rotator in the <code> gpredict </code> settings: </p> <p> <a href="/images/gpredict-rotatorsettings.png"> <img src="/images/gpredict-rotatorsettings.png"/> </a> </p> <p> Then I dug around until I could find the rotator control panel, named antenna control. In this panel there is a 'track' button and an 'engage' button, figuring engage was the test option to manually set the rotator I hit that. </p> <p> <a href="/images/gpredict-rotatorcontrol.png"> <img src="/images/gpredict-rotatorcontrol.png"/> </a> </p> <p> After a short pause a helpful 'ERROR' pops up under the Az/El settings, Good progress. Next I started up <code> nc </code> pretending to be a listening rotator controller so I could see what <code> gpredict </code> was sending. </p> <pre><code>$ nc -l 0.0.0.0 4533 p P 180.00 45.00 p P 180.00 45.00 p P 180.00 45.00 p P 180.00 45.00 p P 180.00 45.00 </code></pre> <p> This output is great, <code> nc </code> is just outputting the bytes sent down the tcp connection. It seems that <code> gpredict </code> sends a letter 'p', I replied with a blank line by hitting enter, this resulted in a capital 'P' and a Az and El. Some guess work interpretation suggests <code> gpredict </code> is asking for our position with 'p', then giving us a position to move to with 'P'. </p> <p> This is a great start, next I will have a look through the <a href="https://github.com/csete/gpredict/"> gpredict source </a> to see what it is doing. I will start with the 'engage' button from <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L629"> gtk-rot-ctrl.c </a> . </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate </p> https://adventurist.me/posts/0135Thu, 03 Nov 2016 00:00:00 +0000 Analysing a Network Protocolhttps://adventurist.me/posts/0136<p> <a href="https://github.com/csete/gpredict/"> gpredict </a> is piece of software for tracking things in orbits, sometimes you want to automatically point things at stuff in orbit. To get things pointed at stuff in orbit we can use a rotator controller, <code> gpredict </code> as a piece of radio software has an antenna rotator controller built it. The <code> gpredict </code> rotator controller expects to speak to something over TCP. </p> <p> I have not been able to find documentation for the protocol (I didn't look very hard), I thought it would be fun to reverse engineer the protocol and write a simple daemon. <a href="http://adventurist.me/posts/0135"> Earlier </a> I took some first steps to see what <code> gpredict </code> was doing on the network. </p> <p> If you want to play a long at home this is what I am going to do: </p> <ul> <li> set up a dummy daemon using netcat (nc -l localhost 4533) </li> <li> use tcpdump with -XX to watch all traffic (e.g. tcpdump -XX -ilo0 tcp and port 4533) </li> <li> send data from gpredict to the daemon (hit the 'engage' button on the antenna control screen) </li> <li> play with responses (type into the console running nc) </li> <li> look at the gpredict code starting here: https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c </li> </ul> <h2> The Network traffic </h2> <pre><code>$ nc -l 0.0.0.0 4533 p P 180.00 45.00 </code></pre> <p> When I press the 'engage' button, <code> gpredict </code> sends a single lower case 'p', if I press enter, sending a blank line, <code> gredict </code> responds with a capital 'P' and two numbers. To me these numbers look like an Az El pair, they correspond to the values on the antenna control screen in <code> gpredict </code> . No need for <code> tcpdump </code> this time. </p> <h2> We have source avaialble </h2> <p> With only one half of the network protocol to look at, we can't get very far. <code> gpredict </code> is open source and there is a <a href="https://github.com/csete/gpredict/"> github </a> mirror where we can browse the source tree. The file names in the 'src' directory show some promising results: </p> <pre><code>gtk-rot-ctrl.c gtk-rot-ctrl.h gtk-rot-knob.c gtk-rot-knob.h rotor-conf.c rotor-conf.h sat-pref-rot.c sat-pref-rot.h </code></pre> <p> The pref and conf files, are probably configuration stuff, I have no idea what is in the knob file, but the gtk-rot-ctrl set of files is what we want. I confirmed this by picking a string in the UI of the relevant screen and grepping through the code for it. This can be troublesome if the software is heavily localised, but it this case I could track down the 'Engage' button to a <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L629"> comment in the code </a> . </p> <p> There are two functions used for network traffic, <code> send </code> is used to send data into a tcp connection, <code> recv </code> is used to receive data from a TCP connection. If we can find these in the code, we find where the software is generating network traffic. Normally only a starting point, it is very common to wrap these two functions into other convenience functions. </p> <p> A grep through the code brings up a <code> send </code> <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L1486"> call </a> in <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L1467"> send <em> rotctld </em> command </a> . More grepping and we find that <code> send_rotctld_command </code> is called from two places, the <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L1205"> get <em> pos </em> </a> function (which I have to guess asks for the rotators positions) and the <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L1268"> set pos </a> function (which must try to set the rotators position). </p> <p> The <code> get_pos </code> function fills a format string with "p\x0a" and uses <code> send_rotcld_command </code> to send it. Looking up 0x0A in an ascii table shows it is Line Feed(LF) also known as a newline on a unix system. It splits <code> buffback </code> on newlines using <a href="https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strsplit"> g_strsplit </a> , looking to find two floating point numbers to use as azimuth and elevation, one on each line. </p> <p> <code> get_pos </code> : </p> <pre><code>/* send command */ buff = g_strdup_printf("p\x0a"); retcode = send_rotctld_command(ctrl, buff, buffback, 128); ... vbuff = g_strsplit(buffback, "\n", 3); if ((vbuff[0] != NULL) &amp;&amp; (vbuff[1] != NULL)) { *az = g_strtod(vbuff[0], NULL); *el = g_strtod(vbuff[1], NULL); } </code></pre> <p> This piece of code shows up something really important, <code> gpredict </code> is using a single function to both send a command and gather the response from the remote end. If we look at <code> send_rotctld_command </code> the <a href="https://github.com/csete/gpredict/blob/master/src/gtk-rot-ctrl.c#L1499"> recv call </a> is called right after a send. Here we can see that <code> gpredict </code> only does a single <code> recv </code> to gather responses, it is expecting a reply that fits into a single read. This is a bug, but probably not one that really matters. </p> <pre><code>/* try to read answer */ size = recv(ctrl-&gt;sock, buffout, sizeout, 0); </code></pre> <p> The <code> set_pos </code> function fills up a format string with a capital 'P', and two floating point numbers. It doesn't do any parsing of the response, only looking at the error code from the socket call. </p> <p> <code> set_pos </code> : </p> <pre><code>/* send command */ g_ascii_formatd(azstr, 8, "%7.2f", az); g_ascii_formatd(elstr, 8, "%7.2f", el); buff = g_strdup_printf("P %s %s\x0a", azstr, elstr); retcode = send_rotctld_command(ctrl, buff, buffback, 128); </code></pre> <h2> Write a Daemon </h2> <p> With this little bit of analysis we have enough to write an antenna control daemon that <code> gpredict </code> can speak to. The rotator control protocol has two simple commands, a position query which expects the currect az/el across separate lines and a position setter, which expects no response. </p> <pre><code>#!/usr/bin/env python import socket TCP_IP = '127.0.0.1' TCP_PORT = 4533 BUFFER_SIZE = 100 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((TCP_IP, TCP_PORT)) s.listen(1) conn, addr = s.accept() print 'Connection address:', addr az = 0.0 el = 0.0 while 1: data = conn.recv(BUFFER_SIZE) if not data: break print("received data:", data) if data == "p\n": print("pos query at az:{} el: {}", az, el); response = "{}\n{}\n".format(az, el) print("responing with: \n {}".format(response)) conn.send(response) elif data.startswith("P "): values = data.split(" ") print(values) az = float(values[1]) el = float(values[2]) print("moving to az:{} el: {}".format( az, el)); conn.send(" ") elif data == "q\n": print("close command, shutting down") conn.close() exit() else: print("unknown command, closing socket") conn.close() exit() </code></pre> <p> Using the <a href="https://wiki.python.org/moin/TcpCommunication"> python TCP server </a> example as a starting point it is easy to put together a daemon that will listen to the rotator controller. The code should be pretty straight forward to read, we process the commands documented earlier. There is one addition that I didn't see in the code at first. There is a quit command that does not use the normal wrapper and instead uses <code> send </code> directly. This command was easy to handle. </p> <p> This is how I approach network problems, whether in code I have written or code that is completely new to me. Hopefully if you have been following along at home the example above is straightforward to read. </p> https://adventurist.me/posts/0136Thu, 03 Nov 2016 00:00:00 +0000 I had to make a candlehttps://adventurist.me/posts/0137<p> <video autoplay="" controls="" loop="" src="/videos/candle.webm"> </video> </p> <p> We don't have candles lying around the lab, I wasn't going to let that stop me. I made one using an arduino mega, the single ws2812 neopixel led I could find and some diffuse that was lying around. I was really hard to capture on my phone, but the <a href="https://github.com/timpear/NeoCandle"> flicker effect </a> I found on github works really well. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0137Fri, 04 Nov 2016 00:00:00 +0000 Internet Cafes in 2016https://adventurist.me/posts/0138<p> The Starbucks I am sat in right now is the model of the modern internet cafe. There is coffee, free WiFi, chairs(!), they are happy for you to sit there all day if you order an over priced drink every so often. And other than me there are people in here using laptops, they might even be working. </p> <p> In the 90's an internet cafe was a different thing, there might have been coffee and drinks, but the main feature that drew people in were the rows and rows of computers. Laptops had weedy specs and were really over priced. Many people probably visited just to use the computers, it might have been there only way to get online. </p> <p> Internet cafes did not last in the west, the pc market had to make laptops affordable to live. With disposable income and infrastructure that had to appear to be world leading it quickly became expected to have a computer at home. </p> <p> There is an impression in the western mindset, driven by the media, that internet cafes are still a big thing in poorer parts of the world. If you show a user in India or China using a computer from an internet cafe no one will bat an eye. Both <a href="http://craphound.com/ftw/download/"> For the Win </a> and <a href="http://www.nealstephenson.com/reamde.html"> Reamde </a> feature <a href="https://en.wikipedia.org/wiki/Gold_farming"> Gold Farmers </a> playing MMO's from internet cafes. </p> <p> Unfortunately Internet cafes aren't a myth, there are still many places you can find desktop computers set up for general public access. University computer rooms, public libraries, airports and hotel lobbies are some common culprits. As in the 90's and 2000's public machines are a security nightmare. </p> <p> You can never be safe using someone else's computer, that is why the cloud is such a joke. General public machines are a potential goldmine to a malicious actor and maybe worse, are a breeding ground for malware that will be around even when the host isn't actively malicious. </p> <p> == Can We Build An Internet Cafe in 2016? == </p> <p> People are going to no matter what, can we build something that is reasonably safe for a user? I think we first have to assume that the machines we are going to use are not actively malicious, there is very little we can do to stop someone that is actively coming after you. Active attacks are rare, most people are only targeted when they stand out from the crowd. </p> <p> I think there are two ways we can do this: </p> <p> <strong> 1. User provides the computing and storage </strong> </p> <p> In this case the user has their own computing power, but they need access to a larger screen and more capable peripherals. The venue operator just have to provide a standard interface, lets say HDMI ports on large monitors, and the keyboard and mouse. </p> <p> You could carry a some sort of HDMI stick pc, a raspberry pi, or something else. This idea is the basic of <a href="https://insights.ubuntu.com/2015/10/20/ubuntus-path-to-convergence/"> Ubuntu's Convergence computing </a> , the phone you carry around all day is already a capable enough computer. With a little hardware to connect a screen, keyboard and mouse, the convergence device goes from phone OS to full desktop OS. </p> <p> The convergence idea is really interesting, but Ubuntu is starting it up very slowly. One day soon, hopefully. </p> <p> <strong> 2. User provides storage </strong> </p> <p> The second idea is that the venue provides <em> normal </em> desktop computers of some sort we would expect, but they don't have a hard drive or operating system installed. </p> <p> Instead the user brings a bootable USB stick with a proactively secure operating system like <a href="https://tails.boum.org/"> tails </a> installed. The user is able to take the USB stick wherever they go and manage to maintain a session between boots. </p> <p> This is possible now. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> <p> The subtitle text for Neal Stevenson's website is excellent </p> <p> <a href="/images/nealstevenson.png"> <img src="/images/nealstevenson.png"/> </a> </p> https://adventurist.me/posts/0138Sat, 05 Nov 2016 00:00:00 +0000 TouchBarhttps://adventurist.me/posts/0139<p> The <a href="https://news.ycombinator.com/item?id=12883047"> HN thread </a> about <a href="https://github.com/avatsaev/touchbar_nyancat"> nyancat on the new MacBook TouchBar </a> is overwhelmingly negative, that's normal for HN, but the response I have seen to it other places has been just as bad. </p> <p> The changes to the keyboard, awkwardness of touch screens and position of the board are common points of compliant. I think Keyboards have too many keys, I type on a <a href="http://olkb.com/planck/"> planck </a> which only has 40 keys. I love this keyboard. I think if you look at a layout map of the planck you will realise that you can get used to very strange layouts. </p> <p> An awesome, long screen like that is a great addition the standard laptop layout. Having a way to access context while not obstructing the main display is awesome. The hardware as implemented by Apple is a problem, if it <a href="http://www.macrumors.com/2016/10/28/touch-bars-t1-chip-variant-watchos/"> really is running WatchOS </a> then no other OS will ever work with it, that doesn't stop over manufacturers doing it with a sensible hardware link. </p> <p> I love the idea of having a secondary display built into my laptop. Look at the awesomeness @jcs managed with the RGB bar on the chromebook pixel, that bar is only RGB, a full colour display could do so much more. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> My OpenBSD driver for the Chrome EC supports userland access, so now the lightbar can blink red whenever pf blocks a packet. <a href="https://t.co/1wnwGOFaPq"> pic.twitter.com/1wnwGOFaPq </a> </p> — joshua stein (@jcs) <a href="https://twitter.com/jcs/status/784821967258017794"> October 8, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Screens on keyboards aren't new, there have been <a href="http://www.razerzone.com/gb-en/switchblade-ui"> gaming keyboards </a> with screens for a long time. Apple might be the first to try this on a laptop, but will probably be the first to succeed with this idea. I suspect Apple will have the first implementation that sees real adoption in the secondary screen peripheral space. </p> <hr/> <p> <a href="http://adventurist.me/posts/0133"> It </a> <a href="http://adventurist.me/posts/0134"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0135"> makes </a> <a href="http://adventurist.me/posts/0136"> seven </a> <a href="http://adventurist.me/posts/0137"> days </a> of <a href="http://adventurist.me/posts/0138"> writing </a> . </p> <p> <strong> Reading: </strong> Abaddon's' Gate, Reamde </p> https://adventurist.me/posts/0139Sun, 06 Nov 2016 00:00:00 +0000 CC0 Images With Unsplashhttps://adventurist.me/posts/0140<p> <a href="/images/unspalsh-nightsky.jpg"> <img src="/imagessmall/unspalsh-nightsky.jpg"/> </a> </p> <p> This has been a hard morning, the weather is extra foul and heading into a real winter, and I sense a cold coming on. On HN today there is the curated CC0 image site <a href="http://unsplash.com"> unsplash </a> , I have co-opted a giant night sky image from there for today's post. </p> <p> I have been thinking for a while that every post really should have an image, ideally I would take a load of great photos and add a sort of relevant one to each post as I go. In lieu of that happening I might integrate something like unsplash and one of their great collections. </p> <pre><code>https://unsplash.it/200/300/?random </code></pre> <p> They do have a service which provides random images with a url, <a href="http://devan.blaze.com.au/blog/2015/11/3/errors-dont-have-to-be-boring"> others </a> have used it to make 404 pages more interesting. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0140Mon, 07 Nov 2016 00:00:00 +0000 Collecting my own stock imageshttps://adventurist.me/posts/0141<p> <a href="http://adventurist.me/posts/0140"> Yesterday </a> I came across the awesome CC0 license stock image site <a href="https://unsplash.com"> unsplash </a> , both today and yesterday I have used other peoples images from that site. The images aren't of anything I have been writing about, but images make blog posts looks a ton better. </p> <p> I think I am going to continue to try and have an image on every blog post, even if it is just to give them some colour. There really is nothing stopping me from using my own pictures of awesome places. </p> <p> <a href="/images/icelandwaterfall.jpg"> <img src="/imagessmall/icelandwaterfall.jpg"/> </a> </p> <p> This awesome picture of the <a href="https://www.icelandtravel.is/about-iceland/destination-guide/south/detail/item350320/Skogarfoss"> Skogarfoss Waterfall </a> (which I got from unsplash) is really strange to me. I was in Iceland in August and I visited that exact waterfall and while I have used someone else's stock photo there is nothing stopping me from using my own picture of the exact same feature. </p> <p> I will attack my photo collection in the next few days and try to built up a bank of images to use. I think I want to have images sorted so I can match them against the tags on blog posts. My approach to tagging is very haphazard, I will probably make groups like: </p> <ul> <li> electronics </li> <li> coffee </li> <li> radios and antennas </li> <li> landscapes(rural) </li> <li> landscapes(urban) </li> <li> graffiti </li> <li> tool kits, workbenchs, desks </li> </ul> <p> I am going to have to start taking more photos. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0141Tue, 08 Nov 2016 00:00:00 +0000 Pirate Searching For Images On 500pxhttps://adventurist.me/posts/0142<p> <a href="http://argh.technology/pages-output/about/"> Ormiret </a> from the <a href="https://57north.org.uk"> hacker space </a> created a <a href="http://argh.technology/posts-output/2016-09-03-photography/"> tool </a> to encourage him to head out and take more photos. His random theme generator is built up from some photo theme lists. <a href="http://adventurist.me/posts/0141"> I have been wanting </a> to have a picture on every blog post, for that to be feasible I have to take many more photos. </p> <p> The theme tool is an awesome idea, I thought it would be more powerful if there were exemplar images alongside the theme. There are quite a few sites that have attracted a large number of photographers and make an excellent place to search for images matching a theme. </p> <p> I looked at both flickr and 500px, but neither of these sites have an API that allows unauthenticated access. I really don't want to create account on these sites just for a throwaway image search. I did spend some time looking at their APIs but neither looked like much fun. </p> <p> 500px has a public search page that doesn't require auth, by using Firefox to grab the request headers it was easy in an hour or so to put together a command line search tool. </p> <pre><code>#/usr/bin/env python import sys import urllib2 import pprint from StringIO import StringIO import gzip import json ################################################################################ # _ _ _ _ # # _ _ ___ _ __| |__ _ __ ___ | |_| |_ (_)___ # # | '_/ -_) '_ \ / _` / _/ -_) | _| ' \| (_-&lt; # # |_| \___| .__/_\__,_\__\___| \__|_||_|_/__/ # # |_| # ################################################################################ header = """ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:49.0) Gecko/20100101 Firefox/49.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br X-CSRF-Token: J2iawi/G7GJ3cqXgKVhYVlIQjNMWCXCdSPNscW/lyZb0xk1+Y3HWlPgCW6/kYQWY6tkfSWF2IWDtx8H8Q8A4Eg== Referer: https://500px.com/search?type=photos&amp;utm_campaign=google_search_box&amp;q=blue Origin: https://500px.com Cookie: _hpx1=BAh7CkkiD3Nlc3Npb25faWQGOgZFVEkiJTcwNWJhODM3OGE0ODIwZGRjMWMzNzBmZGY5NGU1ZTczBjsAVEkiCWhvc3QGOwBGIg41MDBweC5jb21JIhhzdXBlcl9zZWNyZXRfcGl4M2xzBjsARkZJIhBfY3NyZl90b2tlbgY7AEZJIjEwNjdYdkV5M092YVBjUDVQelRsZHpyakprNXAzZjFIOXBUU3RqU3dsOFlRPQY7AEZJIhFwcmV2aW91c191cmwGOwBGSSI%2BL3NlYXJjaD90eXBlPXBob3RvcyZ1dG1fY2FtcGFpZ249Z29vZ2xlX3NlYXJjaF9ib3gmcT1ibHVlBjsAVA%3D%3D--2a92d13e5bc840dd0de0d3d469d0cc3019e12fb3; optimizelyEndUserId=oeu1478624905590r0.6262684177302974; optimizelySegments=%7B%22569090246%22%3A%22false%22%2C%22569491641%22%3A%22campaign%22%2C%22575800731%22%3A%22ff%22%2C%22589900200%22%3A%22true%22%7D; optimizelyBuckets=%7B%227781310076%22%3A%227773970029%22%7D; _ga=GA1.2.166996737.1478624906; _gat=1; _gat_unifiedTracker=1; amplitude_id500px.com=eyJkZXZpY2VJZCI6IjJkYjljZTg3LTk5ZjktNDg4Yy1hNTFlLWNhN2M5ZGU3MGUwZFIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTQ3ODYyNDkzMTM1NSwibGFzdEV2ZW50VGltZSI6MTQ3ODYyNDkzMTM1NSwiZXZlbnRJZCI6MCwiaWRlbnRpZnlJZCI6MCwic2VxdWVuY2VOdW1iZXIiOjB9; optimizelyPendingLogEvents=%5B%22n%3Dhttps%253A%252F%252F500px.com%252Fsearch%253Ftype%253Dphotos%2526utm_campaign%253Dgoogle_search_box%2526q%253Dblue%26u%3Doeu1478624905590r0.6262684177302974%26wxhr%3Dtrue%26time%3D1478624986.482%26f%3D7763794202%2C7254840151%2C7769081978%2C7513516222%2C7781310076%26g%3D582890389%22%5D Connection: keep-alive Cache-Control: max-age=0 """ ################################################################################ host = "api.500px.com" path = "/v1/photos/search?type=photos&amp;term={}&amp;image_size%5B%5D=1&amp;image_size%5B%5D=2&amp;image_size%5B%5D=32&amp;image_size%5B%5D=31&amp;image_size%5B%5D=33&amp;image_size%5B%5D=34&amp;image_size%5B%5D=35&amp;image_size%5B%5D=36&amp;image_size%5B%5D=2048&amp;image_size%5B%5D=4&amp;image_size%5B%5D=14&amp;include_states=true&amp;formats=jpeg%2Clytro&amp;include_tags=true&amp;exclude_nude=true&amp;page=1&amp;rpp=50" themes_url="https://raw.githubusercontent.com/ormiret/photo-themes/master/themes.txt" def search500px(searchstring): query = urllib2.quote(searchstring) url = "https://" + host + path.format(query) opener = urllib2.build_opener() for line in header.split("\n"): if not line: continue s = line.split(":") opener.addheaders.append((s[0], s[1].strip())) response = opener.open(url) if response.info().get('Content-Encoding') == 'gzip': buf = StringIO(response.read()) f = gzip.GzipFile(fileobj=buf) data = f.read() data = json.loads(data) photos = data["photos"] print("{} photos in response".format(len(photos))) images = [] for photo in photos: image = photo["image_url"][-1] page_url = "https://500px.com/" + photo["url"] datafile.write("&lt;img src=\"{} \" href=\"{}\"&gt;&lt;/img&gt;" .format(image, page_url)) images.append({"image":image, "page_url":page_url}) return images if __name__ == "__main__": searchstring = "night time rail" if len(sys.argv) &gt; 1: print(sys.argv) searchstring = " ".join(sys.argv[1:]) print("Searching for: {}".format(searchstring)) filename = "{}.html".format(urllib2.quote(searchstring)) datafile = open(filename, "w") datafile.write(""" &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt; {} &lt;/h1&gt; """.format(searchstring)) images = search500px(searchstring) for image in images: datafile.write("&lt;img src=\"{} \" href=\"{}\"&gt;&lt;/img&gt;" .format(image["image"], image["page_url"])) datafile.write(""" &lt;/body&gt; &lt;/html&gt;""") print("writing out file: {}".format(filename)) datafile.close() </code></pre> <p> This scrip paired with the request headers exported from firefox allows you to search for a string on 500px and generates a page with the first set of results. Of course I had to pull out the search and send Ormiret a pull request to add this functionality to his theme generator. </p> https://adventurist.me/posts/0142Tue, 08 Nov 2016 00:00:00 +0000 Stupidhttps://adventurist.me/posts/0143<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Couldn't say it better if I tried. <a href="https://twitter.com/warrenellis"> @warrenellis </a> <a href="https://twitter.com/DarickR"> @DarickR </a> <a href="https://t.co/yswrRp9u4p"> pic.twitter.com/yswrRp9u4p </a> </p> — Mireille Abrihet (@MireilleAbrihet) <a href="https://twitter.com/MireilleAbrihet/status/796231176109236224"> November 9, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> The ticket sales for <a href="https://tickets.events.ccc.de/33c3/"> Congress </a> this year have been a ultra fast, it is has been entertaining to watch friends fight against server crashes and load while trying to get tickets. This year I was lucky enough to avoid that ordeal, but it has made me think about writing bots to buy tickets. I think I would be trying to do so if I was going through the public sale. </p> <p> I have previously watched a <a href="https://www.youtube.com/watch?v=sgz5dutPF8M"> defcon talk </a> about buying cars using a set of bots, I do wonder if there is a set of literature on doing this and dealing with mitigations. </p> <p> There is also <a href="https://www.youtube.com/watch?v=NtffxCi8aq4"> this talk </a> , it might be good. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0143Wed, 09 Nov 2016 00:00:00 +0000 Politicshttps://adventurist.me/posts/0144<p> <a href="/images/scottishfalls.jpg"> <img src="/imagessmall/scottishfalls.jpg"/> </a> </p> <p> Politically the last few years have been really hard for me, <a href="https://en.wikipedia.org/wiki/Scottish_independence_referendum,_2014"> 2014 </a> , <a href="https://en.wikipedia.org/wiki/United_Kingdom_general_election,_2015"> 2015 </a> , and <a href="https://en.wikipedia.org/wiki/United_Kingdom_general_election,_2015"> 2016 </a> saw votes go completely against my expectations. <a href="https://en.wikipedia.org/wiki/United_States_presidential_election,_2016"> This week </a> was also surprise. It is easy to think I hold fringe views, that I am all alone surrounded by fascists, but the numbers show that only about have the electorate disagree in each of these cases. </p> <p> The problem in almost all of these votes is not the right, but the inability of the left to draw people out. The fascists have it easy, they can hold a deplorable ideal, get rid of the immigrants and their supporters can galvanise around the idea. The left only seems to offer the status quo. </p> <p> There are two courses of action at a time like this. </p> <ol> <li> Get some supplies and a gun, go up a hill and disconnect from the world. (I can reccomend some hills) </li> <li> Get involved and try to advance the causes you really care about. </li> </ol> <p> Today, I really just want to climb a hill and start living in a cave. But that is the easy way out, instead I am going to start helping make the world a better place. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0144Thu, 10 Nov 2016 00:00:00 +0000 Making MacOS be Friendly with gdbhttps://adventurist.me/posts/0145<p> MacOS has lots of cool security features, by default the OS will only run signed code. Great security has trade offs, tonight I was hit my MacOS restricting permissions. <code> gdb </code> needs to be signed before it will be allowed to debug other program. It manifests like this: </p> <pre><code>$ gdb -q neat-streamer Reading symbols from neat-streamer...done. (gdb) r Starting program: /Users/jones/code/neat-streamer/neat-streamer Unable to find Mach task port for process-id 13334: (os/kern) protection failure (0x2). (please check gdb is codesigned - see taskgated(8)) </code></pre> <p> Learning <code> lldb </code> seems like far too much work, this needs fixed. Searching brings up <a href="http://stackoverflow.com/questions/11504377/gdb-fails-with-unable-to-find-mach-task-port-for-process-id-error"> stackoverflow </a> questions, with a pointer to <a href="https://sourceware.org/gdb/wiki/BuildingOnDarwin"> this guide </a> that explains the entire process. In general you need to create a code signing key, sign the gdb binary and then restart the enforcement service <code> taskgated </code> . </p> <p> The restart commands were <a href="http://serverfault.com/questions/194832/how-to-start-stop-restart-launchd-services-from-the-command-line"> a little </a> harder to track down. </p> <p> Restart <code> taskgated </code> : </p> <pre><code>sudo launchctl unload /System/Library/LaunchDaemons/com.apple.taskgated.plistv sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.taskgated.plistv </code></pre> <p> There are also <a href="http://serverfault.com/questions/194832/how-to-start-stop-restart-launchd-services-from-the-command-line"> start and stop </a> commands, but this didn't work for me. The troubleshooting on the guide was of no help. I even went as far as trying a reboot, but no luck. Maybe I will try figuring out <code> lldb </code> . </p> <p> If anyone has any idea hows to get this working, I would love some help. </p> https://adventurist.me/posts/0145Thu, 10 Nov 2016 00:00:00 +0000 iPhoto Messhttps://adventurist.me/posts/0146<p> <a href="http://adventurist.me/posts/0140"> As I </a> <a href="http://adventurist.me/posts/0141"> have said </a> already, I am trying to get control of my photo collection. I want to have an image on almost every blog post, but before I can do that I need to sort out the mess that is my collection. Currently I have raws and jpegs in a directory structure, an iPhoto library and some almost structure files. </p> <p> I want to have the directory layout: </p> <pre><code>year/month/day/[raw|jpeg] </code></pre> <p> For today it would be: </p> <pre><code>2016/11/11/raw 2016/11/11/jpeg </code></pre> <p> Before I can do that I need to extract images from iPhoto and collate everything together. Unfortunately iPhoto on my laptop does not want to start up at all and I suspect the App Store will want me to upgrade my OS too. I am a hacker so this isn't a problem. </p> <p> <a href="/images/iphotolaunch.png"> <img src="/images/iphotolaunch.png"/> </a> </p> <p> Some searching turned up <a href="https://github.com/BMorearty/exportiphoto"> exportiphoto </a> a python program that will extract images from your iPhoto library. Download, run: </p> <pre><code>python exportiphoto.py [options] "iPhoto-Library-dir" "destination-dir" </code></pre> <p> Running this script there was some crunching, some promising output and then it was done super fast, awesome! I <code> sshfs </code> ed out to the storage box and started looking around for my photos. Instead I found a bunch of empty directories, I must have done something wrong. </p> <p> Instead of poking at the script I thought I would have a look at the iPhoto app bundle. Apps on a back are made up of a bundle, the bundle is just a directory which the finder treats in a special way. Looking into the bundle I found a <code> Masters </code> directory. The <code> Masters </code> directory was 40GB of photos in a raw format, most of the pictures that will be in the library. </p> <p> The <code> Masters </code> directory has the photos stored in the correct directory structure, so I copied that out to use as the basis for my tidy. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0146Fri, 11 Nov 2016 00:00:00 +0000 Pictureshttps://adventurist.me/posts/0147<p> <a href="/images/blackflylake.jpg"> <img src="/imagessmall/blackflylake.jpg"/> </a> </p> <p> I had a look through some of the pictures I have from my Iceland trip in August, but it was really painful. My network drive seems to be struggling delivering large files over sshfs, it probably doesn't help that they are 25MB raws. </p> <p> I used <a href="http://www.darktable.org/"> darktable </a> to crop the image, everythin else I had on my machine chocked on the CR2 raw files. </p> <hr/> <p> <strong> Reading: </strong> Abaddon's Gate, Reamde </p> https://adventurist.me/posts/0147Sat, 12 Nov 2016 00:00:00 +0000 High motion quality webmhttps://adventurist.me/posts/0148<p> <code> ffmpeg </code> by default aims for the lowest bitrate it can manage for a video when encoding webm. I have been happy with this so far, but the video I grabbed of a waterfall today does not look good in this mode. I tried changing the bitrate options as discussed on the <a href="https://trac.ffmpeg.org/wiki/Encode/VP8"> ffmpeg wiki </a> , I thought I would show what you can expect with a couple of differnet rates. </p> <p> The original mov file generated from my camera was 21MB. </p> <p> <video autoplay="" controls="" loop="" src="/videos/fallsoffeugh-default.webm"> </video> </p> <pre><code>$ ffmpeg -i INPUT.mov -an output-default.webm </code></pre> <p> The original ultra low, 443kb/s that ffmpeg generates, file is 369KB. </p> <p> <video autoplay="" controls="" loop="" src="/videos/fallsoffeugh-1M.webm"> </video> </p> <pre><code>$ ffmpeg -i DSC_3536.MOV -an -c:v libvpx -b:v 1M output-1M.webm </code></pre> <p> Doubling the rate, file is 976KB. Still a lot of artifacts in the video. </p> <p> <video autoplay="" controls="" loop="" src="/videos/fallsoffeugh-10M.webm"> </video> </p> <pre><code>$ ffmpeg -i DSC_3536.MOV -an -c:v libvpx -b:v 10M output-10M.webm </code></pre> <p> This passed the <em> smell test </em> for me, I think it looks good enough for its size, this file is 5.6MB roughly the size of a jpeg of the same scene. </p> https://adventurist.me/posts/0148Sat, 12 Nov 2016 00:00:00 +0000 I hate softwarehttps://adventurist.me/posts/0149<p> <a href="/images/kirkjufellsfoss.jpg"> <img src="/imagessmall/kirkjufellsfoss.jpg"/> </a> </p> <p> I tried to use <a href="http://hugin.sourceforge.net/"> hugin </a> to stitch together a panorama I took of a glacier, but the binaries they offer will only run on the next version on MacOS. Really annoying. I will give it a try tomorrow on FreeBSD, if not I will have to try some of the gimp plugins. </p> <p> Facing a gimp plugin makes me <a href="http://xkcd.com/1742/"> think of this xkcd </a> . </p> <hr/> <p> <a href="http://adventurist.me/posts/0143"> It </a> <a href="http://adventurist.me/posts/0144"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0145"> makes </a> <a href="http://adventurist.me/posts/0146"> seven </a> <a href="http://adventurist.me/posts/0147"> days </a> of <a href="http://adventurist.me/posts/0148"> writing </a> . </p> <p> <strong> Reading: </strong> Abaddon's' Gate, Reamde </p> https://adventurist.me/posts/0149Sun, 13 Nov 2016 00:00:00 +0000 Panoramas with Huginhttps://adventurist.me/posts/0150<p> <a href="/images/huginpanorama.png"> <img src="/images/huginpanorama.png"/> </a> </p> <p> <a href="http://adventurist.me/posts/0149"> My Idea </a> to use the <a href="http://hugin.sourceforge.net/"> hugin stitching </a> software to make a panorama from some images I found on my camera seems to have hit a snag. I am convinced I didn't have a tripod with me and took the panorama in a haphazard fashion, I remember the area by the glacier being much much colder than the campsite we were staying in and I was pushed to leave. </p> <p> I opened up the 8 images I had to try and stitch together and while they sort of fall out in a reasonable orde I think it is going to take some time with the software to get them together. Unless I find the <a href="http://catb.org/esr/jargon/html/magic-story.html"> more magic button </a> . </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> https://adventurist.me/posts/0150Mon, 14 Nov 2016 00:00:00 +0000 Nihilismhttps://adventurist.me/posts/0151<p> <a href="/images/icelandcoast.jpg"> <img src="/imagessmall/icelandcoast.jpg"/> </a> </p> <p> Today I've got nothing. At my desk there are a load of started and unfinished projects, parts for other things, kits from <a href="https://boldport.club"> boldport club </a> to be made. Nothing that is interesting even in its started state, components to make cools things, coolness sold separately. </p> <p> At the <a href="https://57north.org.uk"> hackerspace </a> tonight I will try to finish my <a href="https://github.com/adventureloop/tilda-sattrack"> sat tracker </a> , but even that is a fallback project. The projects I want to have completed have such a high bar to entry. </p> <p> I wonder if my brain empties out in cycles. </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> https://adventurist.me/posts/0151Tue, 15 Nov 2016 00:00:00 +0000 Sat Tracking and Killer Robotshttps://adventurist.me/posts/0152<p> <video autoplay="" controls="" loop="" src="/videos/killerrobots.webm"> </video> </p> <p> Last night at the <a href="https://57north.org.uk"> hacker space </a> I finally got around to building hardware out for my emfcamp badge powered <a href="https://github.com/adventureloop/tilda-sattrack"> satellite tracker </a> . Most of the time was spent hot gluing together foam board to make a stand for the servos I integrated the control code with the TCP server and the whole thing is controllable from gpredict now. </p> <p> When testing servos, knifes are the recommended indicator devices. </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> https://adventurist.me/posts/0152Wed, 09 Nov 2016 00:00:00 +0000 A mountainhttps://adventurist.me/posts/0153<p> <a href="/images/icelandmountain.jpg"> <img src="/imagessmall/icelandmountain.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> https://adventurist.me/posts/0153Thu, 17 Nov 2016 00:00:00 +0000 Winter Temperatureshttps://adventurist.me/posts/0154<p> <a href="/images/aviemoresnow.jpg"> <img src="/imagessmall/aviemoresnow.jpg"/> </a> </p> <p> Winter is here, stepping out this morning it was -2, hopefully the start of some nice seasonal weather with a showering of snow and not the minimum temperature for the year. </p> <p> The twitters tell me that <a href="http://www.bunniestudios.com/"> Bunnie Huang </a> of <a href="https://www.nostarch.com/xboxfree"> Hacking the Xbox </a> , <a href="https://media.ccc.de/v/30C3_-_5294_-_en_-_saal_1_-_201312291400_-_the_exploration_and_exploitation_of_an_sd_memory_card_-_bunnie_-_xobs"> Breaking SD Cards </a> , <a href="https://www.bunniestudios.com/blog/?p=4585"> The Essential Guide to Electronics in Shenzhen </a> and a ton of other cool things has a <a href="https://www.nostarch.com/hardwarehacker"> new book in the works </a> . I read Hacking the Xbox when it was released for Free after Aaron Swartz's death, the book is an excellent read and gave me a ton of insights about electronics and breaking physical things. The new book is in early access, which means you can read it if you think reading tiny bits of a book is a good idea. </p> <p> While on the <a href="https://www.nostarch.com/"> nostarch </a> I looked at another early access book, <a href="https://www.nostarch.com/networkprotocols"> Attaching Network Protocols </a> . The cover, looking a <a href="https://en.wikipedia.org/wiki/Tardigrade"> Tardigrade </a> at a glance(it isn't), drew me in, the awesome title didn't hurt. </p> <p> Hopefully the internet will come alive and tell me when these two books are finished and available. </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> <p> Of course that snowy picture was taken up a mountain, but it was only about 4 degrees up there. Warmer than it seems it is going to get to today. </p> https://adventurist.me/posts/0154Fri, 18 Nov 2016 00:00:00 +0000 The Use of Bottinghttps://adventurist.me/posts/0155<p> <a href="/images/edgeofthefalls.jpg"> <img src="/imagessmall/edgeofthefalls.jpg"/> </a> </p> <p> <a href="http://sarah.thesharps.us/2016/11/17/impact-of-bots-on-github-communities/"> This article </a> on the use of bots on github made me think of a different use of the <a href="https://developer.github.com/v3/"> github api </a> . </p> <p> The first pieces of python code I pushed to github on my own account were in my <a href="https://github.com/adventureloop/tiny-artnet"> tiny-artnet </a> mircopython artnet implementation. Soon after committing that code I started getting emails from recruiters looking to hire python developers. They would say something along the lines 'based on your github activity we think you would be perfect for a job doing django". </p> <p> At first these were hilarious, micropython is nothing like python, if they had looked at my github profile they would have seen the large C projects I work on. </p> <p> But after a few of these I started to get annoyed, clearly these people were finding my email from code I had written or from commit logs. Why weren't they trying a little bit harder? To me, github is the technical recruiters wet dream, but whoever was generating the leads here clearly wasn't doing a good job. </p> <p> I don't think cold lead generation is a good way to sell anything, let alone a job opportunity, but this is how I would use github(bitbucket, gitlab and everything else too) to do it. </p> <ol> <li> Search projects that have the correct language keywords (python, go, c) </li> <li> Find any email addresses at all, sort by most recent </li> <li> Attempt to resolve email addresses into real people </li> <li> a) Find personal site for email address or b) (worse) find social media pages for address </li> <li> Send generated lead info to recruiter </li> </ol> <p> The human at the end needs to be able to do a final set of filters, but anywhere that is too high a cost isn't going to use the lead well anyway. I am sure the 100 line script that could be written on those lines that would generate substantially better leads than cold contacting any email address. </p> <hr/> <p> <strong> Reading: </strong> Reamde </p> https://adventurist.me/posts/0155Sat, 19 Nov 2016 00:00:00 +0000 Colder Warhttps://adventurist.me/posts/0156<p> <a href="/images/aberdeenlighthouse.jpg"> <img src="/imagessmall/aberdeenlighthouse.jpg"/> </a> </p> <p> It is cold and I am hiding inside, today clearly things <a href="http://adventurist.me/posts/0154"> yesterday </a> was far too warm. Morning temperature was -5, which is nothing compared to the arctic, but cold for somewhere people live. If I set up temperature sensors I could make some plots, but that seems like a lot of hassle. </p> <hr/> <p> <a href="http://adventurist.me/posts/0149"> It </a> <a href="http://adventurist.me/posts/0150"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0151"> makes </a> <a href="http://adventurist.me/posts/0152"> seven </a> <a href="http://adventurist.me/posts/0153"> days </a> of <a href="http://adventurist.me/posts/0154"> writing </a> . </p> <p> <strong> Reading: </strong> Cibola Burn </p> https://adventurist.me/posts/0156Sun, 20 Nov 2016 00:00:00 +0000 Glacial Progresshttps://adventurist.me/posts/0157<p> <a href="/images/glacialflow.jpg"> <img src="/imagessmall/glacialflow.jpg"/> </a> </p> <p> Again it is cold, the previous few years there really hasn't been any substantial 'winter'. This year is different. </p> <p> I did some work on the <a href="http://adventurist.me/posts/0103/"> wireless driver </a> yesterday, but it was entirely refactoring. I do think I am in a point to start crashing things. I am very happy with this sort of progress, even if it isn't really interesting. The small steps are required for the big steps to work. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn </p> https://adventurist.me/posts/0157Mon, 21 Nov 2016 00:00:00 +0000 Kill Gameshttps://adventurist.me/posts/0158<p> <a href="/images/blackflylakemountain.jpg"> <img src="/imagessmall/blackflylakemountain.jpg"/> </a> </p> <p> This Killscreen article, <a href="https://killscreen.com/articles/people-trying-save-programming/"> The people trying to save programming </a> , which I found via <a href="https://lobste.rs"> lobste.rs </a> really caught my attention. The article is about some people that are trying to fix the way games are made, they think that software is development is too impersonal and long for the good old days of the Apple 2. Commercial Game engines are the problem. </p> <p> The article is worth a read. Digging into the <a href="https://handmade.network/"> community around handmade hero </a> is interesting too, but I don't really think either of the developers mentioned are starting a movement. To me it feels like the appeal to the desire everyone has to understand everything, actioning that by inventing the universe. </p> <p> That is fine and all, but far too many new people get stuck in the trap of trying to build a world before they can walk(I did). The best tools for a beginner are the ones that let them succeed as quickly as possible. The hard nitty gritty details can be learnt later on. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn </p> https://adventurist.me/posts/0158Tue, 22 Nov 2016 00:00:00 +0000 The Myth of Something Easyhttps://adventurist.me/posts/0159<p> <a href="/images/icelandlakemountain.jpg"> <img src="/imagessmall/icelandlakemountain.jpg"/> </a> </p> <p> <a href="https://www.youtube.com/watch?v=SOfOlOQIcqw"> The Myth of Something Easy </a> was a good talk, you should watch it. I would have just embedded it and left it at that today, but I had already picked out a picture. </p> <p> The panorama came from my Android phone (nexus something), if you zoom in, the cuts between frames are really jarring. It will be interesting to see how I get on with <a href="http://hugin.sourceforge.net/"> hugin </a> , the images I have to stitch are much large (and maybe higher quality) than anything my crappy phone can do. Some of the shots are out of focus, the stitching will be really interesting to do, whenever I get around to it. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0159Wed, 23 Nov 2016 00:00:00 +0000 Reading Interface Speedhttps://adventurist.me/posts/0160<p> <a href="/images/glacierfield.jpg"> <img src="/imagessmall/glacierfield.jpg"/> </a> </p> <p> <strong> Q </strong> : <a href="http://serverfault.com/questions/207474/how-do-i-verify-the-speed-of-my-nic"> How do I get the interface speed? </a> </p> <p> <strong> A </strong> : On Linux: </p> <pre><code>$ ethtool eth0 Speed: 1000Mb/s </code></pre> <p> Not what I want at all, </p> <p> <strong> Q </strong> <a href="http://stackoverflow.com/questions/596590/how-can-i-get-the-current-network-interface-throughput-statistics-on-linux-unix"> How do I get interface throughput </a> </p> <p> <strong> A </strong> <code> iftop </code> does what top does for network interfaces: </p> <pre><code>$ iftop interface: em0 IP address is: 192.168.204.4 MAC address is: ffffffec:ffffffb1:ffffffd7:34:ffffffa3:ffffffa1 pcap_open_live(em0): em0: You don't have permission to capture on that device ((cannot open device) /dev/bpf: Permission denied) </code></pre> <p> Annoying </p> <pre><code>$ sudo iftop ...cool ncurses display... </code></pre> <p> <strong> A </strong> Besides iftop and iptraf, also check: <code> bwm-ng </code> </p> <pre><code>$ bwm-ng ...cool ncurses display... </code></pre> <p> Not scriptable </p> <pre><code>$ bwm-ng --output csv 1479982871;em0;0.00;0.00;0.00;0;0;0.00;0.00;0.00;0;0;0.00;0.00;0;0 1479982871;lo0;0.00;0.00;0.00;0;0;0.00;0.00;0.00;0;0;0.00;0.00;0;0 1479982871;total;0.00;0.00;0.00;0;0;0.00;0.00;0.00;0;0;0.00;0.00;0;0 </code></pre> <p> <strong> Q </strong> How do those commands gather their data? </p> <p> <strong> A </strong> It is different everywhere </p> <p> Getting a look a network rates is really easy on FreeBSD, the systat tool in <a href="https://www.freebsd.org/cgi/man.cgi?query=ifstat&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+6.3-RELEASE+and+Ports&amp;format=html"> ifstat </a> ships with the base system. But if you want to do this programmatically there isn't a lot of information out there, I had to read source code to figure out how to do it. </p> <p> The initial <code> iftop </code> error message indicates they are doing a capture of all the traffic on all interfaces and working this stuff out on their own. That requires root and I really don't want the hassle of doing it, surely the OS is capturing these stats from the network stack? </p> <p> On Linux, these stats are exposed via <code> /proc </code> : </p> <pre><code>/sys/class/net/eth0/statistics/rx_bytes /sys/class/net/eth0/statistics/tx_bytes </code></pre> <p> There may actually be other interfaces for Linux, but I don't think it is worth digging any further. </p> <p> On FreeBSD you can do what systat does and use a <a href="https://github.com/freebsd/freebsd/blob/master/usr.bin/systat/ifstat.c#L462"> sysctl call </a> to populate a struct. The bwm-ng man page has a heap of methods for finding these numbers on different platforms, for the BSD's and MacOS it suggests the <a href="https://www.freebsd.org/cgi/man.cgi?getifaddrs"> getifaddrs </a> interface. </p> <p> For portable code not written in C I will probably set up a thread running <code> bwm-ng </code> outputting csv data. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0160Thu, 24 Nov 2016 00:00:00 +0000 Lightning Talkshttps://adventurist.me/posts/0161<p> <a href="/images/glacierfront.jpg"> <img src="/imagessmall/glacierfront.jpg"/> </a> </p> <p> It seems I am submitting a lightning talk to CCC. Lightning talks a short 5 minute presentations. The format is really popular for adding a load of content to a conference, giving many more people a chance to talk. </p> <p> I have watched the congress and camp lightning talk sessions before, but I can't really remember any jumping out at me. Searching today for 'best lightning talks eva' didn't have useful results. Well, <a href="https://www.destroyallsoftware.com/talks/wat"> wat </a> came up, <a href="https://www.destroyallsoftware.com/talks/wat"> wat </a> is an excellent talk. </p> <p> I guess I will watch some lightning talks from <a href="https://www.youtube.com/watch?v=zMp2jAHquns"> previous congresses </a> and see what they were like. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0161Fri, 25 Nov 2016 00:00:00 +0000 Sunsethttps://adventurist.me/posts/0162<p> <a href="/images/sunsetship.jpg"> <img src="/imagessmall/sunsetship.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0162Sat, 26 Nov 2016 00:00:00 +0000 Just a picturehttps://adventurist.me/posts/0163<p> <a href="/images/mountainroad.jpg"> <img src="/imagessmall/mountainroad.jpg"/> </a> </p> <p> I wrote up a script yesterday to grab the most recent file from the super awesome <a href="https://flashair-developers.com/en/documents/api/"> toshiba flashair wifi sd card </a> . I had suggested the card to someone in the hackerspace, he planned on using it to help align a <a href="http://www.swann.com/uk/swvid-obc140"> camera trap </a> (not that model, but you get the idea). </p> <p> Once you put the trap up a tree, it is a real hassle to figure out if it is really pointing the way you want it to. So use the wifi sd card to grab the latest image and confirm it is. </p> <p> After writing the script I tried for a while to get my laptop connected, but it seems that the camera trap doesn't keep the card powered on for nearly long enough. I might be able to get it to work if I can get my laptop to over <a href="https://xkcd.com/416/"> overzealous </a> in connecting to the wifi. </p> <script src="https://gist.github.com/adventureloop/9e08bd466450fface79032e0f5c48016.js"> </script> <hr/> <p> <a href="http://adventurist.me/posts/0157"> It </a> <a href="http://adventurist.me/posts/0158"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0159"> makes </a> <a href="http://adventurist.me/posts/0160"> seven </a> <a href="http://adventurist.me/posts/0161"> days </a> of <a href="http://adventurist.me/posts/0162"> writing </a> . </p> <p> <strong> Reading: </strong> Cibola Burn, Excession <strong> Location: </strong> 57.155,-2.210 </p> <p> Apparently there isn't a simple API to turn a lat/lon into the weather. I have no idea why web services all seem to insist on having an API key for all requests. It is just annoying. </p> https://adventurist.me/posts/0163Sun, 27 Nov 2016 00:00:00 +0000 Live Network Tracing in Pythonhttps://adventurist.me/posts/0164<p> <a href="/images/moremountains.jpg"> <img src="/imagessmall/moremountains.jpg"/> </a> </p> <p> <a href="https://www.cs.auckland.ac.nz/~nevil/python-libtrace/"> python-libtrace </a> comes highly recommended over <a href="http://www.secdev.org/projects/scapy/"> scapy </a> . Scapy always feels a bit alien to me, I think the custom repl front end aimed at 'security people' (whatever that means). I am sure it is there to make things simple, but for me it just makes it harder to write programs with. </p> <p> <code> python-libtrace </code> certainly isn't easy to install, all of the documentation is left to the libtrace project. Once I figured out the magic words I was able to throw together a dscp mark classifier really quickly. For live capture on your system you will probably have to change the <code> bpf:em0 </code> to something like <code> pcapint:eth0 </code> . </p> <pre><code>import plt import time trace = plt.trace('bpf:em0') trace.start() INTERVAL = 1 dscp = {} start = time.time() try: for pkt in trace: ip = pkt.ip if not ip: continue dscpvalue = ip.traffic_class &gt;&gt; 2 if dscpvalue in dscp: dscp[dscpvalue] = dscp[dscpvalue] + 1 else: dscp[dscpvalue] = 1 done = time.time() if done - start &gt; INTERVAL: print("marks:".format(len(dscp)), end="") for mark,count in dscp.items(): print(" {}:{},".format(mark, count), end="") print("") dscp = {} start = done except KeyboardInterrupt: trace.close() sys.exit() </code></pre> <p> This can be tested with netcat quite easily, though the options seem to be different everywhere. </p> <pre><code>nc -u -T ef [host] [post] </code></pre> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0164Mon, 28 Nov 2016 00:00:00 +0000 task today https://adventurist.me/posts/0165<p> I use <a href="https://taskwarrior.org"> taskwarrior </a> to manage tasks, well sort of. Every so often I fill it with highish level tasks and leave it completely forgotten for a few weeks. On a similar frequency(though out of phase) I look through my task list and prune out the things I have done. This isn't great, I have had a lot of trouble refining down tasks, figuring out what to do, then doing it. </p> <p> Last night I thought I would try to start generating a set of tasks to do <strong> TOMORROW </strong> , then when I got to work the next today I could ask task warrior what it I was to do that day. Taskwarrior makes that sort of easy with virtual tags, the virtual tags can only be generated by due dates. </p> <pre><code>$ task add due:tomorrow proj:life get milk Created task 1 </code></pre> <p> Will generate a task, due tomorrow today, but come tomorrow it will be tagged with today. Makes sense right?. We can then easily search for all tasks matching the <code> TODAY </code> tag: </p> <pre><code>$ task +TODAY list ID Age P Project Due Description Urg 1 1m L life 2016-11-30 get milk 1 1 task </code></pre> <p> The taskwarriors output looks awesome on the command line, but it doesn't come out my thermal printer very well. Taskwarrior will output json with the <code> export </code> flag, json isn't very fun on the command line. Thankfully there is the <a href="https://stedolan.github.io/jq/"> jq </a> tool. <code> jq </code> claims to be like sed for json, explains it's near inscrutability. </p> <p> With these bits we can generate a snappy list of things we have to do today: </p> <pre><code>figlet -f small TODAY:;cat tmp.json| jq -r '''.[] | .project,.description,""''' </code></pre> <p> Something like: </p> <pre><code> _____ ___ ___ ___ ___ |_ _/ _ \| \ /_\ \ / (_) | || (_) | |) / _ \ V / _ |_| \___/|___/_/ \_\_| (_) schemes.crime.bank Order drawings of bank schemes.crime.bank Enroll on plasma cutting course schemes.crime.botnet Establish control channel for bots on freenode schemes.crime.botnet Register spam address life get milk life put bins out </code></pre> <p> Which is really easy to spit out to my thermal printer: </p> <p> <a href="/images/printeroutput.jpg"> <img src="/imagessmall/printeroutput.jpg"/> </a> </p> <p> I wonder if there is some way to get xscreensaver to run a script when I log in? I could use that hook to tidy away undone tasks and do the print out on my first log in of the day. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession </p> https://adventurist.me/posts/0165Tue, 29 Nov 2016 00:00:00 +0000 The DC3https://adventurist.me/posts/0166<p> <a href="https://en.wikipedia.org/wiki/List_of_accidents_and_incidents_involving_the_DC-3_in_1973#November"> This plane </a> sit in a <a href="https://en.wikipedia.org/wiki/Outwash_plain"> glacial outwash plain </a> in the South of Iceland. The area around it is barren and devoid of life. We arrived in a fog bank, there was nothing to see in any direction save from the well worn path out to the wreckage. </p> <p> Walking out was like being in a dream, we could see through the haze the bright clothing of other visitors to the plane. </p> <p> <a href="/images/crashedplane.jpg"> <img src="/imagessmall/crashedplane.jpg"/> </a> </p> <p> The fog lifted for our return journey, the landscape didn't improve. The area is almost completely flat, with small undulating banks of aggregate. The entire place looked life the surface of mars renderer in black. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession <strong> Location: </strong> 57.168, -2.1055 </p> https://adventurist.me/posts/0166Wed, 30 Nov 2016 00:00:00 +0000 Another Amazing Waterfallhttps://adventurist.me/posts/0167<p> <a href="/images/morewaterfalls.jpg"> <img src="/imagessmall/morewaterfalls.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Excession <strong> Location: </strong> 57.168, -2.1055 </p> https://adventurist.me/posts/0167Thu, 01 Dec 2016 00:00:00 +0000 Excuseshttps://adventurist.me/posts/0168<p> <a href="/images/smallerwaterfall.jpg"> <img src="/imagessmall/smallerwaterfall.jpg"/> </a> </p> <p> I have felt terrible all week and haven't had energy to really do anything. Having an image to post everyday turned out to be an excellent idea. I do need to go through the archives to top up the reserve of images at some point. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn </p> https://adventurist.me/posts/0168Fri, 02 Dec 2016 00:00:00 +0000 Getting the Weatherhttps://adventurist.me/posts/0169<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/ds38znWfqF"> pic.twitter.com/ds38znWfqF </a> </p> — Warren Ellis (@warrenellis) <a href="https://twitter.com/warrenellis/status/804174635042488320"> December 1, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> My good friend Warren Ellis (well complete stranger, but I read his newsletter so that is pretty the same thing) tweets pictures of where he is with the weather info overlaid. I am sure he is using some sort of newfangled social media filter to provide the info. I want something similar for the footnotes on my fairly post, but social media stuff is no good for me, I need an API to use. </p> <p> Now, as hard as I try I cannot find a weather service that will just spit some data at me. I really want to do <code> curl weathersite.internet | jq... </code> and end up with a nice summary for a location. The web is closing up and locking down, which means an API key is required. </p> <p> After putting this off for a while, this morning I remembered I have previously registered for a weather service. A steaming cup of coffee later and I found the <a href="https://github.com/ZeevG/python-forecast.io"> python bindings </a> to the excellent <a href="https://darksky.net/dev/"> forecast.io </a> already installed. </p> <pre><code>import forecastio api_key = "yer_key_here_bampot" lat = 57.168 lng = -2.1055 forecast = forecastio.load_forecast(api_key, lat, lng) weather = forecast.daily().data[0] temperatureMax = int(weather.apparentTemperatureMax) temperatureMin = int(weather.apparentTemperatureMin) summary = weather.summary print("{}°C {}".format(temperatureMax, summary)) </code></pre> <p> Gives a nice </p> <pre><code>4°C Partly cloudy throughout the day. </code></pre> <p> There isn't anything to this, If I could find an API that didn't require a key I probably wouldn't even use python. But madness makes more madness, so here we are. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Virtual Light </p> <p> <strong> Location: </strong> 57.168, -2.1055 </p> <p> <strong> Weather: </strong> 4°C Partly cloudy throughout the day. </p> <p> Warren Ellis's <a href="https://morning.computer"> morning.computer </a> was the main driver for me to start blogging everyday. I like to think I am being influenced by someone super productive, rather than blantently copying him. </p> https://adventurist.me/posts/0169Sat, 03 Dec 2016 00:00:00 +0000 Building a dashhttps://adventurist.me/posts/0170<p> <a href="/images/flowingwater.jpg"> <img src="/imagessmall/flowingwater.jpg"/> </a> </p> <p> I think the weather stuff I played with <a href="http://adventurist.me/posts/0169"> yesterday </a> is going to be an input to a quantified self dashboard I have been toying with building for a long time. </p> <p> I have wanted to put together a dash for years, but I have always struggled to find technologies that I want to work with. For a <a href="https://github.com/uoaerg/nst-demo"> demo at work </a> I have had to put together a simple dash, all it does is show interface throughput for two interfaces, but it has give a chance to play with the front end UI and backend webserving components that I want to use. </p> <p> I am lurking in a coffee shop now, which is a great time to have a first whack at the idea. </p> <hr/> <p> <a href="http://adventurist.me/posts/0164"> It </a> <a href="http://adventurist.me/posts/0165"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0166"> makes </a> <a href="http://adventurist.me/posts/0167"> seven </a> <a href="http://adventurist.me/posts/0168"> days </a> of <a href="http://adventurist.me/posts/0169"> writing </a> . </p> <p> <strong> Reading: </strong> Cibola Burn, Virtual Light </p> <p> <strong> Location: </strong> 57.1446, -2.1060 </p> <p> <strong> Weather: </strong> 6˚C Clear. </p> https://adventurist.me/posts/0170Sun, 04 Dec 2016 00:00:00 +0000 Street Arthttps://adventurist.me/posts/0171<p> <a href="/images/glitchgraphetti.jpg"> <img src="/imagessmall/glitchgraphetti.jpg"/> </a> </p> <p> Union Terrace Gardens has some excellent pieces that were put up as part of a <a href="http://www.rgu.ac.uk/news/gray-s-graduate-leads-aberdeen-s-first-street-art-festival/"> street art festival </a> . Adding culture to the city is great, but there is something about 'santioned creativity' that really annoys me. I know the residents around here would be up in arms if someone did a giant mural overnight. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Virtual Light </p> <p> <strong> Location: </strong> 57.1578,-2.2143 </p> <p> <strong> Weather: </strong> 2°C Partly cloudy starting in the evening. </p> https://adventurist.me/posts/0171Mon, 05 Dec 2016 00:00:00 +0000 Blogs about blogginghttps://adventurist.me/posts/0172<p> <a href="/images/crashedplane2.jpg"> <img src="/imagessmall/crashedplane2.jpg"/> </a> </p> <p> I am still playing with other fields to stick onto the daily post. So far I have been sticking on a reading field that can sort of track how I am progressing with books. I want to include a fuzzy location and the state of the weather around me, obviously I know where I am looking back it will be interesting to me having a record of where I was when I posted. </p> <p> I have tried with <strong> outside </strong> , <strong> reality </strong> , <strong> being </strong> and a load of other vague terms, writing this out those all look ridiculous. Now I have tried just letting the info hang there instead, my current lat/long converted to a place name with a link to a map, followed by the weather. </p> <hr/> <p> <strong> Reading: </strong> Cibola Burn, Virtual Light </p> https://adventurist.me/posts/0172Tue, 06 Dec 2016 00:00:00 +0000 Hacktoberfest Pay offhttps://adventurist.me/posts/0173<p> <a href="/images/hacktoberfest.jpg"> <img src="/imagessmall/hacktoberfest.jpg"/> </a> </p> <p> I looked up reverse geocoding with openstreetmap and found a keyless api. Reverse geocoding is the process of turning a location as a latitude and longitude into a place name. This is handy for creating my daily post footer, I want to have a script that will take in a lat/lng pair and output the full location name and weather with a map link. </p> <p> I can use the kindly provided nominatim reverse geocoding URI and a bit of python. I guess openstreetmap thinks I am in a weird parallel UK that is made up of states, that is easy to deal with thankfully. </p> <pre><code>base_url = "http://nominatim.openstreetmap.org/reverse?format=json&amp;lat={}&amp;lon={}&amp;zoom=18&amp;addressdetails=1" uri = base_url.format(lat, lng) fp = urllib.request.urlopen(uri) response = fp.read() location = json.loads(response.decode("utf8")) fp.close() city = location['address']['city'] country = location['address']['country'] if country == "UK" or country == "US": country = location['address']['state'] return {'country':country, 'city':city} </code></pre> <p> I end up with a single script for generating the location/weather block. The script will default my 'work' location or it will try and format a lat/lng out of any arguments passed in. </p> <pre><code>#!/usr/bin/env python3.5 import forecastio import pprint import urllib.request import json import sys api_key = "yer_key_here_bawbag" lat = 57.168 lng = -2.1055 def forwardweather(lat, lng): forecast = forecastio.load_forecast(api_key, lat, lng) weather = forecast.daily().data[0] temperatureMax = int(weather.apparentTemperatureMax) temperatureMin = int(weather.apparentTemperatureMin) summary = weather.summary return {'temperature':temperatureMax, 'summary':summary} def reversegeocode(lat, lng): base_url = "http://nominatim.openstreetmap.org/reverse?format=json&amp;lat={}&amp;lon={}&amp;zoom=18&amp;addressdetails=1" uri = base_url.format(lat, lng) fp = urllib.request.urlopen(uri) response = fp.read() location = json.loads(response.decode("utf8")) fp.close() city = location['address']['city'] country = location['address']['country'] if country == "UK" or country == "US": country = location['address']['state'] return {'country':country, 'city':city} if __name__ == "__main__": if len(sys.argv) == 2: loc = sys.argv[1].split(',') if len(loc) != 2: exit() lat = float(loc[0]) lng = float(loc[1]) if len(sys.argv) == 3: lat = float(sys.argv[1]) lng = float(sys.argv[2]) print("Getting weather for: {}, {}\n\n".format(lat, lng)) weather = forwardweather(lat, lng) location = reversegeocode(lat, lng) base_url = "http://www.openstreetmap.org/search?query={}%2C%20{}" uri = base_url.format(lat, lng) print("[{}, {}][0]: {}°C, {}".format(location['city'], location['country'], weather['temperature'], weather['summary'])) print("\n[0]: {}".format(uri)) </code></pre> <hr/> <p> <strong> Reading: </strong> Virtual Light </p> https://adventurist.me/posts/0173Wed, 07 Dec 2016 00:00:00 +0000 Congress Planshttps://adventurist.me/posts/0174<p> <a href="/images/rustyrail.jpg"> <img src="/imagessmall/rustyrail.jpg"/> </a> </p> <p> <a href="https://twitter.com/c3daysleft"> The most important twitter account </a> counts down the remaining days to congress. Today there are just 19 days left until a hole opens in the universe and excellent people appear to keep the base going. </p> <p> Ignoring the large amount of realwork™ I have to do, there is a lot of important stuff to be prepared for congress. I have tried to avoid committing to doing anything on my holiday, but I plan to bring the following three ideas: </p> <ul> <li> RGB Pixel Display <ul> <li> I have a 8x8 neopixel display with a small case. I am planning to make it controllable via UDP packets and leave it on the open network for other people to find and play with. </li> </ul> </li> <li> <a href="https://en.wikipedia.org/wiki/Slow_television"> Slow TV </a> <ul> <li> Multicast video feed showing relaxing slow paced video. I have a lot of driving from my trip to Iceland. I will include some other feeds I have picked up in the last few month. We might include a radio station a long side, but that bit hasn't been figured out yet. </li> </ul> </li> <li> Some sort of display showing: <ul> <li> <a href="http://www.rainbowstream.org/"> rainbowstream </a> </li> <li> cool stuff pulled of the open wifi, images, password wall of sheep style. </li> </ul> </li> </ul> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Only 19 days left until <a href="https://twitter.com/hashtag/33C3?src=hash"> #33C3 </a> </p> — Waiting for 33C3 (@c3daysleft) <a href="https://twitter.com/c3daysleft/status/806791571949531136"> December 8, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Virtual Light </p> https://adventurist.me/posts/0174Thu, 08 Dec 2016 00:00:00 +0000 UDP Panelhttps://adventurist.me/posts/0175<p> <video autoplay="" controls="" loop="" src="/videos/udppanel.webm"> </video> </p> <p> Congress is coming, 18 days to go! </p> <p> The whole point of <a href="http://adventurist.me/posts/0174"> sharing my plans yesterday </a> was to make sure I actually do them. Easiest on the list is to set up the UDP controlled blinkenlights panel. I am going to attach this to my bag or something, there must be cool blinkenlights everywhere I go. </p> <p> The panel is a 8x8 Addressable RGB pixel array made from the super popular WS2812. Control is a NodeMCU board running micropython, the NodeMCU board is a ESP8266 broken out in a sensible way, it means I can get this cool little project on the network. </p> <p> I have some pieces of clear acrylic and foam sandwiched together to diffuse the light, all held everything together with some bolts. Here is the small test script I have put together so far: </p> <pre><code>import machine import neopixel import time pin = machine.Pin(14, machine.Pin.OUT) np = neopixel.NeoPixel(pin, 64) skull = [ 0,0,1,1,1,1,1,0, 0,1,1,1,1,1,1,1, 1,0,0,1,0,0,1,1, 1,0,0,1,0,0,1,1, 0,1,1,0,1,1,1,0, 0,0,0,1,1,1,0,0, 0,0,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,] while True: colour = uos.urandom(3) for x in range(len(skull)): if skull[x]: np[x] = colour np.write() time.sleep(1) </code></pre> <p> I am going to accept any 8x8 RGB frame (any 192 byte packet) that is sent and take any other shorter packet and use it to set the colour on the skull. I will include a timeout to change the colour so it isn't just a static panel. </p> <p> If I find a load of spare time between the sofa cushions I will throw together a web interface. </p> <hr/> <p> <strong> Reading: </strong> Virtual Light </p> https://adventurist.me/posts/0175Fri, 09 Dec 2016 00:00:00 +0000 Ubuntu 16.10 on the HP Stream 7https://adventurist.me/posts/0176<p> Yesterday I finally got sick of windows 10 and installed Ubuntu 16.10 on the HP Stream 7. There are load of instructions out there to install earlier versions, but nothing up to date. </p> <p> Intel created a world of pain when it introduced 32bit UEFI for 64bit machines, the Stream 7 is one of many Baytrail devices that have this ridiculous boot firmware configuration. Linux distros have completely ignore this boot combination and 3 years after these devices started appearing haven't started to ship the bootia32.efi files on the install media. </p> <p> <a href="/images/ubuntutablet.jpg"> <img src="/imagessmall/ubuntutablet.jpg"/> </a> </p> <p> Thankfully there are people spinning builds with the correct media and a whole load of drivers to help support silly little Intel convertible tablet things. I used <a href="http://linuxiumcomau.blogspot.com/2016/10/running-ubuntu-on-intel-bay-trail-and.html"> Linuxium's Ubuntu 16.10 </a> build. I flashed it to a USB stick and used my awesome little <a href="http://adventurist.me/posts/0124"> otg usb hub </a> to connect the install media. I did have to disable secure boot in the bios to get the media to boot. </p> <p> I needed a separate keyboard for the install, but the touch screen and WiFi worked out of the box. The hardware support is okay, there is no screen brightness control out of the box and suspend is missing. I spent a while setting up the on screen keyboard <a href="https://launchpad.net/onboard"> onboard </a> , it looks like I am going to have to create my own layout to get a split keyboard. </p> <p> The install was painless, much much easier than the Baytrail device I tried to use ubuntu on in 2014. It does still baffle me that distros don't have boot support for these devices on the installers. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0176Sat, 10 Dec 2016 00:00:00 +0000 You are in controlhttps://adventurist.me/posts/0177<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/ltRfxVCVQ1"> pic.twitter.com/ltRfxVCVQ1 </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/807970714175373316"> December 11, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <a href="http://adventurist.me/posts/0171"> It </a> <a href="http://adventurist.me/posts/0172"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0173"> makes </a> <a href="http://adventurist.me/posts/0174"> seven </a> <a href="http://adventurist.me/posts/0175"> days </a> of <a href="http://adventurist.me/posts/0176"> writing </a> . </p> <p> <strong> Reading: </strong> Nemesis Games, Idoru </p> https://adventurist.me/posts/0177Sun, 11 Dec 2016 00:00:00 +0000 FOSDEM 2017https://adventurist.me/posts/0178<p> <a href="/images/hugewaterfall.jpg"> <img src="/imagessmall/hugewaterfall.jpg"/> </a> </p> <p> It seems I will speaking at <a href="https://fosdem.org"> FOSDEM </a> next year in the bsd devroom. I will be presenting " <a href="https://fosdem.org/2017/schedule/event/transport_evolution_bsd/"> Transport Evolution on top of the BSD's </a> ", whatever that means :D. I also have another talk in a similar vein submitted to the Real Time Communications devroom, it looks like my first FOSDEM will be a busy one. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, Idoru </p> https://adventurist.me/posts/0178Mon, 12 Dec 2016 00:00:00 +0000 It is getting closerhttps://adventurist.me/posts/0179<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> It's getting closer.... \0/ <a href="https://twitter.com/hashtag/33c3?src=hash"> #33c3 </a> <a href="https://t.co/NcnmFf2mwM"> pic.twitter.com/NcnmFf2mwM </a> </p> — Edwin van Andel (@Yafsec) <a href="https://twitter.com/Yafsec/status/808604528123801600"> December 13, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Okay, just 14 days to congress how is your preparation going? </p> <p> I have <a href="http://adventurist.me/posts/0174"> three projects coming </a> with me: </p> <ul> <li> RGB Pixel Display <ul> <li> <a href="http://adventurist.me/posts/0175"> I have the panel built </a> and some initial code running. I still want to connect the panel to the network and do some other cool effects, this has a good start. </li> </ul> </li> <li> Slow TV <ul> <li> <a href="http://foxk.it/"> hibby </a> and I spent a couple of hours playing with VLC and python on Sunday. <a href="https://github.com/adventureloop/slowtv"> We have a script </a> that can send out a multicast video stream which we can pick up in vlc. We need to get separate audio working and video playlists going before we can say this is ready. </li> </ul> </li> <li> Some sort of display showing: <ul> <li> I am going to set up a pi today, it will boot into <a href="https://github.com/DTVD/rainbowstream"> rainbowstream </a> running with image on terminal. I will connect that to the cheap pico projector I have and then I will call it 'done'. </li> </ul> </li> </ul> <hr/> <p> <strong> Reading: </strong> Nemesis Games, Idoru </p> https://adventurist.me/posts/0179Tue, 13 Dec 2016 00:00:00 +0000 33C3 Lightning talkhttps://adventurist.me/posts/0180<p> <a href="/images/marshallcollegechristmas.jpg"> <img src="/imagessmall/marshallcollegechristmas.jpg"/> </a> </p> <p> I got the confirmation email today, I will be presenting a lightning talk about internet transport at congress. There are about one hundred billion lightning talks at each congress spread over three days, the bar for entry is much lower than a real track talk. I am happy to be included with the likes of the hacker yoga guy from camp. The lightning talk reveals the secret fourth planned item for my trip to hamburg. </p> <p> <a href="http://adventurist.me/posts/0178"> With my </a> <a href="https://fosdem.org"> FOSDEM talks </a> and congress I have been preparing 'external' facing presentations a lot this month. I am now sure that there isn't any fixed length of talk that really works. 55 minutes is a lot of time to speak for, writing a coherent story that will come across in that amount of time is hard. </p> <p> And yet, a 5 minute lightning talk slow is a horrible thing! There isn't much time to speak, which means there is almost no time at all to get your problems out and your solutions in order. </p> <p> I am quite sure the lightning talks are live streamed, they are certainly recorded. I will post a link to the timeslot once I know when it is, the live stream just before it happens and the video once it is posted. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, Idoru </p> https://adventurist.me/posts/0180Wed, 14 Dec 2016 00:00:00 +0000 Wellington Suspension Bridgehttps://adventurist.me/posts/0181<p> <a href="/images/wellingtonsuspensionbridge.jpg"> <img src="/imagessmall/wellingtonsuspensionbridge.jpg"/> </a> </p> <p> Unable to remember the name of the <a href="http://www.mcjazz.f2s.com/WellingtonBridge.htm"> Wellington Suspension Bridge </a> I came across this awesome website that documents the <a href="http://www.mcjazz.f2s.com/"> 'Doric Columns' </a> . The site is full of history about Aberdeen and the local area, including old photographs, paintings and etching of the local infrastructure. <a href="http://www.mcjazz.f2s.com/Balgownie.htm"> This Etching </a> of the Brig o' Balgownie gives a real impression of the extent of the land reclaimed from the Sea in Aberdeen. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrow's Parties </p> https://adventurist.me/posts/0181Thu, 15 Dec 2016 00:00:00 +0000 Puffinshttps://adventurist.me/posts/0182<p> <a href="/images/pairofpuffins.jpg"> <img src="/imagessmall/pairofpuffins.jpg"/> </a> </p> <p> Today was a very slow start, staying in bed for an extra hour really didn't help me out at all today. Normally the end of the year is quite calm, all of the deadlines seem to have concentrated themselves at the start of next year. Time to work on interesting, but not pressing problems probably won't exist next year, as much as possible has to happen in the next week. </p> <p> That does make preparation for congress very interesting. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrow's Parties </p> https://adventurist.me/posts/0182Fri, 16 Dec 2016 00:00:00 +0000 Attacking Wifi with Wiresharkhttps://adventurist.me/posts/0183<p> For a <a href="http://adventurist.me/tag/hacking"> thing </a> , I want to dump the wlan traffic between an Android app and a wifi camera. It isn't hard to grab network traffic from Android, if you have a rooted device you can just run <code> tcpdump </code> . <code> tcpdump </code> on Android is annoying, you have to manage the pcap files and it isn't clear what you are capturing. </p> <p> Thankfully, <code> wireshark </code> can be fed <a href="https://wiki.wireshark.org/HowToDecrypt802.11"> WPA and WEP keys </a> , making snooping as a third party an absolute breeze. The key options are in the protocol preferences for <strong> IEEE 802.11 </strong> , they look something like this: </p> <pre><code>wep:a1:b2:c3:d4:e5 wpa-pwd:MyPassword:MySSID wpa-psk:0102030405060708091011...6061626364 </code></pre> <p> <a href="/images/wiresharkwlankeys.png"> <img src="/images/wiresharkwlankeys.png"/> </a> </p> <p> The protocol preferences dialog doesn't seem to do any validation of the keys, instead I had to restart <code> wireshark </code> to get the super unhelpful error message. </p> <p> <a href="/images/wiresharkwlanerror.png"> <img src="/images/wiresharkwlanerror.png"/> </a> </p> <p> The <code> wireshark </code> guide mentions the wireless toolbar, but this wasn't available on my platform and I didn't need it. With just the key, WEP traffic can be decrypted. WPA traffic requires that you capture an EAPOL handshake first. The easiest way to do that is observe the device keying, for testing I just had my phone join the network. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrows Parties </p> https://adventurist.me/posts/0183Sat, 17 Dec 2016 00:00:00 +0000 Weekend offhttps://adventurist.me/posts/0184<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/zaXVqEBQtQ"> https://t.co/zaXVqEBQtQ </a> <a href="https://t.co/sKRhJoBvUU"> pic.twitter.com/sKRhJoBvUU </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/810520016756023296"> December 18, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> This weekend has to be considered a weekend off. I played with a wifi camera yesterday, but I only made a dent in the project. Today was a final(ish) run at Christmas shopping, in all I did almost nothing all weekend. It feels great. </p> <p> Next week will be a hectic run to get work done, and projects ready for congress. </p> <hr/> <p> <a href="http://adventurist.me/posts/0178"> It </a> <a href="http://adventurist.me/posts/0179"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0180"> makes </a> <a href="http://adventurist.me/posts/0181"> seven </a> <a href="http://adventurist.me/posts/0182"> days </a> of <a href="http://adventurist.me/posts/0183"> writing </a> . </p> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrows Parties </p> https://adventurist.me/posts/0184Sun, 18 Dec 2016 00:00:00 +0000 UDP Panel ✓ https://adventurist.me/posts/0185<p> Okay, one CCC project done. <a href="http://adventurist.me/posts/0175"> The panel now accepts data via UDP </a> , if you send enough it will reset the whole panel, to something. It doesn't do what I want, but what it does right now is much much cooler than what I planned to do. </p> <p> If I get time during congress I will do something more I guess. Here is all of the code so you can make your own and play a long at home. </p> <pre><code>import machine, neopixel, time, socket LEDCOUNT = 64 skull = [ 0,0,1,1,1,1,1,0, 0,1,1,1,1,1,1,1, 1,0,0,1,0,0,1,1, 1,0,0,1,0,0,1,1, 0,1,1,0,1,1,1,0, 0,0,0,1,1,1,0,0, 0,0,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,] def chunks(l, n): n = max(1, n) return [l[i:i + n] for i in range(0, len(l), n)] if __name__ == "__main__": addr = "0.0.0.0" port = 6969 pin = machine.Pin(14, machine.Pin.OUT) np = neopixel.NeoPixel(pin, LEDCOUNT) print("receiving from {} {}".format(addr, port)) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) sock.settimeout(1.0) sock.bind((addr,port)) while True: try: pkt,addr = sock.recvfrom(1024) #blocks print("addr {}".format(addr)) except OSError: pkt = b"" colours = chunks(pkt, 3) if len(pkt) == 3*LEDCOUNT: for x in range(LEDCOUNT): np[x] = colour else: colour = (0,0,0) if not len(colours) % 3: colour = uos.urandom(3) else: colour = colours[0] for x in range(len(skull)): if skull[x]: np[x] = colour np.write() time.sleep(0.16) </code></pre> <p> SlowTV is going slowly(lol), the project is all set up. I need to figure out how to get the pi to output at the teeny resolution it supports. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrows Parties </p> https://adventurist.me/posts/0185Mon, 19 Dec 2016 00:00:00 +0000 Last Day!https://adventurist.me/posts/0186<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/dkxJFVMZLR"> pic.twitter.com/dkxJFVMZLR </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/811217108981940224"> December 20, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> I played with the wifi camera last night, but I couldn't get my phone to connect to it when my laptop was in monitor mode. That was perplexing enough to hold up anything I was trying to do. I might try again tonight with something that isn't a mac, verifying I can intercept phone traffic is step 1 in this project. </p> <p> This is my last day in the 'office' this year, apparently I am too late to wish folk a good new year as I am the only person in today. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, All Tomorrows Parties </p> https://adventurist.me/posts/0186Tue, 20 Dec 2016 00:00:00 +0000 What? Internet is Evolvinghttps://adventurist.me/posts/0187<p> Checking the FOSDEM instance of the terrible pentabarf submission system I see that my second talk proposal to a devroom has been accepted. I think, they haven't timetabled the room yet so I can't link to a timetable slot for the talk. </p> <p> I have three talks coming up: </p> <ol> <li> 33C3 Lightning Talk </li> <li> FOSDEM BSD devroom talk </li> <li> FOSDEM Real Time Communications devroom Talk </li> </ol> <p> All three of these talks are going to tell the same story, laid out in different ways: The Internet is Broken, Fixes are hard to deploy, Developers won't use new protocols, We have a solution. </p> <p> The changes that are happening in the internet right now are really interesting, but it is really hard to get over the knowledge curve required for the solutions to make sense. It is really common to hear, "The Internet works fine, why are you trying to fix it", from people that really should know better. </p> <p> If you want to find out the what and why that is internet transport evolution you should find one of these talks and watch it. Hopefully they will all be recorded and online after the events. </p> <p> If you want to know more you can email or track me down in IRC. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0187Wed, 21 Dec 2016 00:00:00 +0000 RSS Feed Readerhttps://adventurist.me/posts/0188<p> For a long while I have wanted a bot to sit in irc channels spitting out updates on rss feeds. I Think I have finally found all the pieces I need to write a bot in the way I like. </p> <p> I have written up a really simple IRC client on top of asyncio, but it needs much more testing than a day of dev. I want to have ssl running before I try and run the bot against anything. </p> <p> The RSS code is much simplier: </p> <pre><code>import aiohttp import asyncio import async_timeout import feedparser import pprint INTERVAL = 60 async def fetch(session, url): with async_timeout.timeout(10): async with session.get(url) as response: return await response.text() async def fetchfeeds(loop, feedurls, ircsock): last_entry = None feeds = [] for url in feedurls: feeds.append({'url':url, 'last':""}) while True: for feed in feeds: async with aiohttp.ClientSession(loop=loop) as session: html = await fetch(session, feed['url']) rss = feedparser.parse(html) if feed['last']: if feed['last']['title'] != rss['entries'][0]['title'] and feed['last']['link'] != rss['entries'][0]['link']: print("new entry") feed['last'] = rss['entries'][0] print("MSG {}".format(feed['last']['title'])) print("MSG {}".format(feed['last']['link'])) else: feed['last'] = rss['entries'][0] await asyncio.sleep(INTERVAL) loop = asyncio.get_event_loop() loop.run_until_complete(fetchfeeds(loop, ['https://n-o-d-e.net/rss/rss.xml', "http://localhost:8000/rss.xml"], None)) </code></pre> <p> This is really only a proof of concept, there needs to be much more error handling before I would expect this to run for long. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0188Thu, 22 Dec 2016 00:00:00 +0000 Feed Testinghttps://adventurist.me/posts/0189<p> <a href="/images/puffin.jpg"> <img src="/imagessmall/puffin.jpg"/> </a> </p> <p> For development of the RSS IRC bot I need an RSS feed that updates frequently, I could subscribe to a HN feed or something from reddit. I did a quick search for something high speed and found a SO thread][1] with exactly what I need. </p> <p> <a href="http://lorem-rss.herokuapp.com/"> The linked heroku app </a> can provide a feed updating at any interval you want. Turns out this is great for soak testing code over night. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0189Thu, 22 Dec 2016 00:00:00 +0000 Bags packed, Leavinghttps://adventurist.me/posts/0190<p> <a href="/images/packetbagkeyboard.jpg"> <img src="/imagessmall/packetbagkeyboard.jpg"/> </a> </p> <p> Weather is getting cold, the storms have been beating the house. </p> <p> Time to leave for somewhere, well somewhere not warmer, just different. Packing for congress was made much harder by ridiculous shipping regulations, an extra couple of bottles in my bag are worth it for the fun of a buckfast party night. </p> <p> The pico projector was one of the first victims in the packing war, having spent more time with this projector I don't think it is going to be a big loss. I still have the udp panel and the slowtv project, with the lightning talk I probably have enough details to worry about at congress.. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0190Sat, 24 Dec 2016 00:00:00 +0000 Outboundhttps://adventurist.me/posts/0191<p> <a href="/images/airplaneinthesnow.jpg"> <img src="/imagessmall/airplaneinthesnow.jpg"/> </a> </p> <p> I think the guy that brought my breakfast told me off for the table I was using. He said something, thankfully my amazing Shure SE215 isolating earphones blocked all of the sound out. I have a reason to be ignorant. I am sitting in a bar place, but I bought food so I could sit at a sensible height and type. </p> <p> I figure the main purpose of airport seating is to stop you complaining and to keep you awake. The lack of somewhere to sit your laptop and type like a normal human is infuriating. </p> <p> This coffee isn't even good. </p> <p> <strong> ABZ-&gt;LHR-&gt;HAM </strong> </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games, Or Nothing </p> <p> And by nothing I mean I don't think I will get any more reading done this year. </p> https://adventurist.me/posts/0191Mon, 26 Dec 2016 00:00:00 +0000 Day 0https://adventurist.me/posts/0192<p> <a href="/images/thanksforyourdata.jpg"> <img src="/imagessmall/thanksforyourdata.jpg"/> </a> </p> <p> It starts! </p> <p> Flight worked out well, the delay I had setting off from Aberdeen shortened my transfer, but it didn't hold anything up. I made it into the congress center around half three and was too early to get a ticket. </p> <p> Rest of the day went into setting up blinkenlights and other important projects. Tomorrow I will explore the place and see what is going on. </p> https://adventurist.me/posts/0192Mon, 26 Dec 2016 00:00:00 +0000 Day 1https://adventurist.me/posts/0193<p> <a href="/images/congresscalendar.jpg"> <img src="/imagessmall/congresscalendar.jpg"/> </a> </p> <p> The first day and their are some excellent sessions lined up. All of the talks are recorded, I normally catch up with the talks that catch my interest after the event. </p> <p> At congress it is best to hit the self organised sessions, they aren't recorded and are almost always excellent. Because they are excellent they are really hard to attend, loads of other people show up. The good sessions are standing room only with the corridor completely full too. </p> <pre><code>- [Are_decentralized_services_unable_to_innovate][1] - [Mechanical_Keyboard_Meetup Tryout][2] - [We Fix the Net][3] </code></pre> <p> In the past I lined up a busy schedule for the congress and ended up not going to any of the sessions. This year I am going to try and drop in and out of events, the sessions above are more of an intent that a plan. </p> <p> The We Fix the Net session is really interesting, instead of a single event they have an afternoon of panels lined up. They are more focused on security aspects than transport, it should be a highlight of the event. </p> <hr/> <p> <strong> Reading: </strong> The Fahrplan, if anything </p> https://adventurist.me/posts/0193Tue, 27 Dec 2016 00:00:00 +0000 33c3 Day 2https://adventurist.me/posts/0194<p> <a href="/images/scopevisualiser.jpg"> <img src="/imagessmall/scopevisualiser.jpg"/> </a> </p> <p> Day 1 became Day 2 with the industry standard partying all night transition. This morning was a very slow start, with my lightning talk somewhere in there, talk came out okay I think. </p> <p> Keeping track of time in here is really difficult, the leds sort of merge everything together, windows would ruin the atmosphere so that isn't available as a measure of time. We know that day lights hurts hackers brains. </p> <p> So far things have been a flop on the project front. The congress network doesn't support multicast on the wireless, the wired segment is fine, but it has caused us to run out of steam. Multicast traffic on the wifi has to be sent at the lowest rate connected clients support, this burns a lot of airtime leaving multicast blocked on wifi access points. </p> <p> The UDP panel hasn't been set up yet, the projector didn't make the trip across. </p> <hr/> <p> <strong> Reading: </strong> Fahrplan </p> https://adventurist.me/posts/0194Wed, 28 Dec 2016 00:00:00 +0000 33c3 Day 3https://adventurist.me/posts/0195<p> <a href="/images/floresenttubes.jpg"> <img src="/imagessmall/floresenttubes.jpg"/> </a> </p> <p> <a href="http://hackaday.com/tag/33c3/"> Hackaday are covering 33c3 </a> , mostly talks so far, but there may also be articles about the all the amazing projects that fill up the CCH. There are so many awesome internet controlled projects around here that it is probably impossible to see all of them. The contents of the rooms in the hack center is changing all the time as well. </p> <p> I think today I am going to see how many network blinkenlights projects I can find and make a little catalog. A <strong> metablinkenlights </strong> controller would be awesome to build out. </p> <hr/> <p> <strong> Reading: </strong> Fahrplan </p> https://adventurist.me/posts/0195Thu, 29 Dec 2016 00:00:00 +0000 Rumble Mesh networkinghttps://adventurist.me/posts/0196<p> <a href="/images/ftpserver.jpg"> <img src="/imagessmall/ftpserver.jpg"/> </a> </p> <p> Congress is a great place to try out apps or networking things that require a lot of people involved. All over the building there are posters up with apps, network services, political action, calls for poets, puzzles, manifestos. Following up on these ideas could fill your time at congress. </p> <p> <a href="/images/rumbleposter.jpg"> <img src="/imagessmall/rumbleposter.jpg"/> </a> </p> <p> One poster than caught my eye was a call to use a decentralised mesh networked micro blogging service. The post links to an app called <a href="http://www.disruptedsystems.org/"> Rumble </a> that is available with Android and iOS. There are enough people willing to try things out at congress that a meshed messaging app could be great fun to use. </p> <p> Unfortunately it seems the app can't handle the network conditions at congress. The meshing can work over wifi or via bluetooth. I suspect the mesh over the wifi uses something like <a href="https://en.wikipedia.org/wiki/Multicast_DNS"> mdns </a> for neighbour discovery. We found when we tried the SlowTV that multicast is blocked on the wifi for performance reasons. </p> <p> The bluetooth option for the app seems unable to find any neighbours in the hackcenter either. It might be that the rf conditions are making this nearly impossible. </p> <p> I will keep trying to play with the app after the event, but it would have been awesome if it had been usable at congress. </p> https://adventurist.me/posts/0196Thu, 29 Dec 2016 00:00:00 +0000 Network Blinkenlightshttps://adventurist.me/posts/0197<p> <a href="https://en.wikipedia.org/wiki/Blinkenlights"> Blinkenlights </a> are really big in hacker culture, the hackcenter where <a href="https://scottishconsulate.org"> our table </a> is located is completely full of led strips, installations, projectors and a ton of other things that glow, flash or blink. </p> <pre><code>ATTENTION This room is fullfilled mit special electronische equippment. Fingergrabbing and pressing the cnoeppkes from the computers is allowed for die experts only! So all the “lefthanders” stay away and do not disturben the brainstorming von here working intelligencies. Otherwise you will be out thrown and kicked anderswhere! Also: please keep still and only watchen astaunished the blinkenlights. </code></pre> <p> The obvious think to do with blinkenlights is to get them onto the network, <a href="http://adventurist.me/posts/0185"> my udp panel </a> continues this glorious tradition. There are loads of awesome blinkenligths on the network: </p> <p> <a href="/images/milliwayssign.jpg"> <img src="/imagessmall/milliwayssign.jpg"/> </a> </p> <p> The <a href="https://milliways.info/"> Milliways </a> sign is made from addressable led strips mounted on a frame. There is an awesome <a href="http://www.heroicrobotics.com/products/pixelpusher"> ethernet connected controller board </a> that drives all of the leds. </p> <p> <a href="/images/flipdot33c3logo.jpg"> <img src="/imagessmall/flipdot33c3logo.jpg"/> </a> </p> <p> There is a group of hackers sat in front of the flipdot sign day and night playing with it. The flipdots are small electromechanical modules that can be either white or black, the modules take a fraction of a second to swith and make an awesome sound as they do. </p> <p> The flipdot sign is <a href="http://139.162.217.211/"> controllable from a (probably tempory) website </a> . </p> https://adventurist.me/posts/0197Thu, 29 Dec 2016 00:00:00 +0000 33c3 Day 4https://adventurist.me/posts/0198<p> <a href="/images/alltoasterswelcome.jpg"> <img src="/imagessmall/alltoasterswelcome.jpg"/> </a> </p> <p> Day 4 is the sad day, at a certain time this evening a switch will flip, everyone will stop what they are doing and start packing up. Right away the hackcenter will go from being another world back to a boring hall. </p> <hr/> <p> <strong> Reading: </strong> Fahrplan </p> https://adventurist.me/posts/0198Fri, 30 Dec 2016 00:00:00 +0000 Books I read in 2016https://adventurist.me/posts/0199<p> Presented with out comment are the books I read in 2016, ordered with the most recently read first: </p> <pre><code>* All Tomorrow's Parties * Idoru * Virtual Light * Excession * Cibola Burn * Reamde * Abandon's Gate * Seveneves * ELEKTROGRAD * Ashes of Victory * Little Brother * Transmetropolitan Book Vol 3 * Transmetropolitan Book Vol 2 * Transmetropolitan Book Vol 1 * Transmetropolitan Book Vol 10 * Transmetropolitan Book Vol 9 * Transmetropolitan Book Vol 8 * Transmetropolitan Book Vol 7 * Transmetropolitan Book Vol 6 * Transmetropolitan Book Vol 5 * Transmetropolitan Book Vol 4 * The Cuckoos Egg * Networks of New York * Hydrogen Sonata * Surface Detail * Matter * Look to Windward * Inversions * Use of Weapons * The Player of Games * Consider Phlebaa * The Man in the High Castle * Overtime * Eqoid * Down on the Farm * Neuromancer * The Soul of a New Machine * The Wise Man's Fear * Name of the Wind * Zero History * Spook Country * The Atrocity Archives * The Fuller Memorandum * The Jennifer Morgue * The Apocalypse Codex * The Annihilation Score * The Rhesus Chart * The Long Dark Tea Time of the Soul * Dirk Gently's Holistic Detective Agency * Titus Groan * Next Stop Execution * Mona Lisa Overdrive * Pattern Recognition * Gormenghast * Cunning Plans * Tubes </code></pre> https://adventurist.me/posts/0199Fri, 30 Dec 2016 00:00:00 +0000 Stranded in Hamburghttps://adventurist.me/posts/0200<p> An abundance of particles in the air forced BA to cancel my flights home. They knocked my flight back 24 hours without any choice in the timing of my new flight. This means I get to spend an extra night in Hamburg and I get to move all of my new year plans to somewhere in the future. </p> <p> Congress is done for another year, it has been any amazing event. There really is nothing like it on the planet, attempts at describing the event and conveying that different world always seem to fail. </p> <p> <a href="/images/cchcongressexit.jpg"> <img src="/imagessmall/cchcongressexit.jpg"/> </a> </p> <p> The Chaos Communication Congress really is a place that must be seen, with the CCH being knocked down next year the event you go to will certainly be materially different that the one I have attended for the past three years. </p> <p> I cannot wait to see how the deal with loosing the CCH and where CCC ends up in the future. </p> <hr/> <p> <strong> Reading: </strong> PO-14 User Manual </p> https://adventurist.me/posts/0200Sat, 31 Dec 2016 00:00:00 +0000 Inboundhttps://adventurist.me/posts/0201<p> <a href="/images/heathrowplanes.jpg"> <img src="/imagessmall/heathrowplanes.jpg"/> </a> </p> <p> I was hoping to write the first blog post of this year from the airport, but time conspired against me. With BA moving my flight 24 hours I had to decided between having a quiet New Year and a fun one. </p> <p> I certainly did not go to 'There is No Party' which was not held somewhere in HH. The music was excellent, the crew that did the lighting and audio did amazing work. It makes me wonder what could happen here if there was space where people could play. </p> <p> From the party I headed back to the apartment, packed and set off for the airport. I turned a long day with a weird sense of time into an adventure across Hamburg at New Year and through the Airport. </p> <p> By the time I made Heathrow I was on about 4 hours sleep in a 36 hour window, I opted to nap instead of writing.. </p> <hr/> <p> <a href="http://adventurist.me/posts/0195"> It </a> <a href="http://adventurist.me/posts/0196"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0197"> makes </a> <a href="http://adventurist.me/posts/0198"> seven </a> <a href="http://adventurist.me/posts/0199"> days </a> of <a href="http://adventurist.me/posts/0200"> writing </a> . </p> <p> <strong> Reading: </strong> Nemesis Games </p> <p> <strong> HAM-&gt;LHR-&gt;ABZ </strong> </p> https://adventurist.me/posts/0201Sun, 01 Jan 2017 00:00:00 +0000 MacOS Malwarehttps://adventurist.me/posts/0202<p> <a href="/images/virtualbeach.jpg"> <img src="/imagessmall/virtualbeach.jpg"/> </a> </p> <p> 14 hours of sleep, I feel like I have woken up in another dimension. </p> <p> There is a ton of congress stuff floating around twitter, <a href="https://gist.github.com/jd7h/810cb22b2ae8044845a2a08b310e6104"> Here </a> is a list of talks ranked from the number of tweets and retweets mentioning them. If you are only going to watch a couple of sessions from 33c3 that list is probably great. </p> <p> I <a href="https://objective-see.com/blog/blog_0x16.html"> caught an awesome article </a> classifying the MacOS malware found in 2016. I am glad there is so little malware aimed at this platform. </p> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0202Mon, 02 Jan 2017 00:00:00 +0000 A little more Chaoshttps://adventurist.me/posts/0203<p> Chaos is an important part of CCC, most of the best things that happen are pranks that only a small number of people experience. The Fnord News Show has a large audience German speaking audience, I am pretty sure this awesome 'event' is unknown outside of the German crowd. </p> <iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/g5t17V_ujls?rel=0?start=2959" width="560"> </iframe> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0203Tue, 03 Jan 2017 00:00:00 +0000 33c3 Talkshttps://adventurist.me/posts/0204<p> God damn it! I won't be downloading all the 33c3 talks this year to watch offline, instead I will stream them from the excellent <a href="https://media.ccc.de"> media.ccc.de </a> . No good reason, I am only doing this because when making a list to feed to wget I did: </p> <pre><code>$ cat 33c3list.txt| grep -v deu | wc -l &gt; tmp.txt $ mv tmp.txt 33c3list.txt </code></pre> <p> I didn't really have the disc spare to store 100GB or so of talks anyway. I will stream the videos in my browser instead. I don't really have set approach to watching the CCC talks. I normally work through the list watching things that other have said were good, or talks whose title catches my eye. </p> <iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8064-the_transhumanist_paradox/oembed" width="1024"> </iframe> <hr/> <p> <strong> Reading: </strong> Nemesis Games </p> https://adventurist.me/posts/0204Wed, 04 Jan 2017 00:00:00 +0000 33c3 Hardware Hackinghttps://adventurist.me/posts/0205<p> <a href="https://www.bunniestudios.com/"> bunnie </a> has a long history of doing really cool things in hardware hacking, his book <a href="http://bunniefoo.com/nostarch/HackingTheXbox_Free.pdf"> Hacking the Xbox </a> is a great read (he has another <a href="https://www.nostarch.com/hardwarehacker"> book in the works too </a> ). bunnie and <a href="http://xoblo.gs"> xobs </a> presented a complete tear down and reverse engineering of <a href="https://media.ccc.de/v/30C3_-_5294_-_en_-_saal_1_-_201312291400_-_the_exploration_and_exploitation_of_an_sd_memory_card_-_bunnie_-_xobs"> sd cards </a> at 30c3, at 33c3 they were back talking about their education project <a href="https://chibitronics.com/"> chibitronics </a> . </p> <p> bunnie's talk is about the project it self, technical design and motivations, if the front matter of the talk turn you off believe me when I say it is worth powering through and watching the whole thing. </p> <iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-7975-making_technology_inclusive_through_papercraft_and_sound/oembed" width="1024"> </iframe> <p> xob's presents an excellent session of bit banging out usb from a low power Cortex-M0+ microcontroller. This talk is a great introduction into the low level details of the usb protocol. </p> <iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8031-no_usb_no_problem/oembed" width="1024"> </iframe> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0205Thu, 05 Jan 2017 00:00:00 +0000 33c3 Spaaaaaaaaaaace!https://adventurist.me/posts/0206<p> The CCC put together an excellent track of talks about Science and Space technology. I chewed through a lot of them yesterday, they set a really great tone and are aimed really well at their audience. </p> <p> I have been thinking recently about organising events locally that have much more technical content than the current things that happen. Up here there isn't the density of expertise required to run a monthly or even quarterly event without running out of fresh speakers very quickly. </p> <iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8406-the_moon_and_european_space_exploration/oembed" width="1024"> </iframe> <p> <a href="http://techmeetup.co.uk/"> Techmeetup </a> <a href="http://techmeetup.co.uk/aberdeen.html"> Aberdeen </a> really struggles to bring speakers in, very have many times falling back to a set of 'known good' speakers from the <a href="https://57north.org.uk"> local hackerspace </a> . </p> <p> Sessions by experts in a field with technical content, aimed at Non Cyber Muggles from other fields (similar pitching as the space track talks) could work very well. I will have to play with this idea and see if people from other fields are interesting in taking part. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0206Fri, 06 Jan 2017 00:00:00 +0000 Hot Adventurehttps://adventurist.me/posts/0207<p> What do you do when you find a USB stick on the ground? </p> <p> Clearly you take it to work, plug it into a computer with network admin privileges to make sure there is nothing funny about it. </p> <p> <a href="/images/hotadventure.jpg"> <img src="/imagessmall/hotadventure.jpg"/> </a> </p> <p> I guess something could go wrong, I saw a documentary once where criminals dropped a load of USB sticks on the ground which an unsuspecting prison guard used in a computer. They probably put some malware on that USB stick and all, not cool. </p> <p> Anyway, at congress I saw this sign, sans stick. I hope there was both something horrible on it and something that made it worth the hassle. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0207Sat, 07 Jan 2017 00:00:00 +0000 Loch Brandyhttps://adventurist.me/posts/0208<p> Went up a hill today. </p> <p> It was a change from sitting inside, the view was really nice. On the way up I was thinking about photography and finding the right equipment. It is pretty clear my J1 with a 10mm pancake lens isn't ideal for landscape photography, but I am not really sure how to get a set of gear to make the photos I want to take possible. </p> <p> <a href="/images/corrielochbrandy.jpg"> <img src="/imagessmall/corrielochbrandy.jpg"/> </a> </p> <p> Sitting down with books and reviews are the obvious way to figure this out, but maybe there is a more 'fun' solution. Here's an idea for free: </p> <ul> <li> We take in the camera equipment you already have. </li> <li> You go through flickr, 500px or something else and tag photos you wish you had taken. </li> <li> We parse out the lens/camera used </li> <li> We recommend the gear to help take the photos you want </li> </ul> <p> Skill will have to be provided by the user. </p> <hr/> <p> <a href="http://adventurist.me/posts/0202"> It </a> <a href="http://adventurist.me/posts/0203"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0204"> makes </a> <a href="http://adventurist.me/posts/0205"> seven </a> <a href="http://adventurist.me/posts/0206"> days </a> of <a href="http://adventurist.me/posts/0207"> writing </a> . </p> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0208Sun, 08 Jan 2017 00:00:00 +0000 State of Interner Censorshiphttps://adventurist.me/posts/0209<iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8068-state_of_internet_censorship_2016/oembed" width="1024"> </iframe> <p> One of the speakers asks the audience early on 'Do you think Internet Censorship should be allowed?' and gets about half the crowd showing hands. I really cannot understand that sort of response, clearly there are things we don't want people to see, but I can't support a blanket censorship system to block that content. </p> <p> If there was a way to block really dangerous material, without risking blocking completely reasonable material I am sure that is what we would be implementing. </p> <p> The <a href="https://wills.co.tt/33c3-censorship/#/"> slides for the presentation are here </a> , there are some <a href="http://netseminar.stanford.edu/seminars/04_28_16.pdf"> other slides here </a> . </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> <p> <a href="http://hwcdn.libsyn.com/p/b/a/8/ba872c06c902ed47/spkmdl49.mp3?c_id=13745713&amp;destination_id=81923&amp;expiration=1483957212&amp;hwt=9505a75ee8878b3697c23e625c6c5f00"> This podcast </a> it is quite nice. </p> https://adventurist.me/posts/0209Mon, 09 Jan 2017 00:00:00 +0000 JTAG on USB3https://adventurist.me/posts/0210<iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8069-tapping_into_the_core/oembed" width="1024"> </iframe> <p> Physical access is pretty much always game over, apart from the iPhone there are not many devices that can stand up to attack. Intel seem to want to make physical access even easier and are now offering JTAG access on USB. </p> <p> JTAG is a hardware debugging protocol normally seen on embedded systems or accessed through a special adapter on the motherboard. You can use JTAG to pause a processor, step through the instructions being executed and read into memory. With JTAG access you have full access to the machine. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0210Tue, 10 Jan 2017 00:00:00 +0000 c720 Trackpad set uphttps://adventurist.me/posts/0211<p> I reinstalled or upgraded my c720 or something and things are a bit all over the place. Tonight I started firefox in the <a href="https://57north.org.uk"> hackerspace </a> and noticed my trackpad wasn't working, it needs to be explicitly setup. This is mentioned on the comprehensive <a href="https://blog.grem.de/pages/c720.html"> FreeBSD c720 guide </a> , but there have been <a href="https://lists.freebsd.org/pipermail/svn-src-stable-11/2016-December/001379.html"> some updates </a> to the driver that aren't reflected on the page. You now need to load the <code> chromebook_platform </code> driver manually. </p> <pre><code># kldload chromebook_platform # kldload ig4 # kldload cyapa </code></pre> <p> <a href="https://www.freebsd.org/cgi/man.cgi?query=cyapa&amp;sektion=4&amp;manpath=freebsd-release-ports"> The cyapa driver </a> offers all the features you would want from a trackpad, two finger dragging, thresholds for taps and an three button mouse emulation mode. </p> <pre><code># sysctl debug.cyapa_enable_tapclick=3 </code></pre> <p> Which gives me the following awesome mouse button layout on the trackpad. </p> <pre><code> Trackpad layout 2/3 1/3 +--------------------+------------+ | | Middle | | | Button | | Left | | | Button +------------+ | | Right | | | Button | +--------------------+............| | Thumb/Button Area | 15% +---------------------------------+ </code></pre> <hr/> <p> Also disable super danger mode: </p> <pre><code># echo "hw.acpi.power_button_state=NONE" &gt;&gt; /etc/sysctl.conf </code></pre> https://adventurist.me/posts/0211Tue, 10 Jan 2017 00:00:00 +0000 William Binneyhttps://adventurist.me/posts/0212<p> My head is pretty full writing slides for FOSDEM. <a href="http://www.truthdig.com/avbooth/item/live_at_truthdig_robert_scheer_and_william_binney_on_the_alleged_russian_ha"> Here is an interview with William Binney </a> , if you don't know of Binney this interview is a great introduction. Binney is credited by Snowden as one of the motivators behind his set of leaks. </p> <p> Binney also gave the keynote at Hope 9, which is a great watch. </p> <iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/FOFtQ6n3WR4" width="560"> </iframe> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0212Wed, 11 Jan 2017 00:00:00 +0000 33c3 Wireshark Workshophttps://adventurist.me/posts/0213<p> I <a href="http://adventurist.me/posts/0183"> use </a> <a href="http://adventurist.me/posts/0131"> Wireshark </a> <a href="http://adventurist.me/posts/0130"> quite </a> all the time. I was lucky to get a copy of <a href="https://www.nostarch.com/hacking2.htm"> Hacking: The Art of Exploitation </a> when I was a teenager, the book gave me an excellent introduction to using <code> tcpdump </code> to perform network analysis. <code> tcpdump </code> is the first tool I reach for when I wonder where the packets are going, but for anything higher level (breaking down http, checking wlan flags) I use <code> wireshark </code> , I am always impressed. </p> <p> <a href="/images/day1wiresharkworkshop.jpg"> <img src="/imagessmall/day1wiresharkworkshop.jpg"/> </a> </p> <p> At 33c3 there was a <code> wireshark </code> introductory self organised session run by <a href="http://kirils.org/"> kirils </a> . I did not go to this session, but the <a href="http://kirils.org/slides/2016-12-27_NetworkConceptsIntroductionAndWiresharkWorkshop.pdf"> slides I found </a> look to be an excellent introduction to using <code> wireshark </code> . </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0213Thu, 12 Jan 2017 00:00:00 +0000 Spooky Fridayhttps://adventurist.me/posts/0214<p> It is Friday the 13th, wooooo spooky!!!! </p> <p> <a href="https://en.wikipedia.org/wiki/Rudy_Giuliani"> Rudy_Giuliani </a> was nominated Cyber Tzar or something yesterday, the hacker community suddenly became very interested in this credentials. This morning twitter was filled with the results of int gathering exercises. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Found on /r/sysadmin, presented without comment. <a href="https://t.co/UmWe7tHURv"> pic.twitter.com/UmWe7tHURv </a> </p> — Ryan Castellucci (@ryancdotorg) <a href="https://twitter.com/ryancdotorg/status/819661915815288836"> January 12, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="in"> Giuliani uses bad SSH key. <br/> <br/> h/t <a href="https://twitter.com/n0x00"> @n0x00 </a> <a href="https://t.co/GI2l90wuty"> pic.twitter.com/GI2l90wuty </a> </p> — Rob Graham (@ErrataRob) <a href="https://twitter.com/ErrataRob/status/819740885504192512"> January 13, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> The domain now points to localhost, someone clearly got a late night phone call. It is strange that only now is noise being made about this, Ruddy isn't exactly a popular figure in America. He made a lot of mistakes in high profile positions. The big scary guys in the Int agencies will have pursued all these leads a long time ago. </p> <p> Of course, that is assuming the site wasn't a honeypot. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0214Fri, 13 Jan 2017 00:00:00 +0000 Walkinghttps://adventurist.me/posts/0215<p> <a href="/images/oxencraig-trigpoint.jpg"> <img src="/imagessmall/oxencraig-trigpoint.jpg"/> </a> </p> <p> Thought we had hit all of the peaks on <a href="https://en.wikipedia.org/wiki/Bennachie"> Bennachie </a> , but looking at stuff later it seems there are about 7 'summits' to hit. That's annoying, living in Aberdeen I have done the <a href="https://www.walkhighlands.co.uk/aberdeenshire/bennachie.shtml"> Mither Tap </a> walk loads of times. Today was my first time taking the trek over to Oxencraig. </p> <p> That was most of today, I poked some wireless driver stuff, but it is all initial steps. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0215Sat, 14 Jan 2017 00:00:00 +0000 Fairy Dusthttps://adventurist.me/posts/0216<p> <a href="/images/33C3rocket.jpg"> <img src="/imagessmall/33C3rocket.jpg"/> </a> </p> <hr/> <p> <a href="http://adventurist.me/posts/0210"> It </a> <a href="http://adventurist.me/posts/0211"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0212"> makes </a> <a href="http://adventurist.me/posts/0213"> seven </a> <a href="http://adventurist.me/posts/0214"> days </a> of <a href="http://adventurist.me/posts/0215"> writing </a> . </p> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0216Sun, 15 Jan 2017 00:00:00 +0000 PO-14https://adventurist.me/posts/0217<p> <a href="/images/inflightsynthertainment.jpg"> <img src="/imagessmall/inflightsynthertainment.jpg"/> </a> </p> <p> I was given a <a href="https://teenage.engineering/products/po"> Teenage Engineering PO-14 </a> for Christmas and took it with me to congress for entertainment on the way. The pocket operator has a load of functions hidden behind very few buttons, I had a lot of fun playing with it on the flight. I am still to really figure out everything this board can do. </p> <p> Watching some OP-1 videos (their much bigger synth) TE manage to pack a ton of functionality into hardly any keys. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes </p> https://adventurist.me/posts/0217Mon, 16 Jan 2017 00:00:00 +0000 BIOS Engineshttps://adventurist.me/posts/0218<p> <a href="https://puri.sm/posts/librem-13-coreboot-report-january-12-2017/"> I read this cool article </a> on trying to get the <a href="https://puri.sm/"> Purism </a> laptop booting with <a href="https://www.coreboot.org/"> coreboot </a> instead of the proprietary bios. Quite a lot of people having been trying to open up the Intel hardware ecosystem in the past few years, all those closed bits make it very hard to say that hardware is secure. </p> <iframe allowfullscreen="" frameborder="0" height="576" src="https://media.ccc.de/v/33c3-8314-bootstraping_a_slightly_more_secure_laptop/oembed" width="1024"> </iframe> <p> It would be nice if we could leave the Intel world and use ARM or MIPS processors, but I think the graphics situation holds us back. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0218Tue, 17 Jan 2017 00:00:00 +0000 Loch Brandyhttps://adventurist.me/posts/0219<p> <a href="/images/lochbrandy-pano.jpg"> <img src="/imagessmall/lochbrandy-pano.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0219Wed, 18 Jan 2017 00:00:00 +0000 Are you a real hacker?https://adventurist.me/posts/0220<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Are you a fed? You have to tell me if you are. <a href="https://t.co/mMtmNA8oOW"> pic.twitter.com/mMtmNA8oOW </a> </p> — GonzoHacker (@GonzoHacker) <a href="https://twitter.com/GonzoHacker/status/821922066085670912"> January 19, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Pretty sure I am not, I lost the git branch with a new feature on it and it took an hour to find. I didn't delete it, I just couldn't remember where it was. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0220Thu, 19 Jan 2017 00:00:00 +0000 5GHz Problemshttps://adventurist.me/posts/0221<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Somebody's illegally configured 5GHz wireless is making a mess of the <a href="https://twitter.com/MetService"> @MetService </a> rain radar. <a href="https://t.co/10noLJuGyG"> pic.twitter.com/10noLJuGyG </a> </p> — Steve Biddle (@stevebiddle) <a href="https://twitter.com/stevebiddle/status/822190488505589760"> January 19, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Interference is a bitch, you should heed the warnings about cheap Chinese video systems they can make a lot of noise. This weather sat didn't stand a chance, <a href="http://blog.metservice.com/Radar_Interference"> Here </a> is an article explaining what is going on. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0221Fri, 20 Jan 2017 00:00:00 +0000 Setting SYSDIRhttps://adventurist.me/posts/0222<p> <a href="/images/callforipfspoets.jpg"> <img src="/imagessmall/callforipfspoets.jpg"/> </a> </p> <p> Poking at the mt7620 wifi driver today, but I don't have a FreeBSD source tree in /usr/src. Trying to build spits out this message: </p> <pre><code>$ make make: "/usr/share/mk/bsd.kmod.mk" line 12: Unable to locate the kernel source tree. Set SYSDIR to override. </code></pre> <p> Searching around, I could find others with this problem, mostly they had had forgotten to checkout a source tree into <code> /usr/src </code> . With a source tree in <code> /home/user/code/freebsd </code> I needed to set SYSDIR. </p> <p> SYSDIR must point to the <code> sys </code> subdir in the FreeBSD source rather than the location of the whole tree(i.e. /usr/src). I modified my module <code> Makefile </code> list so: </p> <pre><code>SRCS=bus_if.h device_if.h opt_usb.h usbdevs.h if_run.c KMOD=run_mt SYSDIR=/home/user/code/freebsd/sys .include &lt;bsd.kmod.mk&gt; </code></pre> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0222Sat, 21 Jan 2017 00:00:00 +0000 Tracing Call Graphshttps://adventurist.me/posts/0223<p> Modern IDEs have a load of functionality to help trace function call and data accesses through large code bases. <code> cscope </code> is an interactive command line tool that helps with searching codebases based on C symbols. With <code> cscope </code> you can find all the callers of a function, every function a function calls, or by C type. </p> <pre><code>$ cd code/repo $ cscope -R </code></pre> <p> Working on <a href="http://adventurist.me/posts/0103"> this </a> <a href="http://adventurist.me/posts/0222"> wireless </a> I have spent a lot of time digging down the callgraph with <code> cscope </code> manually figuring out how things tie together. Today I looked to see if there was a tool I could use to generate a callgraph from the <code> cscope </code> database files. </p> <p> <a href="/images/cscopescreen.png"> <img src="/images/cscopescreen.png"/> </a> </p> <p> I found <a href="http://stackoverflow.com/questions/2178662/generate-call-tree-from-cscope-database["> a stackoverflow thread </a> with the recommendation of a shell script that could generate a <code> dot </code> file with the callgraph. <a href="http://www.toolchainguru.com/2008/07/bash-c-call-trees-and-graphs.html"> The </a> <a href="http://www.toolchainguru.com/2011/03/c-calltrees-in-bash-revisited.html"> script </a> is unfortunately very basic, rather that something to run against a code base it is a set of bash functions. </p> <pre><code>$ . ~/tmp/calltree.sh # load functions in $ _relate rt28xx_open RTUSBWriteMACRegister| dot2png out.png </code></pre> <p> The graph below was ( <a href="https://github.com/adventureloop/mt7610u_wifi_sta_v3002_dpo_20130916"> generated from this repo) </a> took about 1 minute to generate on my reasonably fast laptop. You will need to install the <code> graphviz </code> tools to generate the png. </p> <p> <a href="/images/cscopecallgraph.png"> <img src="/images/cscopecallgraph.png"/> </a> </p> <p> I had to make some modifications to get the script to run, here is my version: </p> <pre><code>#!/bin/bash echo "loading calltree.sh functions" #use cscope to build reference files (./cscope.out by default, use set_graphdb to override name or location) set_graphdb() { export GRAPHDB=$1; } unset_graphdb() { unset GRAPHDB; } build_graphdb() { cscope -bkRu ${GRAPHDB:+-f $GRAPHDB} &amp;&amp; echo Created ${GRAPHDB:-cscope.out}...; } # cscope queries lsyms() { cscope -R ${GRAPHDB:+-f $GRAPHDB} -L0 $1 | grep -v "&lt;global&gt;" | grep "="; } fdefine() { cscope -R ${GRAPHDB:+-f $GRAPHDB} -L1 $1; } callees() { cscope -R ${GRAPHDB:+-f $GRAPHDB} -L2 $1; } callers() { cscope -R ${GRAPHDB:+-f $GRAPHDB} -L3 $1; } # show which functions refer to a set of symbols filter_syms() { local sym cscope_line while read -a sym; do lsyms $sym | while read -a cscope_line; do printf "${cscope_line[1]}\n" done done } # given a set of function names, find out how they're related filter_edges() { local sym cscope_line while read -a sym; do fdefine $sym | while read -a cscope_line; do grep -wq ${cscope_line[1]} ${1:-&lt;(echo)} &amp;&amp; printf "${cscope_line[1]}\t[href=\"${cscope_line[0]}:${cscope_line[2]}\"]\t/*fdefine*/\n" done callees $sym | while read -a cscope_line; do grep -wq ${cscope_line[1]} ${1:-&lt;(echo)} &amp;&amp; printf "$sym-&gt;${cscope_line[1]}\t[label=\"${cscope_line[0]}:${cscope_line[2]}\"]\t/*callee*/\n" done callers $sym | while read -a cscope_line; do grep -wq ${cscope_line[1]} ${1:-&lt;(echo)} &amp;&amp; printf "${cscope_line[1]}-&gt;$sym\t[label=\"${cscope_line[0]}:${cscope_line[2]}\"]\t/*caller*/\n" done done } # dump args one-per-line largs() { for a; do echo $a; done; } toargs() { local symbol while read -a symbol; do printf "%s " $symbol done echo } # present list of symbols to filter_syms properly refs() { local tfile=/tmp/refs.$RANDOM cat ${1:+&lt;(largs $@)} &gt; $tfile filter_syms $tfile &lt;$tfile | sort -u rm $tfile } # present list of function names to filter_edges properly edges() { local tfile=/tmp/edges.$RANDOM cat ${1:+&lt;(largs $@)} &gt; $tfile filter_edges $tfile &lt;$tfile rm $tfile } # append unknown symbol names out of lines of cscope output filter_cscope_lines() { local cscope_line while read -a cscope_line; do grep -wq ${cscope_line[1]} ${1:-/dev/null} || echo ${cscope_line[1]} done } # given a set of function names piped in, help spit out all their callers or callees that aren't already in the set descend() { local symbol while read -a symbol; do $1 $symbol | filter_cscope_lines $2 done } # discover functions upstream of initial set all_callers() { local tfile=/tmp/all_callers.$RANDOM cat ${1:+&lt;(largs $@)} &gt; $tfile descend callers $tfile &lt;$tfile &gt;&gt;$tfile cat $tfile; rm $tfile } # discover functions downstream of initial set all_callees() { local tfile=/tmp/all_callees.$RANDOM cat ${1:+&lt;(largs $@)} &gt; $tfile descend callees $tfile &lt;$tfile &gt;&gt;$tfile cat $tfile; rm $tfile } # all the ways to get from (a,b,...z) to (a,b,...z), i.e. intersect all_callers and all_callees of initial set call_graph() { local tfile=/tmp/subgraph.$RANDOM; local args=/tmp/subgraph_args.$RANDOM cat ${1:+&lt;(largs $@)} &gt; $args cat $args | all_callers | sort -u &gt; $tfile comm -12 $tfile &lt;(cat $args | all_callees | sort -u) rm $tfile $args } # all functions downstream of callers of argument all_callerees() { callers $1 | filter_cscope_lines | all_callees; } # odd experimental set of calls that might help spot potential memory leaks call_leaks() { local tfile=/tmp/graph_filter.$RANDOM all_callerees $1 | sort -u &gt; $tfile comm -2 $tfile &lt;(all_callers $2 | sort -u) rm $tfile } # wrap dot-format node and edge info with dot-format whole-graph description graph() { printf "digraph iftree {\ngraph [rankdir=LR, ratio=compress, concentrate=true];\nnode [shape=record, style=filled]\nedge [color="navy"];\n"; cat | sort -u; printf "}\n"; } # filter out unwanted (as specified in “~/calltree.deny”) and/or unnecessary edges graph_filter() { local tfile=/tmp/graph_filter.$RANDOM cat &gt; $tfile grep fdefine $tfile grep $1 $tfile | grep -v ~/calltree.deny | cut -f1,3 rm $tfile } # how to invoke zgrviewer as a viewer zgrviewer() { ~/bin/zgrviewer -Pdot $@; } # how to invoke xfig as a viewer figviewer() { xfig &lt;(dot -Tfig $@); } # how to create and view a png image pngviewer() { dot -Tpng $@ -o /tmp/ct.png &amp;&amp; gqview -t /tmp/ct.png; } # specify a viewer ctviewer() { pngviewer $@; } # add color to specified nodes colornodes() { (cat; for x in $@; do echo "$x [color=red]"; done;) } # generate dot files _upstream() { all_callers $1 | edges | graph_filter ${2:-caller} | colornodes $1 | graph; } _downstream() { all_callees $1 | edges | graph_filter ${2:-callee} | colornodes $1 | graph; } _upndown() { (all_callers $1; all_callees $1) | edges | graph_filter ${2:-callee} | colornodes $1 | graph; } _relate() { call_graph $@ | edges | graph_filter callee | colornodes $@ | graph; } _leaks() { call_leaks $1 $2 | edges | graph_filter ${3:-callee} | colornodes $1 $2 | graph; } # generate dot files and invoke ctviewer upstream() { _upstream $@ &gt; /tmp/tfile; ctviewer /tmp/tfile; rm -f /tmp/tfile; } downstream() { _downstream $@ &gt; /tmp/tfile; ctviewer /tmp/tfile; rm -f /tmp/tfile; } upndown() { _upndown $@ &gt; /tmp/tfile; ctviewer /tmp/tfile; rm -f /tmp/tfile; } relate() { _relate $@ &gt; /tmp/tfile; ctviewer /tmp/tfile; rm -f /tmp/tfile; } leaks() { _leaks $@ &gt; /tmp/tfile; ctviewer /tmp/tfile; rm -f /tmp/tfile; } # dot file conversions dot2png() { dot -s36 -Tpng -o $1; } dot2jpg() { dot -Tjpg -o $1; } dot2html() { dot -Tpng -o $1.png -Tcmapx -o $1.map; (echo "&lt;IMG SRC="$1.png" USEMAP="#iftree" /&gt;"; cat $1.map) &gt; $1.html; } </code></pre> <hr/> <p> <a href="http://adventurist.me/posts/0217"> It </a> <a href="http://adventurist.me/posts/0218"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0219"> makes </a> <a href="http://adventurist.me/posts/0220"> seven </a> <a href="http://adventurist.me/posts/0222"> days </a> of <a href="http://adventurist.me/posts/0223"> writing </a> . </p> <p> Doing this I also <a href="http://stackoverflow.com/questions/19469770/how-to-find-the-callers-and-callee-of-a-function-in-c-code-in-vi-vim"> found out about </a> <code> vim </code> s <code> cscope </code> integration. </p> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0223Sun, 22 Jan 2017 00:00:00 +0000 Some Postershttps://adventurist.me/posts/0224<p> <a href="/images/posterscoveringdome.jpg"> <img src="/imagessmall/posterscoveringdome.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0224Mon, 23 Jan 2017 00:00:00 +0000 Binary Image Analysishttps://adventurist.me/posts/0225<p> I have gotten to the point with the <a href="http://adventurist.me/posts/0222"> MT76x0U </a> <a href="http://adventurist.me/posts/0103"> driver </a> where I need to load the firmware image onto the MCU. Unlike the older hardware on which the driver is based, the firmware image is much more complicated. The old images are 4KB and can be directly DMA'd across to the MCU, the newer image is around 80KB, contains 2 sections and the reference driver does a complicated dance to copy them across. </p> <p> There is quite a lot of pointer magic in setting up the DMA buffers in the reference image, I need to understand the firmware layout to know what this is trying to accomplish. </p> <p> First thing, <code> binwalk </code> is of no help: </p> <pre><code>$ binwalk mcu/bin/MT7610_formal_2.6.bin DECIMAL HEXADECIMAL DESCRIPTION ------------------------------------------------------------------------------- </code></pre> <p> The image size is: </p> <pre><code>$ ls -l -rw-r--r-- 1 hacker hacker 80288 Dec 21 19:40 mcu/bin/MT7610_formal_2.6.bin </code></pre> <p> The reference code does some work to extract out build info from the 32 byte header, I put together this python script to do the same: </p> <pre><code>import sys import struct if __name__ == "__main__": if len(sys.argv) != 2: print("usage: {} firmware.bin".format(sys.argv[0])) exit() filename = sys.argv[1] data = None with open(filename, "rb") as f: data = f.read() print("Image size: {}".fomrat(len(data))) # ilm_len 4 bytes # dlm_len 4 bytes # fw_ver 2 bytes # build_ver 2 bytes # # 4 bytes of something? # # build_time 16 byte str starting from byte 16 (base+16) """ hdr = data[:32] ilm_len, dlm_len, fw_ver, build_ver, something, build_time = struct.unpack("&lt;IIHH4s16s", hdr) print("ilm_len: {}".format(ilm_len)) print("dlm_len: {}".format(dlm_len)) print("fw_ver: {}".format(fw_ver)) print("build_ver: {}".format(build_ver)) print("something: {}".format(something)) print("build_time: {}".format(build_time)) print("fw version: {}.{}.{}" .format( (fw_ver &amp; 0xf000) &gt;&gt; 8, (fw_ver &amp; 0x0f00) &gt;&gt; 8, fw_ver &amp; 0x00ff)) </code></pre> <p> I know from the reference driver that there are two images shipped in the firmware, called ILM and DLM ( <a href="https://www.andestech.com/tw/product-details01.php?cls=3&amp;id=53"> accoring to this </a> Instruction and Data Local Memory). </p> <pre><code>$ python3.5 parsefirmware.py mcu/bin/MT7610_formal_2.6.bin Image size: 80288 ilm_len: 68780 dlm_len: 11476 fw_ver: 30272 build_ver: 256 something: b'Bv\x11\x02' build_time: b'201308221655____' fw version: 112.6.64 </code></pre> <p> The build time is happily just an ascii string, the first output in <code> strings </code> </p> <pre><code>$ strings ../../mcu/bin/MT7610_formal_2.6.bin| head -n 5 201308221655____H s@! ELq@'P ELq@ &lt;@!H </code></pre> <p> and easy to spot in a <code> hexdump </code> </p> <pre><code>$ head -c 64 ../../mcu/bin/MT7610_formal_2.6.bin| hexdump -C 00000000 ac 0c 01 00 d4 2c 00 00 40 76 00 01 42 76 11 02 |.....,..@v..Bv..| 00000010 32 30 31 33 30 38 32 32 31 36 35 35 5f 5f 5f 5f |201308221655____| 00000020 48 00 00 78 48 00 00 1e 48 00 00 1c 48 00 00 1a |H..xH...H...H...| 00000030 48 00 00 18 48 00 00 16 48 00 00 14 48 00 00 12 |H...H...H...H...| </code></pre> <p> The ILM and DLM sizes are also very useful, with the header they add up to the firmware size! </p> <pre><code>Image size = hdr_size + ilm_len + dlm_len 80288 = 32 + 68780 + 11476 </code></pre> <p> Currently I think the reference driver skips some further data in the ILM, I need to see if there is documentation for the format so I can make an informed guess. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0225Tue, 24 Jan 2017 00:00:00 +0000 VR Shithttps://adventurist.me/posts/0226<p> <a href="/images/vrshit.jpg"> <img src="/imagessmall/vrshit.jpg"/> </a> </p> <p> You'll be sick! </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0226Wed, 25 Jan 2017 00:00:00 +0000 The Network is susceptible to security violationshttps://adventurist.me/posts/0227<p> <a href="https://www.ietf.org/rfc/rfc0602.txt"> RFC602 </a> published in December 1973: </p> <pre><code> "The Stockings Were Hung by the Chimney with Care" The ARPA Computer Network is susceptible to security violations for at least the three following reasons: (1) Individual sites, used to physical limitations on machine access, have not yet taken sufficient precautions toward securing their systems against unauthorized remote use. For example, many people still use passwords which are easy to guess: their fist names, their initials, their host name spelled backwards, a string of characters which are easy to type in sequence (e.g. ZXCVBNM). (2) The TIP allows access to the ARPANET to a much wider audience than is thought or intended. TIP phone numbers are posted, like those scribbled hastily on the walls of phone booths and men's rooms. The TIP required no user identification before giving service. Thus, many people, including those who used to spend their time ripping off Ma Bell, get access to our stockings in a most anonymous way. (3) There is lingering affection for the challenge of breaking someone's system. This affection lingers despite the fact that everyone knows that it's easy to break systems, even easier to crash them. All of this would be quite humorous and cause for raucous eye winking and elbow nudging, if it weren't for the fact that in recent weeks at least two major serving hosts were crashed under suspicious circumstances by people who knew what they were risking; on yet a third system, the system wheel password was compromised -- by two high school students in Los Angeles no less. We suspect that the number of dangerous security violations is larger than any of us know is growing. You are advised not to sit "in hope that Saint Nicholas would soon be there". </code></pre> <p> via </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> First, read this: <a href="https://t.co/vNjckyS1NB"> https://t.co/vNjckyS1NB </a> <br/> Second, realize that this is from 1973 (yes, 43 years ago) <a href="https://t.co/O4u7NVKuyX"> pic.twitter.com/O4u7NVKuyX </a> </p> — Sebastian Schinzel (@seecurity) <a href="https://twitter.com/seecurity/status/824549793699688448"> January 26, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0227Thu, 26 Jan 2017 00:00:00 +0000 There is no loungehttps://adventurist.me/posts/0228<p> <a href="/images/images/thereisnoloungephone.jpg"> <img src="/imagessmall/thereisnoloungephone.jpg"/> </a> </p> <p> I wonder if a CCC style lounge would work as a real club, I guess the status of <a href="https://www.dnalounge.com/backstage/log/2016/12/19.html"> DNA Lounge </a> indicates it isn't a great proposition. Hacker bars for console jockeys are really appealing, the properties that would make them a nice place to be; not too crowded, room to hack, exclusive, don't really translate to a successful business. </p> <p> Still, one can dream. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0228Fri, 27 Jan 2017 00:00:00 +0000 Edge Measurementshttps://adventurist.me/posts/0229<p> <a href="/images/edgemeasurementsession.jpg"> <img src="/imagessmall/edgemeasurementsession.jpg"/> </a> </p> <p> Something for work meant I had to <a href="https://github.com/uoaerg/edgetrace"> throw together a DSCP </a> probing tool at the last minute. It still needs lots of work, but I needed to get out today and test on some real networks (just work and my house don't count). If I have to spend a lot of time in cafes, pubs and chains doing measurements from edges I might as well enjoy it. </p> <p> If I can manage more than a couple of shots like this I can put together an excellent slide when presenting this work. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0229Sat, 28 Jan 2017 00:00:00 +0000 On the roadhttps://adventurist.me/posts/0230<p> <a href="/images/traceaberdeenairport.jpg"> <img src="/imagessmall/traceaberdeenairport.jpg"/> </a> </p> <p> Time for a quick international measurement tour! </p> <p> Well no, nothing as cool. I have meeting and a hackathon in Paris this week, then on Friday I am jetting (on a train) up to Brussles for FOSDEM. Travelling gives me a chance to run my network tracing tool from lots of strange places, hopefully strange places reveal strange networks. </p> <p> <a href="/images/pariscdgtrainboard.jpg"> <img src="/imagessmall/pariscdgtrainboard.jpg"/> </a> </p> <p> Now I am going to have a wander around this city for a bit, before a great day of coding tomorrow. </p> <hr/> <p> <a href="http://adventurist.me/posts/0214"> It </a> <a href="http://adventurist.me/posts/0215"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0216"> makes </a> <a href="http://adventurist.me/posts/0227"> seven </a> <a href="http://adventurist.me/posts/0228"> days </a> of <a href="http://adventurist.me/posts/0229"> writing </a> . </p> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0230Sun, 29 Jan 2017 00:00:00 +0000 I hate phoneshttps://adventurist.me/posts/0231<p> <a href="/images/seidenstrassedepot.jpg"> <img src="/imagessmall/seidenstrassedepot.jpg"/> </a> </p> <p> I wandered down to the Louvre last night and took some pictures, but my phone is refusing to speak to my laptop, so here is the Seidenstrasse instead. I am hacking from the amazing <a href="http://adventurist.me/posts/0054/"> Mozilla Paris offices </a> this week, for some reason this is the projects favourite place to meet. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0231Mon, 30 Jan 2017 00:00:00 +0000 Travelhttps://adventurist.me/posts/0232<p> <a href="/images/thamesdelta.jpg"> <img src="/imagessmall/thamesdelta.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0232Tue, 31 Jan 2017 00:00:00 +0000 They can't take springhttps://adventurist.me/posts/0233<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> George Orwell, Some Thoughts On The Common Toad (1946). <a href="https://t.co/pD5a8GKvsj"> https://t.co/pD5a8GKvsj </a> <a href="https://t.co/BWSMf8Em8c"> pic.twitter.com/BWSMf8Em8c </a> </p> — Graham Sleight (@grahamsleight) <a href="https://twitter.com/grahamsleight/status/826799871432732672"> February 1, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0233Wed, 01 Feb 2017 00:00:00 +0000 Don't Violate DiffServhttps://adventurist.me/posts/0234<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Today's <a href="https://twitter.com/hashtag/network?src=hash"> #network </a> wisdom: You have a problem. You implement <a href="https://twitter.com/hashtag/QoS?src=hash"> #QoS </a> . Now you have 9 problems. </p> — Allan Eising (@dubcroster) <a href="https://twitter.com/dubcroster/status/804246315039334400"> December 1, 2016 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0234Thu, 02 Feb 2017 00:00:00 +0000 FOSDEM Prephttps://adventurist.me/posts/0235<p> Tomorrow, <a href="https://fosdem.org/2017/schedule/speaker/tom_jones_[tj]/"> I am presenting at FOSDEM </a> . Somehow I have gotten roped into doing two talks at almost the same time. </p> <p> At 1555, I will present <a href="https://fosdem.org/2017/schedule/event/qos/"> QoS Challenges for Real Time Traffic </a> in the Real Time Communications devroom. I am pretty certain I am going to explain what the hell QoS in the internet is, some of the benefit you might see and how to do any of this with NEAT. The recent measurements we have been doing suggest that QoS shouldn't be a deal breaker for any connection, great news, but it doesn't make much of a discussion. </p> <p> At 1630, I will present <a href="https://fosdem.org/2017/schedule/event/transport_evolution_bsd/"> Transport Evolution on top of the BSD's </a> in the BSD devroom. The two talks are in the same building, but 15 minutes is a bit tighter than I would have liked. This talk will be about the problems faced in making the internet better and how NEAT will help. </p> <p> I know the BSD devroom will be recorded, but not streamed. I haven't heard anything about the RTC rooms video setup. If you are around for FOSDEM you should drop by and ask me difficult questions. If not I will take them over email. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0235Fri, 03 Feb 2017 00:00:00 +0000 FOSDEM 2017https://adventurist.me/posts/0236<p> I did my talks today, there is video coming, but I am told the audio is out of sync. My hotel doesn't seem to be up to doing streaming video so I haven't even tried. </p> <p> Here are the slides: </p> <p> <a href="/images/QoSChallengesForRealTimeTrafficTitle.png"> <img src="/images/QoSChallengesForRealTimeTrafficTitle.png"/> </a> </p> <p> <a href="https://adventurist.me/presentations/slides/fosdem2017-qoschallengesforrealtimetraffic.pdf"> Which should be clickable, but I can't figure out how to trick my site to do it </a> </p> <p> <a href="/images/BSDTransportEvolutionTitle.png"> <img src="/images/BSDTransportEvolutionTitle.png"/> </a> </p> <p> <a href="https://adventurist.me/presentations/slides/fosdem2017-transportevolutionontopofthebsds.pdf"> Which should be clickable, but I can't figure out how to trick my site to do it </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0236Sat, 04 Feb 2017 00:00:00 +0000 FOSDEM is Donehttps://adventurist.me/posts/0237<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> We're baaaack to talk about live tweeting. TRANSMET: Human Reaction and Criminal Enterprise #3 <a href="https://t.co/yP1N8bE5Zf"> https://t.co/yP1N8bE5Zf </a> <a href="https://twitter.com/warrenellis"> @warrenellis </a> <a href="https://twitter.com/DarickR"> @DarickR </a> <a href="https://t.co/qDTBELFwtO"> pic.twitter.com/qDTBELFwtO </a> </p> — Comicosity (@comicosity) <a href="https://twitter.com/comicosity/status/828330952820527104"> February 5, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> FOSDEM is done! I want to start writing about the things I saw, but my phone still won't speak to my laptop. Tomorrow should be more differenter, once the travel is done I will have access to sane computing. </p> <hr/> <p> <a href="http://adventurist.me/posts/0231"> It </a> <a href="http://adventurist.me/posts/0232"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0233"> makes </a> <a href="http://adventurist.me/posts/0234"> seven </a> <a href="http://adventurist.me/posts/0235"> days </a> of <a href="http://adventurist.me/posts/0236"> writing </a> . </p> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0237Sun, 05 Feb 2017 00:00:00 +0000 Trains Homehttps://adventurist.me/posts/0238<p> <a href="/images/departuresboard.jpg"> <img src="/imagessmall/departuresboard.jpg"/> </a> </p> <p> Long journey back from FOSDEM, a train to Paris, train to the Airport and a hop through Amsterdam before making it home. </p> <p> <a href="/images/traintocdg.jpg"> <img src="/imagessmall/traintocdg.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0238Mon, 06 Feb 2017 00:00:00 +0000 Xen DNA TShirthttps://adventurist.me/posts/0239<p> I got this TShirt at FOSDEM, I was told that <em> it means something </em> . </p> <p> <a href="/images/xentshirt.jpg"> <img src="/imagessmall/xentshirt.jpg"/> </a> </p> <p> First here is all of the text from the tshirt, which should make the page more discoverable: </p> <pre><code>Xen Project @FOSDEM 2017 Forging the DNA of the Cloud AGTCTACTCAGCCGTACTTCATCGACTTAGCGTTGTCTCAGC GCTTGTCACGTCCTGCTCGTCAGCTAGCGTCTAAGCTACCTC ACTAGCTGTGCTAGCTAGCGTCTAAGCTCAATCTGTGATTAC </code></pre> <p> These three strings are a bit unweildly to work with, lets break them down into groups of three. </p> <pre><code>AGT CTA CTC AGC CGT ACT TCA TCG ACT TAG CGT TGT CTC AGC GCT TGT CAC GTC CTG CTC GTC AGC TAG CGT CTA AGC TAC CTC ACT AGC TGT GCT AGC TAG CGT CTA AGC TCA ATC TGT GAT TAC </code></pre> <p> Now to <a href="https://en.wikipedia.org/wiki/DNA_codon_table"> wikipedia </a> to get a DNA Codon Table to refer to: </p> <pre><code>Amino acid Codons Compressed Ala/A GCT GCC GCA GCG GCN Arg/R CGT CGC CGA CGG AGA AGG CGN MGR Asn/N AAT AAC AAY Asp/D GAT GAC GAY Cys/C TGT TGC TGY Gln/Q CAA CAG CAR Glu/E GAA GAG GAR Gly/G GGT GGC GGA GGG GGN His/H CAT CAC CAY Ile/I ATT ATC ATA ATH START ATG Amino acid Codons Compressed Leu/L TTA TTG CTT CTC CTA CTG YTR CTN Lys/K AAA AAG AAR Met/M ATG Phe/F TTT TTC TTY Pro/P CCT CCC CCA CCG CCN Ser/S TCT TCC TCA TCG AGT AGC TCN AGY Thr/T ACT ACC ACA ACG ACN Trp/W TGG Tyr/Y TAT TAC TAY Val/V GTT GTC GTA GTG GTN STOP TAA TGA TAG TAR TRA </code></pre> <p> I poked at this for ages, I wondered if I had need to the take the codons in as they are written. A column at a time. But even looking at that, there was nothing obvious about the codon sequence. </p> <p> After a while I started searching for subsequences from the string. This didn't help at all, but one page on google had a related search for ['dna message translator'][3]. Annoyingly I fed in this string: </p> <pre><code>AGTCTACTCAGCCGTACTTCATCGACTTAGCGTTGTCTCAGCGCTTGTCACGTCCTGCTCGTCAGCTAGCGTCTAAGCTACCTCACTAGCTGTGCTAGCTAGCGTCTAAGCTCAATCTGTGATTAC </code></pre> <p> And got the result: </p> <pre><code>XEN HACKATHON FORGING THE DNA OF THE CLOUD </code></pre> <p> <a href="/images/xendnapuzzle.png"> <img src="/images/xendnapuzzle.png"/> </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0239Tue, 07 Feb 2017 00:00:00 +0000 FOSDEM Boothshttps://adventurist.me/posts/0240<p> FOSDEM is split between devrooms and booths, there are booths for a load of different projects. The <a href="https://www.olimex.com/Products/DIY%20Laptop/"> Olimex DIY Laptop </a> was announced the week before, they were showing it off at a stand at FOSDEM. </p> <p> <a href="/images/olimexlaptop.jpg"> <img src="/imagessmall/olimexlaptop.jpg"/> </a> </p> <p> The hardware is quite nice, the case feels a little cheap, but what can you expect for that price? The keyboard they have on it is horrible. It would be much better served with much fewer keys on the layout, something more like a chromebook would be good (I would settle for 40%, but the market is probably small). </p> <p> <a href="/images/olimexlaptopboards.jpg"> <img src="/imagessmall/olimexlaptopboards.jpg"/> </a> </p> <p> I unplugged the assembled model they had on display and they got upset and it was quickly plugged back in. The hardware is still quite early, it looks like a really solid start. </p> <p> I don't think I would pick up the first generation of hardware, if they continue with the project it will be really promising. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0240Wed, 01 Feb 2017 00:00:00 +0000 OONI Probe Mobilehttps://adventurist.me/posts/0241<p> Awesome news, OONI probe now has an android tool. OONI probe uses tor to map out censorship on the internet. If you want to make the internet a much better place I really suggest running this app. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Boom! Now almost anyone can help fight Internet <a href="https://twitter.com/hashtag/censorship?src=hash"> #censorship </a> with the OONIprobe phone app! <a href="https://t.co/2xmq79rjls"> https://t.co/2xmq79rjls </a> … <a href="https://twitter.com/hashtag/networking?src=hash"> #networking </a> <a href="https://twitter.com/hashtag/MobileApp?src=hash"> #MobileApp </a> <a href="https://t.co/rdUgVV8NTV"> pic.twitter.com/rdUgVV8NTV </a> </p> — torproject (@torproject) <a href="https://twitter.com/torproject/status/829696755155468288"> February 9, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> <a href="http://adventurist.me/posts/0239"> Unrelated </a> , I read an awesome write up on <a href="https://vulnsec.com/2017/reverse-engineering-a-book-cover/"> reverse engineering a book cover </a> . It is a shame I don't read Polish, the author including something interesting in the cover is a real draw to the book for me. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Cryptonomicon </p> https://adventurist.me/posts/0241Thu, 09 Feb 2017 00:00:00 +0000 Evil Bithttps://adventurist.me/posts/0242<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> An email I just received... I should probably add it to <a href="https://t.co/tvQqQJ4ogR"> https://t.co/tvQqQJ4ogR </a> <a href="https://t.co/am46Lu3wkc"> pic.twitter.com/am46Lu3wkc </a> </p> — Steven Bellovin (@SteveBellovin) <a href="https://twitter.com/SteveBellovin/status/829801259439947777"> February 9, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> It appears that people mistake <a href="https://www.ietf.org/rfc/rfc3514.txt"> this April 1st RFC </a> for a genuine one, the <a href="https://www.cs.columbia.edu/~smb/3514.html"> author has a page of replies here </a> . </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0242Fri, 10 Feb 2017 00:00:00 +0000 Headless CHIP WiFihttps://adventurist.me/posts/0243<p> I am working on a modification to <code> hostapd </code> and I really have to run this on linux. The pi I was planning to use has seems to have finally given up the ghost after 4 years of use. Never fear, I failed over to using the <a href="https://getchip.com"> chip </a> , that came with my pocketchip flashed with the headless firmware. </p> <p> The chip will use the microusb connection as a serial port by default, similar to the way the BBB uses the usb port to do ethernet. With a serial connection, I needed to figure out how to get the chip onto wifi. </p> <p> There is a command line tool for interacting with network manager <a href="https://docs.getchip.com/chip.html#wifi-connection"> listed in the chip documentation </a> . <code> nmcli </code> is a pretty great tool for network access. </p> <pre><code>$ nmcli device wifi list * SSID MODE CHAN RATE SIGNAL BARS SECURITY * HameNetwork Infra 11 54 Mbit/s 100 ▂▄▆█ WPA2 NetGear-AWQ4D8 Infra 1 54 Mbit/s 69 ▂▄▆_ WPA1 WPA2 BTWifi-X Infra 6 54 Mbit/s 30 ▂___ WPA2 802.1X BTWifi-with-FON Infra 6 54 Mbit/s 30 ▂___ -- </code></pre> <p> Better yet, there is a <code> nmtui </code> interface that presents a nice ncurses way to configure the network. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0243Sat, 11 Feb 2017 00:00:00 +0000 Ethics in Internet Archivinghttps://adventurist.me/posts/0244<p> The <a href="http://archive.org/"> Internet Archive </a> is my favourite thing on the internet, it is much much more than just the <a href="https://archive.org/web/"> wayback machine </a> . It is a massive archive of human culture, it might be one of the most important things being created right now. </p> <p> There is much more information being added to the IA now than any one person could process themselves. But it isn't that hard for individuals to pick an upload or a topic and process through the files and provide some sort of best of list. </p> <p> The video below is a chat about archiving, I think the most important take away is that we really need people to review the material and make sections accessible. </p> <p> Paraphrased: </p> <pre><code>I am waiting for someone to go through 200 floppy discs and write a blogpost: "I looked at all this junk, these 7 are great." </code></pre> <iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/Wn_WPK-xFoQ?rel=0" width="560"> </iframe> <hr/> <p> <a href="http://adventurist.me/posts/0238"> It </a> <a href="http://adventurist.me/posts/0239"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0240"> makes </a> <a href="http://adventurist.me/posts/0241"> seven </a> <a href="http://adventurist.me/posts/0242"> days </a> of <a href="http://adventurist.me/posts/0243"> writing </a> . </p> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0244Sun, 12 Feb 2017 00:00:00 +0000 Archive this page nowhttps://adventurist.me/posts/0245<p> The <a href="https://archive.org/"> Internet Archive's </a> <a href="https://archive.org/web"> Wayback Machine </a> has an 'archive this page now' button, which I know I was aware of, but I hadn't ever used it. <a href="https://www.youtube.com/watch?v=Wn_WPK-xFoQ"> Watching this chat </a> about archiving I thought I would have a look at it. </p> <p> <a href="/images/savepagenow.png"> <img src="/images/savepagenow.png"/> </a> </p> <p> My preferred option would be to add a hook to my post script that triggers the IA to scrap any new pages. Poking around the <a href="https://archive.org/about/faqs.php"> FAQ </a> and the <a href="https://archive.org/help/wayback_api.php"> scant API page </a> didn't reveal any recommendations for how to use the tools. With no advice I tried <code> curl </code> with the URL they used: </p> <pre><code>curl https://web.archive.org/save/http://adventurist.me/posts/0244 </code></pre> <p> That URL worked great, the <a href="http://web.archive.org/web/*/http://adventurist.me/posts/0244"> history page </a> now has a new scrap entry from today. Having done that I started looking to see how well covered my site was, it turns out very few pages have been captured into the global history. </p> <p> Seems like an easy fix: </p> <pre><code>curl -s -S "https://web.archive.org/save/http://adventurist.me/posts/0[040-243]" &gt; /dev/null </code></pre> <hr/> https://adventurist.me/posts/0245Sun, 12 Feb 2017 00:00:00 +0000 Assorted CHIP Stuffhttps://adventurist.me/posts/0246<p> Some stuff from playing with the stupidly named <a href="https://getchip.com"> CHIP </a> . </p> <h2> Battery </h2> <p> There is a script shipped with the CHIP images that will dump some information from the battery controller. Which is sort of useful I guess. </p> <pre><code>[chip@chip] $ sudo battery.sh BAT_STATUS=0 CHARG_IND=1 BAT_EXIST=1 CHARGE_CTL=0xc9 CHARGE_CTL2=0x45 Battery voltage = 3930.3mV Battery discharge current = 0mA Battery charge current = 882.5mA Internal temperature = 51.9c </code></pre> <h2> LEDs </h2> <p> There are two leds on board, a pink one that is directly wired into power and a status led connected over i2c. The led can be control directly over i2c with the <code> i2cset </code> command. </p> <pre><code>[chip@chip] $ sudo i2cset -f -y 0 0x34 0x93 0x0 #turn off [chip@chip] $ sudo i2cset -f -y 0 0x34 0x93 0x1 #turn on </code></pre> <p> On my CHIP image the led is showing some sort of heartbeat that isn't stopped when I manually intervene. On their forums the <code> i2cset </code> method is reccomended to control the led, but the heartbeat made this impossible. </p> <p> After a ton of poking and searching, trying to see if you can get <code> strace </code> to log processes that access a path (doesn't look like you can) I came across <a href="https://getchip.com"> ledtrig-cpu in the dmesg </a> . </p> <pre><code>[ 2.315000] ledtrig-cpu: registered to indicate activity on CPUs </code></pre> <p> <code> ledtrig-cpu </code> is a kernel module for showing event status on built in leds, there is <a href="http://www.crashcourse.ca/wiki/index.php/LEDs_on_the_BBB"> some inscruitable BBB </a> documentation that somewhat shows how to control it. </p> <p> In <code> /sys/class </code> there is an entry for each on the leds on board, listed with their colour. We can have a play with the led by looking at the following: </p> <pre><code>[root@chip] # cd /sys/class/leds/chip:white:status [root@chip] # ls brightness device max_brightness power subsystem trigger uevent [root@chip] # cat brightness 0 [root@chip] # cat max_brightness 255 [root@chip] # echo 24 &gt; brightness [root@chip] # echo 10 &gt; brightness [root@chip] # echo 255 &gt; brightness [root@chip] # echo 0 &gt; brightness </code></pre> <p> Changing the value in <code> brightness </code> didn't dim the STAT led at all, I can only set it on or off. </p> <pre><code>[root@chip] # cat trigger [none] kbd-scrollock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock nand-disk usb-gadget usb-host axp20x-usb-online timer oneshot heartbeat backlight gpio cpu0 default-on transient flash torch mmc0 rfkill0 rfkill1 rfkill2 rfkill3 </code></pre> <p> The trigger functionality was much more fun. Trigger modes can be changed by writing their name to the file </p> <pre><code>[root@chip] # echo backlight &gt; trigger [root@chip] # echo transient &gt; trigger [root@chip] # echo torch &gt; trigger [root@chip] # echo mmc0 &gt; trigger [root@chip] # echo timer &gt; trigger </code></pre> <p> Setting the trigger mode to <code> timer </code> added two more files the <code> /sys </code> entry: </p> <pre><code>[root@chip] # ls brightness delay_off delay_on device max_brightness power subsystem trigger uevent [root@chip] # cat delay_on 500 [root@chip] # cat delay_off 500 [root@chip] # echo 2000 &gt; delay_off </code></pre> <p> We can restore the trigger to the <code> heartbeat </code> with: </p> <pre><code>[root@chip] # echo heartbeat &gt; trigger </code></pre> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0246Mon, 13 Feb 2017 00:00:00 +0000 This Skull thinghttps://adventurist.me/posts/0247<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> . <a href="https://twitter.com/BSidesSF"> @BSidesSF </a> <a href="https://t.co/QqPNngF6Cc"> pic.twitter.com/QqPNngF6Cc </a> </p> — Dan Tentler (@Viss) <a href="https://twitter.com/Viss/status/831590285821894656"> February 14, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0247Tue, 14 Feb 2017 00:00:00 +0000 FOSDEM Talk Videoshttps://adventurist.me/posts/0248<p> It looks like all the FOSDEM 2017 videos are up and available. Direct links for my two talks: </p> <ol> <li> <a href="https://video.fosdem.org/2017/K.3.401/qos.vp8.webm"> QoS Challenges fro Realtime Traffic </a> </li> <li> <a href="https://video.fosdem.org/2017/K.3.401/qos.vp8.webm"> Transport Evolution on top of the BSDs </a> </li> </ol> <p> <a href="http://adventurist.me/posts/0236"> I posted the slides earlier here </a> </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0248Thu, 16 Feb 2017 00:00:00 +0000 Changing font size in urxvt https://adventurist.me/posts/0249<p> I finally had the need to dynamically change my font size in urxvt. If you search you will find keybindings to do this, such as the ones <a href="https://bbs.archlinux.org/viewtopic.php?id=44121"> recommended in this thread </a> . With my teeny planck keyboard, <code> i3 </code> , and <code> tmux </code> I don't really have room in my head for learning other keybindings. </p> <p> In that thread there is also a <code> printf </code> command that changes the font size via a terminal escape code. </p> <pre><code>alias biggest="printf '\33]50;%s\007' \"xft:Source Code Pro:pixelsize=30\"" alias big="printf '\33]50;%s\007' \"xft:Source Code Pro:pixelsize=20\"" alias small="printf '\33]50;%s\007' \"xft:Source Code Pro:pixelsize=10\"" alias teeny="printf '\33]50;%s\007' \"xft:Source Code Pro:pixelsize=8\"" alias normal="printf '\33]50;%s\007' \"xft:Source Code Pro:pixelsize=12\"" </code></pre> <p> I added the above aliases to my <code> zshrc </code> . </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0249Fri, 17 Feb 2017 00:00:00 +0000 It's Just Emulationhttps://adventurist.me/posts/0250<p> I have done a lot today, but accomplished very little. I think more often than not these days happen. Here is a cool talk about archivist activities around games: </p> <iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/HLWY7fCXUwE?rel=0" width="560"> </iframe> <hr/> <p> <strong> Reading: </strong> Diamond Age </p> https://adventurist.me/posts/0250Sat, 18 Feb 2017 00:00:00 +0000 Kaitai Struct Andes firmware imagehttps://adventurist.me/posts/0251<p> I have added some parsing data for the <a href="https://github.com/kaitai-io/kaitai_struct_formats/pull/24"> andes core firmware format </a> I wrote <a href="http://adventurist.me/posts/0225/"> about before </a> . <code> kaitai </code> is quite nice to write binary formats out with the result is reasonably understandable: </p> <pre><code>meta: id: andes_firmware endian: le seq: - id: image_header type: image_header size: 32 - id: ilm size: image_header.ilm_len - id: dlm size: image_header.dlm_len types: image_header: seq: - id: ilm_len type: u4 - id: dlm_len type: u4 - id: fw_ver type: u2 - id: build_ver type: u2 - id: extra type: u4 - id: build_time type: str size: 16 encoding: UTF-8 </code></pre> <p> The power of <code> kaitai </code> comes from its integration into languages, there is a compiler output to dot that you can <a href="http://kaitai.io/repl/index.html"> play with online </a> . Using that compiler I could generate a png from the dot file like so: </p> <pre><code>dot -Tpng andes.dot &gt; andes.png </code></pre> <p> <a href="/images/andesfirmware.png"> <img src="/images/andesfirmware.png"/> </a> </p> https://adventurist.me/posts/0251Sat, 18 Feb 2017 00:00:00 +0000 70cm Radiohttps://adventurist.me/posts/0252<p> We finally managed to get the programming software, radios and cables in the same room for the Motorola GM4340s we have. The radios are for doing 70cm packet data in Aberdeen, with them finally programmed and tested we need to make a computer radio interface. </p> <p> <a href="/images/gm340connectorpinout.jpg"> <img src="/imagessmall/gm340connectorpinout.jpg"/> </a> </p> <p> The GM340 has an accessory connector on the rear, rather than hacking together something using the microphone jack we can use this. The connector is 0.1" pitch so we can just connect female pin headers to it. </p> <p> <a href="/images/gm340hackedconnector.jpg"> <img src="/imagessmall/gm340hackedconnector.jpg"/> </a> </p> <p> Our connector needs to hook into audio in, audio out, PTT and ground. I soldered these connections on a strip of female pin header and connected them to two TRRS jacks that were lying around. I pulled off the PTT and a ground line to another block of female header so we could connect that to a GPIO on a pi. </p> <p> With this hacked together connector we were able to do some packet between a pi and another radio. </p> <hr/> <p> <a href="http://adventurist.me/posts/0246"> It </a> <a href="http://adventurist.me/posts/0247"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0248"> makes </a> <a href="http://adventurist.me/posts/0249"> seven </a> <a href="http://adventurist.me/posts/0250"> days </a> of <a href="http://adventurist.me/posts/0251"> writing </a> . </p> <p> <strong> Reading: </strong> Diamond Age, Crooked Little Vein </p> https://adventurist.me/posts/0252Sun, 19 Feb 2017 00:00:00 +0000 mosh NAT Scripthttps://adventurist.me/posts/0253<p> <a href="http://adventurist.me/posts/0120"> In the past </a> I required a custom script to <code> mosh </code> into my desktop, I was <a href="https://gist.github.com/tribut/5285883"> updating the script I use for this </a> last night when I discovered it was no longer needed. I figured I might as well post the script here in case it helps someone else. </p> <pre><code>#!/bin/sh # ########################################################## # # wrapper for mosh to work with ssh's proxycommand directive # # this only makes sense if the machine is directly reachable # # from the internet using udp. # # ########################################################## # THISSCRIPT="`basename \"$0\"`" REMOTE="$1" REMOTEIP="$2" NUM=`od -An -N1 -i /dev/random` PORT=$((60000+NUM)) debug() { echo "[$THISSCRIPT] $@" &gt;&amp;2 } usage() { debug "use me like this: $THISSCRIPT host [ip]" } # some default values if [ -z "$REMOTEIP" ]; then if [ -z "$REMOTE" ]; then usage exit 1 fi # does the remote have a hostname listed in .ssh/config REMOTEHOST="`grep -E -C1 \"^Host ([a-zA-Z0-9 ]+ )?$REMOTE( [a-zA-Z0-9 ]+)?$\" ~/.ssh/config | tail -n1 | gsed -r 's/\W*Hostname\W+//'`" if [ -z "$REMOTEHOST" ]; then REMOTEHOST="$REMOTE"; fi # resolve hostname REMOTEIP=`host -4 -t a $REMOTEHOST | head -n 1 | awk '{print $4}'` if [ -z "$REMOTEIP" ]; then debug "could not resolve hostname $REMOTE" exit 1 fi fi debug "starting mosh-server on remote server $REMOTE $REMOTEIP:$PORT" MOSHDATA="`ssh -t \"$REMOTE\" mosh-server new -i $REMOTEIP -p $PORT | grep '^MOSH' | tr -d \"\r\n\"`" if [ -z "$MOSHDATA" ]; then debug "mosh-server could not be started" exit 1 fi PORT="`echo -n \"$MOSHDATA\" | awk '{print \$4}'`" MKEY="`echo -n \"$MOSHDATA\" | awk '{print \$5}'`" if [ -z "$PORT" -o -z "$MKEY" ]; then debug "got no parseable answer" exit 1 fi debug "starting local mosh-client to $REMOTEIP $PORT" MOSH_KEY="$MKEY" exec mosh-client "$REMOTEIP" "$PORT" </code></pre> <hr/> <p> <strong> Reading: </strong> Crooked Little Vein </p> https://adventurist.me/posts/0253Mon, 20 Feb 2017 00:00:00 +0000 Know your Rocketshttps://adventurist.me/posts/0254<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Detailed Tech Overview of the venerable <a href="https://twitter.com/hashtag/Soyuz?src=hash"> #Soyuz </a> U, flying its last mission today: <a href="https://t.co/03JBYQBtJr"> https://t.co/03JBYQBtJr </a> <a href="https://t.co/xmHOf51voA"> pic.twitter.com/xmHOf51voA </a> </p> — ISS Updates (@ISS101) <a href="https://twitter.com/ISS101/status/834269844010844160"> February 22, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Crooked Little Vein </p> https://adventurist.me/posts/0254Wed, 22 Feb 2017 00:00:00 +0000 SHA1 Hash Collisionhttps://adventurist.me/posts/0255<p> Its really windy, so windy that this plane couldn't land first try: </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> It’s windy today: here’s 500 tons of super-jumbo going wobble on the wing! <a href="https://t.co/VGjfOctkqg"> https://t.co/VGjfOctkqg </a> </p> — Charlie Stross (@cstross) <a href="https://twitter.com/cstross/status/834760874409750528"> February 23, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> <a href="https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html"> Google found a SHA1 Collision </a> their blog post is much smarter than anything I could write about it. </p> <hr/> <p> <strong> Reading: </strong> Babylon's Ashes, Diamond Age </p> https://adventurist.me/posts/0255Thu, 23 Feb 2017 00:00:00 +0000 RF Path Probinghttps://adventurist.me/posts/0256<p> We are trying to put up a 70cm amateur radio packet network, I started this by <a href="http://adventurist.me/posts/0252"> hacking together a connector </a> last week. I really need to figure out where I can reach on 70cm. </p> <p> <a href="https://foxk.it/"> Hibby </a> and I tried to voice between my home and his, but were unable to hear each other. That isn't so bad, we really want to be able to get into my office where <a href="https://iain.learmonth.me/"> a friend </a> can host a packet repeater. </p> <p> I have remote access to work, so if I can get audio out of a radio onto the internet I will be able to do a remote check. The plan was to setup a pi, with an [rtl-sdr][6] and [rtl_fm][7] doing demodulation, ssh in and stream the audio back to where ever I am. </p> <p> <code> rtl_fm </code> is an excellent tool, it can connect to an rtl-sdr stick and provide samples from the sdr. It can give you raw iq output or demodulate audio. This <code> rtl_fm </code> command can be used with the <code> play </code> (from the [sox][8] package to play broadcast fm. </p> <pre><code>$ rtl_fm -M wbfm -f 90.9M | play -r 32k -t raw -e s -b 16 -c 1 -V1 - </code></pre> <p> <a href="http://ywwg.com/wordpress/?p=1201"> I referred to a blog post </a> with an example of streaming audio over ssh using sox. To test audio streaming over ssh I <a href="https://williamwaitewright.bandcamp.com/album/the-dance-of-hela"> pushed a copy of this amazing album </a> and got lost for a while listening to it. </p> <pre><code>$ ssh -C sdr@192.168.1.181 "cat test.flac"| play -q - </code></pre> <p> <code> rtl_fm </code> will happily dump samples to stdout, a test with broadcast fm over ssh is: </p> <pre><code>$ ssh -C localhost "rtl_fm -M wbfm -f 90.9M " | play -r 32k -t raw -e s -b 16 -c 1 -V1 - </code></pre> <p> Broadcast FM is an excellent way to figure out if your demodulate pipeline is working, it is always running and it shits out a fuckton of power. </p> <p> The command to demod narrow fm looks like: </p> <pre><code>$ rtl_fm -M fm -s 1000000 -f 145.800M -r 48k | play -r 32k -t raw -e s -b 16 -c 1 -V1 - </code></pre> <p> And it can be run over ssh: </p> <pre><code>$ ssh -C localhost "rtl_fm -M fm -s 1000000 -f 433.550M -r 48k "| play -r 48k -t raw -e s -b 16 -c 1 -V1 - </code></pre> <p> Hibby and I tried some calls to this station from his, but I wasn't able to hear anything. Probably something to do with both of us being in buildings facing away from each other. I will give this a try from mine and see what happens. </p> <hr/> <p> <strong> Reading: </strong> Normal </p> <p> Of course before trying to do all this from my desktop I faffed about for two hours getting a pi up and running with FreeBSD. The pi wasn't able to handle the sdr without really choppy audio. Eventually while writing this up I noticed that the cable from the antenna was long enough to read my desktop. Oh well. </p> <p> <strong> Look it is post 0x100 </strong> </p> https://adventurist.me/posts/0256Fri, 24 Feb 2017 00:00:00 +0000 IETF Document to Bibtexhttps://adventurist.me/posts/0257<p> I am writing stuff up right now so I am not really doing anything that interesting. Users of latex for academic work will know the nightmare that is generating bibtex entries. Thankfully for ietf rfc and drafts entries are automatically generate. I found <a href="http://notesofaprogrammer.blogspot.co.uk/2014/11/bibtex-entries-for-ietf-rfcs-and.html"> this blog post </a> that includes a tool for looking up an entry and getting its bibtex. </p> <hr/> <p> <strong> Reading: </strong> Normal </p> https://adventurist.me/posts/0257Sat, 25 Feb 2017 00:00:00 +0000 curling down bibtex https://adventurist.me/posts/0258<p> When I wrote <a href="http://adventurist.me/posts/0258"> the last post </a> I really wanted to use <code> curl </code> to turn rfc numbers and drafts into <code> bibtex </code> entries. I did have a look, but I had other things to do that seem urgent and I didn't follow it through. </p> <p> <a href="/images/pageerrorsansdivrfc.png"> <img src="/images/pageerrorsansdivrfc.png"/> </a> </p> <p> That was lazy of me, the page will generate an error message with a url when given an rfc or draft that doesn't exist. I looked at this url with a valid rfc, but it wasn't clear how to turn the returned info into a <code> bibtex </code> entry. </p> <p> Stripping that div off the page makes the url visible: </p> <p> <a href="/images/pageerrorrfc.png"> <img src="/images/pageerrorrfc.png"/> </a> </p> <pre><code>Failed to read RFC or Internt-Draft resource at http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9999.xml </code></pre> <p> Using that url format with a valid rfc number (Our beloved <a href="https://www.ietf.org/rfc/rfc768.txt"> RFC768 </a> ) spits out this xml document: </p> <pre><code>$ curl http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.0768.xml &lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;reference anchor='RFC0768' target='http://www.rfc-editor.org/info/rfc768'&gt; &lt;front&gt; &lt;title&gt;User Datagram Protocol&lt;/title&gt; &lt;author initials='J.' surname='Postel' fullname='J. Postel'&gt;&lt;organization /&gt;&lt;/author&gt; &lt;date year='1980' month='August' /&gt; &lt;/front&gt; &lt;seriesInfo name='STD' value='6'/&gt; &lt;seriesInfo name='RFC' value='768'/&gt; &lt;seriesInfo name='DOI' value='10.17487/RFC0768'/&gt; &lt;/reference&gt; </code></pre> <p> That is how far I got when I gave up earlier. Looking at the page again I thought I might try looking at the network traffic it generates. </p> <p> <a href="/images/ffnetworktracerfc.png"> <img src="/images/ffnetworktracerfc.png"/> </a> </p> <p> That is much more interesting, the page itself is doing a request to <code> https://sysnetgrp.no-ip.org </code> . Lets try a <code> curl </code> there and see what we get: </p> <pre><code>$ curl "https://sysnetgrp.no-ip.org/rfc/rfcbibtex.php?type=RFC&amp;number=768" @techreport{RFC0768, author = {J. Postel}, title = {User Datagram Protocol}, howpublished = {Internet Requests for Comments}, type = {STD}, number = {6}, year = {1980}, month = {August}, issn = {2070-1721}, publisher = {RFC Editor}, institution = {RFC Editor}, url = {http://www.rfc-editor.org/rfc/rfc768.txt}, note = {\url{http://www.rfc-editor.org/rfc/rfc768.txt}}, } </code></pre> <p> Much better! </p> https://adventurist.me/posts/0258Sat, 25 Feb 2017 00:00:00 +0000 Don't use SHA1https://adventurist.me/posts/0259<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> 2005 John Gilmore vs Linus Torvalds on SHA1 "debate" in a nutshell (h/t <a href="https://twitter.com/zmanian"> @zmanian </a> ) <a href="https://t.co/mzUNaQPPF9"> https://t.co/mzUNaQPPF9 </a> <a href="https://t.co/VbwphiiNcj"> pic.twitter.com/VbwphiiNcj </a> </p> — Tony Arcieri (@bascule) <a href="https://twitter.com/bascule/status/835955041240416257"> February 26, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <a href="http://adventurist.me/posts/0253"> It </a> <a href="http://adventurist.me/posts/0254"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0255"> makes </a> <a href="http://adventurist.me/posts/0256"> seven </a> <a href="http://adventurist.me/posts/0257"> days </a> of <a href="http://adventurist.me/posts/0258"> writing </a> . </p> <p> Have you subscribed to <a href="http://orbitaloperations.com/"> orbital operations </a> yet? You should. </p> <p> <strong> Reading: </strong> Normal </p> https://adventurist.me/posts/0259Sun, 26 Feb 2017 00:00:00 +0000 Why can't I send UDP packets from a browser?https://adventurist.me/posts/0260<p> You can't because it is a terrible idea, <a href="http://new.gafferongames.com/post/why_cant_i_send_udp_packets_from_a_browser/"> and yet this post </a> explains a really reasonable way forward. My first thought was hopefully the same as yours, "That is absolute insanity, won't someone think of the DDOS?". Glenn Fiedler is responsible for the most <a href="http://gafferongames.com/networking-for-game-programmers/"> pervasive game networking tutorial </a> , it is the <a href="http://beej.us/guide/bgnet/"> beej net guide </a> for games. </p> <p> This isn't a general interface for UDP, that is of course insane. Instead it is networking library specifically for real time games. It uses http authentication to generate a security token then offers a frame locked secure datagram API for moving real time data. The proposed API has hard timeouts, latency and bandwidth expectations, really not useful for anything other than games. </p> <p> Right now there is a <a href="https://netcode.io"> c library available </a> on github. It will be interesting to see a prototype javascript interface. </p> <hr/> <p> <strong> Reading: </strong> Normal </p> https://adventurist.me/posts/0260Mon, 27 Feb 2017 00:00:00 +0000 Stupid Puzzle boxhttps://adventurist.me/posts/0261<p> The space was sent a cool puzzle box as part of a secret santa. One of the puzzles involves getting the output of a flashing light into an LDR on the other side of the box. I played with this with another member last week, we decided to try and decode the light output. </p> <p> I am sure we don't need to do this, but I wanted to try out my idea. He tried to use FinalCut to process a vide of the output, but this didn't work. I suggested we try breaking the video down to frames, running a brightness threshold over them, then generating a plot of the output. </p> <p> Turn the video into frames: </p> <pre><code>$ ffmpeg -i VID.mp4 -f image2 frames/image-%07d.png </code></pre> <p> We can use <code> convert </code> from <code> imagemagick </code> to threshhold an image, here we <code> convert </code> its colour space into hue saturation and brightness and resize the image down to 1x1. Convert will give a text description of what it did so we don't have loads of temporary images. </p> <p> I hand picked a 'dark' image: </p> <pre><code>$ convert dark.png -colorspace hsb -resize 1x1 txt:- # ImageMagick pixel enumeration: 1,1,65535,hsb 0,0: (10086,47272,7376) #27B81D hsb(55,72%,11%) </code></pre> <p> And a 'light' image: </p> <pre><code>$ convert light.png -colorspace hsb -resize 1x1 txt:- # ImageMagick pixel enumeration: 1,1,65535,hsb 0,0: (32525,17838,41551) #7F45A2 hsb(179,27%,63%) </code></pre> <p> I ran <code> convert </code> over each file with some <code> awk </code> magic: </p> <pre><code>for filename in frames/*png; do echo $filename convert $filename -colorspace hsb -resize 1x1 txt:- | tail -n 1 | awk '{ print $4}' | awk -F "," '{ print $3}' | sed -e "s/%)//" &gt;&gt; outfile done </code></pre> <p> <a href="/images/puzzleboxlightplot.png"> <img src="/images/puzzleboxlightplot.png"/> </a> </p> <p> I ran the outputfile through matplotlib to generate a nice plot of the light values. </p> <pre><code>import matplotlib.pyplot as plt values = [] with open("outfile", "r") as f: for line in f.readlines(): value = int(line) if value &gt; 40: value = 100 else: value = 10 values.append(value) plt.figure(figsize=(30,2)) plt.plot(values) plt.ylabel('brightness') plt.savefig("plot.png") </code></pre> <hr/> <p> The hardest part of this was getting the video off my phone, the most time consuming was installing matplotlib. </p> <p> <strong> Reading: </strong> Normal </p> https://adventurist.me/posts/0261Tue, 28 Feb 2017 00:00:00 +0000 Breadhttps://adventurist.me/posts/0262<p> Making bread seems important. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Loaf 1 <a href="https://t.co/viNe0MpgvF"> pic.twitter.com/viNe0MpgvF </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/837019440017510405"> March 1, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> I asked my father how I should start, how I should approach making bread for the first time. He told me just to follow the recipe on the packet of flour. Doing so seems to have worked out okay. </p> <p> Due to a misunderstanding about yeast I ended up making two loafs. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Load 2 <a href="https://twitter.com/hashtag/bread?src=hash"> #bread </a> <a href="https://t.co/uKOKJaRt8X"> pic.twitter.com/uKOKJaRt8X </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/837044241088016385"> March 1, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Normal </p> https://adventurist.me/posts/0262Wed, 01 Mar 2017 00:00:00 +0000 The Sky is not fallinghttps://adventurist.me/posts/0262<p> <a href="http://blog.erratasec.com/2017/03/some-comments-on-wikileaks-ciavault7.html"> Here is an article that explains in clear simple terms </a> why the CIA <a href="https://wikileaks.org/ciav7p1/"> Vault7 </a> leaks are not the end of the world. If you consider yourself technical (which you do, you are reading a <strong> blog </strong> after all) you really have to help constrain the insanity in the face of leaks. </p> <p> Just because you can read 'breaking signal by attacking the device' it does not mean that signal is broken. You have a responsibility to your friends and family, if they panic when they read the news and fall back to SMS because whatsapp is <em> broken </em> , the world is not becoming a better place. </p> <p> Read what trusted security people say, validate their comments, help your family. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> The Forgotten Abbey. <a href="https://twitter.com/hashtag/dailyart?src=hash"> #dailyart </a> <a href="https://t.co/tKjU8gBO8Z"> pic.twitter.com/tKjU8gBO8Z </a> </p> — Stephan Hövelbrinks (@talecrafter) <a href="https://twitter.com/talecrafter/status/839242124923129858"> March 7, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0262Wed, 08 Mar 2017 00:00:00 +0000 Deathhttps://adventurist.me/posts/0263<p> My chemex is dead. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> The chemex is dead :'( <a href="https://t.co/TzsrGfzeC4"> pic.twitter.com/TzsrGfzeC4 </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/837315821223428096"> March 2, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> The poor thing was murdered. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine </p> https://adventurist.me/posts/0263Thu, 02 Mar 2017 00:00:00 +0000 Please hold onhttps://adventurist.me/posts/0264<p> i <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/XwLAENeM7C"> pic.twitter.com/XwLAENeM7C </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/837694070814298112"> March 3, 2017 </a> </blockquote> </p> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Today was insanity with a lab going haywire and then revisions on a paper. I am heading south tomorrow which means pictures of trains and complaining about trains. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine </p> https://adventurist.me/posts/0264Fri, 03 Mar 2017 00:00:00 +0000 Train Wifihttps://adventurist.me/posts/0265<p> <a href="/images/scotrailtrain.jpg"> <img src="/imagessmall/scotrailtrain.jpg"/> </a> </p> <p> On a 'high speed train' which means it is a directish train that barely stops. The wifi is running through the GSM network which in Scotland means it is really spotty. Of course it is unsecured with a captive portal. It is surprising that there aren't more terrible people around. It would be pretty easy to run your own bridging access point. </p> <p> I saw an article this week that claimed something along the lines of "50% of mobile traffic is facebook". That makes sense, if most of the traffic is just a few sites (it is) and those sites have strong protections like certificate pinning, then it doesn't really matter if on hop 1 all of your traffic is exposed. </p> <p> It doesn't stop people fucking with you, but the apps should offer some protection. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine </p> https://adventurist.me/posts/0265Sat, 04 Mar 2017 00:00:00 +0000 #bread number 3https://adventurist.me/posts/0266<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Loaf #3 <a href="https://t.co/7a2ho647WU"> pic.twitter.com/7a2ho647WU </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/838489717834461184"> March 5, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Attempt number 3 at making bread, I was much closer to the recipe this time. I will be able to tell in the morning. I wanted to make buns this time, but I chickened out. I looked at the size of the dough ball and it looked like it would surely burn. </p> <p> The rest of the weekend I spent drinking, which is only interesting if you were both there and drunk. </p> <hr/> <p> <a href="http://adventurist.me/posts/0259"> It </a> <a href="http://adventurist.me/posts/0260"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0261"> makes </a> <a href="http://adventurist.me/posts/0262"> seven </a> <a href="http://adventurist.me/posts/0263"> days </a> of <a href="http://adventurist.me/posts/0264"> writing </a> . </p> <p> <strong> Reading: </strong> Gun Machine </p> https://adventurist.me/posts/0266Sun, 05 Mar 2017 00:00:00 +0000 802.Eleventyhttps://adventurist.me/posts/0267<p> <a href="/images/wifitestchamber.jpg"> <img src="/imagessmall/wifitestchamber.jpg"/> </a> </p> <p> <a href="https://arstechnica.com/information-technology/2017/03/802-eleventy-what-a-deep-dive-into-why-wi-fi-kind-of-sucks/"> This is an article on 802.11 and its problems </a> , the picture is from there and it is awesome. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine </p> https://adventurist.me/posts/0267Mon, 06 Mar 2017 00:00:00 +0000 If your terminal can't render this ◕ ◡ ◕ you have a problemhttps://adventurist.me/posts/0268<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Imagine a world where the actual CIA spends its time figuring out how to spy on you through your TV. That's today. <a href="https://t.co/dQHBrsyIoI"> https://t.co/dQHBrsyIoI </a> </p> — Edward Snowden (@Snowden) <a href="https://twitter.com/Snowden/status/839208458184441856"> March 7, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> It is the end of the world! </p> <p> <a href="https://wikileaks.org/ciav7p1/cms/page_17760284.html"> The collection of Japanese faces is the best part of the leak ◕ ◡ ◕ </a> . </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0268Tue, 07 Mar 2017 00:00:00 +0000 Defrag the Fake Newshttps://adventurist.me/posts/0269<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="und"> <a href="https://t.co/Di70dMOrsB"> pic.twitter.com/Di70dMOrsB </a> </p> — Archillect (@archillect) <a href="https://twitter.com/archillect/status/839860854002696193"> March 9, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> There is nothing good to report, <a href="http://hultbergs.org/defrag/"> maybe running a good old fashioned tool can help? </a> </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0269Thu, 09 Mar 2017 00:00:00 +0000 SSL vhost stuffhttps://adventurist.me/posts/0270<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Ode To My Family <a href="https://twitter.com/hashtag/comic?src=hash"> #comic </a> <a href="https://twitter.com/hashtag/sysadmin?src=hash"> #sysadmin </a> <a href="https://twitter.com/hashtag/linux?src=hash"> #linux </a> <a href="https://twitter.com/hashtag/development?src=hash"> #development </a> <a href="https://twitter.com/hashtag/CloudComputing?src=hash"> #CloudComputing </a> <a href="https://t.co/hu0A3odXn2"> https://t.co/hu0A3odXn2 </a> <a href="https://t.co/RiawlwbyzA"> pic.twitter.com/RiawlwbyzA </a> </p> — turnoff.us (@turnoff_us) <a href="https://twitter.com/turnoff_us/status/839916956887175169"> March 9, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Not that I can fix any of those either. </p> <hr/> <p> I set up <a href="https://letsencrypt.org/"> ssl with Let's Encrypt </a> for <a href="https://trace.erg.abdn.ac.uk"> an experiment </a> yesterday following a handy <a href="https://wiki.freebsd.org/BenWoods/LetsEncrypt"> guide on the FreeBSD wiki </a> . The guide suggested <a href="https://mozilla.github.io/server-side-tls/ssl-config-generator/"> this mozilla tool </a> for generating server configs with good parameters. </p> <p> With the tool I was only able to hit an A rating on the <a href="https://www.ssllabs.com/ssltest/"> ssllabs </a> testing site, the A+ rating was annoyingly elusive. I am using <code> nginx </code> as vhost for a go web service, for HSTS a header has to be appended to the response. The config from Mozilla does this for <code> nginx </code> like this: </p> <pre><code># HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) add_header Strict-Transport-Security max-age=15768000; </code></pre> <p> But, the hosted application has control over the response headers. <code> nginx </code> can be configured to always set the header with the <code> always </code> flag: </p> <pre><code># HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) add_header Strict-Transport-Security "max-age=15768000" always; </code></pre> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0270Sat, 11 Mar 2017 00:00:00 +0000 PXE Boot FreeBSD Installhttps://adventurist.me/posts/0271<p> I am finally starting to make a dent in the pile of things I could be using, but aren't. A friend gave me a motherboard, case, graphics card and power supply over about 18 months, in the past fortnight I finally put it all together and had a working computer. </p> <p> <a href="/images/netbootxyzpxeboot.jpg"> <img src="/imagessmall/netbootxyzpxeboot.jpg"/> </a> </p> <p> The machine came up no problem, one of the drives I recycled from another machine and it already had FreeBSD on it. It turns out the motherboard I was given doesn't want to boot from USB at all. </p> <p> We tried all the different configurations and eventually fell back to using PXE. There is an excellent graphic PXE boot environment available from <a href="http://netboot.xyz"> netboot.xyz </a> , there was a FreeBSD entry in the OS boot menu, but it this is not a supported boot method for FreeBSD. </p> <p> netboot.xyz uses a <a href="http://mfsbsd.vx.sk/"> mfsboot FreeBSD image </a> to launch a live system over PXE. The image is created with a set of <a href="https://github.com/mmatuska/mfsbsd"> scripts available on github </a> . FreeBSD supports booting from a bundled memory image configured with the kernel config, it looks like that is the feature that makes all of this possible. </p> <hr/> <p> <a href="http://adventurist.me/posts/0265"> It </a> <a href="http://adventurist.me/posts/0266"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0267"> makes </a> <a href="http://adventurist.me/posts/0268"> seven </a> <a href="http://adventurist.me/posts/0269"> days </a> of <a href="http://adventurist.me/posts/0270"> writing </a> . </p> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0271Sun, 12 Mar 2017 00:00:00 +0000 GSM CellIDhttps://adventurist.me/posts/0272<p> With installing my new desktop I am also going to move my 4G modem. I wanted to get some signal strength numbers so I could be sure I wasn't completely ruining things for myself. My router has a hand status page that among sensitive private information has signal strength, SNR and noise numbers. </p> <p> <a href="/images/4gmodemstatus.png"> <img src="/images/4gmodemstatus.png"/> </a> </p> <p> On that page there is also a <code> CELL_ID </code> field. The <a href="https://en.wikipedia.org/wiki/Cell_ID"> field is the unique network id </a> of the base station you are connected to. This is apparently useful for location lookups, the wikipedia page has a list of databases that use this field. </p> <p> I tried to feed my <code> CELL_ID </code> into some of these databases, but they all wanted more information. <code> MCC </code> and <code> MCN </code> are pretty easy to find, there is a big table <a href="https://en.wikipedia.org/wiki/Cell_ID"> on the wikipedia page </a> . I was not able to resolve down a <code> LAC </code> from anywhere. There are apps I could try, but I don't really want to install any of them on my phone. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0272Mon, 13 Mar 2017 00:00:00 +0000 Dewatering a pdfhttps://adventurist.me/posts/0273<p> <a href="http://www.internetsociety.org/deploy360/resources/ebook-ipv6-for-ipv4-experts-available-in-english-and-russian/"> There is this pdf ebook </a> that I want to read, but it has a really annoying 'DRAFT' water mark on every page. I looked for an automatic way to remove the watermark and found a <a href="https://superuser.com/a/536644"> really handly superuser </a> answer that completely covers it. </p> <pre><code>$ pdftk original.pdf output uncompressed.pdf uncompress $ sed -e "s/watermarktextstring/ /" uncompressed.pdf &gt; unwatermarked.pdf $ pdftk unwatermarked.pdf output fixed.pdf compress </code></pre> <p> Before I ran that I tried grepping through the pdf for the string 'DRAFT', now the pdf was compressed so I didn't find anything. I wanted to make sure the watermark was just a string so I extract just the first page with <code> pdfseperate </code> . </p> <pre><code>$ pdfseparate -f 1 -l 1 ipv6_for_ipv4_experts_en_a4.pdf out.pdf </code></pre> <p> I opened <code> out.pdf </code> with <code> inkscape </code> and played with editing the watermark, which was indeed just text. I then round tripped the pdf through <code> pdftk </code> and generated a watermark free pdf. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0273Tue, 14 Mar 2017 00:00:00 +0000 UDP Options with Scapyhttps://adventurist.me/posts/0274<p> I am working on an implementation of the <a href="https://www.ietf.org/id/draft-touch-tsvwg-udp-options-05.txt"> UDP Options draft </a> at work, this morning I got the <code> udp_input </code> side of processing building. This needs to be test and gotten working before moving on, before setting up some VMs to test this I need a way to generate packets with UDP Option data appended. </p> <p> This seemed like a great occasion to use <code> go </code> a little more. There is the <a href="gopacket"> gopacket </a> library from google that provides raw packet stuff. </p> <p> images/ <a href="/images/gopacketnonesense.png"> <img src="/images/gopacketnonesense.png"/> </a> </p> <p> I tried for ages to put together a send example that didn't depend on linux. Eventually I got to the point where I could form crazy malformed arp packets. I got to the point of generating the above traces in <code> wireshark </code> , for some reason go was sticking 16 bytes into the address fields and creating madness. You will note in the above arp packet that the length is much longer, that is because go is appending some extra data for shits and giggles. </p> <p> Giving up on go I had a look at the python libraries for generating packets, they are all about the same level of insanity. The <a href="https://pathspider.net"> pathspider </a> project has some <a href="https://github.com/mami-project/pathspider/blob/master/pathspider/plugins/udpopts.py"> test probes </a> for UDP Options using <code> scapy </code> . </p> <p> <a href="/images/udpoptionswireshark.png"> <img src="/images/udpoptionswireshark.png"/> </a> </p> <p> <code> pathspider </code> is a lot of stuff to pull in to generate UDP datagrams, I extracted out the relevant stuff to use with <code> scapy </code> directly: </p> <pre><code>from scapy.all import IP from scapy.all import UDP from scapy.all import * if __name__ == "__main__": ip = IP(src="139.133.204.4", dst="139.133.204.64") udp = UDP(sport=2600, dport=2600) pkt = ip/udp/"Hello world" pkt.getlayer(1).len = len(pkt.getlayer(1)) #force UDP len send((pkt/"\x01\x01\x01\x00")) </code></pre> <p> You can add the numbers together to find that the extra option space is include, you can also see the <code> 01 01 01 00 </code> bytes at the end of the packet which are the options I add. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0274Wed, 15 Mar 2017 00:00:00 +0000 3 Commands to bhyvehttps://adventurist.me/posts/0275<p> Get a vm image and decompress it: </p> <pre><code>$ fetch http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/11.0-RELEASE/amd64/Latest/FreeBSD-11.0-RELEASE-amd64.raw.xz $ xz -d FreeBSD-11.0-RELEASE-amd64.raw.xz </code></pre> <p> 3 commands to FreeBSD runningin bhyve on FreeBSD: </p> <pre><code># kldload vmm # ifconfig tap0 create # sh /usr/share/examples/bhyve/vmrun.sh -c 4 -m 1024M -t tap0 -d FreeBSD-11.0-RELEASE-amd64.raw test </code></pre> <p> Of course that misses out loads of stuff, the network won't work for one. Real instructions are in the <a href="https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html"> handbook </a> . Following in <a href="https://www.strugglingcoder.info/index.php/bhyve-setup-for-tcp-testing/"> Hiren Panchasara's </a> foot steps I am going to use bhyve to test and develop some network modification in FreeBSD. </p> <p> I might try and automate the deployment a bit, so I can run a single command and have fresh vms on a configured network up and running. I suspect I will have to make some changes that involve rebuilding the whole world tree, if that is the case I will be trying to figure out how to get builds much much faster. </p> <hr/> <p> <strong> Reading: </strong> Gun Machine, The Difference Engine </p> https://adventurist.me/posts/0275Thu, 16 Mar 2017 00:00:00 +0000 100kmhttps://adventurist.me/posts/0276<p> At the end of this month they will stop running buses to where I live, it seems basic services aren't available to those that aren't quite rural enough. Preempting the hard switch over I started cycling to work this week. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> <a href="https://twitter.com/mgdm"> @mgdm </a> this is what the tire whole looked like <a href="https://t.co/7ZplhtlvCQ"> pic.twitter.com/7ZplhtlvCQ </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/842788541272903680"> March 17, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Work is not close (hence the whole bus thing), at 20km a day commuting I have done the first 100km week of what will probably be many. Week one has seen two puncture from a hole in my tyre, hopefully I will have better luck next week. </p> <hr/> <p> <strong> Reading: </strong> The Difference Engine </p> https://adventurist.me/posts/0276Fri, 17 Mar 2017 00:00:00 +0000 The Mess We're Inhttps://adventurist.me/posts/0277<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/lKXe3HUG2l4?rel=0" width="560"> </iframe> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0277Sat, 18 Mar 2017 00:00:00 +0000 haskell and git annexhttps://adventurist.me/posts/0278<p> I have finally after nearly a year started setting up data stores with <a href="https://git-annex.branchable.com/walkthrough/#index11h2"> git annex </a> , I am going to try it out with my stash of datasheets, documents and books for a while. If it holds up to what I expect I will use it for the rest of my static binary media, video, audio and images. </p> <p> I have also been revisiting the infuriating torture of learning haskell, with the <a href="https://book.realworldhaskell.org/"> real world haskell book </a> . I did a haskell course and uni and it was horrible, so far the real world haskell book has been equally unenjoyable and slow. </p> <p> <code> git annex </code> is written in haskell so the two things sort of tie together. Not that I plan to hack on <code> git annex </code> . </p> <hr/> <p> <a href="http://adventurist.me/posts/0272"> It </a> <a href="http://adventurist.me/posts/0273"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0274"> makes </a> <a href="http://adventurist.me/posts/0275"> seven </a> <a href="http://adventurist.me/posts/0276"> days </a> of <a href="http://adventurist.me/posts/0277"> writing </a> . </p> <p> <strong> Reading: </strong> The Moon is a Hard Mistress, The Difference Engine </p> https://adventurist.me/posts/0278Sun, 19 Mar 2017 00:00:00 +0000 The entire planethttps://adventurist.me/posts/0279<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> 11:38 on Saturday March 18th, over the South Atlantic Ocean <a href="https://t.co/PrY4GTXV3c"> pic.twitter.com/PrY4GTXV3c </a> </p> — DSCOVR:EPIC (@dscovr_epic) <a href="https://twitter.com/dscovr_epic/status/843928991702695937"> March 20, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> Look at this amazing gem floating in space. </p> <p> Paper deadline was today, I have to set up a large survey this week, but I am starting to surface again from this insane series of deadlines. There is a lot of FreeBSD Kernel work coming up, hopefully both at work and at home. </p> <p> I have already poking at an implementation of UDP Options, there is also the possibility of me being given a TCP ABE implementation to port. For this work, unlike the stuff I did before for NewCWV I am going to provide a solid set of tests in the form of VM images. To do that I will need to figure out generation of images from just a git commit id. </p> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0279Mon, 20 Mar 2017 00:00:00 +0000 UUCPhttps://adventurist.me/posts/0280<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Oh heck yes! <a href="https://t.co/FR8ErNif0x"> pic.twitter.com/FR8ErNif0x </a> </p> — Seth Morabito (@Twylo) <a href="https://twitter.com/Twylo/status/844303459973132288"> March 21, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> <a href="https://github.com/DoctorWkt/4bsd-uucp/"> The Simulator Image </a> and the <a href="https://github.com/DoctorWkt/4bsd-uucp/blob/4.3BSD/uucp.png"> linked picture </a> </p> <hr/> <p> <a href="https://www.alchemistowl.org/pocorgtfo/"> POC||GTFO 14 </a> dropped today. </p> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0280Tue, 21 Mar 2017 00:00:00 +0000 The unix mail commandhttps://adventurist.me/posts/0281<p> <a href="https://xkcd.com/1728/"> This xkcd has been relevant today </a> </p> <p> <a href="/images/cron_mail.png"> <img src="/images/cron_mail.png"/> </a> </p> <p> If you wanted to know how to use the mail command you could <a href="http://www.johnkerl.org/doc/mail-how-to.html"> look here </a> . </p> <pre><code>&gt; d * </code></pre> <p> Might just make it all go away. </p> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0281Wed, 22 Mar 2017 00:00:00 +0000 Help make the internet betterhttps://adventurist.me/posts/0282<p> <a href="http://adventurist.me/posts/0230/"> Back in January </a> I wrote about a small tool I had thrown together to do some internet measurements. Back then we decided not to take the next step and attempt to roll the tool out to a large audience. </p> <p> We have decided we need the network edge data after all and I need your help. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Want to help measure the internet? You could do it from the pub <a href="https://t.co/drfs5wBvZl"> https://t.co/drfs5wBvZl </a> <a href="https://t.co/thD8zMbk2H"> pic.twitter.com/thD8zMbk2H </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/844933351584780288"> March 23, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> First, you can get edgetrace from <a href="https://trace.erg.abdn.ac.uk"> https://trace.erg.abdn.ac.uk </a> </p> <p> <strong> In short: </strong> We need measurements from as many network <em> edges </em> as possible. Places where people connect are almost always near the edges of the internet. Your home, office, the pub or a park with WiFi is probably near the edge. We need your help by running our tool from these sorts of places. The more the better. </p> <p> <strong> In full: </strong> Packets on the internet are given a Best Effort service by default, everything is treated the same. The packets for your video call are treated the same way as a large download, but that means there is more latency when queues grow and packets in your file transfer are dropped when there is network pressure. With Quality of Service and Active Queue Management we can build networks that allow latency sensitive packets through the queue quicker while also stopping packets that shouldn't be dropped from being dropped. </p> <p> The DSCP Bits in the IP header are used give different IP packets different Quality of Service classes. Right now, no one is really sure how these marks are treated; Are they removed? Changed in someone way? Or much worse, does the presence of these marks lead to packets being dropped? </p> <p> To find this out we need to perform a survey, we can (and have) bought time on virtual machines in data centers, but that only measures things that are close to the network core. We also need to measure how these marks are treated at the edge, on connections that real people use. </p> <p> There isn't anyway to easily perform these measurements without asking a whole lot of people for help. This is where you come in. </p> <p> We need you to download and run our tool. If you can do it from home, the bus or the train that is excellent. Every run of the tool helps us build up more data about what is happening in the internet. </p> <p> Thank you for helping make the internet better. </p> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0282Thu, 23 Mar 2017 00:00:00 +0000 Build a FreeBSD VM Image Releasehttps://adventurist.me/posts/0283<p> <a href="https://www.freebsd.org/cgi/man.cgi?release(7)"> release(7) </a> documents a set of shell scripts for creating FreeBSD release files in same manner as the release engineering team. The script creates a new <code> chroot </code> environment, checks out a fresh tree, doing the release builds in a clean environment. </p> <p> That might be what you want. </p> <p> I want to write some scripts that take in a specified network, some git commit ids and generates a set of virtual machine images running in <code> bhyve </code> to reproduce a test environment. Building in a clean environment isn't what I need. </p> <p> The Makefiles in <code> release </code> expect to be run from a tree that already has a built kernel and world. They make building the VM images really easy, but apart from comments in the files aren't documented. </p> <p> I am going to use a directory for all of the stuff: </p> <pre><code>freebsd/ -&gt; src # freebsd src tree -&gt; obj # object directory -&gt; destdir # freebsd destination direcory $ cd freebsd $ git clone https://github.com/freebsd/freebsd.git src $ cd src </code></pre> <p> Build the kernel and world, setting the object directory to the one in our tree. </p> <pre><code>$ env MAKEOBJDIRPREFIX=/home/user/freebsd/obj time make -j4 -DKERNFAST buildkernel $ env MAKEOBJDIRPREFIX=/home/user/freebsd/obj make -j4 buildworld -DWITH_META_MODE=yes -DWITH_CCACHE_BUILD -DNO_CLEAN </code></pre> <p> Move to the release directory to build our VM images: </p> <pre><code>$ cd release # env MAKEOBJDIRPREFIX=/home/user/freebsd/obj make vm-release -j4 DESTDIR=/home/user/freebsd/destdir WITH_VMIMAGES=yes VMFORMATS=raw NOPKG=yes NOPORTS=yes NOSRC=yes # env MAKEOBJDIRPREFIX=/home/user/freebsd/obj make vm-install -j4 DESTDIR=/home/user/freebsd/destdir WITH_VMIMAGES=yes VMFORMATS=raw NOPKG=yes NOPORTS=yes NOSRC=yes </code></pre> <p> I exclude, packages, ports and the <code> src </code> distribution in the images. </p> <p> As a test launch a <code> bhyve </code> VM with our created disk image: </p> <pre><code># sh /usr/share/examples/bhyve/vmrun.sh -c 4 -m 1024M -t tap0 -d ../../destdir/vmimages/FreeBSD-12.0-CURRENT-amd64.raw test </code></pre> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0283Fri, 24 Mar 2017 00:00:00 +0000 Notification Band Thinghttps://adventurist.me/posts/0284<p> Last night I converted by pebble from being a single contained unit, to a 3 part kit. </p> <blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Found my pebble <a href="https://t.co/uLVyENji2Q"> pic.twitter.com/uLVyENji2Q </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/845719123602628609"> March 25, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> I am probably going to have to replace it. </p> <p> Pebble the company is dead, I can still get replacement hardware from amazon or ebay and I suspect it will be generally available at reasonable prices for a year or two. </p> <p> I used my pebble for 3 things </p> <ol> <li> It's a smart watch, so I used it as a watch for time and date </li> <li> I used it for weather, with the <a href="https://apps.getpebble.com/en_US/application/53381b17d1719b42b800028b"> awesome relaxing watch face </a> </li> <li> The vibrate function is amazing for notifications. My phone hasn't been off silent for since I got the pebble, notifications for calls and messages are awesome. Better I can forward notifications from a service <a href="https://pushover.net/"> bus app like pushover </a> and generate them based on things I want. </li> </ol> <p> I can just wear a watch to deal with 1, for 2 I am probably going to use the awesome forecast.io app and not rely on being able to casually check the temperature. </p> <p> For 3 I am really at a loss what to do. I could just replace the pebble, but really I think I want a smart band with a vibration motor for notifications. </p> <p> If what I want doesn't already exist, it is probably too niche to ever become a thing. </p> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0284Sat, 25 Mar 2017 00:00:00 +0000 More breadhttps://adventurist.me/posts/0285<blockquote class="twitter-tweet" data-lang="en"> <p dir="ltr" lang="en"> Bread 8, 1/3 wholemeal four this time. <a href="https://twitter.com/hashtag/bread?src=hash"> #bread </a> <a href="https://t.co/dGswrqVGCt"> pic.twitter.com/dGswrqVGCt </a> </p> — [tj] (@adventureloop) <a href="https://twitter.com/adventureloop/status/846057040493641729"> March 26, 2017 </a> </blockquote> <script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"> </script> <p> I did more bread, but at batch 8 this is no longer really interesting to anyone other than me. </p> <p> People have been complaining that my tweets are marked as offensive material, which is really funny I only really tweet about bread and technology. I looked at my settings and the 'mark as offensive' option was enabled on my output. </p> <p> I'm sure I accidentally enabled it, but the twitter documentation does say they will add it to accounts that have flagged posts. </p> <p> I have no love for twitter, if literally anything else had the communities I want to pay attention to posting I would move away. Ideally something federated, but that is only a pipe dream. </p> <hr/> <p> Yes my phone autocompleted flour to four, you can't edit twitter posts and phones are the worst thing ever. </p> <p> <a href="http://adventurist.me/posts/0278"> It </a> <a href="http://adventurist.me/posts/0279"> is </a> Sunday, so that <a href="http://adventurist.me/posts/0281"> makes </a> <a href="http://adventurist.me/posts/0282"> seven </a> <a href="http://adventurist.me/posts/0283"> days </a> of <a href="http://adventurist.me/posts/0284"> writing </a> . </p> <p> <strong> Reading: </strong> The Moon is a Hard Mistress, The Difference Engine </p> https://adventurist.me/posts/0285Sun, 26 Mar 2017 00:00:00 +0000 Findlater Castlehttps://adventurist.me/posts/0286<p> <a href="/images/findlatercastle.jpg"> <img src="/imagessmall/findlatercastle.jpg"/> </a> </p> <hr/> <p> <strong> Reading: </strong> The Moon is a Harsh Mistress, The Difference Engine </p> https://adventurist.me/posts/0286Mon, 27 Mar 2017 00:00:00 +0000 Gherkin 30% keyboardhttps://adventurist.me/posts/0287<p> <a href="/images/gherkin.jpg"> <img src="/imagessmall/gherkin.jpg"/> </a> </p> <p> I like keyboards, I have been using an <a href="https://olkb.com/planck"> OLKB Planck </a> as my daily driver for 18 months now. I saw a really nice <a href="https://olkb.com/reference/primer/"> ortholinear </a> 30% keyboard go by on mastodon and I had to have one. </p> <p> The keyboard I saw was actually the excellent <a href="http://www.40percent.club/2016/11/gherkin.html"> gherkin </a> by <a href="https://olkb.com/reference/primer/"> di0ib </a> . di0ib has worked in the true spirit of open source and provided all of the design files and firmware for the gherkin. Beyond that they have included child proof instructions to <a href="http://www.40percent.club/2017/03/ordering-pcb.html"> order pcbs </a> . </p> <p> <a href="/images/gherkinpcb.jpg"> <img src="/imagessmall/gherkinpcb.jpg"/> </a> </p> <p> I tricked some friends into agreeing to build boards if I got a run of PCBS and set off. Amazingly easyeda.com was offering 5 more boards (10 vs 5) for just $2 extra. I managed to get 10 sets (board, key plate and base) of the PCBs for about £80. </p> <h2> Build </h2> <p> The build was really easy to do, there is some advice for the socket on 40 percent club, but if you test fit everything as you go it should be straight forward. A build is probably around 2 hours depending on proficiency. </p> <p> Parts Per Keyboard: </p> <pre><code>1 Keyplate PCB 1 Bottom PCB 1 Main PCB 16 M2 Spacers (14mm length) 32 M2 screws 30 key switches 30 key caps 1 Arduino Pro micro 1 machine pin socket (wide 24 pin (2x12)) 30 3mm leds (your choice of colour) 30 1N4148 diodes 1 100 ohm resistors 1 100k ohm resitors 30 470 ohm reistors 1 mosfet (probs A04406A 4406A) </code></pre> <p> Key caps are a harder thing to buy (so many awesome choices) so I ended up using some spares I found in a desk drawer. </p> <h2> Flash </h2> <p> Flashing the firmware to the keyboard was a little harder to figure out. <a href="https://hackaday.io/project/8282-alpen-clack/log/27475-use-a-pro-micro-in-a-keyboard"> Eventually I found some instructions that included the correct avrdude flags on hackaday.io </a> , you also need to use a switch pulling <code> RST </code> down to <code> GND </code> to put the micro controller in programming mode. </p> <p> <a href="/images/promicroflashswitch.jpg"> <img src="/imagessmall/promicroflashswitch.jpg"/> </a> </p> <p> Most of the work is done by the TMK <code> make </code> file, but you must manually specify a target for the program command. The command I used looks like: </p> <pre><code># programming directive MCU = atmega32u4 OPT_DEFS += -DBOOTLOADER_SIZE=512 PROGRAM_CMD = avrdude -p $(MCU) -P /dev/tty.usbmodem1411 -c avr109 -U flash:w:$(TARGET).hex </code></pre> <h2> Use </h2> <p> With the board built and programmed (first try) it is time to figure out how to use it. It took a couple of months of daily use to get used to using the planck, it will be the same with the gherkin. To help learn I have printed out the keyboard layout and the combination of layers. </p> <p> <a href="/images/gherkin-layout.png"> <img src="/images/gherkin-layout.png"/> </a> </p> <p> I modified the default layout a little to make it more similar to how I normally type. I moved space bar to my left hand, made 'X' a repeatable key(gotta be able to delete chars in vim) and added a 'CMD' key. <a href="https://github.com/adventureloop/tmk_keyboard/tree/master/keyboard/gherkin"> I have a fork of the repo </a> with my layout and <code> Makefile </code> changes. </p> <p> The layer system is easy to use, if you hold any of the keys on the base layer it will enable the alternate function for a meta key or it will switch to another layer for a layer key. </p> https://adventurist.me/posts/0287Mon, 21 Aug 2017 00:00:00 +0000 FreeBSD on the GPD Pockethttps://adventurist.me/posts/0288<p> In the distant past before smart phones became identical black rectangles there was a category of devices called <a href="https://en.wikipedia.org/wiki/Palmtop_PC"> palmtops </a> . Palmtops were a class of PDA PC thing that fit in the palm of your hand. Today the Psion 5 series of devices most often capture peoples attention. Not only are they small and awesome, but they have something like a real keyboard. </p> <p> This form factor is so popular that there are <a href="https://hackaday.io/project/4042-psio"> projects trying to update Psion 5 devices </a> with new internals. The Psion 5 is the sort of device I have complained isn't made for a long time, at some point I picked one up on ebay with the intention of <a href="http://wiki.netbsd.org/ports/epoc32/"> running the NetBSD port </a> on it. </p> <p> Earlier this year the world caught up and two big crowd funding projects appeared for modern Psion like palmtop devices. Neither the <a href="https://www.indiegogo.com/projects/gemini-pda-android-linux-keyboard-mobile-device-phone#/"> Gemini </a> or the <a href="https://www.indiegogo.com/projects/gpd-pocket-7-0-umpc-laptop-ubuntu-or-win-10-os-laptop--2#/"> GPD Pocket </a> campaigns convinced me that real hardware would ever appear. In May reviews of the GPD Pocket started to appear and I became aware of people that had backed and received their earlier campaign for the <a href="https://www.indiegogo.com/projects/gpd-win-intel-z8700-win-10-os-game-console-laptop#/"> GPD WIN </a> . </p> <p> With a quirk in indiegogo allowing me to still back the campaign I jumped on board and ordered a tiny little laptop computer. </p> <p> <a href="/images/gpdpocketvspsion5mx.jpg"> <img src="/imagessmall/gpdpocketvspsion5mx.jpg"/> </a> </p> <h2> FreeBSD </h2> <p> <a href="http://adventurist.me/tag/freebsd"> FreeBSD </a> is the only choice of OS for a <a href="https://youtu.be/Q77YBmtd2Rw?t=22s"> pc computer </a> . Support is good enough that I could boot and install without any real issues, but there was enough hardware support missing that I wanted to fix things before writing a blog post about it. </p> <p> Somethings don't work out of the box others will need drivers before they will work: </p> <ul> <li> ~~Display rotation~~ </li> <li> WiFi (broadcom 4356) </li> <li> Bluetooth (broadcom BCM2045A0) </li> <li> Audio (cherry trail audio chrt54...) </li> <li> Graphics </li> <li> ~~Nipple~~ </li> <li> USB C </li> <li> ~~Keyboard vanishes sometimes~~ </li> <li> Battery </li> <li> Suspend </li> <li> Touch Screen (goodix) </li> <li> fan (there is some pwm hardware) </li> <li> backlight </li> <li> ~~I2C~~ </li> <li> gpio </li> </ul> <h2> Display </h2> <p> The most obvious issue is the display panel, the panel it self reports as being a high resolution portrait device. This problem exists in the bios menus and the windows boot splash is rotated for most of the time. </p> <p> <a href="/images/gpdpocketfreebsdbootsplash.jpg"> <img src="/imagessmall/gpdpocketfreebsdbootsplash.jpg"/> </a> </p> <p> Of course the FreeBSD bootsplash and framebuffer are also rotated, but a little neck turning makes the installer usable. Once installed we can address the rotated panel in X, accelerated graphics are probably in the future for this device, but the X framebuffer drive is good enough for FreeBSD hacking. </p> <p> With X we can sort of the rotation problem. <code> xf86-video-scfb </code> is <a href="https://wiki.freebsd.org/Graphics/SCFB"> required to use the framebuffer </a> . </p> <pre><code># pkg install xf86-video-scfb </code></pre> <p> And the following lines have to be added to <code> /usr/local/etc/X11/xorg.conf.d/driver-scfb.conf </code> </p> <pre><code>Section "Device" Identifier "Generic FB" Driver "scfb" Option "Rotate" "CW" EndSection Section "Device" Identifier "Card0" Driver "scfb" EndSection </code></pre> <p> <a href="/images/gpdpocketfreebsd.jpg"> <img src="/imagessmall/gpdpocketfreebsd.jpg"/> </a> </p> <p> The screen resolution is still super high, there doesn't seem to be anyway to do DPI hinting with the framebuffer driver (or in i3 at all), but I can make terminals usable by cranking up the font size. </p> <h2> Keyboard and touchpoint </h2> <p> A Keyboard is vital for a usable computer, out of the box the keyboard works, but the <a href="https://xkcd.com/243/"> touch point </a> does not. Worse, touching the touch point caused the built in USB keyboard to die. </p> <p> Some faffing trying to debug the problem with <a href="https://wiki.freebsd.org/GavinAtkinson"> gavin@ </a> at <a href="https://wiki.freebsd.org/DevSummit/201708"> BSDCam </a> and we got both keyboard and mouse working. For some reason my planck keyboard presents as a mouse among other things, pluggin in a mouse and power cycling the USB device caused <a href="https://www.freebsd.org/cgi/man.cgi?query=ums&amp;sektion=4"> ums(4) </a> to correctly probe and attach. </p> <p> Manually loading <code> ums(4) </code> at boot got the touch point working correctly. In fact, <code> ig4(4) </code> also attaches when manually loaded. </p> <p> Add these lines to <code> /boot/loader.conf </code> </p> <pre><code>ums_load="YES" ig4_load="YES" </code></pre> <p> The <a href="http://dmesgd.nycbug.org/index.cgi?do=index&amp;fts=gpd+pocket"> dmesg </a> shows some problems with ACPI probing, this is probably the source of some of the device problems. </p> <h2> Other devices </h2> <p> Wifi, bluetooth and graphics are bigger problems that will hopefully be caught up in others work and made to work soon. The touchscreen controller is adding a driver and support for Cherry View GPIO, there are datasheets for these and I am working on them. </p> <p> No battery level indicator makes it annoying to use the GPD Pocket out and about. Without a driver the charge controller is using a really low current to recharge the battery. Datasheets are quite readily available for these devices and I am writing drivers now. </p> <h2> GPD Pocket </h2> <p> The Pocket is a great little device, I think its 'cuteness' makes everyone fall in love with it on first sight. I am really looking forward to getting the final things working and using this as a daily device. </p> https://adventurist.me/posts/0288Tue, 22 Aug 2017 00:00:00 +0000 FreeBSD on an Intel x5-z8350 tv boxhttps://adventurist.me/posts/00289<p> There are a load of sort of generic tv boxes on ebay with an Intel x5-z8350 processor. </p> <p> The x5 SOC (formerly Cherry Tree, formerly Cherry View) is the same family as the SOC in my beloved <a href="https://adventurist.me/posts/0288"> GPD Pocket </a> . I was really having trouble with the i2c hardware in the GPD Pocket and wanted something I could take apart and poke with an oscilloscope. I looked first at the <a href="http://www.up-board.org/up/"> UP Board </a> , an x5-z8350 in a raspberry pi form factor, but not only was it much more expensive than this tv box, but it has a CPLD between the SOC io and the pin header. </p> <h2> Installing FreeBSD </h2> <p> First I needed to get the board to boot from USB, <a href="https://www.ebay.co.uk/itm//222614917758"> the listing I bought </a> came with both android and windows 10 (I guess that is what dual os means). In both android and windows 10 there was a handy reboot to other os application. </p> <p> From installing on the GPD Pocket I suspected that the bios boot menu key would be F7 so I used that. Windows 10 also includes a handy <a href="https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/boot-to-uefi-mode-or-legacy-bios-mode"> reboot to uefi config </a> option which makes it easy to get into a bios menu. I used it to disable quiet boot and set the boot delay to a more sensible number. </p> <p> With those changes I rebooted and got a familiar AMI bios boot screen hit F7 and choose your usb stick from the menu. The FreeBSD loader menu came up and continued into a boot from the usb stick, but it hung probing <code> ppc0 </code> . </p> <p> I found a solution on the <a href="https://forums.freebsd.org/threads/56565/"> freebsd forum </a> post about the upboard which suggested running: </p> <pre><code>OK unset hint.uart.1.at </code></pre> <p> at the loader prompt. With that you I could boot and do an install. </p> <p> Before you reboot make sure to make that change permanent, by removing this line in <code> /boot/device.hints </code> </p> <pre><code>... hint.sc.0.flags="0x100" #hint.uart.0.at="isa" # comment this line out hint.uart.0.port="0x3F8 hint.uart.0.flags="0x10 ... </code></pre> <p> now reboot. </p> <h3> Setup </h3> <p> I setup the the <code> drm-next-kmod </code> driver, but the machine froze during boot. Next I tried using a frame buffer driver, which required the collowing config in /usr/local/etc/X11/xorg.conf.d/driver-scfb.conf : </p> <pre><code>Section "Device" Identifier "Generic FB" Driver "scfb" EndSection Section "Device" Identifier "Card0" Driver "scfb" EndSection </code></pre> <h2> Hardware </h2> <p> <a href="/images/x5-ports.jpg"> <img src="/imagessmall/x5-ports.jpg"/> </a> </p> <p> The box has: </p> <ul> <li> Blue/Red LED </li> <li> External Power button </li> <li> External(ish) reset button <ul> <li> Pressing the reset button caused an instant power cycle. </li> </ul> </li> <li> 4 usb ports <ul> <li> 1 USB 3 </li> <li> 2 external USB 2 </li> <li> 1 internal USB 2 </li> </ul> </li> <li> sd card reader <ul> <li> but it doesn't seem to be hotpluggable </li> </ul> </li> <li> ethernet </li> <li> hdmi </li> </ul> <p> The x5 box also has bluetooth and wifi, but neither currently have FreeBSD drivers. </p> <p> <a href="/images/x5-top-without-heatsink.jpg"> <img src="/imagessmall/x5-top-without-heatsink.jpg"/> </a> </p> <p> Internally there are a whole bunch of unpopulated things that might be interesting. </p> <p> <a href="/images/x5-top-top-left.jpg"> <img src="/imagessmall/x5-top-top-left.jpg"/> </a> </p> <p> On the top left there is an unpopulated 2.54mm pin header slot next to the led, silkscreen on the board has 1 and a 7 on either end. Probing around with a multimeter suggested that P7 was ground. </p> <p> I spent quite a while poking the board with a multimeter and osclloscope to see if any gpio or buses were exposed on the headers or the board. I did find that if you connect pin 1 to gnd (or pin 7) the red led comes on and the board goes off. </p> <p> I did not find any useful or even really interesting signals. </p> <p> <a href="/images/x5-top-bottom-right.jpg"> <img src="/imagessmall/x5-top-bottom-right.jpg"/> </a> </p> <p> On the bottom right there is an unpopulate 15 pin header, all but two of these were connect to ground. </p> <h2> MEAT </h2> <p> Some more gory insides: </p> <p> <a href="/images/x5-board-with-heatsink.jpg"> <img src="/imagessmall/x5-board-with-heatsink.jpg"/> </a> <a href="/images/x5-bottom-screw.jpg"> <img src="/imagessmall/x5-bottom-screw.jpg"/> </a> <a href="/images/x5-bottom.jpg"> <img src="/imagessmall/x5-bottom.jpg"/> </a> <a href="/images/x5-case.jpg"> <img src="/imagessmall/x5-case.jpg"/> </a> <a href="/images/x5-ports-naked.jpg"> <img src="/imagessmall/x5-ports-naked.jpg"/> </a> <a href="/images/x5-top-without-heatsink-top-right.jpg"> <img src="/imagessmall/x5-top-without-heatsink-top-right.jpg"/> </a> <a href="/images/x5-without-heatsink-bottom-right.jpg"> <img src="/imagessmall/x5-without-heatsink-bottom-right.jpg"/> </a> <a href="/images/x5-without-heatsink-rtc.jpg"> <img src="/imagessmall/x5-without-heatsink-rtc.jpg"/> </a> </p> <pre><code>Copyright (c) 1992-2018 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #0 r328126: Thu Jan 18 15:25:44 UTC 2018 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 FreeBSD clang version 6.0.0 (branches/release_60 321788) (based on LLVM 6.0.0) WARNING: WITNESS option enabled, expect reduced performance. VT(efifb): resolution 1920x1080 CPU: Intel(R) Atom(TM) x5-Z8350 CPU @ 1.44GHz (1440.00-MHz K8-class CPU) Origin="GenuineIntel" Id=0x406c4 Family=0x6 Model=0x4c Stepping=4 Features=0xbfebfbff&lt;FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE&gt; Features2=0x43d8e3bf&lt;SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,RDRAND&gt; AMD Features=0x28100800&lt;SYSCALL,NX,RDTSCP,LM&gt; AMD Features2=0x101&lt;LAHF,Prefetch&gt; Structured Extended Features=0x2282&lt;TSCADJ,SMEP,ERMS,NFPUSG&gt; VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics real memory = 2147483648 (2048 MB) avail memory = 1946144768 (1855 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: &lt;ALASKA A M I &gt; WARNING: L1 data cache covers fewer APIC IDs than a core (0 &lt; 1) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) random: unblocking device. ioapic0 &lt;Version 2.0&gt; irqs 0-114 on motherboard SMP: AP CPU #2 Launched! SMP: AP CPU #1 Launched! SMP: AP CPU #3 Launched! Timecounter "TSC" frequency 1440001458 Hz quality 1000 random: entropy device external interface netmap: loaded module [ath_hal] loaded module_register_init: MOD_LOAD (vesa, 0xffffffff80ff8620, 0) error 19 random: registering fast source Intel Secure Key RNG random: fast provider: "Intel Secure Key RNG" kbd1 at kbdmux0 nexus0 cryptosoft0: &lt;software crypto&gt; on motherboard acpi0: &lt;ALASKA A M I &gt; on motherboard Firmware Error (ACPI): Failure creating [BDLI], AE_ALREADY_EXISTS (20180105/dswload-498) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20180105/psobject-371) ACPI Error: AE_ALREADY_EXISTS, (SSDT: DptfTab) while loading table (20180105/tbxfload-355) ACPI Error: 1 table load failures, 8 successful (20180105/tbxfload-378) acpi0: Power Button (fixed) unknown: I/O range not supported cpu0: &lt;ACPI CPU&gt; on acpi0 cpu1: &lt;ACPI CPU&gt; on acpi0 cpu2: &lt;ACPI CPU&gt; on acpi0 cpu3: &lt;ACPI CPU&gt; on acpi0 attimer0: &lt;AT timer&gt; port 0x40-0x43,0x50-0x53 irq 0 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 atrtc0: &lt;AT realtime clock&gt; port 0x70-0x77 on acpi0 atrtc0: Warning: Couldn't map I/O. atrtc0: registered as a time-of-day clock, resolution 1.000000s Event timer "RTC" frequency 32768 Hz quality 0 hpet0: &lt;High Precision Event Timer&gt; iomem 0xfed00000-0xfed003ff irq 8 on acpi0 Timecounter "HPET" frequency 14318180 Hz quality 950 Event timer "HPET" frequency 14318180 Hz quality 450 Event timer "HPET1" frequency 14318180 Hz quality 440 Event timer "HPET2" frequency 14318180 Hz quality 440 Timecounter "ACPI-safe" frequency 3579545 Hz quality 850 acpi_timer0: &lt;24-bit timer at 3.579545MHz&gt; port 0x408-0x40b on acpi0 pcib0: &lt;ACPI Host-PCI bridge&gt; port 0xcf8-0xcff on acpi0 pci0: &lt;ACPI PCI bus&gt; on pcib0 vgapci0: &lt;VGA-compatible display&gt; port 0xf000-0xf03f mem 0x90000000-0x90ffffff,0x80000000-0x8fffffff at device 2.0 on pci0 vgapci0: Boot video device xhci0: &lt;Intel Braswell USB 3.0 controller&gt; mem 0x91700000-0x9170ffff at device 20.0 on pci0 xhci0: 32 bytes context size, 64-bit DMA usbus0 on xhci0 usbus0: 5.0Gbps Super Speed USB v3.0 pci0: &lt;serial bus, USB&gt; at device 22.0 (no driver attached) pci0: &lt;encrypt/decrypt&gt; at device 26.0 (no driver attached) pcib1: &lt;ACPI PCI-PCI bridge&gt; at device 28.0 on pci0 pci1: &lt;ACPI PCI bus&gt; on pcib1 re0: &lt;RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet&gt; port 0xe000-0xe0ff mem 0x91604000-0x91604fff,0x91600000-0x91603fff at device 0.0 on pci1 re0: Using 1 MSI-X message re0: turning off MSI enable bit. re0: Chip rev. 0x4c000000 re0: MAC rev. 0x00000000 miibus0: &lt;MII bus&gt; on re0 rgephy0: &lt;RTL8251/8153 1000BASE-T media interface&gt; PHY 1 on miibus0 rgephy0: none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow re0: Using defaults for TSO: 65518/35/2048 re0: Ethernet address: 84:39:be:65:0d:60 re0: netmap queues/slots: TX 1/256, RX 1/256 isab0: &lt;PCI-ISA bridge&gt; at device 31.0 on pci0 isa0: &lt;ISA bus&gt; on isab0 acpi_button0: &lt;Power Button&gt; on acpi0 acpi_tz0: &lt;Thermal Zone&gt; on acpi0 sdhci_acpi0: &lt;Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller&gt; iomem 0x9173c000-0x9173cfff irq 45 on acpi0 mmc0: &lt;MMC/SD bus&gt; on sdhci_acpi0 sdhci_acpi1: &lt;Intel Bay Trail/Braswell SDXC Controller&gt; iomem 0x91738000-0x91738fff irq 47 on acpi0 mmc1: &lt;MMC/SD bus&gt; on sdhci_acpi1 uart0: &lt;16550 or compatible&gt; port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 atkbdc0: &lt;Keyboard controller (i8042)&gt; at port 0x60,0x64 on isa0 atkbd0: &lt;AT Keyboard&gt; irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] atkbdc0: non-PNP ISA device will be removed from GENERIC in FreeBSD 12. est0: &lt;Enhanced SpeedStep Frequency Control&gt; on cpu0 est1: &lt;Enhanced SpeedStep Frequency Control&gt; on cpu1 est2: &lt;Enhanced SpeedStep Frequency Control&gt; on cpu2 est3: &lt;Enhanced SpeedStep Frequency Control&gt; on cpu3 Timecounters tick every 1.000 msec ugen0.1: &lt;0x8086 XHCI root HUB&gt; at usbus0 uhub0: &lt;0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1&gt; on usbus0 mmcsd0: 31GB &lt;MMCHC NCard 4.5 SN 6E7E9160 MFG 06/2017 by 136 0x0003&gt; at mmc0 200.0MHz/8bit/8192-block mmcsd0boot0: 4MB partion 1 at mmcsd0 mmcsd0boot1: 4MB partion 2 at mmcsd0 mmcsd0rpmb: 4MB partion 3 at mmcsd0 mmc1: No compatible cards found on bus WARNING: WITNESS option enabled, expect reduced performance. Trying to mount root from ufs:/dev/mmcsd0p2 [rw]... uhub0: 13 ports with 13 removable, self powered lock order reversal: 1st 0xfffff8000417e240 ufs (ufs) @ /usr/src/sys/kern/vfs_subr.c:2607 2nd 0xfffffe0000e46500 bufwait (bufwait) @ /usr/src/sys/ufs/ffs/ffs_vnops.c:282 3rd 0xfffff800042a09a0 ufs (ufs) @ /usr/src/sys/kern/vfs_subr.c:2607 stack backtrace: #0 0xffffffff80b2bba3 at witness_debugger+0x73 #1 0xffffffff80b2ba24 at witness_checkorder+0xe34 #2 0xffffffff80a9cbeb at __lockmgr_args+0x88b #3 0xffffffff80dc2565 at ffs_lock+0xa5 #4 0xffffffff810f7af9 at VOP_LOCK1_APV+0xd9 #5 0xffffffff80ba7006 at _vn_lock+0x66 #6 0xffffffff80b9599f at vget+0x7f #7 0xffffffff80b87891 at vfs_hash_get+0xd1 #8 0xffffffff80dbe25f at ffs_vgetf+0x3f #9 0xffffffff80db4886 at softdep_sync_buf+0xd16 #10 0xffffffff80dc3354 at ffs_syncvnode+0x294 #11 0xffffffff80d999ff at ffs_truncate+0x6df #12 0xffffffff80dca7f1 at ufs_direnter+0x641 #13 0xffffffff80dd393c at ufs_makeinode+0x61c #14 0xffffffff80dcf5b4 at ufs_create+0x34 #15 0xffffffff810f51d3 at VOP_CREATE_APV+0xd3 #16 0xffffffff80ba6908 at vn_open_cred+0x2a8 #17 0xffffffff80b9f14c at kern_openat+0x20c ugen0.2: &lt;Dell Dell USB Entry Keyboard&gt; at usbus0 ukbd0 on uhub0 ukbd0: &lt;Dell Dell USB Entry Keyboard, class 0/0, rev 1.10/1.15, addr 1&gt; on usbus0 kbd2 at ukbd0 ugen0.3: &lt;SanDisk Cruzer Fit&gt; at usbus0 umass0 on uhub0 umass0: &lt;SanDisk Cruzer Fit, class 0/0, rev 2.00/2.01, addr 2&gt; on usbus0 umass0: SCSI over Bulk-Only; quirks = 0x8100 umass0:0:0: Attached to scbus0 da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 da0: &lt;SanDisk Cruzer Fit 2.01&gt; Fixed Direct Access SPC-4 SCSI device da0: Serial Number 4C530302741216116074 da0: 40.000MB/s transfers da0: 3819MB (7821312 512 byte sectors) da0: quirks=0x2&lt;NO_6_BYTE&gt; re0: link state changed to DOWN GEOM_PART: integrity check failed (da0s4, BSD) GEOM_PART: integrity check failed (ufsid/5a1180062a826673, BSD) GEOM_PART: integrity check failed (diskid/DISK-4C530302741216116074s4, BSD) </code></pre> <p> <a href="http://dmesgd.nycbug.org/index.cgi?do=view&amp;id=3462"> dmesg on dmesgd.nycbug.org </a> </p> https://adventurist.me/posts/00289Sat, 20 Jan 2018 00:00:00 +0000 Far Too Much Summerhttps://adventurist.me/posts/00290<p> There was frost on the car this morning we can declare summer concluded. These last 3 months have been very intense, an absolute ton of fun, but the intensity meant very little down time. </p> <p> I plan to write a series of blog posts to capture some of excellent adventures I had. As always the best things required participation to spare you from inside jokes I will stay close to easily shared realities. </p> <ul> <li> <a href="https://campgnd.com"> campgnd </a> - 1st to 3rd June </li> <li> <a href="https://toorcamp.com"> ToorCamp </a> - 18th to 26th June </li> <li> Montreal - 10th - 21st July <ul> <li> <a href="https://netdevconf.org/0x12/"> Linux NetDevConf </a> - 11th to 13th July </li> <li> <a href="https://www.ietf.org/how/runningcode/hackathons/102-hackathon/"> IETF Hackathon </a> - 14 and 15th July </li> <li> <a href="https://www.ietf.org/how/meetings/102/"> IETF 101 </a> - 16th to 20th July </li> </ul> </li> <li> <a href="https://wiki.freebsd.org/DevSummit/201808"> BSDCam </a> - 15th to 17th August </li> <li> <a href="https://emfcamp.org"> EMF Camp 2018 </a> - 31st Augst to 2nd September </li> <li> Bucharest - 20th to 23rd September <ul> <li> <a href="https://wiki.freebsd.org/DevSummit/201809"> FreeBSD DevSummit </a> - 20th and 21st September </li> <li> <a href="https://2018.eurobsdcon.org/"> EuroBSDCon 2018 </a> - 22nd and 23rd September </li> </ul> </li> </ul> <p> Somehow there was space in this calendar to start running a monthly pancake breakfast at the <a href="https://57north.org.uk"> hackerspace </a> . The next Hacker Breakfast be Sunday the 14th of October. </p> <hr/> <p> It is hard to admit. This summer was too much. </p> <p> It is hard to admin because throughout, despite the travel exhaustion, hangovers and mild illness, it was a ton of fun. The fun came at a cost, post IETF my brain was a puddle and I still had to build a streaming system and write a slide deck based on it. </p> <p> EuroBSDCon was a major stress inducer for me, I submitted to the CFP with a Proof of Concept, which did work. Getting from the PoC to a presentable system was a lot of work. I allocated time to do this and then filled that time with travel and conferences and my job. </p> <p> Six large blocks of travel in a row were too many. I need to figure out how to control the commitments I make so I don't become overwhelmed by saying yes. </p> https://adventurist.me/posts/00290Sat, 29 Sep 2018 00:00:00 +0000 campgnd 2018https://adventurist.me/posts/00291<pre><code> __,--'\ __,--' :. \. _,--' \`. /|\ ` \ `. ____ _ _ ____ / | \ `: \ `/ ___ __ _ _ __ ___ _ __ / ___| \ | | _ \ / '| \ `:. \ / __/ _` | '_ ` _ \| '_ \| | _| \| | | | | / , | \ \ | (_| (_| | | | | | | |_) | |_| | |\ | |_| | / |: \ `:. \ \___\__,_|_| |_| |_| .__/ \____|_| \_|____/ /| ' | \ :. _,-'`. |_| \' |, / \ ` \ `:. _,-'_| `/ '._; \ . \ `_,-'_,-' \' `- .\_ |\,-'_,-' Scotland's first Hacker camp. `--|_,`' </code></pre> <p> One of the <a href="https://campgnd.com"> campgnds </a> I used the tag line 'it happened again!'. It keeps happening and people are still upset about that year we missed. At this point it is easier to keep doing it. </p> <p> <a href="/images/campgnd2018-hammocking.jpg"> <img src="/imagessmall/campgnd2018-hammocking.jpg"/> </a> </p> <p> campgnd is the annual camping trip for the <a href="https://57north.org.uk"> hackerspace </a> . We take 10-20 people off into a remote field build up an unreasonable shanty town of tents, feed it with power and data and let our minds go. </p> <p> <a href="/images/campgnd2018-pokedexhacking.jpg"> <img src="/imagessmall/campgnd2018-pokedexhacking.jpg"/> </a> </p> <p> I love campgnd, it is a chance to escape and an opportunity to test out Village for visiting larger camps around Europe. Getting away and going somewhere is a great way to increase focus, if camping isn't your thing then taking your hackerspace to a makerfaire is a great way to focus on getting projects ready to show. </p> <p> <a href="/images/campgnd2018-smeltpour.jpg"> <img src="/imagessmall/campgnd2018-smeltpour.jpg"/> </a> </p> <p> It seems we are already planning campgnd 2019, if you want to join the madness drop into #scottishconsulate on freenode and ask. </p> <p> <a href="/images/campgnd2018-radiohacking.jpg"> <img src="/imagessmall/campgnd2018-radiohacking.jpg"/> </a> </p> https://adventurist.me/posts/00291Sun, 30 Sep 2018 00:00:00 +0000 FreeBSD on the Intel Compute Stick STK1AW32SChttps://adventurist.me/posts/00292<p> <a href="/images/computestick-peices.JPG"> <img src="/imagessmall/computestick-peices.JPG"/> </a> </p> <p> A FreeBSD developer has been tricked somehow into working on EFI boot. A large missing piece has been support for 32 bit EFI. Many devices with Intel mobile SOCs have shipped with bios which only support 32 bit EFI for boot even on 64 bit processors. </p> <p> Rumour had it the Intel Compute Stick STK1AW32SC was one of the platforms with only 32bit EFI. This compute stick has a SOC from the Cherryview family, the same as the <a href="https://adventurist.me/posts/288"> GPD Pocket </a> , I want FreeBSD to support this SOC well and 32 bit EFI to boot is a part of that. </p> <p> This compute stick is end of life and looking around I saw a few on ebay. I managed to win an auction for a new in box compute stick, getting it for about £50. For that I got: </p> <ul> <li> x5-Z8330 4 Cores 1.44 GHz </li> <li> 2GB Ram </li> <li> 32GB Internal Flash </li> <li> 1 USB 2 Port </li> <li> 1 USB 3 Port </li> <li> MicroSD Card slot </li> <li> Intel Wireless-AC 7265 + Bluetooth 4.2 </li> <li> Intel Integrated Graphics </li> </ul> <p> I asked <a href="https://adventurist.me/posts/288"> Allan Jude </a> to take his compute stick to the <a href="https://adventurist.me/posts/288"> DevSummit at EuroBSDCon </a> , while he was grabbing it someone else piped up and claimed to have run FreeBSD on the compute stick before. Turns out there is a bios option to switch between 32bit boot and 64bit boot. </p> <p> Yes, our deliberate FreeBSD brick actually works. Here is how to install FreeBSD on a Compute Stick: </p> <p> <a href="/images/computestick-biosdefault.jpg"> <img src="/imagessmall/computestick-biosdefault.jpg"/> </a> </p> <p> Break into the bios by hitting F2 at boot. </p> <p> <a href="/images/computestick-select64.jpg"> <img src="/imagessmall/computestick-select64.jpg"/> </a> </p> <p> In 'Configuration' change Operating System from 'Windows 32-bit' to 'Windows 64-bit' </p> <p> Reboot and break into the boot menu and choose your FreeBSD USB stick. </p> <p> As with the <a href="https://adventurist.me/posts/288"> x5 box </a> there is an issue where the uart causes the compute stick to hang. </p> <p> Break into the loader menu and set: </p> <pre><code>OK unset hint.uart.1.at OK boot </code></pre> <p> Install as normal </p> <p> Before rebooting at the end of the installer you need to edit device.hints to disable the uart again. </p> <pre><code># chmod +w /boot/device.hints # vi /boot/device.hints .... hint.sc.0.flags="0x100" hint.uart.0.at="isa" # comment this line out hint.uart.0.port="0x3F8" .... </code></pre> <h2> WiFi </h2> <p> Bluetooth is present in the dmesg, but we need to load the <a href="https://adventurist.me/posts/288"> iwm </a> kernel module then we can configure <a href="https://adventurist.me/posts/288"> WiFi as normal </a> . </p> <pre><code># kldload if_iwm </code></pre> <h2> Graphics </h2> <p> Since setting up the x5 box in January our FreeBSD has has gained support for integrated graphics on CherryView SoCs. Now graphics support is available by installing and loading the <code> drm-next-kmod </code> . </p> <pre><code># pkg install drm-next-kmod # kldload /boot/modules/i915kms </code></pre> <h2> Meat </h2> <p> I was unable to find any tear down pictures of the compute stick so I had to make some. The cast is easy to take a part, there is a single screw under a rubber foot once that is removed the rest of the top case is held on with snap fits. Inside the fan is connected with a tiny cable, the 2.4GHz and 5GHz antennas are glued to the side of the case, everything else is held down with 2 screws. 3 screws hold the heat sink assembly to the pcb. </p> <p> <a href="/images/computestick-top.JPG"> <img src="/imagessmall/computestick-top.JPG"/> </a> </p> <p> Inside there is very little to see </p> <p> On the top is the SOC is in a puddble of goop, an AXP288 PMIC, 64Mb of Winbond flash and two Kingston 4Gb DDR3 Ram modules. </p> <p> On the bottom there are two more DDR3 modules (taking us up to 2GB), a SanDisk SDINADF4A 32GB eMMC and an Intel 7265D2W WiFi + Bluetooth module.. </p> <p> <a href="/images/computestick-bottom.JPG"> <img src="/imagessmall/computestick-bottom.JPG"/> </a> </p> <pre><code>---&lt;&lt;BOOT&gt;&gt;--- Copyright (c) 1992-2018 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-ALPHA7 r338849 amd64 FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1) WARNING: WITNESS option enabled, expect reduced performance. VT(efifb): resolution 1920x1080 CPU: Intel(R) Atom(TM) x5-Z8330 CPU @ 1.44GHz (1440.00-MHz K8-class CPU) Origin="GenuineIntel" Id=0x406c4 Family=0x6 Model=0x4c Stepping=4 Features=0xbfebfbff&lt;FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE&gt; Features2=0x43d8e3bf&lt;SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,RDRAND&gt; AMD Features=0x28100800&lt;SYSCALL,NX,RDTSCP,LM&gt; AMD Features2=0x101&lt;LAHF,Prefetch&gt; Structured Extended Features=0x2282&lt;TSCADJ,SMEP,ERMS,NFPUSG&gt; VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics real memory = 2147483648 (2048 MB) avail memory = 1955004416 (1864 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: &lt;Intel COMSTKFC&gt; WARNING: L1 data cache covers fewer APIC IDs than a core (0 &lt; 1) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) random: unblocking device. ioapic0 &lt;Version 2.0&gt; irqs 0-114 on motherboard Launching APs: 2 1 3 Timecounter "TSC" frequency 1439997858 Hz quality 1000 random: entropy device external interface netmap: loaded module [ath_hal] loaded module_register_init: MOD_LOAD (vesa, 0xffffffff810e1920, 0) error 19 random: registering fast source Intel Secure Key RNG random: fast provider: "Intel Secure Key RNG" kbd1 at kbdmux0 nexus0 efirtc0: &lt;EFI Realtime Clock&gt; on motherboard efirtc0: registered as a time-of-day clock, resolution 1.000000s cryptosoft0: &lt;software crypto&gt; on motherboard acpi0: &lt;Intel COMSTKFC&gt; on motherboard acpi0: Power Button (fixed) unknown: I/O range not supported cpu0: &lt;ACPI CPU&gt; on acpi0 attimer0: &lt;AT timer&gt; port 0x40-0x43,0x50-0x53 irq 0 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 atrtc0: &lt;AT realtime clock&gt; port 0x70-0x77 on acpi0 atrtc0: Warning: Couldn't map I/O. atrtc0: registered as a time-of-day clock, resolution 1.000000s Event timer "RTC" frequency 32768 Hz quality 0 hpet0: &lt;High Precision Event Timer&gt; iomem 0xfed00000-0xfed003ff irq 8 on acpi0 Timecounter "HPET" frequency 14318180 Hz quality 950 Event timer "HPET" frequency 14318180 Hz quality 450 Event timer "HPET1" frequency 14318180 Hz quality 440 Event timer "HPET2" frequency 14318180 Hz quality 440 Timecounter "ACPI-safe" frequency 3579545 Hz quality 850 acpi_timer0: &lt;24-bit timer at 3.579545MHz&gt; port 0x408-0x40b on acpi0 pcib0: &lt;ACPI Host-PCI bridge&gt; port 0xcf8-0xcff on acpi0 pci0: &lt;ACPI PCI bus&gt; on pcib0 vgapci0: &lt;VGA-compatible display&gt; port 0xf000-0xf03f mem 0x90000000-0x90ffffff,0x80000000-0x8fffffff at device 2.0 on pci0 vgapci0: Boot video device xhci0: &lt;Intel Braswell USB 3.0 controller&gt; mem 0x91500000-0x9150ffff at device 20.0 on pci0 xhci0: 32 bytes context size, 64-bit DMA usbus0 on xhci0 usbus0: 5.0Gbps Super Speed USB v3.0 pci0: &lt;encrypt/decrypt&gt; at device 26.0 (no driver attached) pcib1: &lt;ACPI PCI-PCI bridge&gt; at device 28.0 on pci0 pci1: &lt;ACPI PCI bus&gt; on pcib1 pci1: &lt;network&gt; at device 0.0 (no driver attached) isab0: &lt;PCI-ISA bridge&gt; at device 31.0 on pci0 isa0: &lt;ISA bus&gt; on isab0 acpi_button0: &lt;Power Button&gt; on acpi0 acpi_tz0: &lt;Thermal Zone&gt; on acpi0 sdhci_acpi0: &lt;Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller&gt; iomem 0x9152c000-0x9152cfff irq 45 on acpi0 mmc0: &lt;MMC/SD bus&gt; on sdhci_acpi0 sdhci_acpi1: &lt;Intel Bay Trail/Braswell SDXC Controller&gt; iomem 0x9152a000-0x9152afff irq 47 on acpi0 mmc1: &lt;MMC/SD bus&gt; on sdhci_acpi1 atkbdc0: &lt;Keyboard controller (i8042)&gt; at port 0x60,0x64 on isa0 atkbd0: &lt;AT Keyboard&gt; irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] atkbdc0: non-PNP ISA device will be removed from GENERIC in FreeBSD 12. est0: &lt;Enhanced SpeedStep Frequency Control&gt; on cpu0 Timecounters tick every 1.000 msec ugen0.1: &lt;0x8086 XHCI root HUB&gt; at usbus0 uhub0: &lt;0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1&gt; on usbus0 mmcsd0: 31GB &lt;MMCHC DF4032 0.1 SN 9557679A MFG 05/2016 by 69 0x0000&gt; at mmc0 200.0MHz/8bit/8192-block mmcsd0boot0: 4MB partion 1 at mmcsd0 mmcsd0boot1: 4MB partion 2 at mmcsd0 mmcsd0rpmb: 4MB partion 3 at mmcsd0 mmc1: No compatible cards found on bus WARNING: WITNESS option enabled, expect reduced performance. Trying to mount root from ufs:/dev/mmcsd0p2 [rw]... uhub0: 13 ports with 13 removable, self powered lo0: link state changed to UP </code></pre> https://adventurist.me/posts/00292Sun, 30 Sep 2018 00:00:00 +0000 America's Hackercamphttps://adventurist.me/posts/00293<p> <a href="/images/toorcamp2018-milliwaysdome.jpg"> <img src="/imagessmall/toorcamp2018-milliwaysdome.jpg"/> </a> </p> <p> <a href="https://toorcamp.com"> Toorcamp </a> is America's Hackercamp, it happens on the stunning Orcas Island an hour or so North West of Seattle. Hacker events always manage to create their own neon lit world, Toorcamp took this to another level and sequestered 500 hackers away in a idillic resort in the Pacific North west and even then it poured on the neon lighting effects to keep us in a dream world. </p> <p> <a href="/images/toorcamp2018-ledgateway.jpg"> <img src="/imagessmall/toorcamp2018-ledgateway.jpg"/> </a> </p> <p> Doe Bay resort spreads over three regions, a bay area (were I camped with Milliways), an island outcrop and a field at the top of a hill. This division (especially the hill) make it less enticing to move around the site. It also meant that the nosiy area in the bay, by being far away from most of the camping, was able to go all night long without disturbing too many people. </p> <p> <a href="/images/toorcamp2018-callout.jpg"> <img src="/imagessmall/toorcamp2018-callout.jpg"/> </a> </p> <p> Toorcamp is serviced by a group of telephone enthusiasts called Shady Tel. They operate a highly reptuable phone company in the American fashion, offering service anywhere on the camp site, whether near an exchange or on a boat out in the bay. </p> <p> I hate talking to people on the phone, but I found this limited network to be a ton of fun. I must have spent hours wardialling around trying to find people to call. Once I discovered the maintainence line that echo'd back your phone number I started going around and collecting interesting phones. </p> <p> <a href="/images/toorcamp2018-payphone.jpg"> <img src="/imagessmall/toorcamp2018-payphone.jpg"/> </a> </p> <p> Because we are hackers on top of this phone network highly ammusing things pop up. Milliways ran a pager network and from their payphone I spent many hours paging people to call numbers. Knowing how to find numbers for a phone I started paging people to call me at random places. </p> <p> <a href="/images/toorcamp2018-stagedome.jpg"> <img src="/imagessmall/toorcamp2018-stagedome.jpg"/> </a> </p> <p> The Doe Bay resort that hosted Toorcamp would be a wonderful place to go even without an amazing hacker camp in toe. Rather than attempt to describe the event it is easier to link to the 10 intervies the <a href="https://theamphour.com/397-1-an-interview-with-monica-houston-and-alessandra-nolting/"> amp hour podcast </a> did on site. </p> <p> The final night nature decided to turn on a smoke machine and join the party. </p> <p> <a href="/images/toorcamp2018-neonfog.jpg"> <img src="/imagessmall/toorcamp2018-neonfog.jpg"/> </a> </p> https://adventurist.me/posts/00293Mon, 01 Oct 2018 00:00:00 +0000 EMF Camp 2018https://adventurist.me/posts/00294<p> <a href="/images/emfcamp2018-skeletondome.jpg"> <img src="/imagessmall/emfcamp2018-skeletondome.jpg"/> </a> </p> <p> <a href="https://emfcamp.org"> EMF Camp </a> is a giant hacker camp that occurs in the deep South of England. It managed to attract nearly 2500 people into a field for four days at the end August. </p> <p> EMF Camp 2018 was the first time I have volunteered to help with the organisation. I volunteered to help out the content team earlier in the year, it wasn't until the week before that we realised lightning talks needed more organisation. Foolishly I stepped up and got a weird split experience between attending the camp and running a tiny slice of it. </p> <p> It wasn't sooooo awful, I'll probably do it again. </p> <p> <a href="/images/emfcamp2018-map.jpg"> <img src="/imagessmall/emfcamp2018-map.jpg"/> </a> </p> <p> I attended EMF Camp 2014, since then they have really managed to integrate well with the village system used at other camps. The map shows all the spontaneous events that people put together during the camp, the adage 'it is what you make it' really comes out at these events with many participants helping to make it hole. </p> <p> <a href="/images/emfcamp2018-bordercontrol.jpg"> <img src="/imagessmall/emfcamp2018-bordercontrol.jpg"/> </a> <a href="/images/emfcamp2018-shoutytel.jpg"> <img src="/imagessmall/emfcamp2018-shoutytel.jpg"/> </a> </p> <p> In our own way the <a href="https://scottishconsulate.org"> Scottish Consulate </a> contributed too, with our bureaucratic role playing game going beyond the pale and expanding into operation of a phone network (cups and string) and a Hard border from the rest of the camp. </p> <p> <a href="/images/emfcamp2018-polybiusbiotech.jpg"> <img src="/imagessmall/emfcamp2018-polybiusbiotech.jpg"/> </a> <a href="/images/emfcamp2018-tenticle.jpg"> <img src="/imagessmall/emfcamp2018-tenticle.jpg"/> </a> </p> https://adventurist.me/posts/00294Tue, 02 Oct 2018 00:00:00 +0000 EuroBSDCon Bucharest Romaniahttps://adventurist.me/posts/00295<p> The <a href="https://toorcamp.com"> Wikitravel </a> page for Bucharest has some scary warnings about taxis. I didn't heaer any horror stories from conference goers, but there was a large variation in prices for the same journey. </p> <p> He held a two day DevSummit before the conference proper. A DevSummit is a chance to talk through technical issues and hash things out face to face. We did some planning for FreeBSD 13 with the idea of setting GGoals for the release. </p> <p> We tried to match a bit of a hackathon with the DevSummit, but the tutorial schedules meant we couldn't focus the time very well and it was broken up. </p> <h2> EuroBSDCon </h2> <p> <strong> Day One </strong> : </p> <ul> <li> Keynote1: Lightweight virtualization with LightVM and Unikraft </li> <li> <strong> Hacking together a FreeBSD presentation streaming box – For as little as possible </strong> <ul> <li> That was me, I thought it was quite good :D </li> </ul> </li> <li> The Evolution of FreeBSD Governance </li> <li> Using Boot Environments at Scale </li> <li> The End of DNS as we know it </li> <li> Keynote2: Some computing and networking historical perspectives <ul> <li> Ron's keynote was unreal and it is a massive shame that this sessions wasn't recorded. Ron has a ton of experience with working with network systems since 1976, he shared some stories and anecdotes. The one closest to my heart was pirating away an IMP front pannel and saving it from the scrappers. If you get a chance to see Ron speak you should jump up and down at it. </li> </ul> </li> </ul> <p> <strong> Day Two </strong> : </p> <ul> <li> Taking NetBSD kernel bug roast to the next level : Kernel Sanitizers </li> <li> Livepatching FreeBSD kernel <ul> <li> This was an interesting study into how many different platforms do live patching. The FreeBSD way to do live patching could be simplified to 'use dtrace fbt probes'. Which is super reductive of all of the work invovled, but it shows the power of the system we have with dtrace. </li> </ul> </li> <li> Profiling Packet Processing: Performance &amp; Peculiarities </li> <li> Debugging lessons learned as a newbie fixing NetBSD <ul> <li> Maya is a terrifying person. Somehow she manages to hack productivly across the entire range of the stack and across many different architectures. There were many debuggin gems in here, I hope she continues to present on this the information was great. </li> </ul> </li> <li> FreeBSD/VPC: a new kernel subsystem for cloud workloads <ul> <li> This was a reprisal of a <a href="https://www.youtube.com/watch?v=La4ekkKbM5o"> bsdcan talk </a> . </li> </ul> </li> <li> FreeBSD on IBM PowerNV <ul> <li> An recount of the porting work Semihalf did to POWER8. Interesting, I hope it is also sumbitted to AsiaBSDCon. There need to be more written account of bringing up on different architectures. </li> </ul> </li> </ul> <p> Day Two concluded with announcing the location of the next EuroBSDCon, Lillehammer Norway. </p> https://adventurist.me/posts/00295Wed, 03 Oct 2018 00:00:00 +0000 My FreeBSD Development Setuphttps://adventurist.me/posts/00296<p> I do my FreeBSD development using <code> git </code> , <code> tmux </code> , <code> vim </code> and <code> cscope </code> . </p> <p> I keep a FreeBSD fork on my github, I have forked <a href="https://github.com/freebsd/freebsd"> https://github.com/freebsd/freebsd </a> to <a href="https://github.com/adventureloop/freebsd"> https://github.com/adventureloop/freebsd </a> </p> <p> On my fork I have the freebsd/freebsd repo set as an upstream </p> <pre><code>$ git remote -v origin git@github.com:adventureloop/freebsd.git (fetch) origin git@github.com:adventureloop/freebsd.git (push) upstream https://github.com/freebsd/freebsd.git (fetch) upstream https://github.com/freebsd/freebsd.git (push) </code></pre> <p> See this article for information on setting this up <a href="https://help.github.com/en/articles/configuring-a-remote-for-a-fork"> https://help.github.com/en/articles/configuring-a-remote-for-a-fork </a> </p> <p> I do all work on branches using worktrees, keeping the master branch clean. </p> <p> Periodically I sync the master branch with the FreeBSD upstream: </p> <pre><code>$ cd ~/code/freebsd-dev/freebsd-git $ git checkout master $ git fetch upstream $ git merge upstream/master $ git push </code></pre> <p> I have a development setup based on Ian Lapore's arm set up documented on the FreeBSD wiki <a href="https://wiki.freebsd.org/FreeBSD/arm/crossbuild"> https://wiki.freebsd.org/FreeBSD/arm/crossbuild </a> </p> <p> I have a <code> freebsd-dev </code> directory in my code directory. It their I keep a copy of FreeBSD in <code> freebsd-git </code> , and <code> obj </code> directory for build output and a projects directory for in progress code. </p> <pre><code>$ tree -L2 . ├── diffs │ ├── D15222.diff │ └── old ├── dstdir │ ├── boot │ ├── METALOG │ └── usr ├── freebsd-git │ ├── bin │ ├── sbin ... │ └── usr.sbin ├── obj │ └── usr ├── projects │ ├── atomicstats │ ├── axp288 │ ├── bugsquash │ ├── byebyejumbograms ... </code></pre> <p> I use <code> git </code> worktrees for ongoing projects. <code> git </code> worktrees allow you to have a shallow file system copy on a <code> git </code> branch in a directory. </p> <p> When starting a new project I do something like: </p> <pre><code>$ cd ~/code/freebsd-dev/freebsd-git $ git worktree add thj/newdevelopment ../projects/newdevelopment master $ cd ../projects/newdevelopment </code></pre> <p> Once the worktree is set up I launch a <code> tmux </code> session in the projects directory. Each random idea or itch I have, if there is enough there, ends up with a project worktree and a <code> tmux </code> session. </p> <p> <code> tmux </code> allows me to have many windows in a session, I have a serious <code> tmux </code> problem. Right now I have 11 sessions with 42 windows across them. This is a good indicator of my focus level. </p> <p> I do FreeBSD development with <code> cscope </code> and <code> vim </code> . With <code> tmux </code> splits I normally have an open file and I use other <code> cscope </code> instances in <code> tmux </code> windows to search for things I need in the tree. </p> <p> I do testing in a <code> bhyve </code> vm and leave the serial port in a <code> tmux </code> window somewhere. I follow the setup in the FreeBSD <a href="https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html"> handbook </a> and back each vm with a zfs dataset. </p> <p> I do FreeBSD kernel builds using a command like: </p> <pre><code>env MAKEOBJDIRPREFIX=/home/tom/code/freebsd-dev/obj make -j 44 buildkernel \ -DKERNFAST installkernel \ -DNO_ROOT DESTDIR=/home/tom/code/freebsd-dev/dstdir </code></pre> <p> I then ship kernels to the test vm with scp. jhb@ has a nicer method using the <code> bhyve-loader </code> , but I am yet to try it. </p> <p> When changes are maturing I create reviews for them using arcanist, <a href="https://www.bidouilliste.com/blog/2016/01/21/How-to-contribute-to-FreeBSD-with-phabricator-and-git/"> manu@ has a good article on doing this </a> </p> https://adventurist.me/posts/00296Wed, 14 Aug 2019 00:00:00 +0000 FreeBSD on the NanoPi NEOLTShttps://adventurist.me/posts/00297<p> The NanoPi NEOLTS is a SBC from <a href="https://www.friendlyarm.com/index.php?route=product/product&amp;path=69&amp;product_id=132"> FriendlyElec </a> that uses the Allwinner H3 SOC. The NanoPi NEOLTS has a nice selection of hardware including 100Mbit Ethernet, 3 USB Ports and a bunch of exposed GPIO. </p> <p> FreeBSD on the NanoPi uses GENERICSD image. This image requires a bootloader to be added before it will work. We can prepare a single image to be copied to many SD cards by using a memory disk as an intermediate step. </p> <p> <a href="/images/nanopi-neolts.jpg"> <img src="/imagessmall/nanopi-neolts.jpg"/> </a> </p> <p> We need to: </p> <ul> <li> Get the latest GENERICSD card image snapshot </li> <li> Install the correct boot loader pkg </li> <li> Create a memory disk </li> <li> Copy the GENERICSD image to memory disk </li> <li> Copy the bootloader to the memory disk </li> <li> Mount the root partition of the sd card image </li> <li> Copy the programs and files we need for the tutorial to the sd card </li> </ul> <p> The latest image is as I write is 13 CURRENT from 20190829: </p> <pre><code>$ fetch ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv7/ISO-IMAGES/13.0/FreeBSD-13.0-CURRENT-arm-armv7-GENERICSD-20190829-r351591.img.xz </code></pre> <p> We have to decompress the image before we can use it </p> <pre><code>$ xz -d FreeBSD-13.0-CURRENT-arm-armv7-GENERICSD-20190829-r351591.img.xz </code></pre> <p> Each u-boot bootloader platform has its own package, currently there are 46 different bootloaders in the FreeBSD ports system. We want the u-boot for the nanopi_neo (our target). </p> <pre><code>$ pkg search nanopi u-boot-nanopi-neo2-2019.07 Cross-build das u-boot for model nanopi-neo2 u-boot-nanopi_a64-2019.07 Cross-build das u-boot for model nanopi_a64 u-boot-nanopi_m1plus-2019.07 Cross-build das u-boot for model nanopi_m1plus u-boot-nanopi_neo-2019.07 Cross-build das u-boot for model nanopi_neo u-boot-nanopi_neo_air-2019.07 Cross-build das u-boot for model nanopi_neo_air # pkg install u-boot-nanopi_neo-2019.07 </code></pre> <p> The <code> u-boot-nanopi_neo </code> package contains the binary bootloader we need in <code> u-boot-sunxi-with-spl.bin </code> </p> <pre><code>$ pkg info -l u-boot-nanopi_neo-2019.07 u-boot-nanopi_neo-2019.07: /usr/local/share/licenses/u-boot-nanopi_neo-2019.07/GPLv2 /usr/local/share/licenses/u-boot-nanopi_neo-2019.07/LICENSE /usr/local/share/licenses/u-boot-nanopi_neo-2019.07/catalog.mk /usr/local/share/u-boot/u-boot-nanopi_neo/README /usr/local/share/u-boot/u-boot-nanopi_neo/boot.scr /usr/local/share/u-boot/u-boot-nanopi_neo/metadata /usr/local/share/u-boot/u-boot-nanopi_neo/u-boot-sunxi-with-spl.bin </code></pre> <p> With the GENERICSD image and the bootloader we need to create the memory disk image we will use for staging. First we need to create a large enough backing file. </p> <pre><code>$ truncate -s 8G nanopi.img # mdconfig -f nanopi.img md0 </code></pre> <p> Now we can <code> dd </code> the GENERICSD image to the memory disk </p> <pre><code># dd if=FreeBSD-13.0-CURRENT-arm-armv7-GENERICSD-20190829-r351591.img of=/dev/md0 bs=1m </code></pre> <p> We need to <code> dd </code> the bootloader to the start of the SD card, i.e. the entire device and not a partition. </p> <pre><code># dd if=/usr/local/share/u-boot/u-boot-nanopi_neo/u-boot-sunxi-with-spl.bin of=/dev/da0 bs=1k seek=8 conv=sync </code></pre> <p> With the memory disk attached we can interact with the image file as if it were a real USB drive or SD card. </p> <pre><code>$ gpart show md0 =&gt; 63 16777153 md0 MBR (8.0G) 63 2016 - free - (1.0M) 2079 102312 1 fat32lba [active] (50M) 104391 6187041 2 freebsd (3.0G) 6291432 10485784 - free - (5.0G) </code></pre> <p> We can mount the root partition of the SD card and modify or add any files we wish: </p> <pre><code># mount /dev/md0sa mnt </code></pre> <p> When we are done changing things we have to disconnect the memory disk: </p> <pre><code># sudo mdconfig -d -u md0 </code></pre> <p> Finally we can copy the memory disk to a real sd card using <code> dd </code> : </p> <pre><code># sudo dd if=nanopi.img of=/dev/da0 bs=1m </code></pre> https://adventurist.me/posts/00297Sat, 31 Aug 2019 00:00:00 +0000 Help me blog more in Junehttps://adventurist.me/posts/00298<p> This is a post on my blog. </p> <p> I both have a blog and enjoy blogging. I think a blog is the perfect way to keep notes for myself with the nice possibility that they might help someone else. I frequently look up my own post on <a href="https://adventurist.me/posts/0048"> how to take screenshots with imagemagick on this blog. </a> </p> <p> I wrote a blog post everyday for 6 months, <a href="https://adventurist.me/posts/0090"> from the 26th September 2016 </a> to <a href="https://adventurist.me/posts/0286"> the 27th of March 2017 </a> , in the end I added 196 new entries to this blog in 182 days. I can't write an epic detailed post everyday, though I might manage a week or so like that if I have a backlog. Most posts were little more than an image and some text, little more than tweets. </p> <p> But I still wrote, on a few days I even wrote more than one blog post. Under each blog post I included where in the world I was (borrowed from a characters quirk in Cryptonomicom), the weather and the books I was reading at the time. </p> <p> These posts cover a range, <a href="https://adventurist.me/posts/0219"> pictures I was proud of </a> , <a href="https://adventurist.me/posts/0174"> planning for events </a> , <a href="https://adventurist.me/posts/0191"> travel </a> and <a href="https://adventurist.me/posts/0108"> cool projects I worked on </a> . Reviewing these has been a fun experience. </p> <p> All that said, I haven't published a <a href="https://adventurist.me/posts/00297"> blog post for 276 days </a> and I think I would like some help getting back into the public writing groove. </p> <p> I tend to be better at delivering projects when I am held accountable by other people. Think of it as peer help rather than peer pressure. </p> <p> I think it would be really cool if you too wrote some blog posts. Not for me, not for anyone else, but for you. You today and in the future. Write something now to clear your head, write something today that will help you tomorrow. Writing things down helps you remember them, but when you forget you will get to try searching your own log rather than having to scour the depths of the Internet. </p> <p> I asked this weekend at <a href="https://campgnd.com"> campgndd </a> for some peer help so that I would actually write blog posts in June. I suggested we each try to write four this month. </p> <p> These kind people said they would try and write too to keep my going: </p> <ul> <li> <a href="https://wiki.philpem.me.uk"> https://wiki.philpem.me.uk </a> </li> <li> <a href="https://grimmwa.re"> https://grimmwa.re </a> </li> <li> <a href="https://river.cat/"> https://river.cat/ </a> </li> <li> <a href="https://www.alfiepates.me/"> https://www.alfiepates.me/ </a> </li> <li> <a href="https://chebe.dreamwidth.org/"> https://chebe.dreamwidth.org/ </a> </li> <li> <a href="https://mgdm.net"> https://mgdm.net </a> </li> <li> <a href="https://foxk.it"> https://foxk.it </a> </li> </ul> <p> It would be cool if you were to join us. I will look for your response on your blog. </p> https://adventurist.me/posts/00298Tue, 02 Jun 2020 00:00:00 +0000 Capturing a screen sub section with ffmpeghttps://adventurist.me/posts/00299<p> <video controls="" src="https://altelectron.org.uk/media/77aed321b6eab53a23eba9afd7b2c0070ef4574d0d6c7b805d47d2ea80d0998d.webm?name=scroll.webm"> </video> </p> <p> I <a href="https://altelectron.org.uk/notice/9vnwoTWXs6SbazATx2"> tooted </a> me scrolling through the browser tabs I opened from the <a href="https://docs.google.com/spreadsheets/d/1OIUBp4kFxmpWJihhq6WLwJQR1Am4DsD59bEYlJZxeGY/htmlview?pru=AAABcqqfcLg*NP_E2OFXC2QEcC0qJeLyQw#gid=0"> Black Producers bandcamp list </a> . I used ffmpeg to to grab a subsection of the screen with this command: </p> <pre><code>ffmpeg -f x11grab -show_region 1 -framerate 10 -video_size 720x480+100,200 -i $DISPLAY scroll.webm </code></pre> <ul> <li> <code> video_size </code> sets the size and offset in the window (needed if grabbing a subsection) </li> <li> <code> show_region </code> paints a box around the active part, this helps dial in what is captured. </li> </ul> <p> It took me a while to figure out what the input (-i) should be, in the end I figured out that it needs to be the X display, the easiest way to grab this is from the environment variable <code> $DISPLAY </code> . </p> <p> I first made mp4's from the capture, but they were coming out all garbled, firefox refused to play and vlc was pretty sad. I move to webm and the capture is smaller and works in firefox. </p> https://adventurist.me/posts/00299Sat, 13 Jun 2020 00:00:00 +0000 FreeBSD on the Intel 10th Gen i3 NUChttps://adventurist.me/posts/00300<p> I have ended up with some 10th Gen i3 NUC's ( <a href="https://ark.intel.com/content/www/us/en/ark/products/195506/intel-nuc-10-performance-kit-nuc10i3fnh.html"> NUC10i3FNH </a> to be specific) to put to work in my testbed. These are quite new devices, the build date on the boxes is <code> 13APR2020 </code> . Before I figure out what their true role is (one of them might have to run linux) I need to install FreeBSD -CURRENT and see how performance and hardware support is. </p> <p> They have an Intel i3-10110U with 2 cores and 4 threads at 2ish GHz (with 4GHz boost), I got a single 32GB DIMM of RAM for each and a 480GB Western Digital M.2 SSD. This configuration came in just under £500 for each NUC. </p> <p> The NUCs are pretty small, they have pretty beefy fans taking up about a cm of the top of the enclosure. They certainly aren't silent, without any load I could hear the NUC sat on the desk next to me. When building at full steam the fan in the NUC is about as loud as my x270 Thinkpad is when it is building. </p> <h2> What works? </h2> <p> Out of the box I had to break into the bios and disable secure boot to boot the FreeBSD installer. I did this by hitting every FN key as the NUC booted, I think FN2 was the correct choice. At the time my keyboard was being fought over by USB and Bluetooth on my MacBook Pro. </p> <p> FreeBSD install was problem free. I set up the M.2 as a single drive with ZFS, datasets and snapshots are a magic power. </p> <p> Before I tried anything else I had to get an idea at how well this NUC would build FreeBSD. I don't expect this to be a build machine, but having spent a while shopping for build machines recently (I settled on a VM in hetzner) it is the only benchmark I really care about. <code> make -j4 buildworld buildkernel </code> took 2:45, that isn't the fastest in the world, but it is about an 1:15 faster than my x270 with its 2015 <a href="https://ark.intel.com/content/www/us/en/ark/products/88190/intel-core-i5-6300u-processor-3m-cache-up-to-3-00-ghz.html"> i5-6300U </a> . The difference 5ish years makes. </p> <p> Graphics in this 10th Gen Intel processor wasn't supported by <code> drm-current-kmod </code> and I had to install <code> drm-devel-kmod </code> . With the devel kmod the NUC is happy to push all the pixels of the 4k TV I have here and even drive additional second monitor connected with USB-C-&gt;HDMI adapter at the same time. </p> <p> Audio works through the front 3.5mm jack and after changing <code> hw.snd.default_unit </code> from HDMI too. There is an issue where when the display is blanked (turned off), audio will stop, but won't come back when the display does. manu@ suggested setting <code> hw.i915kms.disable_power_well=0 </code> in <code> loader.conf </code> , this resolved the problem for me. </p> <p> The Intel 9462 WiFi in the NUC is not supported (yet), I stuck a cheap <code> rtwn </code> based USB WiFi dongle in the front port. External USB WiFi is cumbersome on a laptop, but on a machine that will rarely move it is fine. The onboard Ethernet is supported by <code> em </code> and is happy to do 940ishMbit/s with <code> iperf3 </code> with TCP and UDP. </p> <p> The NUC has 5 USB ports, 3 USB-A and two USB-C. The USB-C port on the back has a little lightning bolt next to it and I imagine that means it is the one with thunderbolt support. I did a disk speed test to a Sandisk Extreme Portable SSD. The front port managed 200MB/s or so while the rear thunderbolt one only got to about 160MB/s for read and write. My MacBook Pro manages the advertised 500MB/s read speeds, so I need to dig into whether this is a hardware problem or a FreeBSD problem. Luckily I have two so installing Linux to test performance won't be a bother. </p> <p> I quite like these little boxes, you can get more hardware for your money with a tower pc, but not in this form factor. I wouldn't be surprised if the i7 versions of these were quite good at building FreeBSD. The fans are a bit loud, but that can be fixed for me by playing blaring techno. </p> <p> I think the NUC in this configuration is going to make a great test node in my satellite testbed or a nice little desktop box for doing video tasks. </p> <h2> Hardware Support </h2> <pre><code>Storage Yes M.2 is fine, I didn't have a drive to test SATA Graphics Yes drm-devel-kmod (on r362612) Audio Yes hda(4) Ethernet Yes Supported by em(4) Wireless No Intel AC 9462 not supported :( USB Yes All ports work, Suspend/resume Yes suspend is fine, resume required drm-devel-kmod SD slot Yes Comes up as a mmcsdX device Thunderbolt N/A I have no idea what the implications of this are or how to test </code></pre> https://adventurist.me/posts/00300Fri, 26 Jun 2020 00:00:00 +0000 Command Line Bug Hunting in FreeBSDhttps://adventurist.me/posts/00301<p> FreeBSD uses <a href="https://www.bugzilla.org/"> bugzilla </a> for tracking bugs, taking feature requests, regressions and issues in the Operating System. The web interface for bugzilla is okay, but if you want to do a lot of batch operations it is slow to deal with. We are planning to <a href="https://wiki.freebsd.org/OfficeHours"> run a bugsquash </a> in July and that really needs some tooling to help any hackers that show up process the giant bug list we have. </p> <p> Thankfully there is a <a href="https://github.com/williamh/pybugz"> python3 command line tool for interacting with bugzilla, called pybugz </a> . <code> bugz </code> allows you to search through, up date and modify bugs without having to use a web browser. Getting <code> bugz </code> going was not very intuitive and it took me a bit of faffing. </p> <p> <code> bugz </code> ships with a configuration for connecting to the FreeBSD bugzilla you use it by selecting it as a <code> connection </code> . The supported connections are dumped out if you try and do an operation with the <code> -d 3 </code> debug flag. This flag is really helpful for figuring out how to use <code> bugz </code> because while it documents itself, it holds on to the documentation like a powerful secret. </p> <p> <code> bugz </code> really wants you to authenticate before you do anything, it won't show you help for commands without auth. There is however a <code> --skip-auth </code> flag. With this you can search for bugs, lets look for ipv6 issues with a patch in the base system: </p> <pre><code>$ bugz --connection FreeBSD --skip-auth search --product "Base System" "patch ipv6" * Info: Using [FreeBSD] (https://bugs.freebsd.org/bugzilla/xmlrpc.cgi) * Info: Searching for bugs meeting the following criteria: * Info: product = ['Base System'] * Info: status = ['New', 'Open', 'In Progress', 'UNCONFIRMED'] * Info: summary = ['patch ipv6'] 88821 bugs [patch] IPv6 support for ggated(8) 186133 bugs [patch] tcpdump(1): zero checksums are invalid for UDP over IPv6 174225 bugs [network.subr] [patch] add support for ipv6_addrs_IF style aliases to rc.conf(5) 178881 bdrewery [patch] getifaddrs(3) does not report IPv6 addresses properly in 32-bit compatibility mode 180572 rc [network.subr] [patch] SLAAC is enabled for ipv6_cpe_wanif 133227 bugs [patch] whois(1): add support for SLD whois server lookups and IPv6 address lookups 104851 bugs [inet6] [patch] On link routes not configured when using both IPv6 autoconfiguration and manual configuration 147681 bugs [network.subr][patch] Add inet6 keyword if it wasn't specified in ifconfig_IF_ipv6 130657 bugs [ip6] [patch] ipv6 class option 165190 bugs [ipfw] [lo] [patch] loopback interface is not marking ipv6 packets 245103 bz [patch] [ipv6] IPv6: update v6 temporary address lifetime according to rfc4941bis * Info: 11 bug(s) found. </code></pre> <p> We can also filter our search by component: </p> <pre><code>$ bugz --connection FreeBSD --skip-auth search --product "Base System" --component bhyve </code></pre> <p> <code> bugz </code> supports modifying and updating bugz from the command line, this is the main focus of the <a href="https://github.com/williamh/pybugz/blob/master/README"> README on github </a> . To authenticate <code> bugz </code> takes a username and password on the command line, I am not suggesting you fill your history with your bugzilla password, I did something like: </p> <pre><code>$ bugz --connection FreeBSD -u thj@freebsd.org --password `pass show FreeBSD/bugz | head -n 1` search udp </code></pre> <p> There is a <code> -k </code> flag that takes a key file, but I didn't want to dig into the source of <code> bugz </code> to figure out what this actually is. </p> <p> Our bug squash is probably going to focus on clearing bugs with patches and the readme has a workflow for finding bugs and grabbing any diffs. More tools can and should be written around <code> bugz </code> this is just a start. Just playing with this I have spotted bugs than can easily be closed from the tracker. </p> <p> Finally, you are going to need the help while using <code> bugz </code> , it took me longer than I liked to figure out that each sub command documents its own help and they all take the <code> -h </code> after the command. You need auth (or to skip auth) before you can use this flag. </p> <pre><code>$ bugz --connection FreeBSD --skip-auth search -h </code></pre> https://adventurist.me/posts/00301Sat, 27 Jun 2020 00:00:00 +0000 My Streaming Setuphttps://adventurist.me/posts/00302<p> <a href="/images/streamingtitlecard.jpg"> <img src="/imagessmall/streamingtitlecard.jpg"/> </a> </p> <p> In April and May I did some <a href="https://twitch.tv/tjhacking"> streaming on twitch of hardware hacking projects </a> . I started this as a way to work through the material for my cancelled <a href="https://www.bsdcan.org/2020/"> BSDCan </a> hardware hacking tutorial. With the tutorial cancelled I have been left with quite a few <a href="https://www.friendlyarm.com/index.php?route=product/product&amp;product_id=132"> NanoPi Neo LTS </a> and I was thinking about doing the tutorial as a series of videos with the idea of selling intro kits with the boards. </p> <p> So far I have done four streams aiming for about an hour for each. I will say now that I haven't streamed again in June, I am not saying it is the end, but I (and I bet you too) need to control my commitments or I just never get anything done. </p> <ul> <li> <a href="https://www.youtube.com/watch?v=YhNkkgmW9Jw"> An Introduction to hardware hacking with FreeBSD </a> </li> <li> <a href="https://www.youtube.com/watch?v=d6ecb0O3DFk"> Crime against computers 3 </a> </li> <li> <a href="https://www.youtube.com/watch?v=H2tRGTUYfjU"> Bitbanging from shell scripts part 1 </a> </li> <li> <a href="https://www.youtube.com/watch?v=s8uPMXQAAo4"> Driving APA102 LEDs from FreeBSD </a> </li> </ul> <p> I have also been asked to write up my streaming set up so other people can use it. This vanity pic I tooted seems to include most of it. </p> <p> <a href="/images/streamingsetup.jpg"> <img src="/imagessmall/streamingsetup.jpg"/> </a> </p> <h2> Equipment </h2> <p> I have a bunch of equipment because I want to stream stuff in the real world. If you just wanted to share some windows and your webcam as <a href="https://twitch.tv/provostk"> Kristof Provost </a> does then you can get by just with your laptop. </p> <ul> <li> Canon 600D </li> <li> Nikon J1 </li> <li> <a href="https://support.apple.com/kb/SP747?locale=en_GB"> MacBook Pro 13,1 </a> for streaming </li> <li> Zoom H3 microphone </li> <li> Aputure AL-M9 Mini LED Light </li> <li> <a href="https://www.amazon.co.uk/gp/product/B011OHZ8EK/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1"> Tripods </a> for the cameras </li> <li> An arm for the microphone </li> <li> <a href="https://www.amazon.co.uk/gp/product/B00TO8SX7G/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1"> LKV373 HDMI </a> as a capture device for a camera </li> </ul> <p> This is quite a lot of stuff, but other than the Aputure light I had all of it already from other projects. I would like to be able to capture the display of my work oscilloscope, thankfully the scope has VGA out so it is just a matter of figuring out a way to capture. </p> <h2> Software </h2> <p> I am using <a href="https://obsproject.com"> Open Broadcast Studio (OBS) </a> on macOS to mix video and feed it to twitch. </p> <p> OBS supports a rich variety of input sources that can mixed to make a scene. I have been using three scenes to make it easy to setup what is streamed in advance: </p> <ol> <li> Everything </li> <li> Just the camera </li> <li> Just the presentation </li> </ol> <p> Everything is the mixed view of my terminal, the camera output and the slides in a web browser. My tutorial slides are derived from my <a href="https://adventurist.me/presentations/eurobsdcon2019/eurobsdcon2019-hardwarehacking.html"> EuroBSDCan Tutorial </a> and render in a web browser natively. Having a browser in the video mix quickly turned out to be really helpful. </p> <p> OBS has been rock solid and I have had no problems with stability while streaming. The interface is a bit of a maze, but I suspect that is a natural result of the power it offers. </p> <h2> Canon Camera </h2> <p> For most of the top down shots I used a canon 600D with a 18-55mm kit lens. The battery in this thing is quite old and only manages about an hour and a half of video output. I have since gotten a USB powered battery insert that should allow me to run forever, but am yet to try streaming with it. </p> <p> My canon camera does not support acting as a webcam, but <code> gphoto2 </code> does support grabbing live video from it. This should have been easy to feed into OBS, but I couldn't get it working and ended up instead using <code> ffplay </code> to render the video and grabbed that with a video capture. To get video from <code> gphoto2 </code> into <code> ffplay </code> I ran: </p> <pre><code>gphoto2 --stdout --capture-movie | ffplay - </code></pre> <p> This turned out to be very stable and easy to set up. There is quite high latency between the capture output and the <code> gphoto2 </code> capture, but it worked fine if I didn't have to move the camera much. </p> <h2> Nikon Camera </h2> <p> I also have a Nikon J1 and while the camera is awful to use I do have a 10mm lens for it with a macro extender. This allows me to take very high detail pictures of PCBs. I wanted to add this to the streaming set up too. </p> <p> The Nikon firmware is garbage and while <code> gphoto2 </code> does support the camera I found I could only get a single image from the camera before having to reset it and was completely unable to get video from it. Never mind, my <a href="https://adventurist.me/presentations/eurobsdcon2018/eurobsdcon2018-streamingtalks.html"> 2018 EuroBSDCon Talk </a> used a HDMI network extender as a capture device. In the stream <a href="https://www.youtube.com/watch?v=d6ecb0O3DFk"> Crimes Against Computers3 </a> I did something awful with a BeagleBone Black and got video from the Nikon through the HDMI extender into OBS. </p> <p> This was a lot of faff to setup (though I since did get a USB-C Ethernet for the MacBook) and I am still kind of dubious of the stability of the LKV373 so I have only used this in the stream where I figured it out. I might try this again later. </p> <p> Since doing that stream cheap USB2 and USB3 HDMI capture devices have appeared. These are supposed to appear as UVC webcams to the system. I suspect these will be a better method than the LKV373, but I want to try before recommending them. </p> <h2> Audio </h2> <p> For audio I am using a Zoom H3 dictaphone thing. I really like the audio from the Zoom, but I seem to be in the minority. In the end it is the microphone I have. </p> <p> It is stereo which should be mixed down or you will drift across the channels when you move your head. OBS supports this so it wasn't a problem, but I did have to be told about it. </p> <p> The firmware for this thing isn't so great either, it cannot record to the Micro SD card while acting as a USB interface and Annoyingly there is a bug where it defaults to 44KHz for the audio. The USB driver doesn't seem to advertise this to the properly and if you continue with the default you get weird audio. I dealt with <a href="https://adventurist.me/posts/0082"> this before in FreeeBSD </a> , but was surprised to see it appear in macOS. You should always double check your audio before starting a stream. </p> <h2> Why not stream from FreeBSD? </h2> <p> I wanted a pain free approach where I could set up and go for my first streams so while OBS is ported to FreeBSD I expected it to be a lot more work than the much more common macOS/OBS combination. I expect FreeBSD/OBS support to get better if people continue streaming FreeBSD stuff. </p> <p> The MacBook is similar specs to my Thinkpad, but the wireless card in the Thinkpad doesn't have great support and only manages 80211g rates. That might just be enough to stream out the video, but it seems very risky to me. </p> <p> I will look at streaming with OBS from FreeBSD in the future. </p> <p> The streams have done okay so far, there is a big social media boost network of FreeBSD users and developers and that has helped people find the content. I am sure the next stream will have fewer viewers as there has been a gap in my streaming. </p> <h2> You can support this </h2> <p> Finally, I set up a ko-fi page to support me writing and streaming. I plan to write more this year and if there is interest I will do more streams too. The streams so far have mostly been using equipment and parts I already had. Doing more is going to require me spending money. </p> <p> If you have enjoyed my streams, or if you just want me to do more a very solid signal of your support would be tipping me a cup of coffee or something through ko-fi. <a href="https://ko-fi.com/tjhacking"> You can support my hardware habbit here </a> . </p> https://adventurist.me/posts/00302Tue, 30 Jun 2020 00:00:00 +0000 Quick and Dirty Network Scanninghttps://adventurist.me/posts/00303<p> Ever want to scan a subnet in the nosiest, least reliable way and generate too many processes while doing so? Yes? Well do I have a script for you: </p> <pre><code>#!/bin/sh default=172.20.10 if [ -z $1 ] then prefix=$default else prefix=$1 fi pinghost () { ping -t 1 -c 1 $1 &gt; /dev/null if [ $? -eq 0 ] then echo hit $1 fi } for x in `jot 254` do pinghost $prefix.$x &amp; done </code></pre> <p> I wrote this while I was doing <a href="https://hackthebox.eu"> hack the box </a> challenges and it was a fun and quick way to look to actually find things on my test network. I do not recommend using this. Some operating systems won't let you run it twice in succession as it generates a lot of processes. </p> https://adventurist.me/posts/00303Tue, 30 Jun 2020 00:00:00 +0000 Simple ipfw NAT for bhyve virtual machines and vnet jailshttps://adventurist.me/posts/00304<p> Most of the time, I want to do some throw away networking temporally to play with something or to try something out. I really don't like changing all the config on a machine just to try something. The FreeBSD documentation leans the other way first showing you what to edit in rc.conf before maybe mentioning that actual commands to run. </p> <p> The ipfw documentation has a different problem. The example in the handbook and online are both very verbose and very complicated. Because ipfw is normally configured with a shell script the authors go absolutely wild with all the features they can. </p> <p> I had a hard time figuring out ipfw in-kernel NAT from these guides. Instead here I present the simplest set of commands I could find to set up a NAT and a little explanation to help you debug when it doesn't work. </p> <p> This is based on a great email from <a href="https://lists.freebsd.org/pipermail/freebsd-virtualization/2014-October/002998.html"> Allan Jude </a> on the freebsd-virtualization list from 2014 that laid out the basics of this setup. </p> <h2> Set up Overview </h2> <p> For testing I want to run virtual machines and vnet jails on my laptop and give them have access to the internet. I want a throw away NAT setup that is ready to go quickly. </p> <p> My laptop connects to my home network (and eventually the internet) over wifi. The wifi network offers me an address in the 192.168.1.0/24 subnet. On my laptop I want to have multiple guests. To do this we are going to use ipfw NAT and a bridge interface. It will look something like this: </p> <pre><code> TO INTERNET ^ | | v +-------+ 192.168.1.x +-------------| wlan0 |---------------+ | +-------+ | | ^ | | | | | ipfw nat | | | | | V | | +---------+ | | 10.0.4.1 | bridge0 | | | +----+----+ | | ^ | | | 10.0.4.0/24 | | ___________+_______________ | | | | | | | | v v v v | | +---+--+ +--+---+ +--+---+ +--+---+| | | jail | | vm | | jail | | ... || | +------+ +------+ +------+ +------+| +-------------- laptop ---------------+ </code></pre> <p> The interfaces in the jails (the b half of the epair) and the virtual machines (the vtnet in the V) won't be visible to ipfw, but will exist in their own world. To work around this we will use a bridge with the epairs and tap interfaces. </p> <h2> Setting up ipfw NAT </h2> <p> We need to load the kernel modules for ipfw and the ipfw in kernel NAT. ipfw has the frustrating default (and annoyingly different to ipf and pf) of to dening all traffic. This default has the great property of locking you out of a machine you are setting up remotely. </p> <p> This is control by a sysctl that cannot be changed at run time, but we can change the default behaviour with kenv before we load the module: </p> <pre><code># kenv net.inet.ip.fw.default_to_accept=1 </code></pre> <p> Now we can safely load ipfw and the in-kernel NAT. </p> <pre><code># kldload ipfw ipfw_nat </code></pre> <p> ipfw should load enabled, if you are having trouble later on double check that the firewall is actually enabled. </p> <pre><code># sysctl net.inet.ip.fw.enable net.inet.ip.fw.enable: 1 </code></pre> <p> When we do NAT we are acting as a gateway between the traffic on the NATd interface and the real interface. For any packets to be passed we need to enable forwarding. </p> <pre><code># sysctl net.inet.ip.forwarding=1 # sysctl net.inet6.ip6.forwarding=1 </code></pre> <h2> ipfw rule set </h2> <p> We need to create an IPFW NAT instance configured with the interface we want to NAT (wlan0 in this case) and configure rules to pass all traffic from the bridge through the NAT. </p> <pre><code># ipfw nat 1 config if wlan0 # ipfw add 101 nat 1 ip from 10.0.4.0/24 to any out via wlan0 # ipfw add 103 nat 1 ip from any to any in via wlan0 </code></pre> <p> I like to leave a gap between rules like this so I can insert an ipfw log command for the eventual case that nothing makes sense and everything is broken. </p> <h2> set up interfaces </h2> <p> A bridge is the center of our guest network, we will give it the default root address that all of our guests will speak to. </p> <pre><code># ifconfig bridge create bridge0 # ifconfig bridge0 inet 10.0.4.1/24 up </code></pre> <p> Our jail will use an epair interface to speak to the outside world. They come as an a and a b part, ifconfig only tells us about the a part when it clones the interface. When we give a vnet jail an interface it is no longer visible to the host system. An epair gives us two interfaces that act like a virtual ethernet cable, we stick one end into the jail and the other is connected to the bridge. </p> <pre><code># ifconfig epair create epair0a </code></pre> <p> Our virtual machine will use a tap interface to access the world. The tap interface needs to be brought up. There is a helpful sysctl that is off by default which will trigger the interface to be brought up when it is first opened. I like to set this to one, otherwise I find myself debugging networking inside the VM alot with little success. </p> <pre><code># ifconfig tap create tap0 # sysctl net.link.tap.up_on_open=1 </code></pre> <p> With all the interfaces set up we need to add them to our bridge. </p> <pre><code># ifconfig bridge0 addm epair0a addm tap0 </code></pre> <h2> Create jail </h2> <p> Never spoken about is the bsdinstall jail command. It takes a directory and installs a jail into it. This command will ask you some questions, it would be cool if it didn't, that would make automating jail creation in scripts much easier for me. </p> <pre><code># mkdir testjail # bsdinstall jail testjail </code></pre> <p> We make our jail persist so it will stick around as we experiment. The following command creates the jail on the host: </p> <pre><code># jail -c name=testjail persist vnet path=testjail vnet.interface=epair0b </code></pre> <p> Now we can jexec into the jail and configure the epair. When you bring one end of an epair up, the other end comes up, when it goes down the other end goes down. We just need to configure an address and a default route in our jail. </p> <pre><code># jexec testjail sh [testjail] # ifconfig epair0b inet 10.0.4.4/24 up [testjail] # route add default 10.0.4.1 [testjail] # ping -c 1 10.0.4.1 [testjail] # ping -c 1 192.168.1.1 [testjail] # ping -c 1 8.8.8.8 </code></pre> <p> With this setup the jail can speak to our bridge, the local network and the wider Internet. </p> <h2> Create and config a VM </h2> <p> The FreeBSD offers prebuilt virtual machine images, The latest current one is available from a url like this: </p> <pre><code># fetch ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/13.0-CURRENT/amd64/Latest/FreeBSD-13.0-CURRENT-amd64.raw.xz </code></pre> <p> It would be cool if there was a latest symlink that gave you a new head VM from one static place. The image comes xz compressed, we need to unpack it and I like to move it to a consistent place: </p> <pre><code># xz -d FreeBSD-13.0-CURRENT-amd64.raw.xz # mv FreeBSD-13.0-CURRENT-amd64.raw /vms/freebsd-current </code></pre> <p> bhyve requires we load the vmm kernel module, with that we can use the excellent vmrun.sh script to launch our vm. </p> <pre><code># kldload vmm # sh /usr/share/examples/bhyve/vmrun.sh -c 4 -m 1024 -t tap0 -d /vms/freebsd-current freebsd-current </code></pre> <p> Once that comes up you can log in and do some manual config. </p> <pre><code>[vm] # ifconfig vtnet0 inet 10.0.4.5/24 up [vm] # route add default 10.0.4.1 [vm] # ping 8.8.8.8 </code></pre> <p> For DNS in both the jail and the virtual machines I have to manually set up the name server local from my network. </p> <p> /etc/resolv.conf </p> <pre><code>search lan nameserver 192.168.1.1 </code></pre> <p> This won't be valid as I move to other networks, but I am sure I will remember after only a little confusion and debugging. </p> <h2> Conclusion </h2> <p> That is all it takes. The NAT configuration is 3 firewall rules and enabling forwarding. None of this is persistent and that isn't great practice for a production environment, but it you just want to experiment with ipfw and NAT, or spin up a VM for today knowing how to do this in a non-persistent way is really helpful. </p> https://adventurist.me/posts/00304Wed, 01 Jul 2020 00:00:00 +0000 Blog more in 2020https://adventurist.me/posts/00305<p> In June I tried to <a href="https://adventurist.me/posts/00298"> write 4 blog posts </a> and I elicited help from some of my friends to do this. I managed to write 5 posts beyond the announcement I would blog: </p> <ul> <li> <a href="https://adventurist.me/posts/00299"> Capturing a screen sub section with ffmpeg </a> </li> <li> <a href="https://adventurist.me/posts/00300"> FreeBSD on the Intel 10th Gen i3 NUC </a> </li> <li> <a href="https://adventurist.me/posts/00301"> Command Line Bug Hunting in FreeBSD </a> </li> <li> <a href="https://adventurist.me/posts/00302"> My Streaming Setup </a> </li> <li> <a href="https://adventurist.me/posts/00303"> Quick and Dirty Network Scanning </a> </li> </ul> <p> Of course it wasn't just me, I asked other people to blog to help me stay on track. The idea here was that seeing other peoples blog posts would inspire and force me to keep going. This worked reasonably well. The pressure to write the blog posts was there, but publishing was harder. This ended up with me pushing several posts in the final few days of June. </p> <p> The pressure didn't really show up either, I know that the others wrote blog posts, but they didn't tell me! </p> <ul> <li> <a href="https://wiki.philpem.me.uk"> https://wiki.philpem.me.uk </a> </li> <li> <a href="https://grimmwa.re"> https://grimmwa.re </a> </li> <li> <a href="https://river.cat/"> https://river.cat/ </a> </li> <li> <a href="https://www.alfiepates.me/"> https://www.alfiepates.me/ </a> </li> <li> <a href="https://chebe.dreamwidth.org/"> https://chebe.dreamwidth.org/ </a> </li> <li> <a href="https://mgdm.net"> https://mgdm.net </a> </li> <li> <a href="https://foxk.it"> https://foxk.it </a> </li> </ul> <p> They were great sports to get involved and help me with this, you should look up their blogs and drop them into your rss reader. </p> <p> Because this wort of worked I think we should aim to keep doing this. Now 4 posts a month is a lot (maybe even too much) and so I thought that 8 more this year would be good. That is about 1.3333333... a month and seems entirely achievable. </p> <p> I am going to try and blow this number out the water, but even if I fail completely and only manage one or two more post that will still be great. </p> https://adventurist.me/posts/00305Thu, 02 Jul 2020 00:00:00 +0000 Advanced Documentation Retrieval on FreeBSDhttps://adventurist.me/posts/00306<pre><code>On Fri, Jul 16, 2021 at 04:23:20PM -0400, ░▒▓░░ ░▐░▒ wrote: &gt; Hi Tom. &gt; I just not realized you've not have your inbox assaulted by our listener &gt; feedback. Is there a specific address you'd like that routed to? &gt; &gt; Anyway, here is a choice one. &gt; *sigh* ░▒▓░░ I don't know what we should do about Michael . I spoke to a priest about an exorcism and he said "I'm not going near that monster, not on your life", which I thought was pretty alarmist for a priest. Follows is a rough markdown draft of the article "Advanced Documentation Retrieval on FreeBSD" as we discussed - Tom ----------- </code></pre> <h2> Advanced Documentation Retrieval on FreeBSD </h2> <p> FreeBSD is renowned for its very high quality documentation. For many queries the man pages have a wealth of accurate and up to date documentation that is frequently a surprise to uses of other operating systems. It is not uncommon to hear from new FreeBSD users that they have to relearn to try the man pages before searching on the web. </p> <p> Beyond man pages FreeBSD also has very high quality documentation in the form of the FreeBSD handbook. Only talking about the FreeBSD Handbook actually cuts short the range of really high quality documentation that the FreeBSD project offers. </p> <p> The FreeBSD Handbook covers installation and day to day usage of a FreeBSD system and it is kept reasonably up to date by the FreeBSD documentation team. The handbook is an amazing document that comes from a time before blog posts and wikis and it contains a mixture of official project direction and tutorial style walkthroughs on how to use different FreeBSD subsystems and third party software. Not everything is covered by the handbook and many times only one path of a piece of software use is covered, but it is an excellent resource to get started using and configuring a FreeBSD system. </p> <p> Deeper into FreeBSD there are several other 'books' that the FreeBSD project maintains. The full list of books is available from <a href="https://docs.freebsd.org/en/books/"> https://docs.freebsd.org/en/books/ </a> , it includes technical information about how the FreeBSD kernel works in the forms of the Design and Implementation of the 4.4BSD Operating System and the Architecture handbook. Documentation on how to contribute to different parts of the operating system as the porters-handbook, the fdp-primer and the developers-handbook. </p> <p> The FreeBSD project also hosts a wiki which contains less formal and in progress documentation, written by users and developers. The wiki can sometimes be much more like a temporary source of information, but it does contain valuable guides. It is the right place for pages such as <a href="https://wiki.freebsd.org/Laptops"> the laptop compatibility matrix </a> . The wiki is a unique FreeBSD project resource in that users are also able to have edit access. </p> <h2> What else is there? </h2> <p> Beyond the documentation the project provides there are outside sources of information on how to use and configure a FreeBSD system. Searching the web will bring up a lot of Technical information in the form of blog posts and articles. </p> <p> Searching the web is not the only way to get more information on FreeBSD systems. We can use external 'daemonised' resources by using the FreeBSD base system tool <code> invoke </code> . This tool is a little esoteric to use and sadly it is one of the excellent FreeBSD tools written by developers that just quite haven't seen the light of day. </p> <p> <code> invoke </code> ships in the FreeBSD source tree and is in <code> src/tools/tools/invoke </code> . <code> invoke </code> isn't built by default, but it is easy to build on a system using its Makefile: </p> <pre><code># cd /usr/src/tools/tools/invoke # make # make install </code></pre> <p> <code> invoke </code> requires quite a lot of information to be useful, annoying the author ���������@ was in the process of writing a book on invoke when they went missing travelling in rural Romania. However from reading the source we can see the list of information or 'principals' required to correctly invoke documentation. </p> <p> Principals are information locators which are tied closely to the source of the information. Personal web pages of authors work well and are easy to obtain, more potent sources such as hand written notes or the authors blood work the best, but we can substitute social media accounts to get a similar level familiar information about the author. </p> <p> <strong> XXX more on principals XXX </strong> </p> <p> For our example I have collected the personal web page, blog and twitter account of the source we want to use, we can pass them to invoke as arguments or in a configuration file. </p> <p> In addition to 'principals' the invoke tool needs to be run from a special environment. A comment in the source code describes this, but it took the author some trial an error to figure it out in practice. </p> <pre><code>/* * invoke must be run from either a larger or lesser circle. These * can be ancient such as the very high quality circle at Midmar, * however, if you are unable to travel a Ars Theurgia Goetia will * suffice. You must interface the machine running invoke via a * galvanic isolator. The transformer in an Ethernet connector with * magnetics works great, if you only have an SBC you'll have to * figure out something with transformers */ </code></pre> <p> From this comment we can see that we need to create a substitute circle to use with invoke and connect it to our computer, but isolate it from the machine. If we fail to isolate properly we can damage the machine and likely destroy it. </p> <p> We can create the substitute circle by using our preferred ethereal bonding fluid. Blood works very well, but collection can be legally tricky. Luckily we can use a vegan alternative in the form of beeted oat milk. If your local shops don't carry beeted oat milk you can make your own by mixing oat milk with beetroot juice during a full moon. </p> <p> With the substitute bonding fluid we need to draw our circle for summoning and holding triangle (you can see a <a href="https://en.wikipedia.org/wiki/The_Lesser_Key_of_Solomon#Ars_Theurgia_Goetia"> good example here </a> ). In this example we are going to use an Ethernet interface with magnetics, all you really need to do is to plug it into the circle. </p> <p> With the interface connected to the circle we can check for state using ifconfig, we need to look for the <code> ETHER </code> flag in the list of options. </p> <pre><code>igb0: flags=8943&lt;UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500 options=e507bb&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,ETHER&gt; ether ac:1f:6b:46:9e:da inet 11.14.17.13 netmask 0xffffff00 broadcast 137.50.17.255 inet6 fe80::ae1f:6bff:fe46:9eda%igb0 prefixlen 64 scopeid 0x1 media: Ethernet autoselect (1000baseT &lt;full-duplex&gt;) status: active nd6 options=23&lt;PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL&gt; </code></pre> <h2> Running Invoke </h2> <p> With our principals collected, and our link established to the circle we can run the <code> invoke </code> command as follows: </p> <pre><code># invoke -p [principals] [-i interface] [question] </code></pre> <p> We pass in the principals we have gather and tell <code> invoke </code> the interface name. If you hacked together a device you'll need to pass in the gpio controller and pin using -d, for the gpio controller and -P for the pin number. </p> <pre><code># invoke -p [principals] -d /dev/gpioc0 -P 1 [question] </code></pre> <p> The final argument to invoke is a quoted string that contains the question. </p> <p> If you are all set up then you can use <code> invoke </code> to summon your documentation author of choice, for this example I am using <a href="https://mwl.io/"> Michael W. Lucas </a> : </p> <pre><code># invoke -p https://mwl.io https://twitter.com/mwlauthor -i igb0 "How do I configure dummynet with weighted fair queues?" </code></pre> <p> If all goes well you should hear (an normally quite grumpy) disembodied voice bark the answer to your question back to you. </p> <p> As great as this is for single questions sometimes you want the author to hang around and help with protracted debugging sessions. We can achieve this with the <code> manifest </code> option to invoke: </p> <pre><code># invoke -p https://mwl.io https://twitter.com/mwlauthor -i igb0 manifest </code></pre> <p> With this option you will get the author directly summoned into the triangle attached to your summoning circle. Care should be taken with manifestations, the circle and triangle must remain intact for the duration of the session. If you are using a laptop (which I recommend and you need to use with an existing circle). Then make sure to watch the battery life careful. </p> <p> If you don't properly shutdown the session then you risk getting the spirit of the author trapped in your machine and no one wants that. </p> <h2> Conclusion </h2> <p> FreeBSD has a great range of available documentation, but sometimes you hit the limits of information that is readily available online. Here we discussed the <code> invoke </code> command and the ways it can be used to get direct help from the authors of high quality documentation that are a little too public. </p> https://adventurist.me/posts/00306Thu, 28 Oct 2021 00:00:00 +0000 FreeBSD/Ubuntu Dual Boot Homelab in The Bedroom by the bed testbedhttps://adventurist.me/posts/00307<p> Current events have meant that my work place is now my home office, frustratingly this is also where I sleep. On one hand this has resulted in a very short commute, but on the other hand it does mean that I am living in close quarters with the computers I use for experiments, on the third hand (where did that come from?) it means that I get to have a testbed in the room where I keep my bed. </p> <p> Of course this raises the serious question, if I write tests from my bed, which bed is the testbed? Unfortunately I only did one year of philosophy and so others will have to offer answers to this grand question. </p> <p> <a href="/images/bedroomtestbedv1.jpg"> <img src="/imagessmall/bedroomtestbedv1.jpg"/> </a> </p> <p> I am in the unusual (for me) situation of needing to (well getting do, I love perf) do network performance tests on real hardware, thankfully my <a href="http://minke-informatics.co.uk/"> friend Tony </a> was able to lend me two machines from his Bioinformatics cluster to play with for a couple of months. </p> <p> This testbed exists to answer questions of the form: </p> <p> <em> "How does stock Ubuntu compare to FreeBSD?" </em> </p> <p> For these tests to be as fair as possible I need to have as identical hardware for the tests as possible. Tony enabled this by giving machines built out to the same spec, annoyingly his target wasn't "push packets as fast as possible", but was instead "give a reasonable mix of a ton of storage and compute to look at DNA sequences. Anything weird in these computers is clearly his fault and we are very greatful to get to experience them. </p> <p> <a href="https://dmesgd.nycbug.org/index.cgi?do=view&amp;id=6239"> A dmesg from one of the boxes is here </a> , but roughly they are: </p> <ul> <li> CPU: AMD Opteron(tm) Processor 6380 (2500.05-MHz K8-class CPU) </li> <li> 128GB RAM </li> <li> SuperMicro MNL-H8DGI6 motherboard </li> <li> A pair of SSDs on a PCI-e SATA controller </li> </ul> <p> On top of that I added a pair of dual port 10GbE interfaces I found 'lying' around the labs. One is an Intel X520 82599ES and the other is a Mellanox ConnectX-3 Pro. These interfaces don't match and have different performance characteristics, this is fine for setting up the experiments, but I am going to replace them with a matched pair of single Interface 10Gb adapters for 'production' experiments.. </p> <p> My normal method for evaluating if a machine is fast is to build FreeBSD, they managed a <code> buildworld buildkernel </code> in a respectable 58 minutes. </p> <h2> Setup </h2> <pre><code> -left -right +------------------+ 10.0.x.x +------------------+ | |.10.2 .10.1| | ipmi | mlxen0+&lt;----------------&gt;+ix0 | ipmi 192.168.100.173 | | | | 192.168.100.167 | mlxen1+&lt;----------------&gt;+ix1 | | | | | | igb0 | | igb0 | +-----------+------+ +------+-----------+ |___ ___| freebsd 192.168.100.10 \_______ _______/ freebsd 192.168.100.20 linux 192.168.100.11 V V linux 192.168.100.21 +--------------+ | switch | +--------------+ ^ | | freebsd 192.168.100.2 +---------+ | control | | host | +---------+ </code></pre> <p> The two boxes are named with the suffixes '-left' and '-right' with the running OS setting the prefix, so we have freebsd-left, freebsd-right, ubuntu-left and ubuntu-right. </p> <p> The machines have 3 network interfaces on the mother board, Dual Gigabit Intel Ethernet and an interface for IPMI. On each, one interface and the IPMI are connected to a switch which is in turn connected to the switch in the wireless router that bridges to the WiFi in my house. This setup is a little complicated, but because there isn't ethernet run up to my bedroom WiFi is the only sensible way to connect to the Internet. I'd much preferred a bit of NAT weirdness compared to having to set up WiFi in testbed machines. </p> <p> I connected the serial ports on '-left' and '-right' to my control host, which is in the same switch domain as the hosts. I configured the SuperMicro motherboard to send the bios to the serial port. </p> <p> I am really not using IPMI for all its abilities and instead it is a fancy remote power button I can press from the control host: </p> <pre><code> [control] $ ipmitool -I lanplus -H 192.168.100.173 -U ADMIN -P ADMIN chassis power on # power on -left [control] $ ipmitool -I lanplus -H 192.168.100.167 -U ADMIN -P ADMIN chassis power on # power on -right </code></pre> <h2> Serial Console </h2> <p> The serial ports are then connected to the control computer with an awesome two headed usb serial cable (I don't know what it is and would buy more if I did). The operating systems on -left and -right are configured to offer consoles over serial so I don't have to worry about breaking the network and locking myself out when I am far away. </p> <p> On FreeBSD getting serial for loader and the system requires adding config to loader.conf and is documented in the <a href="https://docs.freebsd.org/en/books/handbook/serialcomms/#serialconsole-setup"> FreeBSD handbook </a> . Look at the bottom where it says "Setting a Faster Serial Port Speed" (I think the rest of the stuff on the page is out of date and rebuilding with a custom config is no longer required): </p> <p> <code> /boot/loader.conf: </code> </p> <pre><code> boot_multicons="YES" boot_serial="YES" comconsole_speed="115200" console="comconsole,vidconsole" </code></pre> <p> This configures loader to use both the video console and the serial console, tells it to use serial and sets the serial to the baud rate '115200' from the slow default of 9600. This baud rate matches between FreeBSD, Ubuntu and the BIOS so I don't have to reconfigure my serial terminal. </p> <p> Getty (the thing that gives you login prompts) on FreeBSD is configured as 'onifconsole', so no further config is required. You can check this in <code> /etc/ttys </code> : </p> <p> <code> /etc/ttys: </code> </p> <pre><code> ... # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure </code></pre> <p> Getting Serial for GRUB on Ubuntu (in 2021) requires adding the to <code> /etc/default/grub.d </code> and rebuilding the config file with <code> update-grub </code> , this isn't really documented, but information can be found <a href="https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html"> in the grub manual </a> and in a <a href="http://notesofaprogrammer.blogspot.com/2020/05/enabling-serial-console-on-debian-linux.html"> selection </a> <a href="https://www.cyberciti.biz/faq/howto-setup-serial-console-on-debian-linux/"> of blogposts </a> . For grub serial we need to add: </p> <p> <code> /etc/default/grub.d </code> </p> <pre><code> GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200" </code></pre> <p> I am pretty sure the grub.d that ships with ubuntu is out of date with the actual file, when I rebuilt the menu timeout broke, it went from the default 10 seconds to the 0 seconds in the <code> grub.d </code> that I edited. I didn't care enough to file a bug report, this was a lot of faff. </p> <p> To get console message from the Linux kernel you need to change the flags passed to the kernel when it is booted, you can do this too from <code> grub.d </code> : </p> <p> <code> /etc/default/grub.d: </code> </p> <pre><code> GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200 console=tty0" </code></pre> <p> This tells the Linux kernel to use ttyS0 (com0) as the console, configures the baud rate to '115200' and tells the kernel to use tty0 as the console. After a few messages the kernel will hand over to something else that will ignore the console config if you haven't also configured systemd to offer a console. </p> <p> To configure systemd to use a console you need to create a services file and it will handle the magic for you. This is <a href="https://help.ubuntu.com/community/SerialConsoleHowto"> documented </a> on the Ubuntu wiki, but everything there is wrong. Instead the systemd versions are available in blog posts you can find online. <a href="http://notesofaprogrammer.blogspot.com/2020/05/enabling-serial-console-on-debian-linux.html"> I found the best results following documentation for a different distro targeting the Raspberry Pi 3 </a> . </p> <pre><code> # systemctl enable serial-getty@ttyS0.service # systemctl start serial-getty@ttyS0.service </code></pre> <p> You should now have a working getty on serial, but I think you then need to kick something else, I could only get this to work by rebooting. </p> <h2> Booting </h2> <p> To do comparisons I need to be able to boot both Operating Systems and manage them remotely. Dual boot of some sort means that I can dig into differences on the two the platforms quickly and get answers from the running systems. </p> <p> Dual booting the machines turned out to be a lot harder than I expected. When I got the bios output working on serial I thought I was on to a winner, but that pesky SATA controller doesn't play well with the BIOS boot menu. Only the first drive in the SATA controller pair appears in the boot selector leaving me plumb out of luck. </p> <p> Instead I dove into the Linux world. Knowing that grub knows how to boot FreeBSD I went with using grub to get a boot menu that I can control from the serial port. ( <strong> side note: I know <a href="https://www.gnu.org/software/grub/manual/multiboot/multiboot.html"> that grub is a multiboot </a> compatible boot loader, meaning that it will boot anything that matches that spec. I think it is also multiboot compatible and can be chained, i.e. grub can boot grub. If that is the case then FreeBSD's loader is also multiboot compatible and the FreeBSD kernel is probably too, can loader then boot grub? It will take a truly brave person to figure this particular puzzle out. </strong> ) </p> <p> After installing FreeBSD to the second SSD in the SATA controller. I got messages about a FreeBSD install being detected when I ran <code> update-grub </code> . I think these were just for fun though, I didn't get any new menu entries when I test rebooted. I installed FreeBSD by pulling the drive I installed Ubuntu to, booting a FreeBSD USB installer and installing to the only drive (thanks hot swap bay!). </p> <p> Configuring grub to boot FreeBSD requires adding an entry to one of the extra config files. Internet searching suggested <code> /etc/grub.d/40_custom </code> which I filled out with: </p> <p> /etc/grub.d/40_custom: </p> <pre><code> #!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "FreeBSD 13.0" { set root=(hd1) chainloader +1 } </code></pre> <p> <a href="https://unix.stackexchange.com/a/506793"> A Unix StackExchange Answer </a> helped me figure out the rough grub commands to use and I tried them out on the grub command line (press 'c' from the menu). </p> <p> The final grub config looks like this ( <a href="https://cgit.FreeBSD.org/src/commit/?id=225639e7db685a4047e384abdbc296c0e02bd147"> notice that default grub is friendly and doesn't beep by default </a> ), with above <code> /etc/grub.d/40_custom </code> : </p> <p> /etc/default/grub: </p> <pre><code> # If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT=0 GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT=-1 # pause at bootloader menu GRUB_DISTRIBUTOR=lsb_release -i -s 2&gt; /dev/null || echo Debian GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200 console=tty0" GRUB_CMDLINE_LINUX="" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200" # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' #GRUB_GFXMODE=640x480 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1" </code></pre> <h2> Baseline Measurements </h2> <p> Before running more enjoyable experiments it is a requirement to get baseline measurements for what the systems can do. I think I need a bit more of a test framework for network performance tests, I want to sample memory usage, CPU usage and get flame graphs for tests, but for starters it is good to get raw iperf3 numbers. </p> <p> For each configuration, I ran forward and backward iperf3 tests with UDP and TCP. I let iperf3 run in its default 10 seconds measurement mode, for UDP I requested it try infinite bandwidth (-b 0). </p> <p> For each case I ran iperf3 as a server on <code> *-right </code> and the client on <code> *-left </code> . </p> <p> Remember for these that by default the client iperf3 process sends and the server receives, this is swapped with the <code> -R </code> flag. </p> <p> <strong> freebsd-left -&gt; freebsd-right (server) </strong> </p> <pre><code> tcp iperf3 -c 10.0.10.1 [ 5] 0.00-10.00 sec 6.58 GBytes 5.66 Gbits/sec 0 sender [ 5] 0.00-10.00 sec 6.58 GBytes 5.65 Gbits/sec receiver tcp iperf3 -c 10.0.10.1 -R [ 5] 0.00-10.00 sec 8.34 GBytes 7.16 Gbits/sec 2485 sender [ 5] 0.00-10.00 sec 8.34 GBytes 7.16 Gbits/sec receiver udp iperf3 -c 10.0.10.1 -u -b 0 [ 5] 0.00-10.00 sec 3.63 GBytes 3.11 Gbits/sec 0.000 ms 0/2666610 (0%) sender [ 5] 0.00-10.00 sec 2.03 GBytes 1.74 Gbits/sec 0.006 ms 1173881/2666555 (44%) receiver udp iperf3 -c 10.0.10.1 -u -b 0 -R [ 5] 0.00-10.00 sec 3.24 GBytes 2.79 Gbits/sec 0.000 ms 0/2384960 (0%) sender [ 5] 0.00-10.00 sec 1.91 GBytes 1.64 Gbits/sec 0.003 ms 977341/2384881 (41%) receiver </code></pre> <p> We run baselines so we can understand what future measurements show. Care has to be take that things are actually fair. </p> <p> <code> FreeBSD -&gt; FreeBSD </code> on the same hardware is a fair test, but it isn't what we have here. When we compare the forward and reverse modes for the iperf3 measurement we see that when the <code> freebsd-left </code> is the sender for TCP we get a much lower through put than when <code> freebsd-right </code> is the sender. My guess is that this is the difference between the offload engines in the Intel and Mellanox cards. </p> <p> <code> FreeBSD -&gt; FreeBSD </code> for UDP has interesting results. <code> freebsd-left </code> with the Mellanox card is able to sink more packets into the network than <code> freebsd-right </code> with Intel. Annoyingly these are opposite to the TCP results, where <code> freebsd-right </code> can send more. </p> <p> This might already be highlighting an interesting place to dig, and it is where I would look next, <strong> IF </strong> I were comparing network interfaces. </p> <p> <strong> ubuntu-left -&gt; ubuntu-right (server) </strong> </p> <pre><code> tcp iperf3 -c 10.0.10.1 [ 5] 0.00-10.00 sec 9.59 GBytes 8.24 Gbits/sec 823 sender [ 5] 0.00-10.00 sec 9.59 GBytes 8.23 Gbits/sec receiver tcp iperf3 -c 10.0.10.1 -R [ 5] 0.00-10.00 sec 11.0 GBytes 9.41 Gbits/sec 0 sender [ 5] 0.00-10.00 sec 11.0 GBytes 9.41 Gbits/sec receiver udp iperf3 -c 10.0.10.1 -u -b 0 [ 5] 0.00-10.00 sec 2.09 GBytes 1.79 Gbits/sec 0.000 ms 0/1546210 (0%) sender [ 5] 0.00-10.00 sec 1.50 GBytes 1.29 Gbits/sec 0.006 ms 436284/1546104 (28%) receiver udp iperf3 -c 10.0.10.1 -u -b 0 -R [ 5] 0.00-10.00 sec 2.08 GBytes 1.79 Gbits/sec 0.000 ms 0/1544000 (0%) sender [ 5] 0.00-10.00 sec 1.12 GBytes 965 Mbits/sec 0.015 ms 710878/1543876 (46%) receiver </code></pre> <p> Next up Ubuntu -&gt; Ubuntu. When looking at later measurements we need an idea of where changes come from isolating out variables is a good thing to do. </p> <p> Again with the TCP tests we see a difference in performance between the two systems, for Ubuntu -&gt; Ubuntu it is approximately 1.2 Gbit/s, whereas for FreeBSD it is around 1.5Gbit/s, but FreeBSD has a lower baseline for comparison. </p> <p> Next up for UDP with Ubuntu -&gt; Ubuntu we see something really weird, for the <code> ubuntu-left </code> sender and the <code> ubuntu-right </code> sender the packets we try to send are much lower than the FreeBSD hosts. This correlates with lower overall throughput in both tests, but almost half the performance for <code> ubuntu-right </code> looks really weird. </p> <p> I have a hunch that the lower sending rate is related to better pacing interactions between iperf3 and the Linux kernel. I have no idea why the received rate is so low for <code> ubuntu-right </code> . </p> <p> <strong> freebsd-left -&gt; ubuntu-right (server) </strong> </p> <pre><code> tcp iperf3 -c 10.0.10.1 [ 5] 0.00-10.00 sec 10.7 GBytes 9.19 Gbits/sec 1720 sender [ 5] 0.00-10.22 sec 10.7 GBytes 8.98 Gbits/sec receiver tcp iperf3 -c 10.0.10.1 -R [ 5] 0.00-10.22 sec 8.75 GBytes 7.35 Gbits/sec 1464 sender [ 5] 0.00-10.00 sec 8.75 GBytes 7.52 Gbits/sec receiver udp iperf3 -c 10.0.10.1 -u -b 0 [ 5] 0.00-10.00 sec 3.63 GBytes 3.12 Gbits/sec 0.000 ms 0/2667830 (0%) sender [ 5] 0.00-10.04 sec 1.29 GBytes 1.11 Gbits/sec 0.011 ms 1717151/2667664 (64%) receiver udp iperf3 -c 10.0.10.1 -u -b 0 -R [ 5] 0.00-10.04 sec 2.07 GBytes 1.77 Gbits/sec 0.000 ms 0/1524220 (0%) sender [ 5] 0.00-10.00 sec 1.90 GBytes 1.63 Gbits/sec 0.003 ms 125112/1524149 (8.2%) receiver </code></pre> <p> Finally we get to run it all again with both operating systems in play. If everything was optimal (and we therefore had no work to do) there would be no difference in their performance, but we already know that this isn't true. </p> <p> Running the tests with differing operating systems gives us an opportunity to see if the receiver side of the test has an impact (rather than just the sender). We can do this by pair the faster side with the slower side. </p> <p> For now though, I think the different network cards are introducing too much variation between the systems. The numbers differ here and that on its own is quite interesting, but there seem to be too many choices for why. I find the Ubuntu -&gt; Ubuntu reverse test halving the rate very suspicious and want to run the tests again. </p> <p> The variation in the network cards is actually too much for me, I think it is a red flag in the measurements and would only encourage stupid review comments. This annoyed me enough that I bought a pair of Single Port Mellanox ConnectX-3 EN PCIe 10GbE to evaluate before running any meaningful experiments. </p> <p> These systems are up and running, even with the questions that the baselines raised they are functional enough to start developing the interesting parts of the experiments and writing enough automation glue to rule out me making mistakes. I can then return, rerun the automated experiments and get better numbers. </p> https://adventurist.me/posts/00307Sun, 07 Nov 2021 00:00:00 +0000 FreeBSD/Ubuntu Dual-boot testbed using Desktop Hardwarehttps://adventurist.me/posts/00308<p> Tony needed his computers back, he is a great friend and so he offered me some replacements. This means that we get to make version 2 of the <em> "The Bedroom by the bed testbed" </em> . </p> <p> <a href="https://adventurist.me/posts/00307"> The first version of the testbed was built to answer questions of the form: </a> </p> <p> <strong> "How does stock Ubuntu compare to FreeBSD?" </strong> </p> <p> Version 2 of the testbed continues this approach with an addition: </p> <p> <strong> How does stock Ubuntu compare to FreeBSD, and what if we try emulating a satellite network?" </strong> </p> <p> <a href="/images/bedroomtestbedv2.jpg"> <img src="/imagessmall/bedroomtestbedv2.jpg"/> </a> </p> <p> Tony and I spoke for a while about my needs from a testbed, the machines he lent me before were part of a set, they were two boxes in a 6 node Bioinfromatics cluster. He needed them back to start doing shake out tests of the cluster so he can start selling time on it ( <a href="http://minke-informatics.co.uk/"> check out his excellent company </a> ). </p> <p> While I have been using his machines all of the work so far has been developing experiment tooling. For me the time to replace the machines was actually quite fortunate, I have managed to get automation working, but I don't yet have any finished results. This means that I can move to new machines and apart from a short down time reconfiguring things there shouldn't be any disruption. </p> <p> To replace the Opteron 6380 systems he offered me 2 Threadripper 1950X systems. </p> <p> <em> -left </em> , <em> -right </em> </p> <ul> <li> Threadripper 1950X </li> <li> Asrock X399M Taichi motherboard </li> <li> 32GB RAM @2666MHz ( <em> -right </em> has 64GB, <em> -left </em> will get more once it arrives in the mail) </li> <li> SSD storage </li> </ul> <p> The Opteron machines were server motherboards, in massive whale sized cases and they made whale sized sounds when they were running. The Threadrippers are in lovely little mini-ATX cases and when they are running the make a lovely little hum that easily vanished into the background when I type on my cherry blue keyboard. </p> <p> The smaller quieter form factor comes from the use of desktop hardware, sadly this also means the loss of lights out management. </p> <p> When Tony listened to my needs he also offered me a third system (so I can answer the questions the addition raises), but I turned him down. For longer term plans I need to own machines and I am grudgingly happy to buy hardware to get experiments running. </p> <p> I wanted to lean hard into using desktop hardware for non desktop tasks (my computers don't have an SLA to fulfil). With this goal in mind I speced out a Ryzen 5950X system that was a bit of a monster. I got cold feet at the price and decided to build a compatible system using a lower end Ryzen 7 processor. Gazing into the future I think this might be a safe bet, if I need more compute I should be able to pick up a 5950X on ebay for ~50% of the list price. </p> <p> For 10GbE network I put a single port Mellanox Connect-X 3 Pro interface in each. </p> <p> <em> pokeitwithastick </em> </p> <ul> <li> Ryzen 3700x </li> <li> Asrock X570 PRO4 </li> <li> 32GB RAM @2666MHz </li> <li> NVME storage </li> </ul> <p> From the 'big machine' spec I culled this down to using less and slower RAM and lower end processor. I think I should be able to push up this rig with more faster RAM and a bigger processor, but I get the flexibility to try doing this on the cheap first. </p> <p> The Ryzen system has a Mellanox Connect-X 3 Pro interface with Dual ports. It is going to be routing packets. </p> <p> This machine is able to be a more moving target so I installed FreeBSD-14-CURRENT on it from a recent snapshot. The use of stock CURRENT is worth noting when you think about the performance of the Ryzen system compared to the others. </p> <p> I only know 1 functional test that I really care about and that is building FreeBSD. I pulled the pairs of drives from the testbed v1 machines and transferred them over (the lack of 2.5" drive hot swap on the Threadrippers was annoying). Once I got the drives on the correct SATA cables the boxes came up and I was able to see how all three machines did: </p> <pre><code>host processor RAM time buildworl buildkernel freebsd-left Opteron 6380 128GB 58:00 freebsd-left Threadripper 19050X 32GB 30:45 freebsd-right Threadripper 1950X 64GB 30:06 pokeitwithastick Ryzen 3700X 32GB 33:09 </code></pre> <h2> Network Setup </h2> <p> With a third testbed machine the network diagram from before changes slightly. Rather than the interfaces of the two machines being connected back to back, they are now connected to <em> pokeitwithastick </em> which is acting as a router. </p> <p> The network now looks like this: </p> <pre><code> -left pokeitwithastick -right 10.0.10.x 10.0.20.x +-------------+ +-------------+ +-------------+ | .2| |.1 .1| |.2 | | | | | | | | mlxen0+&lt;-------&gt;+mlxen0 mlxen1+&lt;-------&gt;+mlxen0 | | | | | | | | igb0 | | igb0 | | igb0 | +------+------+ +-----+-------+ +------+------+ | | | | freebsd|192.168.100.50 | ._______ | ____. \________. | .______________/ freebsd 192.168.100.10 V V V freebsd 192.168.100.20 linux 192.168.100.11 +--------------+ linux 192.168.100.21 | switch | | (openwrt) | +--------------+ ^ | | freebsd 192.168.100.2 +---------+ | control | +---------+ </code></pre> <p> This is a pretty standard dumbell network and is good set up for performance work when you need a bottleneck. </p> <h2> Remote Power On </h2> <p> There were two features of the previous hardware that I really liked. Both machines had serial ports, which gave me a last ditch management interface option if I completley hosed the network while I wasn't at home. And the machines support lights out management with IPMI. In a sheer irony, even if the boxes hadn't had serial broken out on the motherboard, IPMI would have given me access. </p> <p> I was using serial and IPMI to allow me to power on the machines remotely and control which Operating System they booted into. IPMI allowed power on, grub was configured to output to serial and video and that gave me boot control. </p> <p> Tony doesn't have the same requirements as me for machines so while my Asrock X570 motherboard has a COM Port header, the Taichi motherboards don't. </p> <p> Wake on LAN (WOL) is a poor replacement for IPMI power control. It is sort of famously badly implemented and it is sort of clear why. It is a packet with the MAC addresses repeated a bunch of times that turns on the system by magic. No matter your opinion of WOL the Intel network interfaces on all three machines seem to be very good at booting with WOL when they get the packets. </p> <p> WOL had to be configured in the BIOS before it could be used: </p> <pre><code>In the X570 PRO4 bios configure: Advanced-&gt;ACPI Configuration-&gt;PCIE Devices Power On "Allow the system to be wakeed up by a PCIE device and enable wake on LAN" In the Taichi bios configure: Advanced-&gt;ACPI Configuration-&gt;PCIE Devices Power On "Allow the system to be wakeed up by a PCIE device and enable wake on LAN" </code></pre> <p> With the BIOS set up remote power on requires using a WOL tool to send a magic packet, the control host is well placed on the network to do this with the <code> wol </code> command: </p> <pre><code>control $ wol a8:a1:59:95:87:60 </code></pre> <p> After running the command I got nothing. </p> <p> This is fine, I am a network engineer and a hacker(!), I can debug this sort of issue. Some time with <code> tcpdump </code> showed that I wasn't getting broadcast traffic through at all. </p> <p> I tested this assertion by using a host directed WOL packet: </p> <pre><code>control $ wol a8:a1:59:95:77:ab -i 192.168.100.50 </code></pre> <p> These packets appear on the host in <code> tcpdump </code> and after a power off are able to wake the machines up. Well at first, if I waited a while then the machine was still not responding to the WOL packet. </p> <p> The diagram in the v1 network and the diagram I would have drawn for the v2 network at first was a lie. <em> control </em> is connected to the switch on the back of an OpenWRT router that is acting as a WiFi client to the network in the house. That switch is in turn connected to an unmanaged Netgear switch that all the rest of the network is connected to (IPMI and useful interfaces). </p> <p> One of these switches was not forwarding broadcast traffic and it was only forwarding unicast traffic when the host was 'alive' enough. Not having IPMI anymore I was able to remove the Netgear switch, my needs now fit onto the four port switch on the OpenWRT router. Removing the Netgear switch didn't solve the problem and I can't remove the OpenWRT router so a different solution is required. </p> <p> OpenWRT has a tool called <code> etherwake </code> to support Wake On LAN, I installed this on the router and I immediately got consistently working WOL: </p> <pre><code>root@OpenWrt:~# etherwake a8:a1:59:95:77:ab </code></pre> <p> I have to ssh to the router to run power on commands, but that is enough for the testbed to be useful now. </p> <h2> Controlling the booted OS </h2> <p> Having a serial interface to access the grub menu and select the booted OS was great. But I have to wipe away my tears and accept that this isn't possible with this hardware. </p> <p> <a href="https://wiki.debian.org/GrubReboot"> Grub supports something called <code> grub-reboot </code> </a> , normally grub tries very hard to not write anything to disk in normal operation. You can however configure grub to use a scratch space and remember which operating system was booted before (and maybe other things). </p> <p> <code> grub-reboot </code> uses this mechanism from the Operating System to control which menu item grub uses as default when it boots. This is part of the <a href="https://www.gnu.org/software/grub/manual/grub/grub.html#Environment-block"> grub environment and is documented here </a> . </p> <p> /etc/default/grub </p> <pre><code># If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT=saved GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2&gt; /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200 console=tty0" GRUB_CMDLINE_LINUX="" # Uncomment to disable graphical terminal (grub-pc only) GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200" </code></pre> <p> To use <code> grub-reboot </code> you need to set the default menu entry to 'saved'. If you changed grub to enable <code> grub-reboot </code> make sure to update grub: </p> <pre><code># sudo update-grub </code></pre> <p> With grub configured with a default menu entry of <code> saved </code> , we can configure grub to boot the next time from a different menu entry other than the first one. </p> <pre><code># sudo grub-reboot 4 # sudo reboot </code></pre> <p> On these systems this allows me to boot from the FreeBSD menu entry (it is fifth in the list). Without serial to boot into FreeBSD I have to do a round trip into Linux, but this is a lot better than having to sit near the hot loud computers. </p> <h2> Performance </h2> <p> The generation change in AMD hardware had a huge improvement in processing speed, going from 58 minutes for a FreeBSD build to 30 minutes is amazing. These machines do networking stuff so it is good to look at network benchmarks for a baseline. </p> <p> On Ubuntu and FreeBSD, the Threadripper machines are able to saturate 10GbE with TCP and get a about 6Gbit/s of UDP traffic. They can generate enough UDP to saturate the link so this is a huge step forward. </p> <p> <code> iperf3 </code> benchmarks where the Ryzen system is the receiver manage half the traffic that the Threadripper systems do, capping out at about 4.5Gbit/s, the Ryzen can however send enough to saturate the link. </p> <p> Base forwarding tests show no change in the throughput of the Threadripper systems. I had never considered that receive could be harder than transmit, but these baselines seem (and chatting to FreeBSD developers) seem to suggest that this isn't uncommon. For now this isn't a problem, but later I might need the Ryzen system to have more head room when running tests. If that happens I'll have a good reason to get a faster processor :D </p> https://adventurist.me/posts/00308Tue, 09 Nov 2021 00:00:00 +0000 Updating mlx4en Firmware on FreeBSDhttps://adventurist.me/posts/00309<p> <a href="https://adventurist.me/posts/00308"> My testbed </a> has Nvidia/Mellanox/Chelsio 10GbE network cards which are quite old, but sit well in the price (super cheap) usability (they work great on FreeBSD ond Linux) spectrum. </p> <p> There is an issue on FreeBSD 14 -CURRENT where when you load the kernel module for the card (mlx4en) <code> kldload </code> hangs. If you hit control C the process will continue and the module will load properly. This is also an issue when you load the module using <code> kld_list </code> in <code> rc.conf </code> and as my router machine can't be managed with serial yet I have no way to press control C when it is booting. </p> <p> <a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259748"> On the bug report </a> I was asked if the firmware is up to date. It wasn't and doing so was not fun. </p> <p> You should follow the Mellanox instructions rather than my blog post to do a firmware update, but <a href="https://www.mellanox.com/sites/default/files/related-docs/prod_software/Mellanox_FreeBSD_User_Manual_v2.1.6.pdf"> The Mellanox FreeBSD documentation for </a> ( <a href="https://www.mellanox.com/related-docs/firmware/mstflint_README.txt"> Linux </a> ) the cards is from 2015 and this is the process that worked for me in 2021. </p> <p> Mellanox have a tools package you can download, there is also a port called <code> mstflint </code> you can install: </p> <pre><code># pkg install mstflint </code></pre> <p> The Mellanox tools need to know which card they are speaking to, you can find the card with <code> pciconf </code> once you have loaded the kernel module: </p> <pre><code># pciconf -lv | grep mlx4 mlx4_core0@pci0:9:0:0: class=0x020000 rev=0x00 hdr=0x00 vendor=0x15b3 device=0x1007 subvendor=0x15b3 subdevice=0x000c </code></pre> <p> Downloading the firmware for card required a OPN and a PSID from the card. You can use <code> mstflint </code> to get information about the card with the pci address and the 'q' query command: </p> <pre><code># mstflint -d pci0:9:0:0 q Image type: FS2 FW Version: 2.40.5030 FW Release Date: 4.1.2017 Product Version: 02.40.50.30 Rom Info: type=PXE version=3.4.746 Device ID: 4103 Description: Node Port1 Port2 Sys image GUIDs: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff MACs: ec0d9ae13420 ec0d9ae13421 VSD: PSID: MT_1200111023 </code></pre> <p> This didn't give me an OPN so instead I looked at <a href="https://www.mellanox.com/support/firmware/connectx3proen"> every entry on the download page </a> until I found the correct PSID. </p> <p> With the firmware downloaded and unzipped you can flash it using <code> mstflint </code> : </p> <pre><code># mstflint -d pci0:9:0:0 -i fw-ConnectX3Pro-rel-2_42_5000-MCX312B-XCC_Ax-FlexBoot-3.4.752.bin b Current FW version on flash: 2.40.5030 New FW version: 2.42.5000 Burning FS2 FW image without signatures - OK Restoring signature - OK </code></pre> https://adventurist.me/posts/00309Thu, 11 Nov 2021 00:00:00 +0000 Some Linkshttps://adventurist.me/posts/00310<p> <a href="https://bsdnow.tv"> Once a month for the podcast </a> I read through about 20 articles so I know what to <a href="https://patreon.com/bsdnow"> talk about on the show </a> . This week when I was reading the article I thought 'this is really easy, maybe I can do this for all my browser tabs' </p> <p> This isn't really a fair comparison because the articles for the show are mostly short and the articles that fill out my tabs are the ones that were too long to read immediately or I wanted to keep them around. </p> <p> Instead of keeping them in firefox I am going to try doing <a href="https://daringfireball.net/linked/"> link posts </a> <a href="https://adventurist.me/tag/links"> again </a> : </p> <ul> <li> <a href="https://www.youtube.com/watch?v=5nN1wjA_S30"> LISA21 - Computing Performance: On the Horizon </a> ( <a href="https://brendangregg.com/blog/2021-07-05/computing-performance-on-the-horizon.html"> also a blog post </a> </li> <li> <a href="https://www.soldierx.com/bbs/202105/Pocket-POCSAG-Transmitter"> Pocket POCSAG Transmitter | SOLDIERX.COM </a> </li> <li> <a href="https://vintageapple.org/macprogramming/"> Vintage Apple </a> </li> <li> <a href="https://www.thebioneer.com/eudaimonia-machine/"> The Home Office Eudaimonia Machine </a> </li> <li> <a href="http://www.infinityplus.co.uk/stories/blit.htm"> BLIT - a short story by David Langford </a> </li> </ul> <p> I think they should have just left it alone and kept calling it eBPF. </p> https://adventurist.me/posts/00310Fri, 19 Nov 2021 00:00:00 +0000 Some Classic Computing Linkshttps://adventurist.me/posts/00311<p> Some Sunday evening reading about keeping old computers alive. </p> <ul> <li> <a href="https://aaronsplace.co.uk/blog/2021-10-23-continuous-intengration-pipeline-for-the-pdp-11.html"> A Continuous Integration Pipeline for the PDP-11 (2.11BSD) - Aaron S. Jackson </a> </li> <li> <a href="http://www.mattmillman.com/projects/10base5/"> Building a 10BASE5 “Thick Ethernet” network – Matt's Tech Pages </a> </li> <li> <a href="https://axio.ms/blog/2021/10/02/MacSE30.html"> Mac SE/30 odyssey </a> </li> <li> <a href="http://archive.retro.co.za/mirrors/68000/www.vintagemacworld.com/sys6net.html"> Internet Access with System 6 </a> </li> </ul> https://adventurist.me/posts/00311Sun, 21 Nov 2021 00:00:00 +0000 Assembling a Dual Processor VAXhttps://adventurist.me/posts/00312<p> <a href="/images/assemblingadualprocessorvax.png"> <img src="/images/assemblingadualprocessorvax.png"/> </a> </p> <ul> <li> <a href="https://github.com/wntrblm/Castor_and_Pollux/blob/main/firmware/scripts/samd21g18a.ld"> Castor <em> and </em> Pollux/samd21g18a.ld at main · wntrblm/Castor <em> and </em> Pollux </a> </li> <li> <a href="https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html"> Is Parallel Programming Hard, And, If So, What Can You Do About It? </a> </li> <li> <a href="http://www.robertwinkler.com/projects/mips_book/mips_book.html"> MIPS Assembly Programmming </a> </li> <li> <a href="https://raw.githubusercontent.com/bsdimp/bsdcan2020-demos/master/pdf/800048.801738.pdf"> A Dual Processor VAX*11/780 </a> </li> </ul> <p> Here are some links on lower level stuff. I have only read the linker script and the paper on the dual processor VAX. The other two are books that I want to get to one day and this blog is as good a place as any to keep them stashed away. </p> <p> MIPS is going away in FreeBSD so this is a great time to read about MIPS assembly. </p> <p> The 1982 paper on the Dual Processor VAX is excellent and you should read it. Papers aren't that interesting anymore. </p> https://adventurist.me/posts/00312Mon, 22 Nov 2021 00:00:00 +0000 Some Links About Thinking and Thinking About Workhttps://adventurist.me/posts/00313<p> The irony of writing a links post containing a bunch of links about productivity as a form of procrastination isn't lost on me. </p> <ul> <li> <a href="https://midrange.tedium.co/issues/mission-statement-311723"> Mission Statement | Revue </a> </li> <li> <a href="https://defector.com/how-to-not-suck-at-writing/"> How To Not Suck At Writing | Defector </a> </li> <li> <a href="http://vihart.com/fifty-fizzbuzzes/"> Fifty Fizzbuzzes | Vi Hart </a> </li> <li> <a href="http://wildrye.com/work-with-the-garage-door-up/"> Work with the Garage Door Up - Wild Rye </a> </li> <li> <a href="https://www.newyorker.com/magazine/2013/01/14/structure"> Structure | The New Yorker </a> </li> <li> <a href="https://www.wired.com/story/six-weeks-100s-miles-hours-glorious-boredom-japan/"> The Glorious, Almost-Disconnected Boredom of My Walk in Japan | WIRED </a> </li> </ul> <p> <strong> part of the process means doing sub-par work to get to the good work </strong> </p> <p> There are a couple of themes in here, I have been writing a lot recently and especially this year. I feel like I am starting to come across advice that makes sense to me, if you want to do things you need to well, do things. There is no substitute for practice. </p> <p> While I am not going to write daily posts again, I miss the format I used before. I will look at resurrecting the tools I used to generate the daily posts before, maybe a weekly update post would be nice to do. </p> <p> I plan to return to 'Work with the Garage Door Up', but I have also adopted a policy of not talking about work in progress, so you will have to wait and see. </p> https://adventurist.me/posts/00313Mon, 22 Nov 2021 00:00:00 +0000 Some ideas I picked from the electromagnetic fieldshttps://adventurist.me/posts/00314<p> I made it to and from the <a href="https://www.emfcamp.org/"> Electromagnetic Field </a> . It was quite an experience to return to a hacker large event after so many years. </p> <p> A real review of the event will appear in the FreeBSD Journal this summer and I rambled a little at the end of BSDNow 459. </p> <p> I don't think I could have articulated before hand exactly how much I missed the massive influx of energy being around people doing things gives you. To be honest, it probably explains why I spent so many years running things myself. The sheer magic of other people doing things seems to relax my brain and lets it fill up to the brim with new ideas. </p> <p> In the vein of "“Make 50 of Something" ( <a href="http://vihart.com/fifty-fizzbuzzes/"> which I learned about from Vi Hart making 50 fizzbuzzers </a> ), I thought it was finally time to write down the ideas in the aftermath of the event and have a record of them. </p> <p> 50 is a lot of things, but I don't think this list actually captures everything that popped into my head. Much of this list is ideas I have been having over the last decade of going to hacker events, but unexecuted ideas can still be good. </p> <p> <a href="/images/emfcamp2022-notebook.jpg"> <img src="/imagessmall/emfcamp2022-notebook.jpg"/> </a> </p> <ol> <li> ID Badge </li> <li> Buckfast FM </li> <li> Buckfast FM badge </li> <li> BBS serial network </li> <li> Government style news distribution network with backdoor leading to a bbs </li> <li> TIC-80 simulator for the badge </li> <li> shit camera ID printer </li> <li> badge tamogotchi thing </li> <li> "Cyberman" led outfit </li> <li> kit dome of trees </li> <li> web bbs </li> <li> retro bbs </li> <li> web bbs serial links to esp consoles </li> <li> demo display on a dome </li> <li> longest serial transmission competition </li> <li> internet of buckets </li> <li> network of floaty led things in lake </li> <li> posters! </li> <li> stickers! </li> <li> sticker: The Internet is Bullshit </li> <li> sticker: Computers are a fuck </li> <li> sticker: "I'll drive if you feed me cheese" </li> <li> sticker: a big pile of tofu </li> <li> talk: 10 years of Scotland as performance art </li> <li> Old Unix BBS </li> <li> something targetting the badge </li> <li> "set" mainframe backdrop </li> <li> weather reports </li> <li> Scotcon TV </li> <li> An actual good computer book shop </li> <li> BSD meet up </li> <li> hacker breakfast </li> <li> 'drugwars' with real location integration </li> <li> CTF coffee puzzle </li> <li> folding bikes! </li> <li> portraits with a camera </li> <li> portraits with a paint brush </li> <li> computer church </li> <li> beacon hunt </li> <li> demo party </li> <li> paiting party </li> <li> talk: Learning a place by drawing its buildings </li> <li> SBC colo </li> <li> deerocracy </li> <li> tshirts </li> <li> sticker: No one hsa found a good use for a networked computer </li> <li> sketching workshop </li> <li> thicknet, network </li> <li> industrial quantities of mauve </li> <li> $5 electronics macro photo workshop </li> <li> silent journalling with [tj] </li> </ol> <p> Yes, It is super vague. There are thousands of words of explanation behind some of these. That you will have to invent for yourself. </p> <p> Steal what you want, I won't remember publishing this and will love seeing your implementation. </p> https://adventurist.me/posts/00314Thu, 09 Jun 2022 00:00:00 +0000 Booting FreeBSD on the RISC-V VisionFive2https://adventurist.me/posts/00315<p> The VisionFive 2 is a RISC-V based single board computer from Starfive integrating their JH7110 SoC. The board is available from Waveshare on its own or with some handy components to get you started. </p> <p> The SoC is pitched to be a competitor to the RaspberryPi 4 in specs and along with oodles of interfaces it has a raspberrypi compatible 40 pin header exposing pins for io. </p> <p> The SoC is also in the <a href="https://pine64.com/product/star64-model-a-4gb-single-board-computer/"> Star64 </a> and <a href="https://pine64.com/product/pinetab-v-10-1-4gb-64gb-risc-v-based-linux-tablet-with-detached-backlit-keyboard/"> PinetabV </a> from Pine64 (I didn't know that the StarFive was for sale until checking when writing this). </p> <p> StarFive is a Chinese integrator using IP blocks from SiFive and so it integrates cores and peripherals from the HiFive Unleashed board. </p> <p> <a href="/images/visionfive2.jpg"> <img src="/imagessmall/visionfive2.jpg"/> </a> </p> <p> I picked one of these up to play with FreeBSD/RISC-V on a computer with a real MMU. Before doing anything I wanted to be sure that I could get Linux to boot on the board. I sort of followed the instructions from the [Waveshare wiki page][wavesharewiki], ignoring the Windows GUI tools and using <code> dd </code> and <code> cu </code> to write the image and connect to serial. </p> <p> With an SD card image with their published I powered up the board and tried to connect. The wiki instructions highlight that you need to break into the boot loader during boot and manually load segments from the SD card. I tried this for about an hour or two with 3 different images (the 69 image took 40 minutes to write to the SD card), but I didn't have any luck. </p> <p> Giving up I just let the u-boot run and got a booting Debian system immediately: </p> <pre><code>U-Boot 2021.10 (Feb 12 2023 - 18:15:33 +0800), Build: jenkins-VF2_515_Branch_SDK_Release-24 CPU: rv64imacu Model: StarFive VisionFive V2 DRAM: 8 GiB MMC: sdio0@16010000: 0, sdio1@16020000: 1 Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB *** Warning - bad CRC, using default environment StarFive EEPROM format v2 --------EEPROM INFO-------- Vendor : StarFive Technology Co., Ltd. Product full SN: VF7110B1-2253-D008E000-00004015 data version: 0x2 PCB revision: 0xb2 BOM revision: A Ethernet MAC0 address: 6c:cf:39:00:42:ba Ethernet MAC1 address: 6c:cf:39:00:42:bb --------EEPROM INFO-------- In: serial@10000000 Out: serial@10000000 Err: serial@10000000 Model: StarFive VisionFive V2 Net: eth0: ethernet@16030000, eth1: ethernet@16040000 switch to partitions #0, OK mmc1 is current device found device 1 bootmode flash device 1 385 bytes read in 6 ms (62.5 KiB/s) Importing environment from mmc1 ... Can't set block device Hit any key to stop autoboot: 0 Can't set block device libfdt fdt_check_header(): FDT_ERR_BADMAGIC Retrieving file: /boot/extlinux/extlinux.conf Can't set block device Error reading config file StarFive # StarFive # U-Boot SPL 2021.10 (Feb 12 2023 - 18:15:33 +0800) DDR version: dc2e84f0. Trying to boot from SPI OpenSBI v1.2 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ &lt; | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : StarFive VisionFive V2 Platform Features : medeleg Platform HART Count : 5 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 4000000Hz Platform Console Device : uart8250 Platform HSM Device : jh7110-hsm Platform PMU Device : --- Platform Reboot Device : pm-reset Platform Shutdown Device : pm-reset Firmware Base : 0x40000000 Firmware Size : 292 KB Runtime SBI Version : 1.0 Domain0 Name : root Domain0 Boot HART : 1 Domain0 HARTs : 0*,1*,2*,3*,4* Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I) Domain0 Region01 : 0x0000000040000000-0x000000004007ffff () Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Domain0 Next Address : 0x0000000040200000 Domain0 Next Arg1 : 0x0000000042200000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Boot HART ID : 1 Boot HART Domain : root Boot HART Priv Version : v1.11 Boot HART Base ISA : rv64imafdcbx Boot HART ISA Extensions : none Boot HART PMP Count : 8 Boot HART PMP Granularity : 4096 Boot HART PMP Address Bits: 34 Boot HART MHPM Count : 2 Boot HART MIDELEG : 0x0000000000000222 Boot HART MEDELEG : 0x000000000000b109 U-Boot 2021.10 (Feb 12 2023 - 18:15:33 +0800), Build: jenkins-VF2_515_Branch_SDK_Release-24 CPU: rv64imacu Model: StarFive VisionFive V2 DRAM: 8 GiB MMC: sdio0@16010000: 0, sdio1@16020000: 1 Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB *** Warning - bad CRC, using default environment StarFive EEPROM format v2 --------EEPROM INFO-------- Vendor : StarFive Technology Co., Ltd. Product full SN: VF7110B1-2253-D008E000-00004015 data version: 0x2 PCB revision: 0xb2 BOM revision: A Ethernet MAC0 address: 6c:cf:39:00:42:ba Ethernet MAC1 address: 6c:cf:39:00:42:bb --------EEPROM INFO-------- In: serial@10000000 Out: serial@10000000 Err: serial@10000000 Model: StarFive VisionFive V2 Net: eth0: ethernet@16030000, eth1: ethernet@16040000 switch to partitions #0, OK mmc1 is current device found device 1 bootmode flash device 1 Can't set block device Failed to load '/boot/uEnv.txt' Hit any key to stop autoboot: 0 Can't set block device Importing environment from mmc1 ... ## Warning: Input data exceeds 1048576 bytes - truncated ## Info: input data size = 1048578 = 0x100002 385 bytes read in 6 ms (62.5 KiB/s) ## Warning: defaulting to text format ## Error: "boot2" not defined 47546 bytes read in 13 ms (3.5 MiB/s) 47546 bytes written in 563 ms (82 KiB/s) Retrieving file: /boot/extlinux/extlinux.conf 823 bytes read in 10 ms (80.1 KiB/s) U-Boot menu 1: Debian GNU/Linux bookworm/sid 5.15.0-starfive 2: Debian GNU/Linux bookworm/sid 5.15.0-starfive (rescue target) Enter choice: 1: Debian GNU/Linux bookworm/sid 5.15.0-starfive Retrieving file: /boot/initrd.img-5.15.0-starfive 9684953 bytes read in 421 ms (21.9 MiB/s) Retrieving file: /boot/vmlinuz-5.15.0-starfive 8015200 bytes read in 348 ms (22 MiB/s) append: root=/dev/mmcblk1p3 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 Retrieving file: /boot/dtbs/starfive/jh7110-visionfive-v2.dtb 47546 bytes read in 13 ms (3.5 MiB/s) Uncompressing Kernel Image Moving Image from 0x44000000 to 0x40200000, end=41767000 ## Flattened Device Tree blob at 48000000 Booting using the fdt blob at 0x48000000 Using Device Tree in place at 0000000048000000, end 000000004800e9b9 Starting kernel ... clk u5_dw_i2c_clk_core already disabled clk u5_dw_i2c_clk_apb already disabled [ 0.000000] Linux version 5.15.0-starfive (sw_buildbot@mdcsw02) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 SMP Mon Dec 19 07:56:37 EST 2022 [ 0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000 [ 0.000000] Machine model: StarFive VisionFive V2 [ 0.000000] earlycon: uart0 at MMIO32 0x0000000010000000 (options '115200') [ 0.000000] printk: bootconsole [uart0] enabled [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000080000000, size 512 MiB [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000040200000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x000000023fffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040200000-0x00000000c010ffff] [ 0.000000] node 0: [mem 0x00000000c0110000-0x00000000c01fffff] [ 0.000000] node 0: [mem 0x00000000c0200000-0x000000023fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000023fffffff] [ 0.000000] SBI specification v1.0 detected [ 0.000000] SBI implementation ID=0x1 Version=0x10002 [ 0.000000] SBI TIME extension detected [ 0.000000] SBI IPI extension detected [ 0.000000] SBI RFENCE extension detected [ 0.000000] SBI SRST extension detected [ 0.000000] SBI v0.2 HSM extension detected [ 0.000000] CPU with hartid=0 is not available [ 0.000000] CPU with hartid=0 is not available [ 0.000000] riscv: ISA extensions acdfim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] percpu: Embedded 17 pages/cpu s31528 r8192 d29912 u69632 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2067975 [ 0.000000] Kernel command line: root=/dev/mmcblk1p3 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 [ 0.000000] Unknown command line parameters: stmmaceth=chain_mode:1 selinux=0 [ 0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear) [ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB) [ 0.000000] Memory: 7582168K/8386560K available (9884K kernel code, 4982K rwdata, 4096K rodata, 2191K init, 401K bss, 280104K reserved, 524288K cma-reserved) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4. [ 0.000000] rcu: RCU debug extended QS entry/exit. [ 0.000000] Tracing variant of Tasks RCU enabled. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] CPU with hartid=0 is not available [ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller [ 0.000000] riscv-intc: 64 local interrupts mapped [ 0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts. [ 0.000000] random: get_random_bytes called from start_kernel+0x4d0/0x6e2 with crng_init=0 [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns [ 0.000001] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns [ 0.009005] clocksource: timer@13050000.ch0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.020330] clocksource: timer@13050000.ch1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.031662] clocksource: timer@13050000.ch2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.042988] clocksource: timer@13050000.ch3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.054477] Console: colour dummy device 80x25 [ 0.060704] printk: console [tty0] enabled [ 0.065259] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=40000) [ 0.076482] pid_max: default: 32768 minimum: 301 [ 0.081782] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.090298] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.100574] ASID allocator disabled [ 0.104515] rcu: Hierarchical SRCU implementation. [ 0.109965] EFI services will not be available. [ 0.115349] smp: Bringing up secondary CPUs ... [ 0.121954] smp: Brought up 1 node, 4 CPUs [ 0.128390] devtmpfs: initialized [ 0.139598] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.150460] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) [ 0.171957] pinctrl core: initialized pinctrl subsystem [ 0.178604] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.185824] cpuidle: using governor menu [ 0.212080] platform soc:dsi-output: Fixing up cyclic dependency with 29400000.dc8200 [ 0.221266] platform 295d0000.mipi: Fixing up cyclic dependency with soc:dsi-output [ 0.230103] platform 29590000.hdmi: Fixing up cyclic dependency with 29400000.dc8200 [ 0.250583] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages [ 0.257968] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages [ 0.268496] vgaarb: loaded [ 0.271719] SCSI subsystem initialized [ 0.276289] usbcore: registered new interface driver usbfs [ 0.282365] usbcore: registered new interface driver hub [ 0.288257] usbcore: registered new device driver usb [ 0.294100] mc: Linux media interface: v0.10 [ 0.298849] videodev: Linux video capture interface: v2.00 [ 0.305076] Advanced Linux Sound Architecture Driver Initialized. [ 0.312174] Bluetooth: Core ver 2.22 [ 0.316137] NET: Registered PF_BLUETOOTH protocol family [ 0.321995] Bluetooth: HCI device and connection manager initialized [ 0.328993] Bluetooth: HCI socket layer initialized [ 0.334376] Bluetooth: L2CAP socket layer initialized [ 0.339947] Bluetooth: SCO socket layer initialized [ 0.345655] clocksource: Switched to clocksource riscv_clocksource [ 0.359945] NET: Registered PF_INET protocol family [ 0.366328] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.382150] tcp_listen_portaddr_hash hash table entries: 4096 (order: 5, 163840 bytes, linear) [ 0.391902] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear) [ 0.401467] TCP bind hash table entries: 65536 (order: 9, 2097152 bytes, linear) [ 0.411645] TCP: Hash tables configured (established 65536 bind 65536) [ 0.419151] UDP hash table entries: 4096 (order: 6, 393216 bytes, linear) [ 0.427156] UDP-Lite hash table entries: 4096 (order: 6, 393216 bytes, linear) [ 0.435832] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.442719] RPC: Registered named UNIX socket transport module. [ 0.449269] RPC: Registered udp transport module. [ 0.454444] RPC: Registered tcp transport module. [ 0.459629] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.467439] PCI: CLS 0 bytes, default 64 [ 0.472432] Initialise system trusted keyrings [ 0.477573] workingset: timestamp_bits=62 max_order=21 bucket_order=0 [ 0.477763] Unpacking initramfs... [ 0.490491] NFS: Registering the id_resolver key type [ 0.496101] Key type id_resolver registered [ 0.500717] Key type id_legacy registered [ 0.505234] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.512649] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering... [ 0.520870] ntfs: driver 2.1.32 [Flags: R/W]. [ 0.525964] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc. [ 0.533157] fuse: init (API version 7.34) [ 0.577419] NET: Registered PF_ALG protocol family [ 0.582730] Key type asymmetric registered [ 0.587294] Asymmetric key parser 'x509' registered [ 0.592771] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249) [ 0.600969] io scheduler mq-deadline registered [ 0.605983] io scheduler kyber registered [ 0.712788] clk-starfive-jh7110 13020000.clock-controller: starfive JH7110 clkgen init successfully. [ 0.724053] L2CACHE: DataError @ 0x00000000.08040140 [ 0.729629] L2CACHE: DataFail @ 0x00000000.0804006C [ 0.735093] L2CACHE: No. of Banks in the cache: 8 [ 0.740308] L2CACHE: No. of ways per bank: 16 [ 0.745115] L2CACHE: Sets per bank: 256 [ 0.749369] L2CACHE: Bytes per cache block: 64 [ 0.754279] L2CACHE: Index of the largest way enabled: 15 [ 0.760564] jh7110-pmu 17030000.power-controller: registered 8 power domains [ 0.828245] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled [ 0.838268] @@#########################@@ [ 0.880540] @@ dev ptr:ffffffe0bff00000/1500/1 [ 0.885723] PVR_K: 1: Read BVNC 36.50.54.182 from HW device registers [ 0.893003] PVR_K: 1: RGX Device registered BVNC 36.50.54.182 with 1 core in the system [ 0.903216] [drm] Initialized pvr 1.17.6210866 20170530 for 18000000.gpu on minor 0 [ 0.924159] loop: module loaded [ 0.930154] spi-nor spi0.0: gd25lq128d (16384 Kbytes) [ 1.191214] Freeing initrd memory: 9456K [ 1.212281] 3 fixed-partitions partitions found on MTD device 13010000.spi.0 [ 1.220111] Creating 3 MTD partitions on "13010000.spi.0": [ 1.226190] 0x000000000000-0x000000020000 : "spl" [ 1.233161] 0x000000100000-0x000000400000 : "uboot" [ 1.240125] 0x000000f00000-0x000001000000 : "data" [ 1.248093] libphy: Fixed MDIO Bus: probed [ 1.254081] CAN device driver interface [ 1.258941] starfive-eth-plat 16030000.ethernet: force_sf_dma_mode is ignored if force_thresh_dma_mode is set. [ 1.270362] starfive-eth-plat 16030000.ethernet: User ID: 0x41, Synopsys ID: 0x52 [ 1.278643] starfive-eth-plat 16030000.ethernet: DWMAC4/5 [ 1.284695] starfive-eth-plat 16030000.ethernet: DMA HW capability register supported [ 1.293336] starfive-eth-plat 16030000.ethernet: RX Checksum Offload Engine supported [ 1.301978] starfive-eth-plat 16030000.ethernet: Wake-Up On Lan supported [ 1.309464] starfive-eth-plat 16030000.ethernet: TSO supported [ 1.315906] starfive-eth-plat 16030000.ethernet: Enable RX Mitigation via HW Watchdog Timer [ 1.325125] starfive-eth-plat 16030000.ethernet: Enabled Flow TC (entries=1) [ 1.332900] starfive-eth-plat 16030000.ethernet: TSO feature enabled [ 1.339913] starfive-eth-plat 16030000.ethernet: Using 40 bits DMA width [ 1.598015] libphy: stmmac: probed [ 1.601791] YT8531 Gigabit Ethernet stmmac-0:00: attached PHY driver (mii_bus:phy_addr=stmmac-0:00, irq=POLL) [ 1.612755] YT8531 Gigabit Ethernet stmmac-0:01: attached PHY driver (mii_bus:phy_addr=stmmac-0:01, irq=POLL) [ 1.624914] starfive-eth-plat 16040000.ethernet: force_sf_dma_mode is ignored if force_thresh_dma_mode is set. [ 1.636328] starfive-eth-plat 16040000.ethernet: User ID: 0x41, Synopsys ID: 0x52 [ 1.644586] starfive-eth-plat 16040000.ethernet: DWMAC4/5 [ 1.650657] starfive-eth-plat 16040000.ethernet: DMA HW capability register supported [ 1.659300] starfive-eth-plat 16040000.ethernet: RX Checksum Offload Engine supported [ 1.667947] starfive-eth-plat 16040000.ethernet: Wake-Up On Lan supported [ 1.675420] starfive-eth-plat 16040000.ethernet: TSO supported [ 1.681863] starfive-eth-plat 16040000.ethernet: Enable RX Mitigation via HW Watchdog Timer [ 1.691113] starfive-eth-plat 16040000.ethernet: Enabled Flow TC (entries=1) [ 1.698891] starfive-eth-plat 16040000.ethernet: TSO feature enabled [ 1.705903] starfive-eth-plat 16040000.ethernet: Using 40 bits DMA width [ 1.962922] libphy: stmmac: probed [ 1.966737] YT8531 Gigabit Ethernet stmmac-1:00: attached PHY driver (mii_bus:phy_addr=stmmac-1:00, irq=POLL) [ 1.977684] YT8531 Gigabit Ethernet stmmac-1:01: attached PHY driver (mii_bus:phy_addr=stmmac-1:01, irq=POLL) [ 1.990177] Intel(R) Wireless WiFi driver for Linux [ 1.997530] cdns3-starfive 10210000.usbdrd: usb mode 2 2.0 probe success [ 2.005728] usbcore: registered new interface driver uas [ 2.011632] usbcore: registered new interface driver usb-storage [ 2.035993] starfive-rtc 17040000.rtc: registered as rtc0 [ 2.041959] starfive-rtc 17040000.rtc: setting system clock to 2001-01-01T00:00:00 UTC (978307200) [ 2.052010] i2c_dev: i2c /dev entries driver [ 2.056986] usbcore: registered new interface driver uvcvideo [ 2.064494] starfive-wdt 13070000.wdog: Heartbeat: timeout=15, count/2=180000000 (0aba9500) [ 2.074249] Bluetooth: HCI UART driver ver 2.3 [ 2.079178] Bluetooth: HCI UART protocol H4 registered [ 2.085056] starfive-cpufreq soc:starfive,jh7110-cpufreq: Failed to get regulator for cpu! [ 2.094201] starfive-cpufreq soc:starfive,jh7110-cpufreq: Failed to init starfive cpu dvfs info [ 2.104367] sdhci: Secure Digital Host Controller Interface driver [ 2.111207] sdhci: Copyright(c) Pierre Ossman [ 2.116050] Synopsys Designware Multimedia Card Interface Driver [ 2.122972] sdhci-pltfm: SDHCI platform and OF driver helper [ 2.130039] jh7110-sec 16000000.crypto: Unable to request sec_m dma channel in DMA channel [ 2.139189] jh7110-sec 16000000.crypto: Cannot initial dma chan [ 2.146014] usbcore: registered new interface driver usbhid [ 2.152166] usbhid: USB HID core driver [ 2.156657] usbcore: registered new interface driver snd-usb-audio [ 2.172080] NET: Registered PF_PACKET protocol family [ 2.177724] can: controller area network core [ 2.182629] NET: Registered PF_CAN protocol family [ 2.187939] can: raw protocol [ 2.191215] can: broadcast manager protocol [ 2.195856] can: netlink gateway - max_hops=1 [ 2.200998] Bluetooth: RFCOMM TTY layer initialized [ 2.206424] Bluetooth: RFCOMM socket layer initialized [ 2.212118] Bluetooth: RFCOMM ver 1.11 [ 2.216311] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 2.222169] Bluetooth: BNEP filters: protocol multicast [ 2.227956] Bluetooth: BNEP socket layer initialized [ 2.233611] 9pnet: Installing 9P2000 support [ 2.238405] Key type dns_resolver registered [ 2.243868] Loading compiled-in X.509 certificates [ 2.285477] starfive_jh7110-pinctrl 13040000.gpio: SiFive GPIO chip registered 64 GPIOs [ 2.295094] starfive_jh7110-pinctrl 17020000.gpio: SiFive GPIO chip registered 4 GPIOs [ 2.304078] pl08xdmac 16008000.sec_dma: initialized 8 virtual memcpy channels [ 2.311992] pl08xdmac 16008000.sec_dma: initialized 16 virtual slave channels [ 2.321510] debugfs: Directory '16008000.sec_dma' with parent 'dmaengine' already present! [ 2.330687] pl08xdmac 16008000.sec_dma: DMA: PL080 rev0 at 0x16008000 irq 23 [ 2.338771] ssp-pl022 10060000.spi: ARM PL022 driver for StarFive SoC platform, device ID: 0x00041022 [ 2.348977] ssp-pl022 10060000.spi: mapped registers from 0x0000000010060000 to (____ptrval____) [ 2.359120] ssp-pl022 10060000.spi: Requested frequency: 10000000 Hz is unsupported,select by default 8250000 Hz [ 2.370741] ssp-pl022 10060000.spi: will use autosuspend for runtime pm, delay 100ms [ 2.380629] i2c 2-0045: Fixing up cyclic dependency with 295d0000.mipi [ 2.388122] seeed_panel 2-0045: Unknown Atmel firmware revision: 0x00 [ 2.395431] i2c 2-0019: Fixing up cyclic dependency with 295d0000.mipi [ 2.404073] at24 5-0050: supply vcc not found, using dummy regulator [ 2.411894] at24 5-0050: 512 byte 24c04 EEPROM, writable, 16 bytes/write [ 2.421270] axp15060-regulator 5-0036: Register mipi_0p9 done! vol range:900 ~ 900 mV [ 2.431418] axp15060-regulator 5-0036: Register hdmi_1p8 done! vol range:1800 ~ 1800 mV [ 2.441765] axp15060-regulator 5-0036: Register hdmi_0p9 done! vol range:900 ~ 900 mV [ 2.451931] axp15060-regulator 5-0036: Register cpu_vdd done! vol range:500 ~ 1540 mV [ 2.461375] i2c 6-0010: Fixing up cyclic dependency with 19800000.vin_sysctl [ 2.469570] imx219 6-0010: supply VANA not found, using dummy regulator [ 2.477029] imx219 6-0010: supply VDIG not found, using dummy regulator [ 2.484377] imx219 6-0010: supply VDDL not found, using dummy regulator [ 2.499168] imx219 6-0010: failed to read chip id 219 [ 2.504953] imx219: probe of 6-0010 failed with error -5 [ 2.513417] pcie_plda 2b000000.pcie: host bridge /soc/pcie@2B000000 ranges: [ 2.521191] pcie_plda 2b000000.pcie: MEM 0x0030000000..0x0037ffffff -&gt; 0x0030000000 [ 2.530144] pcie_plda 2b000000.pcie: MEM 0x0900000000..0x093fffffff -&gt; 0x0900000000 [ 2.539130] ATR entry: 0x0940000000 -&gt; 0x0000000000 [0x0010000000] (param: 0x000001) [ 2.547698] ATR entry: 0x0030000000 -&gt; 0x0030000000 [0x0008000000] (param: 0x000000) [ 2.556265] ATR entry: 0x0900000000 -&gt; 0x0900000000 [0x0040000000] (param: 0x000000) [ 2.905756] pcie_plda 2b000000.pcie: Port link up. [ 2.911202] pcie_plda 2b000000.pcie: PCI host bridge to bus 0000:00 [ 2.918138] pci_bus 0000:00: root bus resource [bus 00-ff] [ 2.924191] pci_bus 0000:00: root bus resource [mem 0x30000000-0x37ffffff] [ 2.931793] pci_bus 0000:00: root bus resource [mem 0x900000000-0x93fffffff pref] [ 2.940084] pci 0000:00:00.0: [1556:1111] type 01 class 0x060400 [ 2.946728] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0xffffffff 64bit pref] [ 2.954755] pci 0000:00:00.0: supports D1 D2 [ 2.959479] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold [ 2.970356] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring [ 2.979343] pci 0000:01:00.0: [1106:3483] type 00 class 0x0c0330 [ 2.986000] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff 64bit] [ 2.993564] pci 0000:01:00.0: PME# supported from D0 D3cold [ 3.003108] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01 [ 3.010448] pci 0000:00:00.0: BAR 0: no space for [mem size 0x100000000 64bit pref] [ 3.018918] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x100000000 64bit pref] [ 3.027773] pci 0000:00:00.0: BAR 8: assigned [mem 0x30000000-0x300fffff] [ 3.035257] pci 0000:01:00.0: BAR 0: assigned [mem 0x30000000-0x30000fff 64bit] [ 3.043349] pci 0000:00:00.0: PCI bridge to [bus 01] [ 3.048836] pci 0000:00:00.0: bridge window [mem 0x30000000-0x300fffff] [ 3.056432] pci 0000:00:00.0: enabling device (0000 -&gt; 0002) [ 3.062673] pci 0000:01:00.0: enabling device (0000 -&gt; 0002) [ 3.068956] pci 0000:01:00.0: quirk_usb_early_handoff+0x0/0x9d4 took 12239 usecs [ 3.077348] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 3.083132] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1 [ 3.091725] xhci_hcd 0000:01:00.0: hcc params 0x002841eb hci version 0x100 quirks 0x0000040000000890 [ 3.101883] pcie_plda 2b000000.pcie: msi#0 address_hi 0x0 address_lo 0x190 [ 3.109864] xhci_hcd 0000:01:00.0: xHCI Host Controller [ 3.115640] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2 [ 3.123831] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed [ 3.131508] hub 1-0:1.0: USB hub found [ 3.135704] hub 1-0:1.0: 1 port detected [ 3.141068] hub 2-0:1.0: USB hub found [ 3.145241] hub 2-0:1.0: 4 ports detected [ 3.152489] pcie_plda 2c000000.pcie: host bridge /soc/pcie@2C000000 ranges: [ 3.160247] pcie_plda 2c000000.pcie: MEM 0x0038000000..0x003fffffff -&gt; 0x0038000000 [ 3.169208] pcie_plda 2c000000.pcie: MEM 0x0980000000..0x09bfffffff -&gt; 0x0980000000 [ 3.178197] ATR entry: 0x09c0000000 -&gt; 0x0000000000 [0x0010000000] (param: 0x000001) [ 3.186760] ATR entry: 0x0038000000 -&gt; 0x0038000000 [0x0008000000] (param: 0x000000) [ 3.195309] ATR entry: 0x0980000000 -&gt; 0x0980000000 [0x0040000000] (param: 0x000000) [ 3.355708] usb usb2-port2: over-current condition [ 3.455731] usb 1-1: new high-speed USB device number 2 using xhci_hcd [ 3.515736] usb usb2-port4: over-current condition [ 3.625932] pcie_plda 2c000000.pcie: Port link down, exit. [ 3.645690] clk-starfive-jh7110-vout 295c0000.clock-controller: starfive JH7110 clk_vout init successfully. [ 3.666898] hub 1-1:1.0: USB hub found [ 3.668071] clk-starfive-jh7110-isp 19810000.clock-controller: starfive JH7110 clk_isp init successfully. done. Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done. Begin: Running /scripts/local-premount ... done. Warning: fsck not present, so skipping root file system [ 7.114158] EXT4-fs (mmcblk1p3): mounted filesystem with ordered data mode. Opts: (null). Quota mode: disabled. done. Begin: Running /scripts/local-bottom ... done. Begin: Running /scripts/init-bottom ... done. [ 7.883228] systemd[1]: System time before build time, advancing clock. [ 7.980379] systemd[1]: systemd 251.2-5 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified) [ 8.012496] systemd[1]: Detected architecture riscv64. Welcome to D[ 8.020576] systemd[1]: Hostname set to &lt;starfive&gt;. ebian GNU/Linux bookworm/sid! </code></pre> <p> With that working it was time to try FreeBSD. A little searching unearthed a <a href="https://forums.freebsd.org/threads/freebsd-on-visionfive2-board-with-risc-v-rv64gc-starfive-jh7110-soc.87757/"> forums post </a> showing a success <code> opensbi-&gt;u-boot-&gt;loader </code> process, but almost immediate failure once the kernel started. The forums post used a stock 13 image to boot which made it look like getting to a partially booting kernel wouldn't require too much extra work even if there was an immediate boot issue to fix. </p> <p> The Debian boot process initially recommended manually picking up the kernel and device tree images to boot. A little googling pulled up a <a href="https://github.com/robn/freebsd-vf2"> git repo with a script and instructions on how to boot </a> . With that magic I grabbed a current snapshot and tried to reproduce the failing boot. </p> <pre><code>U-Boot SPL 2021.10 (Feb 12 2023 - 18:15:33 +0800) DDR version: dc2e84f0. Trying to boot from SPI OpenSBI v1.2 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ &lt; | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : StarFive VisionFive V2 Platform Features : medeleg Platform HART Count : 5 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 4000000Hz Platform Console Device : uart8250 Platform HSM Device : jh7110-hsm Platform PMU Device : --- Platform Reboot Device : pm-reset Platform Shutdown Device : pm-reset Firmware Base : 0x40000000 Firmware Size : 292 KB Runtime SBI Version : 1.0 Domain0 Name : root Domain0 Boot HART : 1 Domain0 HARTs : 0*,1*,2*,3*,4* Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I) Domain0 Region01 : 0x0000000040000000-0x000000004007ffff () Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Loading kernel... /boot/kernel/kernel text=0x5c324c text=0x182fa4 data=0xf5508 data=0x2dc4+0x264a4c 0x8+0x1ffc5c0+0x8+0xfb1fc/ Loading configured modules... /boot/kernel/umodem.ko text=0x2080 text=0x1280 data=0x6f0+0x4 0x8+0x71b8+0x8+0xdcc loading required module 'ucom' /boot/kernel/ucom.ko text=0x2618 text=0x2d28 data=0x960+0x858 0x8+0xfae0+0x8+0x1492 can't find '/etc/hostid' can't find '/boot/entropy' Hit [Enter] to boot immediately, or any other key for command prompt. Booting [/boot/kernel/kernel]... Using DTB provided by EFI at 0x47ef2000. Kernel entry at 0xf680002e... Kernel args: (null) clk u5_dw_i2c_clk_core already disabled clk u5_dw_i2c_clk_apb already disabled ---&lt;&lt;BOOT&gt;&gt;--- GDB: no debug ports present KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2023 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 14.0-CURRENT #0 main-n263139-baef3a5b585f: Thu May 25 06:56:04 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC riscv FreeBSD clang version 15.0.7 (https://github.com/llvm/llvm-project.git llvmorg-15.0.7-0-g8dfdcc7b7bf6) WARNING: WITNESS option enabled, expect reduced performance. VT: init without driver. SBI: OpenSBI v1.2 SBI Specification Version: 1.0 CPU 0 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 1) marchid=0x8000000000000007, mimpid=0x4210427 MMU: 0x1&lt;Sv39&gt; ISA: 0x112d&lt;Atomic,Compressed,Double,Float,Mult/Div&gt; real memory = 4294967296 (4096 MB) avail memory = 4122566656 (3931 MB) sbi_trap_error: hart0: trap handler failed (error -2) sbi_trap_error: hart0: mcause=0x0000000000000005 mtval=0x0000000040048060 sbi_trap_error: hart0: mepc=0x0000000040004cac mstatus=0x0000000200001800 sbi_trap_error: hart0: ra=0x0000000040009ee2 sp=0x0000000040047f10 sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x0000000040048000 sbi_trap_error: hart0: s0=0x0000000040047f20 s1=0x0000000040048000 sbi_trap_error: hart0: a0=0x0000000040048060 a1=0x0000000000000002 sbi_trap_error: hart0: a2=0x0000000000000000 a3=0x0000000000000019 sbi_trap_error: hart0: a4=0x0000000000000001 a5=0x0000000040048060 sbi_trap_error: hart0: a6=0x00000000400480a8 a7=0x0000000000000004 sbi_trap_error: hart0: s2=0x00000000400241a8 s3=0x0000000000000000 sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000040029000 sbi_trap_error: hart0: s6=0x0000000040029020 s7=0x0000000000000000 sbi_trap_error: hart0: s8=0x000000000000001c s9=0x0000000040035ab0 sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000000 sbi_trap_error: hart0: t0=0x0000000000000000 t1=0x0000000000000000 sbi_trap_error: hart0: t2=0x0000000000000000 t3=0x0000000000002000 sbi_trap_error: hart0: t4=0x0000000000000000 t5=0x0000000000000000 sbi_trap_error: hart0: t6=0x0000000000000000 </code></pre> <p> Cool, I can reproduce the failure. I love it when that happens. </p> <p> The git repo I got the u-boot commands from was adding a memory disk image to the boot process and showed a system log of the host getting all the way up to single user (without any device specific devices discovered). Digging into their script they pull down a different device tree blob and use that with their manual u-boot boot. </p> <p> There was a follow up post by Jess (jrtc27@) linking to a <a href="https://github.com/starfive-tech/VisionFive2/issues/33"> issue with the device tree blob </a> . I guess her suggestions were merged into the visionfive2 tree and they have yet to make it through Linux and into FreeBSD. </p> <p> We need an updated DTB. </p> <pre><code>Loading kernel... /boot/kernel/kernel text=0x5c324c text=0x182fa4 data=0xf5508 data=0x2dc4+0x264a4c 0x8+0x1ffc5c0+0x8+0xfb1fc/ Loading configured modules... can't find '/boot/entropy' /boot/kernel/umodem.ko text=0x2080 text=0x1280 data=0x6f0+0x4 0x8+0x71b8+0x8+0xdcc loading required module 'ucom' /boot/kernel/ucom.ko text=0x2618 text=0x2d28 data=0x960+0x858 0x8+0xfae0+0x8+0x1492 can't find '/etc/hostid' Hit [Enter] to boot immediately, or any other key for command prompt. Booting [/boot/kernel/kernel]... Using DTB provided by EFI at 0x47f00000. Kernel entry at 0xf680002e... Kernel args: (null) clk u5_dw_i2c_clk_core already disabled clk u5_dw_i2c_clk_apb already disabled ---&lt;&lt;BOOT&gt;&gt;--- GDB: no debug ports present KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2023 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 14.0-CURRENT #0 main-n263139-baef3a5b585f: Thu May 25 06:56:04 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC riscv FreeBSD clang version 15.0.7 (https://github.com/llvm/llvm-project.git llvmorg-15.0.7-0-g8dfdcc7b7bf6) WARNING: WITNESS option enabled, expect reduced performance. VT: init without driver. SBI: OpenSBI v1.2 SBI Specification Version: 1.0 CPU 0 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 1) marchid=0x8000000000000007, mimpid=0x4210427 MMU: 0x1&lt;Sv39&gt; ISA: 0x112d&lt;Atomic,Compressed,Double,Float,Mult/Div&gt; real memory = 4294967296 (4096 MB) avail memory = 4121706496 (3930 MB) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs CPU 1 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 2) CPU 2 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 3) CPU 3 : Vendor=SiFive Core=6/7/P200/X200-Series Processor (Hart 4) arc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seeding' was enabled. random: entropy device external interface kbd0 at kbdmux0 ofwbus0: &lt;Open Firmware Device Tree&gt; clk_fixed0: &lt;Fixed clock&gt; on ofwbus0 clk_fixed1: &lt;Fixed clock&gt; on ofwbus0 clk_fixed2: &lt;Fixed clock&gt; on ofwbus0 clk_fixed3: &lt;Fixed clock&gt; on ofwbus0 clk_fixed4: &lt;Fixed clock&gt; on ofwbus0 clk_fixed5: &lt;Fixed clock&gt; on ofwbus0 clk_fixed6: &lt;Fixed clock&gt; on ofwbus0 clk_fixed7: &lt;Fixed clock&gt; on ofwbus0 clk_fixed8: &lt;Fixed clock&gt; on ofwbus0 clk_fixed9: &lt;Fixed clock&gt; on ofwbus0 clk_fixed10: &lt;Fixed clock&gt; on ofwbus0 clk_fixed11: &lt;Fixed clock&gt; on ofwbus0 clk_fixed12: &lt;Fixed clock&gt; on ofwbus0 clk_fixed13: &lt;Fixed clock&gt; on ofwbus0 clk_fixed14: &lt;Fixed clock&gt; on ofwbus0 clk_fixed15: &lt;Fixed clock&gt; on ofwbus0 clk_fixed16: &lt;Fixed clock&gt; on ofwbus0 clk_fixed17: &lt;Fixed clock&gt; on ofwbus0 clk_fixed18: &lt;Fixed clock&gt; on ofwbus0 clk_fixed19: &lt;Fixed clock&gt; on ofwbus0 simplebus0: &lt;Flattened device tree simple bus&gt; on ofwbus0 plic0: &lt;RISC-V PLIC&gt; mem 0xc000000-0xfffffff irq 14,15,16,17,18,19,20,21,22 on simplebus0 timer0: &lt;RISC-V Timer&gt; Timecounter "RISC-V Timecounter" frequency 4000000 Hz quality 1000 Event timer "RISC-V Eventtimer" frequency 4000000 Hz quality 1000 rcons0: &lt;RISC-V console&gt; cpulist0: &lt;Open Firmware CPU Group&gt; on ofwbus0 cpu0: &lt;Open Firmware CPU&gt; on cpulist0 Timecounters tick every 1.000 msec usb_needs_explore_all: no devclass Release APs WARNING: WITNESS option enabled, expect reduced performance. Trying to mount root from ufs:/dev/ufs/rootfs [rw]... mountroot: waiting for device /dev/ufs/rootfs... random: unblocking device. Mounting from ufs:/dev/ufs/rootfs failed with error 19. Loader variables: vfs.root.mountfrom=ufs:/dev/ufs/rootfs vfs.root.mountfrom.options=rw Manual root filesystem specification: &lt;fstype&gt;:&lt;device&gt; [options] Mount &lt;device&gt; using filesystem &lt;fstype&gt; and with the specified (optional) option list. eg. ufs:/dev/da0s1a zfs:zroot/ROOT/default cd9660:/dev/cd0 ro (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) ? List valid disk boot devices . Yield 1 second (for background tasks) &lt;empty line&gt; Abort manual input mountroot&gt; </code></pre> <p> Cool that works, but it is a very annoying way to boot. Can we fix it? </p> <pre><code>StarFive # printenv baudrate=115200 boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr} boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootriscv64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg boot_scripts=boot.scr.uimg boot.scr boot_syslinux_conf=extlinux/extlinux.conf boot_targets=mmc0 dhcp bootargs=console=ttyS0,115200 debug rootwait earlycon=sbi bootcmd=run load_vf2_env;run importbootenv;run load_distro_uenv;run boot2;run distro_bootcmd bootcmd_dhcp=devtype=dhcp; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00027:UNDI:003000;setenv bootp_arch 0x1b;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci; bootcmd_distro=run fdt_loaddtb; run fdt_sizecheck; run set_fdt_distro; sysboot mmc ${fatbootpart} fat c0000000 ${bootdir}/${boot_syslinux_conf}; bootcmd_mmc0=devnum=0; run mmc_boot bootdelay=2 bootdir=/boot bootenv=uEnv.txt bootmode=flash bootpart=1:3 chip_vision=B chipa_gmac_set=fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_10 &lt;0x0&gt;;fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_100 &lt;0x0&gt;;fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_1000 &lt;0x0&gt;;fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_delay_sel &lt;0x9&gt;;fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_10 &lt;0x0&gt;;fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_100 &lt;0x0&gt;;fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_1000 &lt;0x0&gt;;fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_delay_sel &lt;0x9&gt; chipa_set=if test ${chip_vision} = A; then run chipa_gmac_set;fi; chipa_set_linux=fdt addr ${fdt_addr_r};run visionfive2_mem_set;run chipa_set; chipa_set_linux_force=fdt addr ${fdt_addr_r};run visionfive2_mem_set;run chipa_gmac_set; chipa_set_uboot=fdt addr ${uboot_fdt_addr};run chipa_set; chipa_set_uboot_force=fdt addr ${uboot_fdt_addr};run chipa_gmac_set; devnum=1 distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done distroloadaddr=0xb0000000 efi_dtb_prefixes=/ /dtb/ /dtb/current/ eth0addr=6c:cf:39:00:42:ba eth1addr=6c:cf:39:00:42:bb ethaddr=6c:cf:39:00:42:ba ext4bootenv=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenv} fatbootpart=1:2 fdt_addr_r=0x46000000 fdt_high=0xffffffffffffffff fdt_loaddtb=fatload mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile}; fdt addr ${fdt_addr_r}; fdt_sizecheck=fatsize mmc ${fatbootpart} ${bootdir}/dtbs/${fdtfile}; fdtaddr=fffc5dd0 fdtcontroladdr=fffc5dd0 fdtfile=starfive/starfive_visionfive2.dtb importbootenv=echo Importing environment from mmc${devnum} ...; env import -t ${loadaddr} ${filesize} initrd_high=0xffffffffffffffff ipaddr=192.168.120.230 kernel_addr_r=0x40200000 load_distro_uenv=fatload mmc ${fatbootpart} ${distroloadaddr} ${bootdir}/${bootenv}; env import ${distroloadaddr} 17c; load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile} load_vf2_env=fatload mmc ${bootpart} ${loadaddr} ${testenv} loadaddr=0xa0000000 loadbootenv=fatload mmc ${bootpart} ${loadaddr} ${bootenv} memory_addr=40000000 memory_size=200000000 mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi mmcbootenv=run scan_mmc_dev; setenv bootpart ${devnum}:${mmcpart}; if mmc rescan; then run loadbootenv &amp;&amp; run importbootenv; run ext4bootenv &amp;&amp; run importbootenv; if test -n $uenvcmd; then echo Running uenvcmd ...; run uenvcmd; fi; fi mmcpart=3 netmask=255.255.255.0 partitions=name=loader1,start=17K,size=1M,type=${type_guid_gpt_loader1};name=loader2,size=4MB,type=${type_guid_gpt_loader2};name=system,size=-,bootable,type=${type_guid_gpt_system}; preboot=run chipa_set_uboot;run mmcbootenv pxefile_addr_r=0x45900000 ramdisk_addr_r=0x46100000 scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi; scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootriscv64.efi; then echo Found EFI removable media binary efi/boot/bootriscv64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done scan_mmc_dev=if test ${bootmode} = flash; then if mmc dev ${devnum}; then echo found device ${devnum};else setenv devnum 0;mmc dev 0;fi; fi; echo bootmode ${bootmode} device ${devnum}; scan_sf_for_scripts=${devtype} read ${scriptaddr} ${script_offset_f} ${script_size_f}; source ${scriptaddr}; echo SCRIPT FAILED: continuing... script_offset_f=0x1fff000 script_size_f=0x1000 scriptaddr=0x43900000 serial#=VF7110B1-2253-D008E000-00004015 set_fdt_distro=if test ${chip_vision} = A; then if test ${memory_size} = 200000000; then run chipa_gmac_set;run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};else run chipa_gmac_set;run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};fi;else run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};fi; sf_boot=if sf probe ${busnum}; then devtype=sf; run scan_sf_for_scripts; fi stderr=serial@10000000 stdin=serial@10000000 stdout=serial@10000000 testenv=vf2_uEnv.txt type_guid_gpt_loader1=5B193300-FC78-40CD-8002-E86C45580B47 type_guid_gpt_loader2=2E54B353-1271-4842-806F-E436D6AF6985 type_guid_gpt_system=0FC63DAF-8483-4772-8E79-3D69D8477DE4 uboot_fdt_addr=0xfffc5dd0 ver=U-Boot 2021.10 (Feb 12 2023 - 18:15:33 +0800) visionfive2_mem_set=fdt memory ${memory_addr} ${memory_size}; Environment size: 7216/65532 bytes </code></pre> <p> From the u-boot environment we can find the DTB file u-boot is passing on to the EFI loader. If we move our DTB to be in that location on disk we should be able to boot automatically. </p> <pre><code>fdtfile=starfive/starfive_visionfive2.dtb </code></pre> <p> With the working DTB in the correct place we can boot the FreeBSD image from power on without any manual intervention. We fail at mount root because we are missing drivers for any sort of storage medium, eMMC or SD (both are on a SDIO controller), USB or NVMe. We don't have any drivers for this board yet, the stuff detected in the dmesg above is devices in the DTB which exist elsewhere and so have FreeBSD drivers. </p> <p> To get past mount root (without using a memory disk) we need to have a storage driver, so lets pull up the docs and write one! </p> <h2> <strong> Much angered reading and intense searching later </strong> </h2> <p> It looks like there isn't useful documentation available for a driver writer. There are open source drivers on their way into the Linux Kernel, but the Software TRM is a high level overview, the software developer guides explain how to use interfaces from Linux and everything else is a useless summary. </p> <p> From searching I found that <a href="https://discuss.haiku-os.org/t/progress-on-running-haiku-on-visionfive-2/13369"> Haiku is booting and running on the VisionFive2 </a> . They have drivers for the PCIe controller giving them USB and NVMe and graphics on the frame buffer because u-boot is kind enough to set it up. As far as I can tell (I hope I'm wrong), they PCIe controller driver has been cribbed from the Linux Kernel. </p> <p> While writing drivers from others source is possible, it is a bit hairy going from the GPL to BSD licenses and it is terribly annoying when you hit issues to not have documentation. </p> <p> I can't see FreeBSD supporting the VisionFive2 without there being proper open documentation to write drivers from. </p> https://adventurist.me/posts/00315Sat, 27 May 2023 00:00:00 +0000 BSDCan 2023https://adventurist.me/posts/00316<p> In the Days before my fiancée and I explored Ottawa a bit, got stranded in a forest in Quebec and did our usual tour of coffee shops and book stores (got to make sure your bags are heavier on the way home somehow). </p> <p> The evening before BSDCan and the Devsummits is traditionally a meeting of the Editorial Board of the FreeBSD Journal and accomplices to discuss what we want to cover in the next year. We had a brain storming session that picked up nearly 40 ideas for articles. From this we will figure out topics for the issues in the next year. </p> <p> <a href="/images/fbsdjournal2023-meeting.jpg"> <img src="/imagessmall/fbsdjournal2023-meeting.jpg"/> </a> </p> <h1> Devsummit Day 1 </h1> <p> Typically in the days before a BSD conference the FreeBSD project holds a <a href="https://wiki.freebsd.org/DevSummit/202305"> developer summit with some time aside for hacking </a> . BSDCan is a big event for this and the Devsummit before was well attended. </p> <h2> Foundation update </h2> <p> The Devsummit normally starts with an update from the FreeBSD foundation on what is going on. This summits update included a lot of information about on going projects, new hires and direction the foundation is working in. After a pandemic gap in major updates there was a lot of new information from the foundation. </p> <p> This year is the 30th anniversary of the start of the FreeBSD project and the foundation got us cake to celebrate! </p> <p> <a href="/images/30thcake.jpg"> <img src="/imagessmall/30thcake.jpg"/> </a> </p> <h2> Core update </h2> <p> Next up is normally an update from core letting us know what they are doing about it. </p> <h2> Guided code reading with Mark J. </h2> <p> For a new Devsummit thing Mark Johnson did a guided code reading session in the scheduler. This was an introduction to the files and functions of the ULE scheduler ifreebsd which has been a topic of discussion in recent years and more in the last two months. </p> <p> I think as a new format this worked quite well, taking 40 minutes or so to walk around a sun system might be a good way to give devs kick start introductions when help is needed. </p> <h2> Story time with Mike Karels </h2> <p> Wrapping up the first Devsummit day we had a story time session with Mike Karels. Mike is one of the OG BSD people, it was great to hear his experiences working with and on BSD for the last 4 decades. This one was recorded and will be worth revisiting in the future. </p> <h1> Devsummit Day 2 </h1> <p> I took the morning of the second day of the Devsummit to stare into my slides and wonder why I had signed up to talk again. For me this is normal fair in the lead up to a conference, but boy am I good at forgetting about all the lead in anxiety before presenting a talk. </p> <h2> 15 planning </h2> <p> I made it to the Devsummit to join the have/need/want/axe session for FreeBSD 15. These sessions are where we try to figure out what we might have for an upcoming release and what we need to get devs to sign up to do. </p> <p> In the last few years we've had more desire to kill off old subsystems and tools, making the code base both smaller and easier to maintain. 15 will continue this and there is a nice list of things to get rid of. </p> <h2> Group photo and off to the pub to help set up for registration </h2> <p> Post lunch we had a project group photo of everyone that made the Devsummit. I decided to duck out for the rest of the day and help Dan prepare stuff for registration for start of the conference. It helped that this prep was in a pub. </p> <p> <a href="/images/bsdcan23tshirts.jpg"> <img src="/imagessmall/bsdcan23tshirts.jpg"/> </a> </p> <h1> BSDCan Day 1 </h1> <p> I took the morning of the first day to review my slides, drink coffee and try to avoid becoming agitated before my talk skipping the two sessions which happened in the slots before. </p> <h2> My talk - Making FreeBSD QUIC </h2> <p> I reprised my talk from EuroBSDCon, I had hoped to expand on it, but procrastination and time limitations got in the way. I’m working on a hacky GSO for FreeBSD, while it would have been great to present early results, they just weren't ready in time. </p> <p> I think the talk went well, but as it was a second presentation that isn’t too surprising. If I present at a BSD conference again it’ll be something completely new and weirdly out of the box. </p> <h2> Mateusz - Dtrace vs eBPF </h2> <p> An update from EuroBSDCon 2022, Mateusz looked at the tracing overheads for eBPF and DTrace . There are a lot of claims out there about how things work and the impact performance tools have ranging from no overhead so the tool is safe to use all the way up to too much overhead so tools are never safe to use. </p> <p> Mateusz normalised out differences between FreeBSD and Linux and explored the overheads of both sets of tools on each OS. </p> <h2> Kirk - gunion </h2> <p> Kirk came to give an overview of a new geom module call gunion: </p> <p> <em> “Turns out explains gunion takes about 10 minutes so I’ll give some background on geom too” </em> </p> <p> Kirk covered why we have geom and how it developed over time. He talked about the nop geom which has grown enough features to not be a no operation anymore. He wrapped up talking about gunion - a new geom writable layer that grabs writes to a paired geom allowing you to dry run potentially destructive operations. The use came for this is a quick fsck -y without the pitfall fall of potentially killing your disk. </p> <h2> Me again, with Benedict and Allan - BSDNow Live </h2> <p> Final session for day 1 a live performance of BSDNow. We went into this one with as much prep as we normally do and that just wasn't enough. </p> <p> Our big announcement at the end is that Allan is going to retire from hosting the show with the live show being his final episode. </p> <p> I got positive feedback after and I may be tempted to try this format again. The recording is the record of if this was a good use of everyone’s time. </p> <p> <a href="/images/bsdnowlive23selfie.jpg"> <img src="/imagessmall/bsdnowlive23selfie.jpg"/> </a> </p> <p> In the future I'll ask to have the hour before the live show blocked out for set up and preparation and bring enough of a mic set up that we can be heard in the room, on the stream and have a good mix for the show. This 'speak into the goat' experience while very funny was not a great recording environment. </p> <h1> BSDCan Day 2 </h1> <p> I started the second day with a detour to get good coffee from Little Victories and got caught in the start of the day of rain. The <a href="https://www.lvcoffee.ca/"> little victories chain </a> (there are 2 in 2023) is my recommendation for the best coffee near the venue, I made the 10 minute detour twice on my way in to have “good” coffee. </p> <p> <a href="/images/lvcoffee.jpg"> <img src="/imagessmall/lvcoffee.jpg"/> </a> </p> <h2> Kristof - if_ovpn </h2> <p> The first session was Kristof talking about the design and implementation of the <code> if_ovpn </code> kernel module. This modules allows crypto and packet processing to be handled in the kernel avoiding a round trip to user space for every packet. </p> <p> This works in a similar way to TLS offload where the meat is handled in the kernel, but the slower control traffic has to dealt with my a user space process. </p> <p> It seemed to offer pretty good performance improvements over the user space side; almost 5x </p> <h2> Taylor Campbell - NetBSD disk encryption </h2> <p> It is always good to know what is going on in other parts of the BSD world and with two competing talks which I’d watch on YouTube I decided to see a NetBSD talk. </p> <p> Taylor spoke about the design and usage of CGD disk device which offers encryption in NetBSD. He talked about some of the details and limitations of the current system. I’m glad that there are modern descriptions of NetBSD kernel internals happening at conferences. I do wish I’d managed to see one of the OpenBSD sessions but it didn't work out. </p> <h2> Corey Stephan - Using BSD in the liberal arts </h2> <p> Corey’s talk was a change of pace from the normal content at a BSD conference. Corey is a theologian teaching at a Texan university. </p> <p> “Who has sufficient time to build a better computer workflow” </p> <p> He spoke about the role open software and our communities can have in the study and teaching of liberal arts. Corey has had good experiences working with us BSD folk and is able to work well with packaged software. I’m hoping he’ll give an update in a few years and tell us if he managed to convert anyone else. </p> <h2> Lunch interview with the freebsd foundation </h2> <p> During lunch I did a short “how you got into bsd” interview with Drew from the foundation. I think it’s going into TikTok or something similar. </p> <h2> Wuyang Chung - single address space capability system </h2> <p> Another change of pace and a very academic style presentation. </p> <h2> Warner Losh - kboot: Booting FreeBSD with LinuxBoot </h2> <p> LinuxBoot offers a mechanism for a Linux kernel to boot another kernel, this can have a huge advantage if you need to reboot something that takes a long time to move through firmware initialisation. With LinuxBoot you kexec the new image and can do a warm restart. </p> <p> Warner did work to enable FreeBSD to be booted with kexec/Linuxboot. This is similar to the way FreeBSD could be booted on the PlayStation 3, but with a decade plus of new stuff added in. </p> <h2> Closing and Auction </h2> <p> BSDCan ends each year with a closing ceremony and auction. In the closing ceremony Dan announced that he was stepping down after 20 years of running the conference. New team is coming together to keep BSDCan going into its third decade. </p> <p> The final event is an auction to raise money for the Ottawa mission. I joined in and picked up a 5th copy of the 30th anniversary journal edition with signatures from the people at the conference. </p> <p> <a href="/images/bsdcan2023-ottawa-art-phine.jpg"> <img src="/imagessmall/bsdcan2023-ottawa-art-phine.jpg"/> </a> </p> https://adventurist.me/posts/00316Sun, 28 May 2023 00:00:00 +0000 Booting Linux on the Pine64 Ox64 SBChttps://adventurist.me/posts/00317<p> The Ox64 (notice that is a letter 'O' not a 0) is a tiny microcontroller sized single board computer from Pine64. The Ox64 is built around the bl808 SOC from Bouffalo Lab. It has one application level 64 bit RISC-V core, a 32 bit RISC-V core and an extra little 32 bit RISC-V core for handling io. </p> <p> It is a computer in the form factor of a microcontroller and it is built around what seems to be an open eco system. The Ox64 is early in its lifetime and Pine64 are quite good at making hardware for the community to build software around. That means that software is early and there is much to do (as I learned) to get code running. </p> <p> Lets get Bouffalo's example Linux build going on this tiny thing. </p> <h2> First signs of life </h2> <p> <a href="https://wiki.pine64.org/wiki/Ox64"> There is quite a bit of documentation and write ups in the wiki page which helped me get going. </a> </p> <p> The links in the wiki aren't super clear about how to get any sort of working Linux image on the Ox64. Before trying any of those I wanted to get some signs of life out of the board. A two hour round trip to the hackerspace later I had headers soldered on to my two boards and connected up the Waveshare USB uart I got with the VisionFive2 kit. </p> <p> The instructions aren't clear about where to expect the initial uart output to appear. The pinout on the wiki has RXD and TXD marked in several places, but also GPIO14/GPIO15 for UART0 <em> TX adn UART0 </em> RX. Two baud rates are listed 115200 and 2000000 (this might be faster than your usb uart can go), I got the following out of GPIO14/15 with a baud rate of 2000000. </p> <pre><code>$ sudo cu -l /dev/ttyU0 -s 2000000 ____ __ __ _ _ _ | _ \ / _|/ _| | | | | | | | |_) | ___ _ _| |_| |_ __ _| | ___ | | __ _| |__ | _ &lt; / _ \| | | | _| _/ _` | |/ _ \| |/ _` | '_ \ | |_) | (_) | |_| | | | || (_| | | (_) | | (_| | |_) | |____/ \___/ \__,_|_| |_| \__,_|_|\___/|_|\__,_|_.__/ Build:19:50:39,Nov 20 2022 Copyright (c) 2022 Bouffalolab team dynamic memory init success,heap size = 93 Kbyte sig1:ffff32ff sig2:0000ffff Pong! Ping! Pong! Ping! Pong! </code></pre> <h2> Flashing with DevCube </h2> <p> The <a href="https://github.com/openbouffalo/buildroot_bouffalo"> buildroot instructions </a> on the wiki have an example usage of the SDK to build firmware and how to flash boot firmware for the two cores. </p> <p> Bouffalo's flashing tool is called Devcube, they provide binaries for Linux, Mac OS and Windows. The Linux Binary (version 1.8.4) refused to run on FreeBSD with Linux compat giving me: </p> <pre><code>$ ./BLDevCube-ubuntu PySide2/__init__.py: Unable to import shiboken2 from /tmp/_MEIN3lvWA/base_library.zip, /tmp/_MEIN3lvWA/lib-dynload, /tmp/_MEIN3lvWA /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /tmp/_MEIN3lvWA/libstdc++.so.6) </code></pre> <p> <a href="/images/ox64linux-flash.jpg"> <img src="/imagessmall/ox64linux-flash.jpg"/> </a> </p> <p> I don't have a lot of experience using Linux compat and I want to get this board going in less than a month of work so I flashed from Mac OS. </p> <p> In Mac OS I was able to run Devcube, but kept hitting failures trying to flash the firmware images onto the board. Eventually I started trying more extreme things, the wiki page suggested that certain USB uart chips just don't work, so I tried another adapter. Another suggested solution was to write a USB uart firmware on to a pi pico and use that. I pulled the pi pico from my BluesSCSI v2, copied the firmware on to the virtual msdos file system and that finally worked. </p> <p> With the firmware written the output on uart0 changed to: </p> <pre><code>[I][] [I][] ____ ____ __ __ _ [I][] / __ \ | _ \ / _|/ _| | | [I][] | | | |_ __ ___ _ __ | |_) | ___ _ _| |_| |_ __ _| | ___ [I][] | | | | '_ \ / _ \ '_ \| _ &lt; / _ \| | | | _| _/ _` | |/ _ \ [I][] | |__| | |_) | __/ | | | |_) | (_) | |_| | | | || (_| | | (_) | [I][] \____/| .__/ \___|_| |_|____/ \___/ \__,_|_| |_| \__,_|_|\___/ [I][] | | [I][] |_| [I][] [I][] Powered by BouffaloLab [I][] Build:11:52:22,Mar 6 2023 [I][] Copyright (c) 2023 OpenBouffalo team [I][] Copyright (c) 2022 Bouffalolab team [I][] =========== flash cfg ============== [I][] jedec id 0xEF6018 [I][] mid 0xEF [I][] iomode 0x04 [I][] clk delay 0x01 [I][] clk invert 0x01 [I][] read reg cmd0 0x05 [I][] read reg cmd1 0x35 [I][] write reg cmd0 0x01 [I][] write reg cmd1 0x31 [I][] qe write len 0x01 [I][] cread support 0x00 [I][] cread code 0xFF [I][] burst wrap cmd 0x77 [I][] sector size: 0x04 [I][] ===================================== [I][] dynamic memory init success,heap size = 156 Kbyte [I][MAIN] Starting Mailbox Handlers [I][MBOX] Forwarding Interupt SDH (33) to D0 (0x58008bbc) [I][MBOX] Forwarding Interupt GPIO (60) to D0 (0x58008d0e) [I][MAIN] Running... [I][MBOX] Mailbox IRQ Stats: [I][MBOX] Peripheral SDH (33): 0 [I][MBOX] Peripheral GPIO (60): 0 [I][MBOX] Unhandled Interupts: 0 Unhandled Signals 0 [I][MBOX] ==================================== [I][MBOX] Mailbox IRQ Stats: [I][MBOX] Peripheral SDH (33): 0 [I][MBOX] Peripheral GPIO (60): 0 [I][MBOX] Unhandled Interupts: 0 Unhandled Signals 0 [I][MBOX] ==================================== [I][MBOX] Mailbox IRQ Stats: [I][MBOX] Peripheral SDH (33): 0 [I][MBOX] Peripheral GPIO (60): 0 [I][MBOX] Unhandled Interupts: 0 Unhandled Signals 0 [I][MBOX] ==================================== </code></pre> <p> This is promising and nice to see firmware giving us a channel for further debugging in the future. </p> <p> I wrote the example sd card image onto a card and tried to boot and got nothing. </p> <p> In the instructions I spotted that the uart for u-boot/linux was on gpio 16/17 on the other side of the board to where I had soldered headers (I only had enough right angled headers to do one side). Luckily, I soldered straight headers onto all pins of the second Ox64 I got for working on this. </p> <p> With those connected I still got nothing, I tried all the uarts on the pinout in the wiki. Dropping to 115200 for the baud because some disconnected messages in the discord suggested that might be the issue. I verified that the baud should be 2000000 in the DTB files. </p> <p> I gave in, joined the Pine64 discord and asked what might be up. Arne said that Devcube 1.8.4 has some konwn issues and I should try <a href="https://dev.bouffalolab.com/media/upload/download/BouffaloLabDevCube-v1.8.3.zip"> Devcube 1.8.3 </a> . This version didn't like uploading the bl808-firmware.bin file, it was unable to establish a connection to the firmware and gave me the same errors I saw before when I was using the USB uart adapter. </p> <p> I tried fruitlessly many combinations of boot switches and power cycles, but I couldn't get the firmware to write. </p> <p> Not sure what to try next I connected up to the system uart to see if I could get any further hints and instead I got a booting Linux: </p> <pre><code>[I][] [I][] ____ ____ __ __ _ [I][] / __ \ | _ \ / _|/ _| | | [I][] | | | |_ __ ___ _ __ | |_) | ___ _ _| |_| |_ __ _| | ___ [I][] | | | | '_ \ / _ \ '_ \| _ &lt; / _ \| | | | _| _/ _` | |/ _ \ [I][] | |__| | |_) | __/ | | | |_) | (_) | |_| | | | || (_| | | (_) | [I][] \____/| .__/ \___|_| |_|____/ \___/ \__,_|_| |_| \__,_|_|\___/ [I][] | | [I][] |_| [I][] [I][] Powered by BouffaloLab [I][] Build:11:52:04,Mar 6 2023 [I][] Copyright (c) 2023 OpenBouffalo team [I][] Copyright (c) 2022 Bouffalolab team [I][] dynamic memory init success,heap s[I][LowLoad] D0 start... [I][LowLoad] low_load start... [I][LowLoad] Header at 0x5d5ff000 [I][LowLoad] Section dtb(1) - Start 0x5d5ff100, Size 14314 [I][LowLoad] Copying DTB to 0x51ff8000...0x51ffb7ea [I][LowLoad] Done! [I][LowLoad] Section OpenSBI(2) - Start 0x5d60f100, Size 109864 [I][LowLoad] Copying OpenSBI to 0x3ef80000...0x3ef9ad28 [I][LowLoad] Done! [I][LowLoad] Section Kernel(3) - Start 0x5d62f100, Size 315597 [I][LowLoad] Uncompressing Kernel to 0x50000000... [I][LowLoad] Done! [I][LowLoad] CRC: 00000000 [I][LowLoad] load time: 61311 us [I][LowLoad] Setting PMP [I][LowLoad] Booting OpenSBI at 0x000000003ef80000 with DTB at 0x51ff8000 OpenSBI v1.2 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ &lt; | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : Pine64 Ox64 (D0) Platform Features : medeleg Platform HART Count : 1 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 1000000Hz Platform Console Device : bflb_uart Platform HSM Device : --- Platform PMU Device : --- Platform Reboot Device : --- Platform Shutdown Device : --- Firmware Base : 0x3ef80000 Firmware Size : 200 KB Runtime SBI Version : 1.0 Domain0 Name : root Domain0 Boot HART : 0 Domain0 HARTs : 0* Domain0 Region00 : 0x00000000e4008000-0x00000000e400bfff (I) Domain0 Region01 : 0x00000000e4000000-0x00000000e4007fff (I) Domain0 Region02 : 0x000000003ef80000-0x000000003efbffff () Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Domain0 Next Address : 0x0000000050000000 Domain0 Next Arg1 : 0x0000000051ff8000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Boot HART ID : 0 Boot HART Domain : root Boot HART Priv Version : v1.11 Boot HART Base ISA : rv64imafdcvx Boot HART ISA Extensions : time Boot HART PMP Count : 8 Boot HART PMP Granularity : 4096 Boot HART PMP Address Bits: 38 Boot HART MHPM Count : 8 Boot HART MIDELEG : 0x0000000000000222 Boot HART MEDELEG : 0x000000000000b109 U-Boot 2023.04-rc2 (Mar 06 2023 - 11:48:40 +0000) DRAM: 64 MiB Core: 36 devices, 17 uclasses, devicetree: board MMC: mmc@20060000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:2... Loading Environment from nowhere... OK In: serial@30002000 Out: serial@30002000 Err: serial@30002000 Net: Warning: emac@20070000 (eth0) using random MAC address - fa:6f:53:9f:5c:36 eth0: emac@20070000 Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:2... Found /extlinux/extlinux.conf Retrieving file: /extlinux/extlinux.conf Select the boot mode 1: Pine64 0X64 Kernel 2: Sipeed M1SDock Kernel Enter choice: 1 1: Pine64 0X64 Kernel Retrieving file: /extlinux/../Image append: root=PARTLABEL=rootfs rootwait rw rootfstype=ext4 console=ttyS0,2000000 loglevel=8 earlycon=sbi Retrieving file: /extlinux/../bl808-pine64-ox64.dtb ## Flattened Device Tree blob at 51ff8000 Booting using the fdt blob at 0x51ff8000 Working FDT set to 51ff8000 Loading Device Tree to 0000000053f22000, end 0000000053f25fab ... OK Working FDT set to 53f22000 Starting kernel ... [ 0.000000] Linux version 6.2.0 (runner@fv-az587-938) (riscv64-unknown-linux-gnu-gcc (Xuantie-900 linux-5.10.4 glibc gcc Toolchain V2.6.1 B-20220906) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 Mon Mar 6 11:17:27 UTC 2023 [ 0.000000] OF: fdt: Ignoring memory range 0x50000000 - 0x50200000 [ 0.000000] Machine model: Pine64 Ox64 [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') [ 0.000000] printk: bootconsole [sbi0] enabled [ 0.000000] efi: UEFI not found. [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000050200000-0x0000000053ffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000050200000-0x0000000053ffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000050200000-0x0000000053ffffff] [ 0.000000] SBI specification v1.0 detected [ 0.000000] SBI implementation ID=0x1 Version=0x10002 [ 0.000000] SBI TIME extension detected [ 0.000000] SBI IPI extension detected [ 0.000000] SBI RFENCE extension detected [ 0.000000] riscv: base ISA extensions acdfim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15655 [ 0.000000] Kernel command line: root=PARTLABEL=rootfs rootwait rw rootfstype=ext4 console=ttyS0,2000000 loglevel=8 earlycon=sbi [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 48084K/63488K available (3941K kernel code, 4584K rwdata, 2048K rodata, 2118K init, 301K bss, 15404K reserved, 0K cma-reserved) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] riscv-intc: 64 local interrupts mapped [ 0.000000] plic: interrupt-controller@e0000000: mapped 64 interrupts with 1 handlers for 2 contexts. [ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns [ 0.000003] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns [ 0.000920] Console: colour dummy device 80x25 [ 0.001166] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000) [ 0.001687] pid_max: default: 32768 minimum: 301 [ 0.002408] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.002749] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.007710] cblist_init_generic: Setting adjustable number of callback queues. [ 0.008028] cblist_init_generic: Setting shift to 0 and lim to 1. [ 0.008940] ASID allocator using 16 bits (65536 entries) [ 0.010160] EFI services will not be available. [ 0.011191] devtmpfs: initialized [ 0.014879] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.015375] futex hash table entries: 256 (order: 0, 6144 bytes, linear) [ 0.016003] pinctrl core: initialized pinctrl subsystem [ 0.018536] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.019435] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations [ 0.019823] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations [ 0.025441] bflb-ipc 30005000.mailbox: Bouffalo Lab IPC mailbox interrupt controller [ 0.030626] SCSI subsystem initialized [ 0.033265] clocksource: Switched to clocksource riscv_clocksource [ 0.061833] NET: Registered PF_INET protocol family [ 0.062497] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.064593] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.065029] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear) [ 0.065544] TCP established hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.065953] TCP bind hash table entries: 512 (order: 1, 8192 bytes, linear) [ 0.066387] TCP: Hash tables configured (established 512 bind 512) [ 0.067071] UDP hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.067407] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.068175] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.070709] workingset: timestamp_bits=62 max_order=14 bucket_order=0 [ 0.073019] NET: Registered PF_ALG protocol family [ 0.073455] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 0.073801] io scheduler mq-deadline registered [ 0.074056] io scheduler kyber registered [ 0.074387] io scheduler bfq registered [ 0.075570] bflb-gpio-pinctrl 200008c4.pinctrl: No cache defaults, reading back from HW [ 0.077954] bflb-gpio-pinctrl 200008c4.pinctrl: Bouffalo Lab pinctrl+GPIO(+interrupt) controller - Registered 32 function(s) for 46 pin(s) [ 0.083806] 30002000.serial: ttyS0 at MMIO 0x30002000 (irq = 2, base_baud = 2500000) is a BFLB UART [ 0.084288] printk: console [ttyS0] enabled [ 0.084288] printk: console [ttyS0] enabled [ 0.084735] printk: bootconsole [sbi0] disabled [ 0.084735] printk: bootconsole [sbi0] disabled [ 0.086406] 2000aa00.serial: ttyS1 at MMIO 0x2000aa00 (irq = 3, base_baud = 2500000) is a BFLB UART [ 0.115172] brd: module loaded [ 0.131893] loop: module loaded [ 0.133183] physmap-flash 58500000.xip_flash: physmap platform flash device: [mem 0x58500000-0x588fffff] [ 0.139081] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information. [ 0.139577] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;. All Rights Reserved. [ 0.140210] PPP generic driver version 2.4.2 [ 0.140910] PPP BSD Compression module registered [ 0.141223] PPP Deflate Compression module registered [ 0.142332] sdhci: Secure Digital Host Controller Interface driver [ 0.142723] sdhci: Copyright(c) Pierre Ossman [ 0.142993] sdhci-pltfm: SDHCI platform and OF driver helper [ 0.144330] mmc0 bounce up to 128 segments into one, max segment size 65536 bytes [ 0.145494] ledtrig-cpu: registered to indicate activity on CPUs [ 0.146299] bflb-seceng 20004000.seceng: No cache defaults, reading back from HW [ 0.149836] random: crng init done [ 0.150084] bflb-seceng 20004000.seceng: Bouffalo Lab Secure Engine [ 0.151045] riscv-pmu-sbi: SBI PMU extension is available [ 0.151453] riscv-pmu-sbi: 16 firmware and 10 hardware counters [ 0.153359] NET: Registered PF_INET6 protocol family [ 0.156148] Segment Routing with IPv6 [ 0.156517] In-situ OAM (IOAM) with IPv6 [ 0.156953] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 0.158856] NET: Registered PF_PACKET protocol family [ 0.159229] Key type dns_resolver registered [ 0.183293] debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page table helpers [ 0.197399] mmc0: SDHCI controller on 20060000.sdhci [20060000.sdhci] using DMA [ 0.198161] Waiting for root device PARTLABEL=rootfs... [ 0.489067] mmc0: new high speed SDHC card at address b368 [ 0.491548] mmcblk0: mmc0:b368 NCard 29.1 GiB [ 0.510192] mmcblk0: p1 p2 p3 [ 0.551381] EXT4-fs (mmcblk0p3): mounted filesystem c0eebeb6-58dd-4946-bc48-e8c2c43098cc with ordered data mode. Quota mode: disabled. [ 0.552227] VFS: Mounted root (ext4 filesystem) on device 179:3. [ 0.559988] devtmpfs: mounted [ 0.568251] Freeing unused kernel image (initmem) memory: 2116K [ 0.568740] Run /sbin/init as init process [ 0.569018] with arguments: [ 0.569212] /sbin/init [ 0.569447] with environment: [ 0.569654] HOME=/ [ 0.569812] TERM=linux [ 0.841528] EXT4-fs (mmcblk0p3): re-mounted c0eebeb6-58dd-4946-bc48-e8c2c43098cc. Quota mode: disabled. [ 1.647489] Adding 1048572k swap on /dev/mmcblk0p1. Priority:-2 extents:1 across:1048572k SS Root Partition Already resized Starting syslogd: OK Starting klogd: OK Running sysctl: OK Starting mdev... OK Initializing random number generator: OK Saving random seed: OK Starting rpcbind: OK Starting iptables: OK Starting network: OK Starting dhcpcd... dhcpcd-9.4.1 starting dhcp_vendor: Invalid argument forked to background, child pid 103 Starting sntp: sntp 4.2.8p15@1.3728-o Mon Mar 6 10:45:15 UTC 2023 (1) pool.ntp.org lookup error Temporary failure in name resolution FAIL Starting ntpd: OK Starting dropbear sshd: OK Welcome to Buildroot ox64 login: </code></pre> <p> Cool, that is Linux going, with only a lot of hassle. I wonder what I could try next? </p> https://adventurist.me/posts/00317Sun, 28 May 2023 00:00:00 +0000 netmap on cxgbe interfaceshttps://adventurist.me/posts/00318<p> Last year my testbed machine got the luxury of 100Gbit Chelsio T6 network interfaces with a pair of T62100-LP-CR cards. I have been using these recently for <a href="https://ipng.ch/s/articles/2024/02/10/vpp-freebsd-1.html"> VPP development </a> <a href="https://ipng.ch/s/articles/2024/02/17/vpp-freebsd-2.html"> on FreeBSD </a> and while they work well I have been having a lot of trouble doing any packet generation with them. </p> <p> I got pretty miserable performance using netmaps <code> pkt-gen </code> on FreeBSD and trying Linux the comparative oddness of the T6 drivers seems to trip on the <a href="https://trex-tgn.cisco.com/"> TRex </a> packet generator suite on Linux. </p> <p> From reading Chelsio's own documentation it seemed I was missing something, they have benchmarks using <code> pkt-gen </code> showing link saturation for small packets at 40Gbit/s on their T5 cards. What was up? </p> <p> When I run a <code> pkt-gen </code> (lives in <code> tools/tools/netmap </code> ) benchmark I get a little under 1 Gbit/s of traffic: </p> <pre><code>$ sudo ./pkt-gen -f tx -i cc0 -S 00:07:43:74:3f:e9 -D 00:07:43:74:3f:e1 ... 250.554583 main_thread [2713] 9.012 Mpps (9.587 Mpkts 4.326 Gbps in 1063799 usec) 512.00 avg_batch 0 min_space </code></pre> <p> ~9 Mpps isn't that great, I paid for 100 Gbit and 4 just isn't enough. </p> <p> FreeBSD has a <a href="https://man.freebsd.org/cgi/man.cgi?netmap(4)"> zero copy userspace networking framework called netmap </a> , it cleverly hooks into drivers early in their packet processing pipeline and if there is a netmap application running steals them so the host doesn't see them. Aiding with support, if the app doesn't want the given packet it can be given back to the driver and normal processing can occur. </p> <p> Drivers can be natively supported with netmap or if support isn't available an emulated mode driver can be used. </p> <p> Eventually after looking really really hard at the Chelsio examples I saw that the network interface names were different from mine. They were prefixed with a 'v', 'vcxl' rather than 'cxl'. </p> <p> A bunch of googling later I read the top <a href="https://man.freebsd.org/cgi/man.cgi?query=cxgbe"> cxgbe(4) </a> correctly: </p> <pre><code>The cxgbe driver uses different names for devices based on the associated ASIC: ASIC Port Name Parent Device Virtual Interface T4 cxgbe t4nex vcxgbe T5 cxl t5nex vcxl T6 cc t6nex vcc </code></pre> <p> To get a virtual interface we need to set the <code> hw.cxgbe.num_vis </code> sysctl to a value greater than 1. I added the following to my <code> /boot/loader.conf </code> : </p> <pre><code># Add a virtual port for cxgbe hw.cxgbe.num_vis="2" # Number of VIs per port hw.cxgbe.nnmrxq_vi="8" # Number of netmap RX queues per VI hw.cxgbe.nnmtxq_vi="8" # Number of netmap TX queues per VI hw.cxgbe.nrxq_vi="8" # Number of RX queues per VI hw.cxgbe.ntxq_vi="8" # Number of TX queues per VI </code></pre> <p> On a reboot I have a shiny new <code> vcc0 </code> device, letting pkt-gen run there I get much nicer results: </p> <pre><code>$ sudo ./pkt-gen -f tx -i vcc0 -S 00:07:43:74:3f:e9 -D 00:07:43:74:3f:e1 ... 329.706767 main_thread [2713] 68.770 Mpps (73.060 Mpkts 33.010 Gbps in 1062380 usec) 480.61 avg_batch 99999 min_space </code></pre> <p> ~70 Mpps and 33 Gbps of 64 byte packets <strong> is pretty great </strong> , with an imix I can saturate the 100Gbps with <code> pkt-gen </code> . </p> <p> I didn't find anything about this differentiator by searching, <code> pkt-gen </code> doesn't mention it. There are some dmesg lines, but if you don't know, you don't know. </p> <pre><code>238.184192 [1135] generic_netmap_attach Emulated adapter for cc0 created (prev was NULL) 238.192821 [ 320] generic_netmap_register Emulated adapter for cc0 activated 238.200244 [1889] netmap_interp_ringid invalid ring id 1 238.206046 [ 295] generic_netmap_unregister Emulated adapter for cc0 deactivated </code></pre> https://adventurist.me/posts/00318Fri, 23 Feb 2024 00:00:00 +0000