Where small furry rodents roam free.

This is my little pied-a-terre on the web where I can give my 2 euro-cents about the world.
Feel free to roam around, everything here is cool.
Reducing AVR program size with AVR-GCC July 15, 2009
Filed under: Technical — Gabe @ 8:47 am

I was hacking on my AtTiny13 this afternoon, having some trouble getting my .hex file small enough to flash. I looked around to find some details about reducing the final binary size so I could get my .hex down a couple lines, and finally figured out the following (which reduced my .hex by about 0.6k, or 16 lines).

When you link together the .o files that you compiled the first time around, a bunch of trash comes along. Especially for me I was using a software OWI (One Wire Interface) lib for only 1 or 2 of its functions, but all the other crap comes along for the ride. I needed to tell avr-gcc to not include those instructions since they were never actually getting called.

The magic happens with the ‘-Wl,–relax,–gc-sections‘ options added to avr-gcc when it is linking (stick it in your Makefile at the EDLFLAGS line perhaps).

Add in ‘-ffunction-sections -fdata-sections‘ to avr-gcc when it is compiling the object files (CPPFLAGS line), and you will probably (hopefully?) see a reduction in code size if you have some unused functions.

I’m no GCC expert, but it looks like the -fdata-sections and -ffunction-sections will cut up the data and functions into seperate sections. By using the linker options above you are telling the linker to only link sections that are referenced, and you ignore the rest. A quick search for these options will give you much more detail as to what actually happens if you are interested.

NFS with VFAT July 10, 2009
Filed under: Technical — Gabe @ 9:42 am

So I was having a bunch of problems with an NFSv4 (or v3 for that matter) export on my NSLU2. It was giving me a lot of ’stale file handle’ errors, and sometimes downright telling me that files had disappeared.

It would seem that this was all stemming from the use of a VFAT FS on my exported drive. It’s a USB HD that I also sometimes use on WinXP for photo stuff, so I stuck with vfat (back when I chose this NTFS read/write wasn’t *yet* clear). The NFS FAQ has this to say about NFS on FAT shares:

Second, it is a poor idea to export a FAT or VFAT (i.e., MS-DOS or Windows 95/98) filesystem with NFS. FAT is not designed for use on a multi-user machine, and as a result, operations that depend on permissions will not work well. Moreover, some of the underlying filesystem design is reported to work poorly with NFS’s expectations.

After some more googling it would seem that the lack of enough metadata capability in FAT file systems does not make NFS happy.

Incidentally it’s not clear to me whether you can export NTFS read/write over NFS yet since the most recent drivers seem to still be on FUSE.

NTFS-3g has the following to say about that:

Can I export NTFS via NFS?

Yes. There are two solutions depending on the Linux kernel version:

1. Obsolete: Use the FUSE kernel module from the FUSE 2.7.4 software package and please read the FUSE README.NFS file.

2. Preferred: Use the FUSE kernel module included in the Linux 2.6.27 and later kernels.

On their FAQ

So I finally settled with simply using Samba to export the VFAT partition, and that seems to work without issue, and actually has decent throughput (watching some really high bitrate episodes over the network works fine, even from a 266MHz ARM server).

Trying out gnome-blog. July 7, 2009
Filed under: Musings — Gabe @ 12:54 am

This is a post from gnome-blog. I really liked gnome-do’s twitter integration, and I’m hoping that gnome-blog will encourage to make more more posts to this blog. I’m deffinitely aiming at a more twitter-esque posting scheme (albeit with actual technical info snippets, and not random mind diarrhea).

Scan for ssh servers on subnet with NMAP.
Filed under: Technical — Gabe @ 12:22 am

Look for servers running with a certain port open (ssh for example) on a range of IP addresses:

nmap -p 22 –open 192.168.0.1-255

chrooting with udev July 6, 2009
Filed under: Technical — Tags: , , — Gabe @ 11:34 pm

If you’re having issues about commands failing with “function not implemented” when you’re in a chroot, make sure you’ve:

mounted dev:

mount -o bind /dev /mnt/chroot/dev

mounted proc:

mount proc -t proc /mnt/chroot/proc

That should be enough to get stuff working with (as root):

chroot /mnt/chroot/ /bin/bash
Back to life?
Filed under: Musings, Technical — Tags: , — Gabe @ 11:30 pm

I’ve kind of neglected this blog for a while, but I think I should at least use it for my personal note-taking and log-keeping on experiments, so it may just have more technical mumbo-jumbo than most people like, but you can filter that out by only nooking at non-technical categories in the post.

I’m also moving to India in about 2 weeks (end of July 2009) in case someone reads this and is wondering where I’m at.



Gabe 2008