Raj Agrawal

Learnings from software and technology

  • Home
  • Technology
  • Software
  • Work
  • Play

Connect

  • GitHub
  • LinkedIn
  • YouTube

Powered by Genesis

You are here: Home / Archives for linux

Raspberry Pi – A Delicious $25 Computer

March 10, 2012 by Raj Agrawal 2 Comments

Raspberry Pi – A credit-card sized computer has sold out after it’s soft release at the end of February, and the demand for this new device just keeps on rising!

Raspberry-Pi-Juke-Box
Image Credit: blog.ziade.org

A British organisation is behind the new Raspberry Pi, and there are hopes that this tiny PC will make computing accessible to everybody. 10,000 units went on sale from the 29th of February 2012, and the demand reached a rate of 700 per second. Like the purchase prices for most computing devices, you won’t really need to squeeze your savings, because the device only costs $25, while there is another model (with few hardware add-ons) available for $35. It’s a no frills piece of technology, which offers a computing experience to people that simply cannot afford to spend on an average PC.

Reasons behind its development

Designed by the Raspberry Pi foundation, a registered charity established in 2009, education was the stimulus behind its development. The foundation is supported by the technology company Broadcomm, and the University of Cambridge Computer Laboratory. The goal was to create a cheap device that would encourage and empower the next generation of computer programmers. The creation of Raspberry Pi has now opened the doors to a number of possibilities, specifically providing an hands-down solution for people from all over, who cannot afford today’s standard computer equipment.

What’s within (Tech Specs)

Raspberry Pi is simply a single-board computer. The developers have come up with two models of the device so far, simply called Model A, at $25, and Model B, at $35. The difference between the two is that Model B has the addition of a second UBS port and a network connectible Ethernet port, but apart from that both are identical. It measures 85.60mm x 53.98mm x 17mm, and weighs just 45g.

The Raspberry Pi is equipped with the ARM1176JZF-S 700MHz single-core processor, and a Videocore 4 GPU, which is capable of handling full High Definition Blu-ray quality video playback.

It has a total of 256MB of RAM, and an SD card reader which acts as the storage/ hard drive, for the device. There is a standard 3.5mm audio jack for plugging in headphones or speakers, and if you want to use a microphone, it can handle a USB powered microphone. There is an HDMI input port, so that it can be plugged into any HDMI compatible display device, along with an RCA video port so that it can be plugged into a standard television set too.

For Wi-Fi connectivity an external Wi-Fi adapter can be plugged into the USB port. The device is powered by 5v micro USB, and astonishingly, it is possible to run the Pi from 4 AA batteries!

What about software?

The developers of Raspberry Pi have been using a Linux operating system, and are using Fedora as their recommended distribution. Linux is free and open-source so that it can be developed and improved. While the Raspberry Pi used Fedora for now, it will soon support other Linux systems, like Debian and Arch Linux. The idea is go get people in the community to develop new software for the device, and if software can be compiled for the ARMv6 architecture it should, in theory, work on the Raspberry Pi.

Is there anything missing?

What the Raspberry Pi lacks is a keyboard, mouse, and display device, so they need to be bought separately. The Raspberry Pi foundation explains on its FAQs that,

We’re trying to build the cheapest possible computer that provides a certain basic level of functionality, and keeping the price low means we’ve had to make hard decisions about what hardware and interfaces to include.

A lot of time and though has gone into developing it, and seems that the Raspberry Pi is ticking all the right boxes so far.

In the strive to keep costs down, the bare-bones PC comes with an open board, so all the components can be seen. And at the moment, Raspberry Pi is being sold without any case (outer-shell) although they are currently being developed. And at the moment, Raspberry Pi is being sold without any case although cases are currently being developed. If you intend to get yourself one, then you can buy it from Farnell.com.

Filed Under: Consumer Technology Tagged With: linux, open source

Manually Install Software/ Apps On Any Linux Distro

January 26, 2012 by Raj Agrawal 1 Comment

Most of windows users who switch to Linux are befuddled when they download a software and end up with a file with extensions like “tar.gz” or “tar.bz2” contrary to straight away setups, as seen on Windows OS “.exe” or “.msi”.

