kscope는 KDE용 cscope의 GUI 프로그램이다.
솔찍히 대충써봐서인지 자세히는 모르겠지만
결과적으로 source insight를 대체하기에는 너무나 부족한 감이 든다.
물론 추적기능이라던가, 여러가지 있지만, 자동추적 기능이 없기 때문에 공백이 크게 느껴지는 것 같다.

아래는 kscope의 Project 메뉴이다.


Create Project를 하면 아래와 같은 dialog 창이 뜬다.

위에는 프로젝트의 이름( = 프로젝트 디렉토리의 이름)을 넣고
아래에는 프로젝트 디렉토리가 저장될 경로를 넣는다.
colinux portable ubuntu / ubuntu 9.04 에서 해봤는데,
/home이 아닌 곳에서는 아래와 같은 에러가 나므로, 되도록이면 $HOME(사용자 디렉토리) 에 생성하도록 한다.


프로젝트를 생성후, 소스 트리에서 소스파일들을 추가해준다.
Add/Remove files에 들어가면 아래와 같은 Dialog창으 뜨게 되고,
Add 에서 Directory 등을 이용해 파일을 추가한다. (이 부분은 source insight와 거의 유사하다)


만약에 *.c *.h 외에 다른 확장자가 필요하다면,
초기 프로젝트 생성시에 File Types에서 추가를 해주거나
Project 메뉴의 Project Properties에서 추가를 해주면 된다.


'프로그램 사용 > ctags & cscope' 카테고리의 다른 글

ctags 제약사항  (0) 2011.10.28
kscope 에서 특정 확장자 추가하기  (0) 2009.11.04
ctags format - CTAGS 출력 포맷/양식  (0) 2009.06.14
ctags  (0) 2009.01.07
Posted by 구차니
프로그램 사용/u-boot2009. 8. 19. 17:20
fw_printenv는 uboot에 포함된 tool이다
uboot/tool/env 에 존재하는 녀석인데
ethaddr을 값을 변경하려고 하니 에러가 발생하였다.

fw_setenv()의 리턴값은 30인데 아마도 EROFS가 30인듯 하다(errno.h에서는 발견하지 못한 변수이다.)
눈에 들어온 부분은 아래의 strcmp() 이다.
	/*
	 * Delete any existing definition
	 */
	if (oldval) {
		/*
		 * Ethernet Address and serial# can be set only once
		 */
		if ((strcmp (name, "ethaddr") == 0) ||
			(strcmp (name, "serial#") == 0)) {
			fprintf (stderr, "Can't overwrite \"%s\"\n", name);
			return (EROFS);
		}

		if (*++nxt == '\0') {
			*env = '\0';
		} else {
			for (;;) {
				*env = *nxt++;
				if ((*env == '\0') && (*nxt == '\0'))
					break;
				++env;
			}
		}
		*++env = '\0';
	}

아무튼, uboot에서 기본적으로 ethaddr과 serial#을 지원하고
이값들은, 한번만 write되고 수정되서는 안되기 때문에 제약사항으로 묶어놓은 듯 하다.
Posted by 구차니
프로그램 사용/u-boot2009. 8. 17. 18:34
busybox에서 라고 해야 하나,
아무튼, busybox의 경우에는 커널에서 부팅시에 ip를 설정한다.

TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
stmmaceth_open: MAC address 00:fa:e0:fa:e0:59
stmmac_init_phy: phy_id=0:03, phy_addr=0x3
IP-Config: Complete:
      device=eth0, addr=192.168.10.116, mask=255.255.255.0, gw=192.168.10.1,
     host=hmp_7109, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=192.168.10.10, rootpath=
Looking up port of RPC 100003/2 on 192.168.10.10
PHY: 0:03 - Link is Up - 100/Full
Looking up port of RPC 100005/1 on 192.168.10.10
VFS: Mounted root (nfs filesystem) readonly.
Freeing unused kernel memory: 100k freed
  Vendor: AXXEN     Model: SKYMIRROR         Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
