Tag Archive : tools

/ tools

A cross compiler is a compiler that runs on one platform/architecture but generates binaries for another platform/architecture. With devices like the Raspberry Pi, where you really don’t have much CPU or memory to work with, if you’re doing any heavy compiling (like when working on the kernel) a cross compiler is the only way to go.

While there are a lot of different methods for building cross-compilers, by far the quickest and easiest is to use crosstool-ng. This is a set of scripts that bring up a menuconfig-like interface to choose your compiler settings, then goes off and downloads what it needs, patches it, configures it, builds it and installs it all for you.

For this article I use:

  1. Slackware64 14.0 (Linux)
  2. crosstool-ng

Crosstool-NG Overview

Crosstool-ng is a set of scripts that bring up a menuconfig-like interface to choose compiler settings. The project aims to build a toolchain. Crosstool-ng also support alternative components such as uClibc, glibc, or eglibc.

Insight

Our example will build a cross compiler toolchain for Raspberry Pi, which use ARMv6 and running Linux as operating system. This will assume our OS on Pi only Linux and we cannot use this toolchain to build for other OS (RISC OS, etc).

Obtain Material

Download crosstool-ng from their official site. The latest version available per August 30th 2013 is crosstool-ng 1.18. Once the download complete, extract the content.

We also need to install crosstool-ng to our system. Let’s say we want to install it to /opt/crosstool-ng

To complete above, do following:

wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.18.0.tar.bz2
tar xjf crosstool-ng-1.18.0.tar.bz2
cd crosstool-ng-1.18.0
./configure --prefix=/opt/crosstool-ng
make
make install
export PATH="${PATH}:/opt/crosstool-ng/bin"

For installation of crosstool-ng, make sure you do `make install` using root privileges.

Preparing Environment

We need a working directory for compiling our cross-compiler. This will contain toolchain configuration, downloaded files, and intermediary build results. This is not where the final location the toolchain will end up. You should reserve some space, at least 3.5GB.

Create a directory, you choose it. For example, I will use ~/working as the working directory. Go to that directory.

mkdir ~/working
cd ~/working

Compilation & Installation

Go to working directory.

Run ct-ng script to display you a configuration menu. Make sure /opt/crosstool-ng/bin is in your search path.

ct-ng menuconfig

You should see some configuration options there.

Here is the important stuff:

Path and misc options

  • Enable “Try features marked as EXPERIMENTAL”.
  • Change the prefix directory, from ${HOME}/x-tools/${CT_TARGET} to /opt/cross/x-tools/${CT_TARGET}

Target options

  • Change the “Target Architecture” to arm
  • Change the “Endiannes” to Little endian
  • Change the “Bitness” to 32-bit

Operating System

  • Change “Target OS” to Linux

Binary utilities

  • Change “binutils version” to the latest one you can find which isn’t marked as experimental (at this time 2.22)

C Compiler

  • Enable “Show Linaro versions”
  • In the gcc version field, choose the Linaro version of gcc

Once the configuration done, save it.

To build the toolchain, do following:

ct-ng build

This should take some times, minutes in my case.

Once it done, you should have cross toolchain reside on /opt/cross/x-tools/arm-unknown-linux-gnueabi/bin. You might want to add this to your search path.

Testing

First, test the version

arm-unknown-linux-gnueabi-gcc --version

Now test for the compilation. Write this source code as test.c.

#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

and compile it.

arm-unknown-linux-gnueabi-gcc -o test test.c

Ripping MP3 from CUE / FLAC

December 9, 2015 | Article | No Comments

In this article we will discuss about how to rip MP3 from FLAC files. For this purpose I use Sound Converter and run it on Ubuntu 12.04 Desktop version.

Prerequisite

As mentioned, we need Sound Converter. We can download it from here.

Next we need to install some additional packages:

apt-get install flac mp3splt vbrfix

Usage & Process

Convert the FLAC file to MP3 using Sound Converter. This process is quite simple. Start the sound converter and specify the flac file you want to convert. Just press the “Convert” button. This converts the flac file to one single mp3 file but we aware of multiple songs in this mp3 file.

Next we need to split the single mp3 files into multiple mp3 tracks. This can be done by mp3splt.

