Tuesday, June 14, 2011

Linux SCSI Subsystem


Reference:
http://www.t10.org
Linux SCSI Subsystem

ARM Qemu

Qemu

Qemu
[ ]# mkdir /home/qemu
[ ]# cd /home/qemu/
[ ]# git clone git://git.qemu.org/qemu.git qemu-git
[ ]# cd qemu-git/
[ ]# ./configure --target-list="arm-softmmu"
[ ]# make
[ ]# cp arm-softmmu/qemu-system-arm /usr/bin/

Or
http://download.savannah.gnu.org/releases/qemu/qemu-0.14.1.tar.gz

U-boot
[ ]# cd /home/qemu/
[ ]# wget http://ftp.denx.de/pub/u-boot/u-boot-2010.03.tar.bz2
[ ]# cd u-boot-2010.03
[ ]# make versatilepb_config ARCH=arm CROSS_COMPILE=arm-linux-
[ ]# make all ARCH=arm CROSS_COMPILE=arm-linux-
[ ]# qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot.bin

U-Boot 2010.03 (Jun 15 2011 - 14:38:26)

DRAM: 0 kB
## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB
Flash: 0 kB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: SMC91111-0
VersatilePB # print
bootargs=root=/dev/nfs mem=128M ip=dhcp netdev=25,0,0xf1010000,0xf1010010,eth0
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
ethact=SMC91111-0

Environment size: 202/8188 bytes
VersatilePB #

Simple "Hello World!" Root File System
[ ]# cd /home/qemu/
[ ]# echo "#include " > test.c
[ ]# echo "int main() {" >> test.c
[ ]# echo -e '\tprintf("Hello World!\\n");' >> test.c
[ ]# echo -e "return 0;" >> test.c
[ ]# echo "}" >> test.c

[ ]# arm-linux-gcc -static test.c -o test
[ ]# echo test | cpio -o --format=newc > rootfs

ARM Linux Versatile (ARMv5)
[ ]# cd /home/qemu/
[ ]# wget http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.35/linux-2.6.35.12.tar.bz2
[ ]# tar jxvf linux-2.6.35.12.tar.bz2
[ ]# cd linux-2.6.35.12
[ ]# make ARCH=arm versatile_defconfig
[ ]# make ARCH=arm menuconfig

Enabling EABI support in the kernel. (CONFIG_AEABI=y, CONFIG_OABI_COMPAT=y)

[ ]# make ARCH=arm CROSS_COMPILE=arm-linux- all
[ ]# qemu-system-arm -M versatilepb -m 128M -kernel arch/arm/boot/zImage -initrd rootfs -serial stdio -append "console=ttyAMA0 root=/dev/ram rdinit=/test"

You can use “-nographic” instead of “-serial stdio” to launch QEMU without opening another window, but then to close it you have to type Ctrl-A and then “x”.

How to install Qemu in Linux for Versatile Express platform
Processor: Cortex A9

COREMU

Sunday, June 12, 2011

Linux Kernel Tracer

# mount -t debugfs nodev /sys/kernel/debug

# cat /sys/kernel/debug/tracing/available_tracers
wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop

# cat /sys/kernel/debug/tracing/current_tracer
nop

# echo sched_switch > /sys/kernel/debug/tracing/current_tracer
# cat /sys/kernel/debug/tracing/current_tracer
sched_switch

# cat /sys/kernel/debug/tracing/trace_options
noprint-parent nosym-offset nosym-addr noverbose

# echo print-parent > /sys/kernel/debug/tracing/trace_options

# echo 1 > /sys/kernel/debug/tracing/tracing_enabled
# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt
# echo 0 > /sys/kernel/debug/tracing/tracing_enabled

Thursday, June 9, 2011

OProfile on ARM Linux

How to compile OProfile

binutils
[ ]#./configure \
     --target=arm-linux \
     --host=arm-linux \
     --build=i686-pc-linux-gnu \
     --enable-shared \
     --prefix=/home/oprofile/binutils-stable_bin \
     --disable-nls --disable-poison-system-directories

[ ]#make
[ ]#make install

oprofile-0.9.6
[ ]#./configure --with-linux=/home/linux-2.6.35.12-cavm1 \
     --with-kernel-support \
     --disable-optimization \
     --disable-werror \
     --target=arm-linux \
     --host=arm-linux \
     --build=i686-pc-linux-gnu \
     --enable-static \
     --with-binutils=/home/oprofile/binutils-stable_bin \
     --prefix=/home/oprofile/oprofile-0.9.6_bin

