Tag: ubuntu
UoA ECE Department ‘DonKey’ on Linux
by Rob Connolly on Jan.29, 2010, under Howtos
Introduction: Since finishing my Part IV Project, I’ve been threatening to do some embedded/microcontroller stuff in my spare time at home. I’ve now finally go around to it and I thought I’d start by playing with a few components I had left over from a Uni project a while back. I’ve also ordered an Arduino board (see below), but it hasn’t arrived yet. When it does, I think I’m going to have a go programming it in C rather than the random Arduino language, as I have much more experience of programming embedded systems than your average Arduino user. I’ll report on my progress when I have some!
In the Electrical and Computer Engineering Deaprtment of the University of Auckland, where I work we have a little device, internally known as the ‘DonKey’. The purpose of this is to allow easy programming of Atmel AVR based microcontrollers via USB, rather than the simpler serial interface. We also have some internally developed software to program microcontrollers via the device, unfortunately this software is pretty much windows only (we did have a successful attempt to compile it for Linux, but this was quite a while ago, a better solution would be to use a native Linux application).
Internally the DonKey uses an FTDI based USB to UART chip (specifically the FT232R) to communicate with the microcontroller. This presents some problems as, despite being the basis of the programmer on incredibly popular Arduino boards, the main Linux programming tool (AVRdude) has no official FTDI support. I think this is largely due to the use of a bootloader on the Arduino boards, which negates the need of the programming tool to directly flash the board. If however you brick the AVR on the Arduino, you would be out of luck and would need a physical programmer (more on this below).
In this howto I’ll cover how to get the DonKey working on Linux with AVRdude. Luckily, while researching how I might go about this I found that a large part of the work had been done for me, due to the fact that the Arduino also uses these chips. I found instructions on doswa.com on how to patch and compile AVRdude for just this purpose (so you could flash a bootloader to a new AVR).
These instructions work quite well for the DonKey, up until you get to running the ‘./configure’ command, I replaced this with:
$ ./configure --prefix=$HOME/.local
to setup the code to do a local install in my home directory (as I want this to be my primary version of AVRdude, but not to screw with things on the root filesystem).
Next I followed the instructions on modifiying the makefile and compiling AVRdude via the ‘make’ command. After ‘make’ I also typed:
$ make install
to install into the directory setup earlier. Now AVRdude is installed, the next thing to do is a bit of configuration, firstly you’ll want to make sure it’s on your $PATH so add the following to your ~/.bashrc file:
export PATH=$HOME/.local/bin:$PATH
and run the command:
$ source ~/.bashrc
to re-read the file.
The next issue is that you may wish to remove any copy of AVRdude that is otherwise installed (I found that sometimes my shell would run the wrong one – especially if you use ’sudo’ to run it):
sudo apt-get remove --purge avrdude
Now, I just mentioned above that you might use ’sudo’ to run AVRdude, well according to the doswa article you do need to use sudo when using the FTDI based programmers. I’m not sure why this is, but it’s not very useful if you want to be able to call AVRdude from a Makefile or the like.
I solved this by setting a ’suid root’ on my AVRdude binary. For those that don’t know what this is, the suid bit is a Unix permission setting that makes any program with it run under it’s owning user rather than the user who called it. If the owner happens to be root, the program runs as root even if the user who calls it isn’t. This is probably really insecure if you do it a lot, but you should be OK in this case.
WARNING: Despite what I say, it might not be OK. Allowing any program unrestricted root access has the potential to hose your system and scatter all your data to the winds. FOLLOW THESE INSTRUCTIONS AT YOUR OWN RISK!!
So here we go:
$ sudo chown root:root ~/.local/bin/avrdude
$ sudo chmod u+s ~/.local/bin/avrdude
Now you should be able to successfully run AVRdude on FTDI based devices without resorting to using sudo every time.
But, what of the DonKey I hear you cry! Well all we have to do to support the DonKey is give AVRdude a little bit of configuration which tells it what the DonKey actually is. This can go in ~/.avrduderc, and looks a bit (well exactly) like this:
programmer
id = "donkey";
desc = "University of Auckland ECE DonKey";
type = ft245r;
miso = 1; # D1
sck = 2; # D2
mosi = 3; # D3
reset = 4; # D4
;
OK, now you should be able to successfully use the DonKey with AVRdude, using a command similar to this:
avrdude -c donkey -p m8 -P ft0 -U myawesomeavrproject.hex
Note: this command is for the ATMega8 as denoted by the ‘-p m8′, check the AVRdude manual page for the correct -p option if you are using a different type of AVR.
OK, well that’s pretty much it, I’ll post back soon regarding my other progress with some microcontroller stuff. Bye for now!
Online Filesystem Resizing with LVM
by Rob Connolly on Oct.10, 2009, under Tips
I use LVM on my main desktop machine. This is awesome because it allows me to dynamically allocate space to partitions as I choose, however I always forget how to do a resize, so I’m going to write it down here. This isn’t going to be a full LVM tutorial (there’s plenty of material out there for that), although maybe that’s an idea for the future.
The following commands will resize an ext2, ext3, or ext4 filesystem running on LVM while it is mounted:
$ sudo lvresize -L +XXG <path to fs device>
$ sudo resize2fs <path to fs device>
In the above command you need to replace XX with the number of GB you want the filesystem to grow by and <path to fs device> by the device node (typically /dev/mapper/something).
An there you have it, done! Obviously there is a huge amount more you can do with the two tools above, take a look at their man pages for more info.
Hopefully this post will save me from having to work out how to do this every time!
Turnitin follow up…
by Rob Connolly on Oct.08, 2009, under Rants
Well it’s been a couple of days since I posted my rant about my bad experience with turnitin.com on Ubuntu and (shock horror!) I’ve had a response (thus defying the title of this blog).
The responder was Stephen Sharon via Twitter, he’s written a paper around some of the legal concerns over turnitin and he sent me the link. It’s good reading and confirms some of the things I had heard surrounding the site. I’d encourage everyone reading this to click through and read Stephen’s paper (it’s 38 pages, but double spaced and with much of each age containing references).
I’m not qualified to give legal comment on tunitin (I’m and Engineer not a Lawyer), but I will give my opinion. Before I do I’d like to give the following disclaimer (in true Software Freedom Law Show style):
WARNING: The following DOES NOT (in any way, shape or form) constitute legal advice, it is only my own (perhaps misguided) opinion. I would urge anyone who has any concerns over how their data may have been used by Turnitin to contact someone who actually knows what they a talking about, in this case A LAWYER!
Basically, I think Turnitin is on pretty shaky legal ground both in terms of Copyright and Privacy (certainly under US law). Here I New Zealand we have different privacy laws, but I’m sure they probably say much the same thing. The copyright issues are also concerning, I don’t want to turn over my rights to Turnitin just so I can submit my paper. What if my assignment gave technical details of an invention which I may in future have some financial interest in. Turnitin would have the right to use that information as they see fit.
Realistically I think it’s only a matter of time before Turnitin is taken to court again to face a hard examination of their user agreement, etc. This whole thing brings be back onto the subject of Free Software. I think it really is important for these tools which have such important uses to be Free (as in speech), it would be great to see a Free Network Service replace Turnitin as the dominant player in this market. I would much rather trust that to be transparent and honest than a company driven by profit and market share.
Anyway that’s just my $0.02. Before I finish I’ll encourage you all again to read Stephen’s paper.
Bye!
Turnitin.com, wtf?
by Rob Connolly on Oct.06, 2009, under Rants
Sorry about this but I really have to say something about this. We had to submit an assignment yesterday via turnitin.com and it broke on me because I wasn’t using a ’supported operating system’, I was using Ubuntu.
When I logged in I got a message warning me that it might not work, but I honestly don’t see the reason why. Shouldn’t it just be browser specific, not OS specific? I then proceeded to upload my PDF and it seemed to think it actually wasn’t a PDF! Switching to a Windows XP machine and uploading the same PDF worked fine which is the really random thing.
I don’t even see why our University has to use a third party service for this anyway, I’m sure they have the resources to do this in house. Then there is the whole copyright thing, which I’m not altogether happy with either.
Anyway, at least it seems Ubuntu isn’t alone in this, according to a friend Windows 7 also triggers the same error message (albeit without the PDF fail).
Again, sorry for the rant.
Even easier netboot installation…
by Rob Connolly on Jun.24, 2009, under Howtos
A while ago I covered netbooting/installation on ubuntu, well I’ve now found an even easier way to do this! It’s probably the easiest way to go about this as it really only involves editing one config file. Some of the info here comes from the official Ubuntu documentation on this, though my approach is actually easier, since you don’t need a separate tftp server.
The main piece of software you will need is dnsmasq, which you can install with the command:
sudo apt-get install dnsmasq
I already had this installed as I’m using it as a DNS cache for my network (which is also pretty useful). It turns out that dnsmasq is a bit of a ’swiss army knife’, it can do DHCP, DNS and TFTP all together and very easily. You should edit the config file:
sudo nano /etc/dnsmasq.conf (continue reading…)