mp3splt -f -c Album.cue Album.mp3

We assume Album.mp3 is the product of Sound Converter.

The “cue” files are generally provided with flag files for this purpose. If we don’t possess this cue file, we have to use some mp3 splitter to achieve the same.

The new mp3 files might have issues with reading mp3 duration of these files. If that happens then vbrfix will fix the problem.

vbrfix myfile.mp3 myfile_fix.mp3

That way should fix the duration problem.

Convert VCD to AVI (Xvid) on Ubuntu

December 9, 2015 | Article | No Comments

Have old VCDs? Want to convert VCDs to AVI (Xvid) and not lose too much video quality? Here we have MEncoder.

MEncoder is a free command line video decoding, encoding, and filtering tool and also sibling of MPlayer. MEncoder can convert all the formats that MPlayer understands into a variety of compressed and uncompressed formats using different codecs.

In this article we will discuss about how to use mencoder to convert vcd to avi on Ubuntu. Any Ubuntu version and any architecture is fine. However in this article I will use Ubuntu 12.10 desktop edition.

Prerequisite

MEncoder!

MEncoder is included in the MPlayer distribution. Check whether we have MEncoder or not.

mencoder --version

Which should give you similar to this:

MEncoder 1.1-4.7.1 (C) 2000-2012 MPlayer Team
--help is not an MEncoder option

Exiting... (error parsing command line)

However if it’s not recognized, then you haven’t install MPlayer and MEncoder. You can install it

apt-get install mplayer mencoder

Usage & Process

VCD or Video CD, is the first format for distributing films on standard 120mm (4.7 in) optical discs. VCD discs are playable in dedicated VCD players, most DVD and Blue-ray Disc players, PC, and some video game consoles.

VCD has structure, made of some tracks in CD-ROM XA mode. The first track of a VCD is in CD-ROM XA Mode 2 Form 1 and stores metadata and menu information. This track may also contain other non-essential files, and is shown by OS when loading the disc. The rest of the tracks are usually in CD-ROM XA Mode 2 Form 2 and contain video and audio multiplexed in an MPEG program stream (MPEG-PS) container, but CD audio tracks are also allowed.

As said before, VCD consists of some tracks. To check the track that needs to be converted, use following:

mplayer vcd://2

Let say we want track 2. To convert, use following:

mencoder vcd:/2 -o file.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000

That command will convert to AVI with bit rate 2000.

Wait till done.

Installing Lightread RSS Reader on Ubuntu

December 9, 2015 | Article | No Comments

RSS or Rich Site Summary, is a family of web feed formats used to publish frequently updated works – such as blog entries, news headlines, audio, and video – in a standardized format. An RSS document (which then called “feed”, “web feed”, or “channel”) includes full or summarized text, plus metadata such as publishing dates, and authorship.

Using RSS, one can subscribe to a site and when a new content arrive, he can be notified.

Lightread is a RSS reader client which enable user to sync with news or RSS online then read them offline without internet connection. Lightread also can synchronize with google account.

In this article we will discuss about how to install Lightread for Ubuntu from ppa. Any Ubuntu version and any architecture is fine. However in this article I will use Ubuntu 12.10 desktop edition.

Preparation

As said before, we will install Lightread from ppa. Therefore we need to add the ppa key. Do this with root privileges.

add-apt-repository ppa:cooperjona/lightread

Then update the repository to get the latest index.

apt-get update

Installation

The installation goes smooth like other application. Invoke following command with root privilege:

apt-get install lightread

At this point, Openshot has been installed successfully.

Installing Openshot 1.4.3 on Ubuntu using PPA

December 9, 2015 | Article | No Comments

Openshot is one of powerful Video editor in Linux environment. It is free, simple to use with rich feature.

In this article we will discuss about how to install Openshot for Ubuntu from ppa. Any Ubuntu version and any architecture is fine. However in this article I will use Ubuntu 12.10 desktop edition.

Features

The version we will install is 1.4.3 with following new features:

  1. New transitions: 6 bars, boxes
  2. New dark theme
  3. New 3D animations: Realistic EArth, Exploding Text, Dissolving Text
  4. Improved Drag & Drop features
  5. Apply Effects to Tracks
  6. Adjust Speed of Animated Titles
  7. New effects: Sharpness, Vignette, Lens Correction, more (10+)

