Thursday, June 30, 2011

Setting up minicom and ckermit for u-boot serial file transfers

Took awhile to get this simple bit of legacy working. I'm working over a USB serial console to a dev board and needed to update some parts of flash but I don't have working ethernet yet. U-Boot allows for kermit binary file transfers, but default ckermit settings don't appear to work well. So to speed others along, here's what I did. Quite simply, add this to (or create) ~/.kermrc:

set carrier-watch off
set handshake none
set flow-control none
set file type bin
set rec pack 1000
set send pack 1000
set window 5

Otherwise, ckermit expects some modem line signals and CONNECT before it starts the transfer. Now you can use minicom's send command.

Wednesday, June 29, 2011

Bluecherry is hiring an Ubuntu developer!

My old employer, Bluecherry, is looking to hire an Ubuntu developer with the following experience:

  • Extensive knowledge of the Video4Linux2 and ALSA sound API
  • Prior experience in Linux based software design / implementation
  • Prior knowledge of Ubuntu, including building / maintaining Debian packages
  • Prior experience with gstreamer and RTSP
  • Prior experience with MYSQL.
  • Prior experience with Matroska file containers and video encoding
  • Excellent verbal and written communication skills
  • Strong knowledge of C
  • Previous work with and understanding of working with video / audio formatting / codecs including MPEG4 and H.264
  • Internet and operating system security fundamentals
  • Sharp analytical abilities and proven design skills
  • Strong sense of ownership, urgency, and drive
  • Demonstrated ability to achieve goals in a highly innovative and fast paced environment
Yes it's a long list, but you are replacing me, so get used to high expectations, but a highly rewarding job. You don't need to know all of this, but you should have a good enough foundation that you can embrace the current codebase and not shy away from a steep learning curve. Visit Bluecherry's job posting for more information.

Wednesday, June 8, 2011

Stripping an Ubuntu system to just the basics...

WARNING: I am not responsible for you trashing your system. Use this guide with care. No attempt was made to ensure your intelligence level (nor mine).

UPDATE: Please read the comments about using apt-mark instead of the man-handler of a script that I have in the main post. Should lessen the chance of hosing your system.

While working on a cross-build system inside an Ubuntu 10.10 virtual machine instance, I decided I didn't want all the fluff of the desktop version. However, instead of just going through the entire package list on the machine, I came up with a quick way to have APT automatically handle it for me.

Ubuntu is nice in that it has meta-packages for the different levels of their system. The top-level meta-packages -- ubuntu-minimal, ubuntu-standard and ubuntu-desktop -- let APT know which package group to install (ubuntu-standard is generally used for server installs). APT also has the nice functionality of automatically being able to remove packages which were only installed because they were depended on by some other package. For example, if you install ffmpeg, you get a ton of libraries with it. If you then remove ffmpeg, you can run "apt-get autoremove" to also remove the libraries that are no longer needed because they were only installed to satisfy ffmpeg's dependencies.

So now, how to abuse this functionality. First, we find out how APT tracks these implicit/explicit package states (packages we installed directly vs. packages that were only installed to satisfy dependencies). We find /var/lib/apt/extended_states. The format is similar to /var/lib/dpkg/status and has stanzas in the form of:

Package: foo
Architecture: i386
Auto-Installed: 1

So here's a quick script that will mark all of your currently installed packages as auto-installed:


arch=$(dpkg --print-architecture)
dpkg --get-selections | awk '{print $1}' | \
(while read pkg; do
        echo "Package: $pkg"
        echo "Architecture: $arch"
        echo "Auto-Installed: 1"

Here's how we use it ( is the shell script from above):

sudo cp /var/lib/apt/extended_states /var/lib/apt/extended_states.bak
bash | sudo tee /var/lib/apt/extended_states > /dev/null 2>&1

Now, we have to tell APT that we want to keep some things. Personally, I went with the ubuntu-standard as a base line and added a few necessities for good measure. You could go with ubuntu-minimal, and also add packages here that you specifically want to keep (otherwise the commands later will remove them). Note, I specifically added grub-pc because a boot-loader is not a required package (think EC2, diskless installs, etc.). Be sure to add your boot-loader to this command if you require it.

sudo apt-get install ubuntu-standard grub-pc vim build-essential git

This most likely wont do much, since these packages are already installed. However, APT will mark them as "Auto-Installed: 0" so that it knows we explicitly installed them. Next, time to ditch a few hundred megs:

sudo apt-get --purge autoremove

This will take some time and finally spew out a huge list of things to remove. You may want to give it a quick once-over to make sure you aren't tossing something important. If you see a package you need, ^C out and run the apt-get install command again with the new package(s).

So now you should be clean and clear. Note that the above --purge option is meant to completely remove things like configuration files that were installed with the packages you are removing. If that scares you, then remove that option.