[ ]#make

How to use OProfile on ARM platform
Default: timer mode, $ modprobe oprofile timer=1
$ opcontrol --reset
$ opcontrol --init
$ opcontrol --start --vmlinux=/tmp/vmlinux --session-dir=/tmp/linux
$ opcontrol --start-daemon

$ opcontrol --dump
$ opcontrol --save=output
$ opreport --session-dir=/tmp/linux session:output -l image:/tmp/vmlinux

Sample Rate = HZ

OProfile with performance counter
$ opcontrol --callgraph=8 --separate=kernel --vmlinux=/boot/vmlinux
$ opcontrol --event=CPU_CYCLES:100000:0:1:1 \
                  --event=L1D_CACHE:100000:0:1:1 \
                  --event=L2D_CACHE:10000:0:1:1 \
                  --event=BUS_ACCESS:100000:0:1:1 \
                  --event=BUS_CYCLES:100000:0:1:1 \
                  --event=UNALIGNED_LDST_RETIRED:10000:0:1:1
$ opcontrol --init
$ opcontrol --reset
$ opcontrol --start-daemon
$ opcontrol --status
$ opcontrol --start

$ opcontrol --dump
$ opreport

Sample Rate = (CPU frequency in MHz) / (CPU_CYCLES count) / 64.
      The default value of CPU_CYCLES = 100000. The CPU_CYCLES can be changed as following               example “--event=CPU_CYCLES:125000".

      If CPU is running in 800MHz, the sample rate is 800MHz / 100000 / 64 = 125 samples per second.
   

Reference:
http://friendalways.blogspot.com/2009/11/oprofile-on-arm-linux.html

Wednesday, June 8, 2011

HD over Wireless

1. WiVu: Cavium
2. WiDi (Wireless Display): Intel
3. WiHD (Wireless HD): Intel, ...
4. WiGig: Wilocity (Atheros)
5. WHDI: AMIMON, Sibeam ()

Tuesday, May 10, 2011

aclocal.m4 Error

Q:
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf. If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
make: *** [configure] Error 1

A:
Running aclocal to create aclocal.m4
[ ]# aclocal
Running autoheader to create config.h.in
[ ]# autoheader
Running automake to create Makefile.in
[ ]# automake
Running autoconf to create configure
[ ]# autoconf

Run ./configure and then make to compile the code
[ ]# ./configure
[ ]# make

Saturday, April 30, 2011

How to install CodeSourcery ARM Cross-Compiler on Mac

ARM EABI Version
RTOS systems or bare metal systems where no operating system is present. These configurations should not be used to build Linux kernels or applications.

The source tarball includes:
binutils-2010.09-51.tar.bz2
cloog-2010.09-51.tar.bz2
coreutils-2010.09-51.tar.bz2
expat-2010.09-51.tar.bz2
gcc-2010.09-51.tar.bz2
gdb-2010.09-51.tar.bz2
gmp-2010.09-51.tar.bz2
libelf-2010.09-51.tar.bz2
libiconv-2010.09-51.tar.bz2
make-2010.09-51.tar.bz2
mpc-2010.09-51.tar.bz2
mpfr-2010.09-51.tar.bz2
newlib-2010.09-51.tar.bz2
ppl-2010.09-51.tar.bz2
zlib-2010.09-51.tar.bz2

How to rebuild the toolchain from CodeSourcery released source tarball
$ git clone https://github.com/jsnyder/arm-eabi-toolchain.git
$ cd arm-eabi-toolchain
$ sudo make install-deps
$ sudo make install-cross

$ export PATH=$HOME/arm-cs-tools/bin:$PATH

ARM GNU/Linux Version
Systems running full Linux, i.e., Linux on CPUs with an MMU. Use Sourcery G++ to build both the Linux kernel and applications.

The source tarball includes:
The difference between these 2 versions are the C library and, of course, the Linux kernel source code.
glibc-2010.09-50.tar.bz2
glibc_localedef-2010.09-50.tar.bz2
glibc_ports-2010.09-50.tar.bz2

Reference:
1. https://github.com/jsnyder/arm-eabi-toolchain
2.