Preparation

As said before, we will install Openshot from ppa. Therefore we need to add the ppa key. Do this with root privileges.

add-apt-repository ppa:openshot.developers/ppa

Then update the repository to get the latest index.

apt-get update

Installation

The installation goes smooth like other application. Invoke following command with root privilege:

apt-get install openshot frei0r-plugins

At this point, Openshot has been installed successfully.

First Interaction with SQLite

December 9, 2015 | Article | 1 Comment

In the previous article we have discussed about how to install SQLite. Whether you have installed it for Linux, Windows, or Mac OS X, there should be a working SQLite. If you don’t have it yet, please proceed to installation first depend on you system.

In this article we will discuss about SQLite and cover following topics:

  • Create a new SQLite database called “xathrya.db”.
  • Create “projects” table with three fields 1) Project ID 2) Name and 3) Deadline
  • Insert 5 records into the project tables.
  • Verify the records
  • Delete a record
  • Update a record
  • Exit SQLite3
  • Reopen database

Actually the operating system is not the matter here, means you can use SQLite on any operating system (whether Linux, Windows, or Mac OS X). This article should be generic enough to cover all of them.

Create a New SQLite Database

Like any SQL DBMS, data is stored on a database. However, SQLite will store all the information (tables, and metadatas) on a single file instead of creating differet files.

In this section we will create a new database with filename xathrya.db. Use following command:

sqlite3 xathrya.db

You would be prompted by something like this:

SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

At this point, we have entered the SQLite’s command shell. Using this shell we can enter SQL command and manage our database.

Create Table

Creating a table in SQLite is like using any Relational DMBS. The underlying language is similiar, SQL.

Now let’s create a table “projects” having three fields:

  1. Project ID, denoted by field id as integer.
  2. Name, denoted by field name as varchar
  3. Deadline, denoted as deadline as datetime

The command (within SQLite shell) would be:

create table projects(id integer primary key,name varchar(20),deadline date);

If you see on current working directory, we have newly created file xathrya.db as result of our command.

Insert Record

To insert a record we use familiar SQL command

insert into tableT values(list of values);

Which in our case the the tableT would be projects and the list of values will be the value of id,name,deadline respectively. Let’s insert 5 records there.

insert into projects values(101,'GSM Tracker using Raspberry Pi','2013-08-01');
insert into projects values(102,'GUNDAM OS','2014-08-01');
insert into projects values(103,'Project Mikan','2015-08-01');
insert into projects values(104,'Project Freedom','2016-08-01');
insert into projects values(105,'Low Orbit Unmanned Plane using Arduino','2017-08-01');

Verify Record

Let’s see whether our records has been saved by SQLite by invoking following command:

select * from projects;<br>

And you should be given following result.

101|GSM Tracker using Raspberry Pi|2013-08-01
102|GUNDAM OS|2014-08-01
103|Project Mikan|2015-08-01
104|Project Freedom|2016-08-01
105|Low Orbit Unmanned Plane using Arduino|2017-08-01

Delete a Record

To delete a record, for example on with id 105, use following command:

delete from projects where id=105;<br>

Now let’s verify the tables. At this point, SQLite should give you following result:

101|GSM Tracker using Raspberry Pi|2013-08-01
102|GUNDAM OS|2014-08-01
103|Project Mikan|2015-08-01
104|Project Freedom|2016-08-01

Update a Record

SQLite can be used to update an individual record. For example we want to change project with id 102 and set the deadline to 2013-07-02. Use following command;

update projects set deadline='2013-07-02' where id=102;<br>

Now verify the table. The output should be like this:

101|GSM Tracker using Raspberry Pi|2013-08-01
102|GUNDAM OS|2013-07-02
103|Project Mikan|2015-08-01
104|Project Freedom|2016-08-01

Exit

To exit, press CTRL+D (CTRL and D at same time).

Reopen Database

When we create a database, it is nothing but a file. To access an existing database and query the records, do the following. i.e When you do “sqlite3 xathrya.db”, if the database doesn’t exist it’ll create it. If it already exists, it’ll open it. As simple as that 😀

