home contact

GNU/Linux Tweaks

This section contains a collection of some GNU/Linux tips and tweaks. An overview:


Tab completion

By default, tab completion on several distributions does not show the list of all possible options immediately, without having to hit the TAB-key several times. Add the line "set show-all-if-ambiguous on" to your /etc/inputrc or /.inputrc file to make the TAB-key show all completion options immediately.

Modifying the Grub splash image

Using the GIMP for example, create a .xpm image consisting of 14 colours. Gzip this image and put it in /boot/grub. Now edit /boot/grub/grub.conf and add/modify the splashimage parameter into: splashimage=(hd0,0)/grub/yourimage.xpm.gz .

Booting from an installer ISO image

First, mount the ISO image and copy the files initrd-2.6..., System.map-2.6... and vmlinuz-2.6... to /boot. (as of Fedora 10) Copy images/install.img to the directory containing the ISO file (preserve the images/ directory).

Next, edit your Grub configuration and add an entry for the installer. The easiest way to do this, is by copying the default grub entry and changing the filenames in that entry accordingly.

Reboot your system and select the new entry. The installer will launch and ask you to enter the location of the ISO image. If you had downloaded the ISO into /data/iso, and /data is the mount point for partition /dev/sda3, then you need to select /dev/sda3 in the menu and enter /iso in the path field.

Some great vim features

The vim editor offers a vast amount of features. I really like the following:

Profiling multiple instances of one executable

Suppose you want to profile (using gprof) an executable of which several instances will be running at the same time. By default, only one gmon.out file will be created, which will be overwritten by the different instances. To get a separate gmon.out for every instance of the executable, set the GMON_OUT_PREFIX environment variable before running the executable.

Using git to backup your private projects over ssh

If you have an ssh account on some server, you can use git to easily backup anything you want. First, login to the ssh server and setup a bare repository:

ssh username@server.org
mkdir myrepo.git
cd myrepo.git
git init --bare

Then, on your local machine, setup a repo as follows:

cd yourproject
git init
git add yourfiles
git commit
git remote add origin ssh://username@server.org/path/to/myrepo.git
git push origin master

From now on, you can simply use git push to backup your project (provided that you first git-commit your local changes). To retrieve the backup, simply clone the repo:

git clone ssh://username@server.org/path/to/myrepo.git

Note that cloning an empty repo (which has just been initialized using git init --bare) will give an error message "fatal: no matching remote head", so you can clone only after committing and pushing at least one file.

Embedding fonts in a PDF

When preparing the final manuscript of a conference paper, all fonts need to be embedded into the PDF file. To accomplish this, run the following (after producing a .dvi file):

dvips -t letter -Ppdf -G0 paper.dvi -o paper.ps

Replace ''letter'' with ''a4'' depending on the conference requirements. Then, run the following to produce the final PDF:

ps2pdf -dPDFSETTINGS=/printer -dMaxSubsetPct=100 \
       -dSubsetFonts=true -dEmbedAllFonts=true paper.pdf

To inspect the resulting PDF, run:

pdffonts paper.pdf

If all fonts are properly embedded, there should be no ''no'' in the ''emb'' column.

Producing proper handouts from OpenOffice Impress

I found that OpenOffice 3.2.1 produces low-resolution, pixelated and distorted graphics when printing handouts with e.g. 6 slides per page. After trying various workarounds, I found the following solution:

The resulting PDF file now contains the slides in a 2x3 handout format, without showing any graphics quality degradation.

Programming Xilinx FPGAs

How to program a Xilinx FPGA board on a GNU/Linux system? In this section, I describe a possible method.

What do I need?

Got all of that, what's next?

1. Compile the libusb-driver. Make the LD_PRELOAD environment variable point to libusb-driver.so.
2. Make sure the modules parport, parport_pc and ppdev are active. Use the modprobe command when necessary.
3. Make sure that permissions for the parallel port are set up correctly. If you get a "permission denied" error, it is likely this is not the case.
4. Now run iMPACT, setup the JTAG programming chain and program the FPGA device. Programming will take a while, since the libusb-driver does not support the parallel cable at full speed. Particularly the last percent of the progress bar takes a while to complete. Just be patient, it will eventually complete. :)
Last modified: Thu 08 Sep 2011, 10:43:57