teverett

Tom Everett

teverett

Calgary

khubla.com

http://www.khubla.com

Check out snippets of the blog postings. Click on the link to view the full post at the original site as the author intended.

A simple modelling language

3/12/2016

Recently I had reason to get interested in process modelling.  Ultimately I ended up writing an Antlr4 grammar for Modelica (here), but in the mean time I came up with SML (Simple Modeling Language).  The Antlr4 grammar is sml.g4. The characteristics I wanted in my own modeling languages were: Ability to define models as text files Models should be as Object Oriented as possible Ability to compose models.  That is; ability to have models that include models. Ability to define variables that are internal to models and variables that are exposed by models (i.e. “ports”) Ability to put models in namespaces Ability to define equations in models that related the variables.  The equations should be expressed in standard form. Support

[...]

Uncategorized 

pdp-7 Unix

3/12/2016

Unix version 0 was written in 1963 by Ken Thompson, on a PDP-7.  Recently, the source code code Unix V0 has been discovered, and you can read it here, as pdf scans of printouts.  You can read about the discovery, and the effort to boot Unix V0 on a real PDP-7 here.  The project home page is here. I got interested in PDP-7 unix, and then in PDP-7 assembler.  Eventually, I wrote an Antlr4 grammar to parse PDP-7 assembler files in the original as format that Thompson wrote them here.  The resulting grammar is here.  

Uncategorized 

Building a simple RIAK ORM

2/21/2016

I’ve been interested in RIAK for a while, and ORM’s are nothing short of fascinating. I decided to try writing an ORM for Riak, and the results are here: https://github.com/teverett/cbean My ORM is not an ORM of course, because RIAK is not relational. However it is ORM-like; I can store POJO’s and retrieve them. The features I wanted for my ORM were those that I am accustomed to with Hibernate, or eBean. Ability to store POJO’s and retrieve them Ability to store object trees of POJO’s which contain POJO’s Support for Lists of POJO’s composed inside a POJO Lazy Loading In the end, I ended up with a ORM-like layer that can store data into any Key-Value store. There is a plugin which supports RIAK, and

[...]

Java 

Building QEMU

12/13/2015

In general, I install QEMU on my Macbook using MacPorts.  However I recently had a need to get the tip of the QEMU development tree. Getting the QEMU source tree is trivial: git clone git://git.qemu-project.org/qemu.git I needed an updated version of dtc: git submodule update –init dtc The build instructions from the README are: mkdir build cd build ../configure make However, my case I only need ARM emulation, so: ../configure –target-list=arm-softmmu make make install The binary qemu-system-arm will be at /usr.local/bin oscar:build tom$ /usr/local/bin/qemu-system-arm –version QEMU emulator version 2.4.94, Copyright (c) 2003-2008 Fabrice Bellard    

Uncategorized 

MusicBrainzTagger

3/15/2015

I’ve tried a couple different mp3 taggers to tag my mp3 library, however, most seem to have trouble with large mp3 libraries.  So, after doing some reading about AcoustID and MusicBrainz I decided to quickly code up my own tagger, MusicBrainzTagger. MusicBrainzTagger is a command-line application which recurses a directory of mp3 files and tags each one, one by one.  This approach allows it to handle very large libraries; it only processes one file at a time.  File processing consists of reading any ID3 tags in the input mp3, and then calculating the Acoustic ID fingerprint.  The fingerprint is then resolved to a MusicBrainz ID which is used to look up the recording. MusicBrainzTagger then tags the file, renames it, and moves it to a

[...]

Java 

FreeBSD-10.1 Soekris r276913

1/10/2015

There is a new build of FreeBSD 10.1 for Soekris here.   The source tree revision is r276913.  

FreeBSD 

Bare Metal coding on FreeBSD

11/15/2014

I recently got interested in the technical details of how ARM OS’s work, so I decided to try my hand at writing a simple one.  This blog post is not about the OS itself, but about setting up the development environment. In my case, I’m developing in a terminal session, on FreeBSD 10 on an AMD-64 host, so I’ll need to cross-compile all my code.  Luckily, the ports tree includes gcc-arm-embedded a port of the launchpad ARM cross tools.  It’s easy to install: pkg install gcc-arm-embedded This package includes all the tools which are needed: -rwxr-xr-x 1 root wheel 711488 Oct 3 11:17 arm-none-eabi-addr2line -rwxr-xr-x 2 root wheel 740040 Oct 3 11:17 arm-none-eabi-ar -rwxr-xr-x 2 root wheel 1298680 Oct 3 11:17 arm-none-

[...]

FreeBSD 

FemtoOS; a simple bootloader and protected mode kernel

10/14/2014

I’ve recently become interested in how the i386 boot loader works.  There is an excellent example of a boot loader here, and another here.  Some simple protected-mode code which implements a kernel capable of writing a line of text, is here.  FemtoOS, is the culmination of combining code from all those, and building a simple boot loader plus a protected mode kernel, that outputs text.  In my case, I’m compiling the kernel on FreeBSD. The bootloader is in boot.asm.  Like any i386 boot loader, it’s loaded by the BIOS at address 0xC700, in 16-bit real mode. It starts by clearing the screen, outputting a message, and then loading kernel.bin from the disk.  kernel.bin is loaded at address 0x1000.  The bootloader then enters

