Tuesday, November 17, 2009

Fedora 12: Favorite Bugs and Features

Thanksgiving in the U.S. is just around the corner and like clockwork we have another Fedora Linux release.

Fedora 12: Unite


  • Favorite (fixed) bug: [531419] qemu issue with non-virtio NICs receiving heavy traffic volumes:

    I helped track down and fix this bug upstream, asked nicely and got the patch into Fedora 12's qemu-0.11 package in time. This way people following my How to handle a Linux BSP tutorial can still get working NFS root on an emulated ARM platform.


  • Favorite new feature: wireshark USB traffic capture:

    The required kernel(usbmon), libpcap and wireshark changes are all in place in Fedora 12 and we can capture USB packets larger then 32 bytes, save them in .pcap files and dissect them in the familiar wireshark user interface.

    Everything works out of the box just by "yum install wireshark && wireshark"! Doing USB work have never been more pleasant.

Friday, October 30, 2009

Vrapper: Eclipse Plugin for VIM Addicts

People who were exposed to the VIM editor at a young age tend to become addicted to its keybindings. I recently discovered the Vrapper Eclipse plugin that although still young and not as featureful as some of the plugins for other IDEs listed here made using Eclipse a much more pleasurable experience.

The usual reason a heavy VIM user would consider using Eclipse is for its Java refactoring or C/C++ code browsing, "find all call sites of function F" features. The C++ parsing and code completion part in particular is something proprietary tools like Source Insight does a lot better then older open source tools like cscope.

In a previous job, I hacked extensively on a code base where Java code with deep class hierarchies and C and C++ code from different vintage and style was linked into a single Linux process. Some of that code implemented device drivers in userspace using a chip vendor supplied abstraction layer which is of course not as well designed as the Linux kernel driver API. I relied on Eclipse and cscope + VIM to navigate the Java and C/C++ part of that code base respectively. I wish I could have used the Vrapper plugin then.

Friday, August 28, 2009

How to Handle a Linux BSP: from u-boot to "Hello World!"


  1. Get a minimal Linux system capable of running a "Hello World" C application from the pack of software that your chip vendor calls their Linux "Board Support Package".
  2. Configure and build the u-boot bootloader, the Linux kernel, the busybox minimal application environment and getting dynamically linked applications working.
  3. Uses the qemu emulator to emulate an ARM hardware platform that loads all software over the network.

Monday, August 3, 2009

mozrunner on Fedora x86_64

If you try to use the mozrunner python library on Fedora or Red Hat x86_64, you'll get:
$ mozrunner
Traceback (most recent call last):
File "/home/scottt/work/itrs_test/env/bin/mozrunner", line 8, in
load_entry_point('mozrunner==1.3.5', 'console_scripts', 'mozrunner')()
File "/home/scottt/work/itrs_test/env/lib/python2.6/site-packages/mozrunner/__init__.py", line 86, in main
moz = get_moz_from_settings(settings)
File "/home/scottt/work/itrs_test/env/lib/python2.6/site-packages/mozrunner/__init__.py", line 165, in get_moz_from_settings
cmd_args=settings['MOZILLA_CMD_ARGS'])
File "/home/scottt/work/itrs_test/env/lib/python2.6/site-packages/mozrunner/__init__.py", line 131, in get_moz
raise Exception ('No default or local profile has been set.')
Exception: No default or local profile has been set.
the solution: see mozrunner issue 10 for a trivial patch to ask mozrunner to look under /usr/lib64 instead of just /usr/lib.

If you're trying to use the windmill web testing framework, you'll need mozrunner-1.x-fedora-x86_64.patch instead until someone ports windmill to mozrunner-2.

Don't you just love 64 bit userspace packaging differences (multilib) between Linux distributions?

Monday, July 20, 2009

mkdosfs on larger then 2GB filesystems

If you have trouble creating FAT (a.k.a. vfat, fat32) filesystems larger then 2GB, remember to build mkfs.vfat (mkdosfs) from dosfstools with:

make CFLAGS='-D_FILE_OFFSET_BITS=64'

Some embedded chip vendors forget to do this in their Linux Board Support Packages.

See 'feautre_test_macros(7)' for the details regarding defining the '_FILE_OFFSET_BITS=64' C preprocessor symbol.
Basically it causes the 'off_t' type in the C library to become 64 bits. ISO C and POSIX functions that uses 'off_t' include:

ftruncate, lockf, lseek, pread, pwrite, truncate, fseek, ftello
Google 'large file support' for more info.

Friday, April 3, 2009

'getline' is in POSIX 2008 and exposed in stdio.h by default

While using buildroot-avr32-v2.3.0 on Fedora 11, I got this build failure:

linux-2.6.27.6]$ make headers_install
<... SNIP ...>
HOSTCC scripts/unifdef
scripts/unifdef.c:209: error: conflicting types for ‘getline’
/usr/include/stdio.h:653: note: previous declaration of ‘getline’ was here


Apparently, 'getline' is now part of POSIX 2008 and is exposed by glibc-2.9.90's stdio.h by default without the user having to declare feature test macros like "#define _XOPEN_SOURCE NNN" or "_GNU_SOURCE".
I pity the kids who are now trying the 'getline' example from
"The C Programming" Chapter 1 and don't know they need to use 'c89' (or 'c99', 'gcc -std=c99 etc) instead of 'gcc'.

Edit: see also:

Saturday, March 21, 2009

My first Android (gcc-4.4 build) patch

My first patches to Google's Android code base are trivial: they make the Android platform build on Fedora 11's gcc-4.4 pre-release:
I got stuck half way through on this known issue of the "opencore" library failing to build because of the recent "cupcake" branch merge so there are likely more gcc-4.4 patches required.

Getting the trivial patches merged were reasonably painless. I followed the submit-patches document and:
  • Signed the individual Contributor Agreement and uploaded my SSH key.
  • Used "repo status", "git commit -a", "repo upload" to upload my patches.
I do hate how the "repo" git wrapper script always wants to fetch the latest code from the network on "repo sync" and doesn't have a "repo checkout" command that works from my local git repositories without touching the network though. Connecting to android.git.kernel.org from Taiwan is painfully slow.