2010年11月29日

gcc : error: dereferencing pointer to incomplete type

Issue:
drivers/i2c/i2c-dev.c:637: error: dereferencing pointer to incomplete type

Solution:
Add header file of struct prototype.

2010年9月24日

Improve DDOS, TIME_WAIT and CLOSE_WAIT issue

net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_timestamps=0
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_keepalive_intvl=15
net.ipv4.tcp_keepalive_probes=5
net.ipv4.tcp_synack_retries=3
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_max_syn_backlog=2048
net.ipv4.ip_local_port_range=5000 65000

Query status:
netstat -nat|awk '{print awk $NF}'|sort|uniq -c|sort -n

2010年9月15日

awk: Illegal instruction

Issue:
#> awk '{print $5}'
Illegal instruction

Solution:
Enable Float-Point Emulation from Kernel menuconfig.
[*] NWFPE math emulation

2010年9月10日

warning: deprecated conversion from string constant to 'char*'

Issue:
warning: deprecated conversion from string constant to 'char*'
warning: deprecated conversion from string constant to 'char*'
warning: deprecated conversion from string constant to 'char*'

Solution:
Happens on compiling with gcc v4.3.3.
Change [char *] to [const char *].

2010年9月3日

configure: error: cannot determine linux version when cross-compiling

Issue:
checking whether to build optimizer debugging code... no
checking whether to build parser debugging code... no
checking Linux kernel version... unknown
configure: error: cannot determine linux version when cross-compiling

Solution:
Directly edit "configure" file, and add a new line:
linux)
ac_cv_linux_vers=2
echo "$as_me:$LINENO: checking Linux kernel version" >&5
echo $ECHO_N "checking Linux kernel version... $ECHO_C" >&6

This is a work-around, actually I don't like that.

sysctl.h:41: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token

Issue:
In file included from ./include/sys/sysctl.h:44,
from libc/sysdeps/linux/arm/ioperm.c:46:
sysctl.h:41: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token
make[4]: *** [libc/sysdeps/linux/arm/ioperm.os] Error 1

Solution:
Directly edit sysctl.h from
struct __sysctl_args {
int __user *name;
int nlen;
void __user *oldval;
size_t __user *oldlenp;
void __user *newval;
size_t newlen;
unsigned long __unused[4];
};
to
struct __sysctl_args {
int __attribute__((noderef, address_space(1))) *name;
int nlen;
void __attribute__((noderef, address_space(1))) *oldval;
size_t __attribute__((noderef, address_space(1))) *oldlenp;
void __attribute__((noderef, address_space(1))) *newval;
size_t newlen;
unsigned long __unused[4];
};

Failed in compiling busybox

Issue:
LINK busybox_unstripped
modutils/lib.a(insmod.o): In function `insmod_main':
insmod.c:(.text.insmod_main+0x390): undefined reference to `query_module'
insmod.c:(.text.insmod_main+0x3c4): undefined reference to `query_module'
insmod.c:(.text.insmod_main+0x474): undefined reference to `query_module'
insmod.c:(.text.insmod_main+0x4c4): undefined reference to `query_module'
insmod.c:(.text.insmod_main+0x598): undefined reference to `query_module'
insmod.c:(.text.insmod_main+0xbe0): undefined reference to `create_module'
collect2: ld returned 1 exit status
make[4]: *** [busybox_unstripped] Error 1

Solution:
Uncheck [ ] Support version 2.2.x to 2.4.x Linux kernels
or
# CONFIG_FEATURE_2_4_MODULES is not set

2010年5月25日

Windows XP hangs at loading agp440.sys!?

1. Remove all USB devices except of mouse and keyboards, you can disable USB ports from BIOS as well. (Or yank out USB device when the boot is stopping at loading agp440.sys!?)
2. Trying to boot into Safe Mode.
3. Execute "chkdsk /R" and then reboot.
4. Windows will do disk check and recovery your system.
5. Done.

Reference: http://marc-bourassa.com/2005/04/24/agp440sys-and-dead-xp-system

Or

In my case, everything works fine after I remove CD-ROM drive.

2010年4月16日

Add persistent static routing rule into Windows.


C:\> route -p add 10.10.10.0 mask 255.255.255.0 192.168.1.1 metric 1

This writes the persistent route to the following Windows Registry key as a string value (REG_SZ):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes

From: http://www.itsyourip.com/networking/howto-add-persistent-static-routes-in-windows/

2010年4月7日

Coresump Analysis (arm-linux-uclibc-gdb)

[root@porter tmp]# arm-linux-uclibc-gdb /tftpboot/web_httpd
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i386-redhat-linux --target=arm-linux-uclibc"...
(gdb) set solib-search-path /tmp/libs
(gdb) core-file /tftpboot/coredump
warning: exec file is newer than core file.
warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?)
warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
Reading symbols from /tmp/libs/libm.so.0...done.
Loaded symbols for /tmp/libs/libm.so.0
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /tmp/libs/libssl.so.0.9.8...done.
Loaded symbols for /tmp/libs/libssl.so.0.9.8
Reading symbols from /tmp/libs/libcrypto.so.0.9.8...done.
Loaded symbols for /tmp/libs/libcrypto.so.0.9.8
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /tmp/libs/libc.so.0...done.
Loaded symbols for /tmp/libs/libc.so.0
Reading symbols from /tmp/libs/librt.so.0...done.
Loaded symbols for /tmp/libs/librt.so.0
Reading symbols from /tmp/libs/libdl.so.0...done.
Loaded symbols for /tmp/libs/libdl.so.0
Reading symbols from /tmp/libs/ld-uClibc.so.0...done.
Loaded symbols for /tmp/libs/ld-uClibc.so.0
Core was generated by `web_httpd -h /web'.
Program terminated with signal 11, Segmentation fault.
[New process 1555]
[New process 1554]
[New process 1528]
#0 0x40210444 in select () from /tmp/libs/libc.so.0
(gdb) where
#0 0x40210444 in select () from /tmp/libs/libc.so.0
#1 0x40012358 in sys_wait_for_event_msg (n=15, readfds=0x81c0, writefds=0x0,
exceptfds=0x0, timeout=0x0, msg=0x0) at libsys.c:2665
#2 0x00012cec in web_mgr_mainloop () at web_mgr.c:336
#3 0x40081394 in ?? ()
Backtrace stopped: frame did not save the PC
(gdb)

2010年4月1日

SVN access rule

[groups]
sdk-developer = man1
sdk2-developer = man2
everyone = man1, man2, man3, man4

[MyRepo:/private]
@everyone = r

[MyRepo:/private/sdk]
@sdk-developer = rw
@sdk2-developer = r
@everyone =

Note: man3 and man4 can't access /private/sdk due to the limitation of last rule "@everyone =".
If the last rule is missed, for people not included in the list will use the rule which inherited from parent directory, then they will have "r" permission and be able to access /private/sdk.

2010年1月14日

Trigger CoreDump under Linux

Enable core dumps:
#> ulimit -c unlimited

Force a core dump with following signals:

SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating point exception
SIGSEGV 11 Core Invalid memory reference