2012年3月27日 星期二

u-boot dhcp request, no ack

In u-boot> dhcp

discover ->
offer <-
request ->

no ack!

discover, offer, request, loop...

While the same board can run dhcp client without problem in Linux.

It turns out that the problem is on dhcp server: some dhcp servers will ignore too fast request.

I found this fix to u-boot:

Just put a short delay (50~100ms) between offer and request.

2012年2月24日 星期五

"route: SIOCDELRT: No such process"

"route: SIOCDELRT: No such process"

this message comes from "route del"

ref:
http://lists.busybox.net/pipermail/busybox/2010-December/074073.html

2012年2月20日 星期一

Invalid FAT entry (uboot)

Did you encounter

Invalid FAT entry

when using fatload or fatls command in uboot?
possibly the filesystem is corrupted (from the view of uboot).
For instance,

U-Boot > fatls mmc 0
2187544 uimage
Invalid FAT entry

1 file(s), 0 dir(s)

Try to format the partition to fat. (mkfs.vfat)
Copy origin files into it and try again.

2011年12月16日 星期五

2011年10月26日 星期三

get free memory size in kernel

Just paste this section to where you want to check:

{
#define K(x) ((x) << (PAGE_SHIFT - 10))
struct sysinfo si; \
si_meminfo(&si); \
printk("free=%lu k\n", K(si.freeram)); \
}

may need to include linux/mm.h

2011年6月26日 星期日

Use vim/cscope/ctags to navigate linux kernel

Install cscope:

sudo apt-get install cscope exuberant-ctags

Generate cscope and ctag file for x86:

##################################

#!/bin/bash
# File name: genctags.sh
# Usage: genctags.sh x86

LNX=.
ARCH=x86

if [ ! -z "$1" ];then
ARCH="$1"
fi

if [ "$2" != "tag" ];then

echo "Gen cscope file for $ARCH ..."
find $LNX \
-path "$LNX/arch/*" ! -path "$LNX/arch/$ARCH*" -prune -o \
-path "$LNX/include/asm-*" ! -path "$LNX/include/asm-$ARCH*" -prune -o \
-path "$LNX/tmp*" -prune -o \
-path "$LNX/Documentation*" -prune -o \
-path "$LNX/scripts*" -prune -o \
-path "$LNX/drivers*" -prune -o \
-name "*.[chxsS]" -print > cscope.files

cscope -b -q -k
fi

echo "Gen ctags file ($ARCH)..."

EXCLUDE_PATH=`find . -path "$LNX/arch/*" ! -path "$LNX/arch/$ARCH*" -prune`
EXCLUDE_PATH2=

for path in $EXCLUDE_PATH
do
EXCLUDE_PATH2="$EXCLUDE_PATH2 --exclude=$path"
done

ctags -R $EXCLUDE_PATH2

###############################################

For vim:


try it:
vim ./init/main.c

move the cursor to a symbol then...

ctrl + ] -- goto definition
[ + d -- show macro definition (if it is a macro)
ctrl + o -- goto previous position
ctrl + i -- goto next position
ctrl + \ s -- list usages
ctrl + shift + space -- list usages and pops a select to a new window (ctrl+w o to close)

search tag "main":
: ta main

search tags including "main":
:ta /main

search tags beginning with "main":
:ta /^main

Ref:

2011年6月9日 星期四