Windows OS users are accustomed to installing software by downloading a setup package, and following through the installation wizard and complete the installation like a PRO. On Linux the story is quite different, you may get a handful of apps which are available as setup files, but many apps are archives of source files. The process of installing software from these source files may seem arduous for Linux newbies but once you understand the procedure you will find it’s really easy.

Requirements

Build Tools

These are the tools required for compiling the source files. The method to install these tools depend on your distribution.

The packages required on Ubuntu/Linux Mint can be installed be executing the following command in the terminal,

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2

On Fedora, execute the following,

sudo yum -y install gcc ncurses-devel

The command begins with a “sudo” because root access is required for installing packages, if you do not have access to the root account then you cannot install these.

The procedure

Once you’ve installed build tools you are ready to compile and install the software.

Steps involved:

  1. Extract
  2. Configure
  3. Compile
  4. Install
  5. Clean

Step 1: Extract

First we need to extract the source files from the archive. Execute the following commands to extract the source:

tar -xvjf ‘archive name’ (for .tar.bz2 files)

tar -xvzf ‘archive name’ (for .tar.gz files)

Example,

tar -xvzf bison-2.3.tar.gz

extract
Screen 1

After extracting the sources navigate into the source directory, there you will find README file, you may want to read through as it contains details about the ‘to be installed’ software, the license, and instructions for installation.

Step 2: Configure

In this step we need to configure the software. To configure you just need to run the configure script using,

./configure

In this step the script checks whether your system is ready for compiling the sources. If you did not install the build tools you may get an error message during the check.

Once the script has finished it’s execution without any errors it will generate a “Makefile” in the source directory.

The Makefile is required as it is used by the “make” utility to compile the sources.

conf1
Screen 2

Step 3: Compiling

After the “configure” script has been successfully executed and a “Makefile” is generated, you can start compiling the software by executing the following command

make -j’number of cpu cores+1′

Example,

make -j3 (without spaces in between. Enter 3, if your processor is Intel core2duo)

compile
Screen 3

Step 4: Installation

Once the compilation is finished and there are no errors, your software is ready to be installed.

To install execute the following command,

sudo make install

makeinstall
Screen 4

Step 5: Cleanup

During the compilation process many temporary files are created that you no longer require. You can delete those files to free up disk space by executing,

make clean

clean
Screen 5

You may want to keep the Makefile though, as it will be required if you wish to uninstall the software.

To uninstall the software execute,

sudo make uninstall

uninst
Screen 6

Filed Under: Technology Tagged With: linux, ubuntu

Compile A Custom Linux Kernel – An Essential Guide

January 19, 2012 by Raj Agrawal 4 Comments

You might question – why compile a custom linux kernel when the distro vendor already provides you with one? The answer is simple, the kernel which ships with your distro is a generic kernel, it means it’s designed to run on any machine on which it’s installed, it supports almost all types of processors, graphic cards, storage devices, wired/wireless networking, etc. As the generic kernel has support for plethora of PC hardware, you might argue that it is better to use a generic kernel instead of custom built kernel, but that’s not the case. A generic kernel has all the features you want, more specifically, your hardware wants, but it also has many features that you may never need. A simple example would be of the processor support, suppose you have an Intel processor the generic kernel will support it but it also has support for AMD processors which is redundant as you will never run the same kernel on an Intel processor and an AMD processor simultaneously. Thus a custom compiled kernel is more suited to your PC requirements and thus is smaller in size. Smaller size means your kernel occupies less space than the generic one but supports all the hardware you have installed in your machine.

To sum it up you might want to compile your custom Linux kernel to/for:

  1. Build a kernel customized for your hardware setup
  2. Improved performance
  3. Learn how kernel works
  4. Fun 😀

Requirements

Kernel sources: These are the source files of the kernel. You will need to compile these source files later. The latest kernel sources can be downloaded from HYPERLINK “http://www.kernel.org/”www.kernel.org.

Build Tools: These are the tools which you will require for compiling the source files. The method to install these tools depend on your distribution.

The packages required on Ubuntu/Linux Mint can be installed be executing the following command in the terminal,

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2

On Fedora, execute the following,

sudo yum -y install gcc ncurses-devel

