Windows equivalent to ldd

I love the ldd tool in Linux and needed this badly on Windows. Windows equivalent can be done using obj-dump

objdump.exe -p ref_read.exe

This command gives a long list of all the dlls and the functions I use in my application, ref_read.exe. So a shorter list can be extracted using grep

objdump.exe -p ref_read.exe | grep .dll

🙂

How to create bare minimum Debian Wheezy rootfs from scratch

This is a good read for creating rootfs for debian versions. To login as root without password remove * in this line root:*:16393:0:99999:7::: of /etc/shadow file.

olimex

debian-wheezy-download

In this post we will explain how you can create your own Debian rootfs with pre-installed packages of your choice, which to allow tiny Linux images to be created.

All steps below should work on any Debian host (Debian/Ubuntu etc) and are verified with Ubuntu 12.04LTS.

First of all you need to install the support packages on your pc

sudo apt-get install qemu-user-static debootstrap binfmt-support

Next you need to choose the version of Debian in this case we are building a wheezy image.

targetdir=rootfsdistro=wheezy

Now we will build first stage of Debian rootfs :

mkdir $targetdirsudo debootstrap --arch=armhf --foreign $distro $targetdir

Next copy the qemu-arm-static binary into the right place for the binfmt packages to find it and copy in resolv.conf from the host.

sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/sudo cp /etc/resolv.conf $targetdir/etc

If everything is right we now have a minimal Debian Rootfs

sudo chroot $targetdir

Inside the…

View original post 307 more words

How to send patches with git-send-email

burzalodowa

The prerequisites for this tutorial is that you have already made some changes to your local kernel tree and that these changes have been committed.
In this tutorial, are described the steps to follow in order to create and send a patch series using git-send-email.

Initially, you need to determine which of your commits want to be sent, so do:

$ git log --pretty=oneline --abbrev-commit

The output, in my case, looks like:

db868ad xhci: remove conversion from generic to pci device in xhci_mem.c
c010f0c xhci: remove unnecessary check in xhci_free_stream_info()
a166493 xhci: fix SCT_FOR_CTX(p) macro
56e4cd3 xhci: replace USB_MAXINTERFACES with config->desc.bNumInterface
...

Lets assume that I want to send the last 3 commits i.e db868ad, c010f0c and a166493. The first thing I need to do is to create patches for these commits and store them in a local directory e.g. ~/patches/

Patches that can be sent using git-send-email should have…

View original post 998 more words

Ever wondered where does gcc looks for the include files on Linux

Ever wondered where does gcc looks for the include files on Linux

Type this command

$ $(gcc -print-prog-name=cc1) -v

and you get a result like this

ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.4.1/include
 /usr/lib/gcc/i486-linux-gnu/4.4.1/include-fixed
 /usr/include/i486-linux-gnu
 /usr/include
End of search list.

For details on cc1 which is the c compiler proper. Refer this link

This command can be extended for arm based gcc like arm-linux-gcc

$ $(arm-linux-gcc -print-prog-name=cc1) -v

and an example looks like this

ignoring nonexistent directory "/home/prajosh/toolchain/SAM9G20/buildroot-2011.05/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/local/include"
ignoring nonexistent directory "/home/prajosh/toolchain/SAM9G20/buildroot-2011.05/output/host/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.6/../../../../arm-unknown-linux-uclibcgnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/prajosh/toolchain/SAM9G20/buildroot-2011.05/output/host/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.6/include
 /home/prajosh/toolchain/SAM9G20/buildroot-2011.05/output/host/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.6/include-fixed
 /home/prajosh/toolchain/SAM9G20/buildroot-2011.05/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include
End of search list.

Compiling Linux for SAM9: SAM9G20-EK board (Target) on Ubuntu (Host)

I am compiling Linux for SAM9G20-EK board. I will be doing this fresh with my Host as Ubuntu 9.10. Ubuntu will be running on Sun Virtual Machine. I will be also working on a native Linux machine

If you are expecting an already configured virtual machine for ARM9G20-EK board you can download form the following link http://www.at91.com/component/resource/article/Academy/44-Workshop/1147-sam9g20-linux-buildroot-workshop.html

This exercise is to help any newbie in bringing up the tool-chain. Here the tool-chain will not be recompiled. I will fetch already compiled binaries to build Linux.

1. Please download the appropriate package from the link http://www.angstrom-distribution.org/toolchains/ for the SAM9G20 a package with  arm5te should be chosen. I have chosen the package angstrom-2009.X-test-20091214-armv5te-linux-gnueabi-toolchain-qte-4.6.0-i686.tar.bz2 for Ubuntu9.0 on i686 host.

2. After downloading the same untar it to the root folder (/). You will find a new folder /usr/local/angstrom/arm/ and it contains the environment-setup.

3. Add the commands in environment-setup to your ~/.profile and log off and log in to make the commands take effect.

4. We can test our installation and tool-chain by following the example. This example is taken form http://www.angstrom-distribution.org/toolchains/ Creating and building a simple example. We will create a simple Qt Embedded application and use qmake2 and make to cross compile.

$ cd $HOME
$ mkdir qte-example
$ cd qte-example

$ echo "TEMPLATE=app
SOURCES=main.cpp
" > qte-example.pro

$ echo '#include <QApplication>
#include <QPushButton>

int main(int argc, char** argv) {
    QApplication app(argc, argv);

    QPushButton btn("Hello World");
    btn.show();
    btn.showMaximized();

    return app.exec();
}
' > main.cpp

$ qmake2
$ make
$ ls -l

-rw-r--r-- 1 prajosh prajosh   221 2011-03-07 14:53 main.cpp
-rw-r--r-- 1 prajosh prajosh  4500 2011-03-07 14:53 main.o
-rw-r--r-- 1 prajosh prajosh 10505 2011-03-07 14:53 Makefile
-rwxr-xr-x 1 prajosh prajosh  9516 2011-03-07 14:53 qte-example
-rw-r--r-- 1 prajosh prajosh    31 2011-03-07 14:52 qte-example.pro

will be the output of ls command. Where qte-example is the executable generated from make

$ ./qte-example 
bash: ./qte-example: cannot execute binary file

which shows this executable is not for the Host. This confirms our toolchain

5. Download the kernel source from kernel.org. I have used linux-2.6.31.14

6. Once the Kernel have been downloaded we can unzip it and start work
$ cd $HOME
$ mkdir Code
$ mkdir -p Code\Linux_kernel
$ cd Code\Linux_kernel

copy the kernel zip bundle here and unzip or rar or tar it here

$ cd linux-2.6.31.14 or which ever version you have downloaded
$ make at91sam9260ek_defconfig ARCH=arm

this will generate the .config file for the final make

6. Fire make with the following command
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi-

On completion of the make the Linux image can be found in the Linux folder in my case linux-2.6.31.14 🙂 enjoy.........