[완료] arm target에 ntp 설치하기

blhole의 이미지

처음에는 openwrt 기반 리눅스에서 사용하던 ntp-4.2.4p4을 가지고 시도했습니다.
ntp요청을 보내고 ntp 서버에서 응답을 받으면 ntpd가 죽습니다.
우선 더 최신버전(ntp-4.2.6p2)으로 바꾸어 봤습니다.

$ /usr/local/bin/ntpd -g -l /var/log/ntp.log
/usr/local/bin/ntpd: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory

libcap이라는 shared library가 없다고 하네요. 구글 열심히 찾아봤습니다. root가 아닌 다른 유저도 ntpd를 실행시키고자 할 때 필요한 library인 것 같아 과감히 --disable-linuxcaps 옵션을 이용해 이 놈을 뺐습니다.

./configure --host=arm-linux --prefix=/home1/ymkim/project/app/ntp-4.2.6p2/local --disable-all-clocks --disable-parse-clocks --enable-NMEA --enable-LOCAL-CLOCK --enable-SHM --disable-linuxcaps

그랬더니 4.2.4p4 버전과 같은 증상으로 프로세서가 죽더군요.
소스 따라가 봤습니다. main함수에서는 rbuf->receiver에서 죽더군요. callback 함수인데, $NTP_HOME/ntpd/ntp_io.c 에 rb->receiver = receive; 로 등록되고, $NTP_HOME/ntpd/ntp_proto.c 에 receive 함수이더군요.
결국 추적해 보면 fabs라는 수학함수 실행 중에 죽는데.. 이 놈은 꼼수로 넘어가도 다음에 sqrt, log등 수학함수가 나와서. 제가 어떻게 해 볼 수 없는 영역이더군요. libm 을 어떻게 해야 하는 건가? 어떻게 해야 할 지 모르겠습니다.

$ uname -a
Linux W5300E01-ARM 2.6.24.4 #22 PREEMPT Tue Nov 9 08:53:00 KST 2010 armv4tl unknown

결국 ntpclient 를 받아서 쓰고 있기는 한데.. 오기가 생기네요..

blhole의 이미지

글을 올리고 나서 좀더 찾아본 후 원인을 알게 되었습니다.
수학함수 자체의 문제가 아니라 floating point 연산이 들어간 것이 문제였습니다.
그리고 에러 메시지가 Illegal instruction으로 나오는 것도 중요한데 질문에는 그걸 빠뜨렸었고요..

http://www.informit.com/articles/article.aspx?p=1620207&seqNum=4 링크에 자세한 설명이 나옵니다.
FPU, EABI, VFP등의 용어를 설명해 줍니다.

아래 두 글도 저의 질문과 관련이 있는 것들이고요..
http://kldp.org/node/115720
http://kldp.org/node/108991

이제 원인을 알았으니 해결 방법을 찾아야겠죠?
구글링을 열심히 해서 "-msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4 -mtune=arm920t"을 gcc 의 옵션으로 넣어줘야 한다는 것을 알아냈죠? 하지만 다른 옵션은 괜찮은데 -msoft-float을 포함시키면 configure에서 오류를 내더군요.

[ymkim@localhost ntp-4.2.6p2]$ ./configure --host=arm-linux --prefix=/home1/ymkim/project/app/ntp-4.2.6p2/local --disable-all-clocks --disable-parse-clocks --enable-NMEA --enable-LOCAL-CLOCK --enable-SHM --enable-linuxcaps CFLAGS="$(CFLAGS) -march=armv4 -mtune=arm920t -msoft-float" 
-bash: CFLAGS: command not found
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... /bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... arm-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking for style of include used by make... GNU
checking for arm-linux-gcc... arm-linux-gcc
checking whether the C compiler works... no
configure: error: in `/home1/ymkim/project/app/ntp-4.2.6p2':
configure: error: C compiler cannot create executables
See `config.log' for more details.

그래서 조금 더 찾아봤더니 제 개발환경이 ELDK 4.0이었는데, 4.2에서 부터 "soft-float"를 지원하는 것을 알았습니다.
지금 4.2 다운 받고 있는데.. 해보고 다시 글 올리겠습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.