Monday, April 06, 2015

Raspbian has overscan enabled by default

When I first started up Raspbain on my new Raspberry Pi 2, the picture didn't fill the entire size of the screen. I could see black borders on all sides on my 24 inch BENQ monitor. The reason for this was that Raspbain by default adding overscan to the signal. Modern TVs and monitors don't need overscan and hence disabling overscan altogether can make the Pi graphics fill the entire screen.

Check the settings on TV or monitor first. If this donsn't remove the black borders, then try disabling overscan on the Pi. This can be done by setting the parameter disabe_overscan to 1 in /boot/config.txt and commenting other parameters related to overscan.
  1. Take a backup of /boot/config.txt
    sudo cp /boot/config.txt /boot/config.txt.backup
  2. Open config.txt for editing
    sudo vi /boot/config.txt
  3. Uncomment the #disable_overscan=1 (Remove the #)
  4. Comment all other overscan parameters
  5. Save and exit
  6. Reboot
    sudo reboot

Saturday, April 04, 2015

Installing Source Code Pro true type fonts for Raspbian

As programmer you need good fonts, and I highly recommend Source Code Pro. To install Source Code Pro font for single user account do the following:
  • Download latest release of Source Code Pro fonts
  • Unzip the fonts into the directory: ~/.fonts
  • Update the font cache: fc-cache -vf

I was having problem working out what the semi bold font name was, the following one liner was useful:
fc-list :fontformat=TrueType -f "%{family}\n" | sort -u | less

Add the folllowing in ~/.Xresources to use Size 11 of Source Code Pro semi bold font for xterm:
XTerm*faceName: Source Code Pro,Source Code Pro Semibold
XTerm*faceSize: 11

For the changes in ~/.Xresources to take effect without restarting X, you can do the following:
xrdb -merge ~/.Xresources

And to verify that the changes have took effect, you can do the following:
xrdb -query -all

Saturday, March 07, 2015

Burning RASPBIAN Linux image onto micro sd card

Recently I got Raspberry PI 2 and I got around to burning RASPBIAN image onto micro SD card.

Here is a step by step guide what I did:

Please note that the use of the dd tool can overwrite any partition of your machine. If you specify the wrong device in the instructions below you could delete your primary Linux partition. Please be careful.
  • Run df -h to see what devices are currently mounted.
  • Insert the micro sd card into your computer
  • Run df -h again. The new device that has appeared is your SD card. The left column gives the device name of your SD card.On my machine it was listed as /dev/sdb1 . The last part (i.e. 1) is the partition number.
  • Run umount /dev/sdb1 
  • In the terminal, write the image to the card with the command:
sudo dd bs=4M if=2015-02-16-raspbian-wheezy.img of=/dev/sdb
  • Run sync to ensure the write cache is flushed and that it is safe to unmount your SD card.
  • Remove the SD card from the card reader.

I did this all in Virtualbox VM, therefore did not have hard disk space in the VM to dd-ing from the micro SD card back to another image on my hard disk.If I had the hard disk space in the VM I would have done the following to check what had be writtten to the SD card:
sudo dd bs=4M if=/dev/sdb of=from-sd-card.img
sudo truncate --reference 2015-02-16-raspbian-wheezy.img from-sd-card.img
diff -s from-sd-card.img 2015-02-16-raspbian-wheezy.img


diff should report that the files are identical.