SCSI device sda: 4016128 512-byte hdwr sectors (2056 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
SCSI device sda: 4016128 512-byte hdwr sectors (2056 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: Attached scsi removable disk sda
Welcome to STLinux BusyBox system

머.. 이건 중요한게 아니고, 아무튼, ifdown을 통해서 죽이고
ifup을 통해서 올리려고 하는데, ifup시 static ip가 설정이 되지 않고
초기 kernel argument로 넘긴 값으로 부팅이 되는 문제가 있다.

검색을 해보니

Re: ETH0 already configured durring boot
The U-boot uses its own network driver and only the MAC address set up by the U-boot affects the network driver under Linux.

The network is started by the script /etc/init.d/networking in Debian/Emdebian distribution.  The soft links are used in each run level start up directories /etc/rcX.d, where X is run level 0, 1, 2, etc.  The normal run level is 3.  You can remove the link in the directory to disable the network start up.

The text file /etc/network/interfaces configures the network interfaces.  It should be something like,

auto eth0
iface eth0 inet dhcp

You can also just remove everything in this file to disable the automatic start up of the network.

[링크 : http://glomation.net/smf/index.php?topic=111.0]

라고 되어있는데, 일단 커널레벨에서 설정하는 것과는 별개의 문제이다.

# cat /etc/network/interfaces
######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
#
# A "#" character in the very first column makes the rest of the line
# be ignored. Blank lines are ignored. Lines may be indented freely.
# A "\" character at the very end of the line indicates the next line
# should be treated as a continuation of the current one.
#
# The "pre-up", "up", "down" and "post-down" options are valid for all
# interfaces, and may be specified multiple times. All other options
# may only be specified once.
#
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################

# We always want the loopback interface.
#
# auto lo
# iface lo inet loopback

# An example ethernet card setup: (broadcast and gateway are optional)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.0.42
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1

# A more complicated ethernet setup, with a less common netmask, and a downright
# weird broadcast address: (the "up" lines are executed verbatim when the
# interface is brought up, the "down" lines when it's brought down)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.1.42
#     network 192.168.1.0
#     netmask 255.255.255.128
#     broadcast 192.168.1.0
#     up route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2
#     up route add default gw 192.168.1.200
#     down route del default gw 192.168.1.200
#     down route del -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2

# A more complicated ethernet setup with a single ethernet card with
# two interfaces.
# Note: This happens to work since ifconfig handles it that way, not because
# ifup/down handles the ':' any differently.
# Warning: There is a known bug if you do this, since the state will not
# be properly defined if you try to 'ifdown eth0' when both interfaces
# are up. The ifconfig program will not remove eth0 but it will be
# removed from the interfaces state so you will see it up until you execute:
# 'ifdown eth0:1 ; ifup eth0; ifdown eth0'
# BTW, this is "bug" #193679 (it's not really a bug, it's more of a
# limitation)
#
# auto eth0 eth0:1
# iface eth0 inet static
#     address 192.168.0.100
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1
# iface eth0:1 inet static
#     address 192.168.0.200
#     network 192.168.0.0
#     netmask 255.255.255.0

# "pre-up" and "post-down" commands are also available. In addition, the
# exit status of these commands are checked, and if any fail, configuration
# (or deconfiguration) is aborted. So:
#
# auto eth0
# iface eth0 inet dhcp
#     pre-up [ -f /etc/network/local-network-ok ]
#
# will allow you to only have eth0 brought up when the file
# /etc/network/local-network-ok exists.

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet. If their MAC addresses get swapped (because an
# updated kernel uses a different order when probing for network cards,
# say), then they don't get brought up at all.
#
# auto eth0 eth1
# iface eth0 inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /path/to/check-mac-address.sh eth0 11:22:33:44:55:66
#     pre-up /usr/local/sbin/enable-masq
# iface eth1 inet dhcp
#     pre-up /path/to/check-mac-address.sh eth1 AA:BB:CC:DD:EE:FF
#     pre-up /usr/local/sbin/firewall

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet, identified by MAC address rather than interface
# name:
#
# auto eth0 eth1
# mapping eth0 eth1
#     script /path/to/get-mac-address.sh
#     map 11:22:33:44:55:66 lan
#     map AA:BB:CC:DD:EE:FF internet
# iface lan inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /usr/local/sbin/enable-masq $IFACE
# iface internet inet dhcp
#     pre-up /usr/local/sbin/firewall $IFACE

# A PCMCIA interface for a laptop that is used in different locations:
# (note the lack of an "auto" line for any of these)
#
# mapping eth0
#    script /path/to/pcmcia-compat.sh
#    map home,*,*,*                  home
#    map work,*,*,00:11:22:33:44:55  work-wireless
#    map work,*,*,01:12:23:34:45:50  work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note, this won't work unless you specifically change the file
# /etc/pcmcia/network to look more like:
#
#     if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
#     get_info $DEVICE
#     case "$ACTION" in
#         'start')
#             /sbin/ifup $DEVICE
#             ;;
#         'stop')
#             /sbin/ifdown $DEVICE
#             ;;
#     esac
#     exit 0

# An alternate way of doing the same thing: (in this case identifying
# where the laptop is is done by configuring the interface as various
# options, and seeing if a computer that is known to be on each particular
# network will respond to pings. The various numbers here need to be chosen
# with a great deal of care.)
#
# mapping eth0
#    script /path/to/ping-places.sh
#    map 192.168.42.254/24 192.168.42.1 home
#    map 10.15.43.254/24 10.15.43.1 work-wireless
#    map 10.15.43.23/24 10.15.43.1 work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note that the ping-places script requires the iproute package installed,
# and the same changes to /etc/pcmcia/network are required for this as for
# the previous example.


# Set up an interface to read all the traffic on the network. This
# configuration can be useful to setup Network Intrusion Detection
# sensors in 'stealth'-type configuration. This prevents the NIDS
# system to be a direct target in a hostile network since they have
# no IP address on the network. Notice, however, that there have been
# known bugs over time in sensors part of NIDS (for example see
# DSA-297 related to Snort) and remote buffer overflows might even be
# triggered by network packet processing.
#
# auto eth0
# iface eth0 inet manual
#     up ifconfig $IFACE 0.0.0.0 up
#       up ip link set $IFACE promisc on
#       down ip link set $IFACE promisc off
#       down ifconfig $IFACE down

# Set up an interface which will not be allocated an IP address by
# ifupdown but will be configured through external programs. This
# can be useful to setup interfaces configured through other programs,
# like, for example, PPPOE scripts.
#
# auto eth0
# iface eth0 inet manual
#       up ifconfig $IFACE 0.0.0.0 up
#       up /usr/local/bin/myconfigscript
#       down ifconfig $IFACE down

/etc/network/interfaces는 ifup / ifdown 에서 사용하는 내용으로 저러면 된다는데...
결국 미궁이다.. 후우...

[링크 : http://www.annodex.net/cgi-bin/man/man2html?interfaces]
[링크 : http://www.annodex.net/cgi-bin/man/man2html?8+ifup]
[링크 : http://www.annodex.net/cgi-bin/man/man2html?8+ifdown]


Posted by 구차니
어쩌면 당연한걸지도 모르겠지만..
리눅스와 윈도우의 개행은 CR+LF / LF로 차이가 크다.

vi에서 보면
CR+LF는 ^M이 붙는데,
이로 인해서 쉘에서 인식을 제대로 못하고
실행을 못하는 문제가 생긴다.


bash에서는 문제가 없었던거 같은데.. 흐음..
아무튼 busybox에서 사용하는 ash의 경우에는 CR+LF의 경우에는
제대로 안되니 반드시 확인을 해야한다.


(이걸로 일주일 공쳤네 ㄱ-)
Posted by 구차니
제목이랑은 조금 심하게 다르지만..

busybox-1.10.1/networking/ping.c 의 소스를 보면
enum {
    DEFDATALEN = 56,
    MAXIPLEN = 60,
    MAXICMPLEN = 76,
    MAXPACKET = 65468,
    MAX_DUP_CHK = (8 * 128),
    MAXWAIT = 10,
    PINGINTERVAL = 1, /* 1 second */
};

라는 부분에 timeout 10초와 핑간격 1초가 정의되어 있다.
어짜피 alarm() 함수가 integer 만 받아서 소수점은 무리이므로
ping -c 를 이용하여 빠르게 핑 테스트는 힘들듯 하다.

다른 방법으로 접근을 하자면,
ping -c 1 ... ; ping -c 1 ...
이런식의 명령행으로 할 경우 1초 간격없이 빠르게 핑을 연속으로 보낼 수 있다.
Posted by 구차니
프로그램 사용2009. 8. 3. 19:18
머.. libjpeg가 그랬듯이 libpng도 별 건 없다.

$ more INSTALL
Installing libpng version 1.2.38 - July 16, 2009

On Unix/Linux and similar systems, you can simply type
    ./configure [--prefix=/path]
    make check
    make install
and ignore the rest of this document.

$ ./configure --host=sh4-linux
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for sh4-linux-strip... sh4-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for sh4-linux-gcc... sh4-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether sh4-linux-gcc accepts -g... yes
checking for sh4-linux-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of sh4-linux-gcc... gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... sh4-unknown-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by sh4-linux-gcc... /opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld
checking if the linker (/opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld) is GNU ld... yes
checking how to run the C preprocessor... sh4-linux-gcc -E
checking for sh4-linux-sed... /bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for BSD- or MS-compatible name lister (nm)... /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B
checking the name lister (/opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B) interface... BSD nm
checking the maximum length of command line arguments... 98304
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld option to reload object files... -r
checking for sh4-linux-objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for sh4-linux-ar... sh4-linux-ar
checking for sh4-linux-strip... (cached) sh4-linux-strip
checking for sh4-linux-ranlib... sh4-linux-ranlib
checking command to parse /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B output from sh4-linux-gcc object... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if sh4-linux-gcc supports -fno-rtti -fno-exceptions... no
checking for sh4-linux-gcc option to produce PIC... -fPIC -DPIC
checking if sh4-linux-gcc PIC flag -fPIC -DPIC works... yes
checking if sh4-linux-gcc static flag -static works... yes
checking if sh4-linux-gcc supports -c -o file.o... yes
checking if sh4-linux-gcc supports -c -o file.o... (cached) yes
checking whether the sh4-linux-gcc linker (/opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ANSI C header files... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for working strtod... no
checking for pow... no
checking for pow in -lm... yes
checking for memset... yes
checking for pow... (cached) no
checking for pow in -lm... (cached) yes
checking for zlibVersion in -lz... yes
checking if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE... yes
checking if libraries can be versioned... yes
checking for symbol prefix...
configure: pkgconfig directory is ${libdir}/pkgconfig
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpng.pc
config.status: creating libpng-config
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

물론 크로스 컴파일이므로
make check는 "cannot execute binary file" 메시지를 출력하면서 중단된다.
Posted by 구차니
sed '/s/replace old/replace new/'
스트림이니까, 파이프로 연결해도 당연히(?!) 된다.

[링크 : http://www.grymoire.com/Unix/Sed.html]
Posted by 구차니
awk의 가장 유용한 사용방법은
awk '{print $1}' 가 아닐까 생각이 된다.
일단 1번부터 시작하여 n 번째의 문자열을 출력해주며
문자열은 공백으로 구분한다.

예를 들어
/proc/cmdline의 경우
$ cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet

인데 awk를 사용할 경우
$ cat /proc/cmdline | awk '{print $1}'
ro
$ cat /proc/cmdline | awk '{print $2}'
root=/dev/VolGroup00/LogVol00
$ cat /proc/cmdline | awk '{print $3}'
rhgb
$ cat /proc/cmdline | awk '{print $4}'
quiet
$ cat /proc/cmdline | awk '{print $5}'

이런식으로 구분을 하여 옵션별로 떼어낼 수 있다.


$ cat /proc/cmdline | awk '{print NF}'
4
NF는 내부 변수로 컬럼의 갯수를 알려준다.


[링크 : http://www.grymoire.com/Unix/]
Posted by 구차니
프로그램 사용/busybox2009. 7. 30. 17:24

#!/bin/sh

/bin/run-parts --arg=$1 /etc/udhcpc.d

[링크 : http://www.doit.org/udhcpc/udhcpc.script]

#!/bin/sh
# /etc/init.d/udhcpc: start or stop udhcpc client

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/sbin/udhcpc

test -x $DAEMON || exit 0

case "$1" in
  start)
    echo -n "Starting DHCP client: udhcpc"
    start-stop-daemon --start --quiet --exec $DAEMON \
      -- --script=/etc/udhcpc.script || echo -n " already running"
    echo "."
  ;;

  restart)
    /etc/init.d/udhcpc stop
    /etc/init.d/udhcpc start
  ;;

  reload)
  ;;

  force-reload)
  ;;

  stop)
    echo -n "Stopping DHCP client: udhcpc"
    start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " not running"
    echo "."
  ;;

  renew)
    start-stop-daemon --signal USR1 --stop --quiet --exec $DAEMON || echo -n " not running"
  ;;

  release)
    start-stop-daemon --signal USR2 --stop --quiet --exec $DAEMON || echo -n " not running"
  ;;

  *)
    echo "Usage: /etc/init.d/udhcpc {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0

[링크 : http://www.doit.org/udhcpc/udhcpc]

[링크 : http://www.doit.org/udhcpc/]
Posted by 구차니
프로그램 사용/busybox2009. 7. 30. 13:16
menu 'Build Options'

config CONFIG_STATIC
    bool "Build BusyBox as a static binary (no shared libs)"
    default n
    help
      If you want to build a static BusyBox binary, which does not
      use or require any shared libraries, then enable this option.
      This can cause BusyBox to be considerably larger, so you should
      leave this option false unless you have a good reason (i.e.
      your target platform does not support shared libraries, or
      you are building an initrd which doesn't need anything but
      BusyBox, etc).

      Most people will leave this set to 'N'.

[링크 : http://stablebox.googlecode.com/svn/trunk/Config.in]

비지박스를 컴파일 하면, 용량이 생각보다 크다.
이 경우에는 위의 옵션을 꺼주면 컴팩트해진다.

1.10.4 기준으로 1.6M에서 600K 정도로 용량이 줄어드는데,
확신할 수는 없지만, 이 옵션을 사용했기 때문에 DNS resolv를 하지 못하는 것 같다.
busybox에서 ping이나 telnet 이 resolv 실패가 뜨면

libresolv.so
libdns.so

를 복사 해주면 되는데, 이 옵션의 영향이 아닐까 생각이된다.
Posted by 구차니