sqlite3 xathrya.db

If you dont believe it, try to see the tables projects.

Installing SQLite on Windows

December 9, 2015 | Uncategorized | 1 Comment

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private. SQLite is currently found in more applications than we can count, including several high-profile projects.Unlike most other SQL databases, SQLite is and embedded SQL database engine. It does not have separate server process.SQLite reads and writes directly to ordinary disk files. All power of database is contained in a single disk file. The file format is cross-platform which can be adopted to 32-bit and 64-bit systems or between big-endian and little-endian architectures. SQLite is not as a replacement for complex database, but as replacement for fopen() primitive.

In this article we will discuss about installing SQLite for Windows operating system. For this purpose I use Windows 7 32-bit as test machine. The method we use will be binary installation.

Obtain the Materials

SQLite latest version is 3.7.17. Download the source code from SQLite’s main download page. You need to download following:

  1. A command-line shell for accessing and modifying SQLite databases. This program is compatible with all versions of SQLite through 3.7.17 and beyond. Download here.
  2. This ZIP archive contains a DLL for the SQLite library version 3.7.17 for 32-bit x86 processors using the Win32 API. The DLL is built using SQLITE_ENABLE_COLUMN_METADATA so that it is suitable for use with Ruby on Rails. Download here.
  3. (optional) An analysis program for database files compatible with all SQLite versions through 3.7.17 and beyond. Download here.

Installation

Assuming we have downloaded the above files:

  • Create a directory (folder) C:\>sqlite and unzip the zipped files into this folder. This should gives us sqlite3.exe, sqlite3.def, and sqlite3.dll. If you have download the analysis program, then you will get sqlite3_analyzer.exe.

  • Add C:\>sqlite in your PATH environment variable

  • open command prompt (cmd) and issue sqlite3 command which should display a result something as below.

C:\>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

At this point we have installed the SQLite.

To explore / interact with SQLite for first time, see this article.

Installing SQLite on Linux

December 9, 2015 | Article | 3 Comments

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private. SQLite is currently found in more applications than we can count, including several high-profile projects.Unlike most other SQL databases, SQLite is and embedded SQL database engine. It does not have separate server process.SQLite reads and writes directly to ordinary disk files. All power of database is contained in a single disk file. The file format is cross-platform which can be adopted to 32-bit and 64-bit systems or between big-endian and little-endian architectures. SQLite is not as a replacement for complex database, but as replacement for fopen() primitive.

In this article we will discuss about installing SQLite in Linux. For this purpose I use Slackware64 14.0 as test machine. However, it can also be installed to other Linux distribution than Slackware. The method we use will be source installation.

Obtain the Materials

SQLite latest version is 3.7.17. Download the source code from SQLite’s main download page. The one we use in this article is this. Later we will refer this as SQLite archive.

Installation

Assuming we have downloaded the SQLite archive (sqlite-autoconf-30717.tar.gz):

tar xvfz sqlite-autoconf-3070717.tar.gz
cd sqlite-autoconf-3070717
./configure
make
make install

Note that to do installation, you should have enough privilege.

At this point we have installed the SQLite.  The default installation would take /usr/local as prefix, thus the header will be located on /usr/local/include and the library will be at /usr/local/lib as well.

To explore / interact with SQLite for first time, see this article.

Installing Firebird on Linux

December 9, 2015 | Uncategorized | No Comments

Firebird is a relational database offering many ANSI SQL standard features that runs on various operating system. It offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers.

In this article we will discuss about installing Firebird in Linux. For this purpose I use Slackware64 14.0 as test machine. However, it can also be installed to other Linux distribution than Slackware. The method we use will be source installation.

Obtain the Materials

Firebirdsql site use Sourceforge to host their source code, can be found here. The latest version we can find is Firebird 2.5.2 which can be downloaded here.

Installation

Assuming we have extract the archive and locate ourselves at source code’s directory, do following to do compilation and installation:

./configure
make
make install

Note that to do installation, you should have enough privilege.

At this point, we have installed Firebird SQL standard installed.

Social media & sharing icons powered by UltimatelySocial