Wednesday, December 10, 2014

dump

reference

export ARCH=arm-linux (arm-cortexa5-linux-uclibcgnueabihf   ct-ng)
export CROSS_COMPILE=arm-linux-gnueabi-

Linux kernel (3.15)
make clean
make mrproper
make vexpress_defconfig
make menuconfig

General setup --->
[ X ] Embedded system
Configure standard kernel feature(expert users) --->
[ * ] Enable ELF core dump (new)

Enable debug mode in uClibc

download: (0.9.28 trendnet lib for 312 model) http://www.uclibc.org/downloads/old-releases/
make CROSS=arm-linux- menuconfig

General Library Settings  --->
Build pthreads debugging support

this option not found in 0.9.28 version
uClibc development/debugging options  --->
  Strip libraries and executables


Enable Core Dump support in Busybox


  1. Init Utilities  --->
    Support dumping core for child processes (debugging only)
  2. Second, create an empty file in the target’s filesystem’s root directory, called “.init_enable_core“.


build ramfs

_install$ arm-linux-ldd --root bin bin/busybox
       libm.so.0 => /lib/libm.so.0 (0x8badf00d)
       libc.so.0 => /lib/libc.so.0 (0x8badf00d)
       ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x8badf00d)

mkdir lib
copy busybox depend files to lib folder
find depends file in cross compiler folder
~/x-tools/arm-cortexa5-linux-uclibcgnueabihf$ find . -name libm.so.0
./arm-cortexa5-linux-uclibcgnueabihf/sysroot/lib/libm.so.0

cp -v <cross_compiler_lib>/libm.so.0 _install/lib
cp -v <cross_compiler_lib>/libc.so.0  _install/lib
cp -v <cross_compiler_lib>/ld-uClibc.so.0 _install/lib

first check
_install$ find . | cpio -o --format=newc > ../../rootfs.img

note
qemu-system-arm -machine help

qemu-system-arm -M vexpress-a9 -m 128M -kernel zImage -initrd rootfs.img -append "root=/dev/ram rdinit=/bin/sh"

_install$mkdir proc sys dev etc etc/init.d
_install$ vim etc/init.d/rcS
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s

_install$ chmod +x etc/init.d/rcS

_install$ find . | cpio -o --format=newc > ../../rootfs.img

qemu-system-arm -M vexpress-a9 -m 128M -kernel zImage -initrd rootfs.img -append "root=/dev/ram rdinit=/sbin/init"
-redir tcp:8888::80

check
#include <stdlib.h> // C
//#include <cstdlib> // C++
void main(void)
{
abort();
}

arm-linux-gcc -o cdump cdump.c -static

Wednesday, October 29, 2014

Linux core dump

http://www.cyberciti.biz/tips/linux-core-dumps.html

Saturday, October 4, 2014

scp examples


Copy the file "foo.txt" from a remote host to the local host

$ scp username@remotehost:foo.txt /some/local/directory

copy the file "foo" from local to remote

$ scp foo username@remotehost:/some/remote/directory

Friday, October 3, 2014

VIM Cheat sheet

VIM

buffers
:buffers - show all open buffers
:ls
:files

:buffer <name> - switch buffer , tab auto compilation
:b <buf num> - switch by number
:only - keep only this window open