Saturday, September 14, 2013

NVRAM usage in Emebedded System

Refer to: Non-volatile random-access memory

NVRAM can be replaced by SRAM with battery . 

In Linux, mostly NVRAM is statically mapped to memory space.

MTD partition is built on top of it, which can be used for sequential

reading/writing or block device simulation  for filesystem. 

To verify data integrity on NVRAM:

bash-3.2# flash_eraseall -j /dev/mtd3
Erasing 16 Kibyte @ 1fc000 -- 99 % complete. Cleanmarker written at 1fc000.

bash-3.2# mkdir /mnt/flash

bash-3.2# mount -t jffs2 /dev/mtdblock3 /mnt/flash

bash-3.2# ls -al test.img
-rw-rw-rw- 1 root root 262144 Jan  9 00:34 test.img
bash-3.2# cp test.img /mnt/flash/

bash-3.2# md5sum /mnt/flash/test.img
ec87a838931d4d5d2e94a04644788a55  /mnt/flash/test.img

Friday, September 13, 2013

short notes using KGDB on X86

Using kgdb, kdb and the kernel debugger internals
Using kgdb and the kgdb Internals

1.) Configure, Compile and Load the kernel
2.) Check the /pro/cmdline
bash-3.2# cat /proc/cmdline
rw root=/dev/ram0 ide_generic.probe_mask=0x0 kgdboc=ttyS0,9600,B
3.) Check sysfs
bash-3.2# cat /sys/module/kgdboc/parameters/kgdboc
4.) Trigger the kernel to kgdb
bash-3.2# echo g > /proc/sysrq-trigger
[  489.043906] SysRq : GDB
5.) gdb vmlinux
(gdb) target remote

Remote debugging using

Do what you want from here.
Enjoy debugging.......