The command begins with a “sudo” because root access is required for installing packages, if you do not have access to the root account then you cannot install these.

Once you have installed the build tools and downloaded the kernel sources you are ready to compile your custom kernel.

The kernel source you have downloaded is in an archive, first you will need to extract the sources. Execute the following command without the ‘quotes’:

tar -xjvf  ‘kernel archive file name’ ‘folder in which you want to extract the sources‘

Example, the command with the appropriate paths may look like:

tar -xjvf linux-2.6.25.tar.bz2 /home/casper/kernel/

After the kernel sources are extracted navigate into that directory and create a soft link named “linux”. Some Kernel sources require a path from the linux directory in order to compile, so the soft link needed. Run the following command to make a soft link,

ln -s ‘kernel source folder name’ linux

Example,

ls -s zen-stable linux

link
Screen 1

Now navigate to the linux directory and execute the following commands:

make clean && make mrproper

Screen 2

These commands clean the directory structure deleting any files from the previous builds.

Configure

Now we are ready to configure our kernel, but we have to choose whether we want to configure the kernel from scratch or use current kernel configuration as a base and develop on it. As we are beginners in the realm of kernel compilation we will stick with the easy method i.e. use the current configuration as a base. The current configuration can be found in “/boot/”.

Run the following command to copy the current configuration into your source folder,

cp /boot/’your config file name’ ‘your kernel source path/linux/.config

Example,

cp config-3.1.5-casper.kernel-v.1.1+ /home/nishikant/kernel/linux/.config

config
Screen 3

Now we need to compare the old configuration to the new one, so run the following command,

make oldconfig

oldconfig
Screen 4

In the screenshot the command doesn’t give any output because I am current running a custom kernel, but on your PC you might be prompted to select new features that are available.

Now run the following command,

make menuconfig

Screen 5

After executing “make menuconfig” a GUI interface will appear, here you can select the features you want. Say, processor type, cpu schedulers, IO schedulers, filesystem drivers, networking drivers, etc. Once you are done with the customization, select exit and then save the configuration.

save
Screen 6

Now you have finished customizing the kernel and it’s time to compile. The command to compile the kernel is,

make -j’number of cpu cores+1′

Example,

make -j3 (without spaces in between. Enter 3, if your processor is Intel core2duo)

If your processor supports hyper-threading then the number is twice the number of cpu cores,

Example,

make -j9 on Intel corei7 2600/2600k

The compilation process make take 15 minutes to an hour depending on your PC.

Once the compilation is over (without any errors), you are now ready to install your kernel, to install the kernel execute the following command,

sudo make modules_install install

After the kernel is installed you have to update your bootloader so that you can boot using your kernel.

On Ubuntu/Linux Mint the command is,

sudo update-grub

updategrub
Screen 7

While on Fedora, run,

su -c ‘grub2-mkconfig -o /boot/grub2/grub.cfg’

If you are using a different bootloader instead of grub then the above commands won’t work.

That’s it, you’re done compiling your custom kernel, after you restart your PC you’ll be able to boot into your kernel from the bootloader’s menu.

If your PC won’t boot into your kernel or some drivers don’t work then you can always boot into the generic kernel(that’s why having more than one kernel on your PC is always useful).

If you want to delete the kernel from your PC just delete the following file/directories(root access required):

/boot/’config-kernel name’

Example,

/boot/config-3.1.5-casper.kernel-v.1.1+

Next,

/boot/initrd.img-‘kernel name’

Example,

/boot/initrd.img-3.1.5-casper.kernel-v.1.1+

Next,

/boot/vmlinuz-‘kernel name’

Example,

 /boot/vmlinuz-3.1.5-casper.kernel-v.1.1

Next,

‘kernel name’ folder in /lib/modules

Example,

3.1.5-casper.kernel-v.1.1+

Finally update your bootloader,

On Ubuntu/Linux Mint the command is,

sudo update-grub

On Fedora run,

su -c ‘grub2-mkconfig -o /boot/grub2/grub.cfg’

So, this is it. Drop in your feedback/ questions about this tutorial. I’d be glad to hear/ answer them!

Filed Under: Technology Tagged With: linux, ubuntu

  • 1
  • 2
  • 3
  • Next Page »