[...]

Uncategorized 

FreeBSD 10.1-BETA3 SOEKRIS Image

9/28/2014

Image file here.  

FreeBSD 

SOEKRIS image for FreeBSD-11

9/28/2014

Image file here, boot log here.  

FreeBSD 

FreeBSD Wandboard r270855

8/30/2014

A new FreeBSD Wandboard build is available here and the boot log is here. This build uses U-Boot 2014.07.

FreeBSD 

Time Machine backups using FreeBSD ZFS

8/26/2014

In this blog article, I described a way to use Netatalk3 to do Time Machine backups on FreeBSD.  This approach worked well, but it had some problems: The Time Machine backups are in every user’s home dir.  That’s messy and there is the potential that they’ll accidentally delete the backup. If I put the backups on a ZFS disk, I can compress them I would like the potential to use ZFS snapshots down the road I would prefer to have all the backups in one directory, rather than scattered across user profiles So, here is a new, better recipe.  Note that this recipe will only work with Netatalk 3.1.2 or better.  The current FreeBSD port is version 3.1.3, so that helps.  Firstly, as in the other recipe, the first step is to

[...]

FreeBSD 

TimeMachine backups on FreeBSD-10

8/24/2014

I usually work on a Macbook, and I use keyless ssh with a cron job to do nightly backups.  It works very well.  However, I decided to try backups with Time Machine, using my FreeBSD-10 server as the host. The first step is to install netatalk3, and nss_mdns pkg install netatalk3 pkg install nss_mdns avahi needs mDNS, so that needs to be configured in /etc/nsswitch.conf.  Ensure that this line exists: hosts: files dns mdns Finally, configure netatalk.  My configuration in /usr/local/etc/afp.conf looks like [Global] vol preset = default_for_all_vol log file = /var/log/netatalk.log hosts allow = 192.168.77.0/24 mimic model = TimeCapsule6,116 [default_for_all_vol] file perm = 0640 directory perm = 0750 cnid scheme = dbd [Homes] basedir regex =

[...]

FreeBSD 

Building U-boot 2014 on FreeBSD

8/23/2014

I’m upgrading the U-boot version used for Wandboard by Crochet-BSD.    The first step is to upgrade the Device Tree Compiler (DTC); there are instructions here. Once you have the U-boot 2014 source, the build is trivial: gmake SED=gsed HOSTCC=cc CROSS_COMPILE=armv6-freebsd- wandboard_quad_config gmake SED=gsed HOSTCC=cc CROSS_COMPILE=armv6-freebsd-  

FreeBSD 

Building u-boot for Chromebook

8/4/2014

I got interested in building Crochet images for Chromebook.  The first step, naturally is to build U-boot for Chromebook. In order to build U-boot, you’ll need to have already installed gmake gcc You can get these from the ports tree.  You’ll also need xdev, the FreeBSD cross-compiler toolkit. I started with the latest U-boot 2014 source, which I got here.  The latest U-boot requires DTC 1.4.  I’m on FreeBSD 10, which has a much older DTC. To build the latest DTC: git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git cd dtc gmake CC=gcc cp dtc /usr/bin Once we have DTC 1.4, we can build U-boot. wget ftp://ftp.denx.de/pub/u-boot/u-boot-2014.07.tar.bz2 tar zxvf u-boot-2014.07.tar.bz2 cd u-boot-2014.07 gmake SED=gsed

[...]

FreeBSD 

Pragmatach 1.39 released

8/3/2014

The updated main page is here.  This release include a number of bug fixes for issues discovered by Coverity.  

Pragmatach 

FreeBSD-wandboard build 269149

8/2/2014

Available here.    

FreeBSD 

Cross-compiling NetBSD on FreeBSD-10

7/13/2014

I was curious to see how difficult it would be to compile NetBSD on FreeBSD 10.  Once you have the source, there is a build.sh script which is very helpful.  The build is as simple as: ./build.sh -m i386 tools ./build.sh -m i386 kernel=GENERIC release In my case I have both clang and gcc installed.  I believe the cross-compile tools were built with clang.  The resulting gcc cross-compiler “i486–netbsdelf-gcc” was used to build the NetBSD source. The generated binaries appear in obj/releasedir/i386/binary/

FreeBSD 

Enabling i2c on FreeBSD Wandboard

7/6/2014

FreeBSD-11 has support for i2c on Wandboard. The working boot image is here, and the boot log is here. In order to enable it, there were three steps Enable the kernel options Update the files.imx6 file Create the DTS mappings The kerne config for Wandboard-Quad is here, however, most of the kernel options for Wandboard Quad are in the IMX6 config. The kernel options to enable are: device fsliic # Freescale i2c/iic device iic # iic protocol device iicbus # iic bus The files files.imx6 contains the mappings between the devices in the conf file, and the files to compile for that device.  In order to compile in the fsliic device for Freescale, I need to enable the mapping for it, so that /sys/arm/freescale/imx/i2c.c is compiled in. arm/

[...]

FreeBSD