포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 20MB 입니다.

예전 aesop에서 열심히 활동하던 후배의 글입니다.

자료를 찾아보니 있네요...^^,
그냥 참고하시기 바랍니다.
=========================================================
이 문서는 S3C2410 기반의 환경에서 아파치를 올린 문서입니다. 
제가 허접한지라 문서가 제맘대로나 딴지 걸지 마시고 그냥 참고하시기 바랍니다.ㅡㅡ;; 
                                                         - 2005. 3. 30. tssuk -


< How to Apache Cross Compile >

필자의 개발환경
OS : wowlinux 7.1
Kernel : 2.4.2
Machine : x.86

Target 환경
OS : linux 
Kernel : 2.4.18
Machine : arm (S3C2410)


#1.   Download apache file at www.apache.org
version apache_1.3.33


#2.  압축 해제
[root@wc02 utils]# tar xvfz apache_1.3.33.tar.gz 


#3. 압축 해제한 디렉토리를 하나 복사해 둔다.
[root@wc02 utils]# cp apache_1.3.33 host_apache_1.3.33 -a


#4. 복사한 아파치 디렉토리로 가서 우선 Host PC용으로 컴파일 해둔다.
    이유는 크로스 컴파일 도중에 필요한 파일들이 있기 때문이므로 
    gcc 컴파일러를 이용해 미리 컴파일 해 두는 것이다.

[root@wc02 utils]# cd host_apache_1.3.33/

[root@wc02 host_apache_1.3.33]# mkdir /usr/local/apache/

[root@wc02 host_apache_1.3.33]# ./configure --prefix=/usr/local/apache/

Configuring for Apache, Version 1.3.33
 + using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
 + configured for Linux platform
 + setting C compiler to gcc
 + setting C pre-processor to gcc -E
 + using "tr [a-z] [A-Z]" to uppercase
 + checking for system header files
 + adding selected modules
 + using system Expat
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/modules/standard
[root@wc02 host_apache_1.3.33]# 
[root@wc02 host_apache_1.3.33]# make 

/*여기까지 작업이 끝났으면 크로스 컴파일 할 아파치 디렉토리로 이동한다.
  Host PC에서 실제 make install해 실행해 본 결과 웹서버로 잘 동작했다.*/


#5.  환경 변수 설정 및 configure 화일 수정

[root@wc02 src]# export CC=arm-linux-gcc
[root@wc02 src]# export CPP=arm-linux-gcc
[root@wc02 src]# export LD=arm-linux-ld
[root@wc02 src]# export STRIP=arm-linux-strip
[root@wc02 src]# export OBJCOPY=arm-linux-objcopy

[root@wc02 apache_1.3.33]# vi configure 
##
##  determine platform id
##
## PLATFORM="`$aux/GuessOS`" <----------- 이 부분을 다음줄 처럼 수정한다.
PLATFORM=arm-whatever-riscix
/*이부분을 수정하는 이유는 설치될 환경을 arm으로 고정시키기 위해서이다.
  크로스 컴파일이므로 그냥 두면 i.*86계열로 host pc 환경이 저장된다.
  만일 arm계열이 아는 다른 cpu를 사용한다면 
  (Root_dir)/src/helpers/GuessOS 파일의 내용을 살펴보기 바란다. 내용중 
  해당 cpu에 대한 항목이 있으면 그 부분을 복사해서 PLATFORM을 교체한다.



#6.   설치 위치 설정 및 환경 설정
[root@wc02 apache_1.3.33]# ./configure --prefix=/usr/local/apache
Configuring for Apache, Version 1.3.33
 + using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
Creating Makefile in src
 + configured for Linux platform
 + setting C pre-processor to NOT-AVAILABLE
 + using "tr [a-z] [A-Z]" to uppercase
 + checking for system header files
 + adding selected modules
 + using builtin Expat
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/lib/expat-lite
Creating Makefile in src/modules/standard
[root@wc02 apache_1.3.33]# 


* 주의 : 실제 타겟 환경과 같은 경로상에 실행파일을 설치해야 한다..
그리고 위와 같이 실행했을때 크로스 컴파일이라는 환경 때문에 에러가 발생한다.
에러가 발생하는 이유는 환경에 필요한 파일을 생성중 컴파일러가 arm-linux-gcc
이므로 이기때문에 x.86환경의 호스트 PC에서 파일을 읽지 못하기 때문이다.
지금부터 문제를 하나씩 잡아 나간다.




#7. (Root_dir)/src/main 디렉토리로 이동한다.
make를 두번 하게되면 아래와 같은 두개의 파일이 생성된다.

[root@wc02 main]# make
/(Root_Dir)/src/main/gen_test_char

[root@wc02 main]# make
/(Root_Dir)/src/main/gen_uri_delims 

이 두개의 파일이 생성되면 #4번에서 Host PC용으로 make 해둔 곳으로 이동해
이 두개의 파일을 현재 생성된 파일과 교체한다.


#8.   Change compiled file at host pc
/(Root_Dir)/src/main/gen_test_char
/(Root_Dir)/src/main/gen_uri_delims 

[root@wc02 main]# cp ../../../host_apache_1.3.33/src/main/gen_test_char ./
[root@wc02 main]# cp ../../../host_apache_1.3.33/src/main/gen_uri_delims ./


#9.   make install
/*source의 /(Root_dir)로 이동해 make install을 실행한다.*/

[root@wc02 apache_1.3.33]# make install

Install message ................................

+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the         |
| (initially created or preserved) configuration files   |
|                                                        |
|   /usr/local/apache/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up     |
| Apache the first time by running:                      |
|                                                        |
|   /usr/local/apache/bin/apachectl start
|                                                        |
| Thanks for using Apache.       The Apache Group        |
|                                http://www.apache.org/  |
+--------------------------------------------------------+


#10.  Install check

정상적으로 인스톨 되었다고 위에서와 같은 메시지가 뜨면 
/usr/local/apache/ 로 이동해 해당 디렉토리들이 있는지 확인한다.
.
|-- bin
|-- cgi-bin
|-- conf
|-- htdocs
|   `-- manual
|       |-- howto
|       |-- images
|       |-- misc
|       |-- mod
|       |-- programs
|       `-- vhosts
|-- icons
|   `-- small
|-- include
|   `-- xml
|-- libexec
|-- logs
|-- man
|   |-- man1
|   `-- man8
`-- proxy


/* 주의 : apache/bin으로 이동해 file 명령으로 생성된 바이너리 파일이 
arm용인지 확인한다. 나의 경우 no machine로 생성되어 있었다. */

[root@wc02 bin]# file httpd
httpd: ELF 32-bit LSB executable, no machine, version 1, dynamically linked
(uses shared libs), stripped

/* 파일을 복사하는 과정에서 제대로 되지 않은 것 같다. 이 부분을 교체해준다.
   교체해주는 위치는 /(Root_Dir)/src/ 이다.
   이 위치에 가보면 httpd 파일이 존재한다. file httpd 명령으로 확인해 본다.*/

[root@wc02 src]# file httpd 
httpd: ELF 32-bit LSB executable, Advanced RISC Machines ARM, version 1,
dynamically linked (uses shared libs), not stripped

/* Arm 환경에서 동작할수 있는 형태의 httpd 화일이 존재한다.
   /user/local/apache/bin 안의 httpd 화일과 교체한다. */

[root@wc02 src]# cp httpd /usr/local/apache/bin/ 
cp: overwrite `/usr/local/apache/bin/httpd'? y



#11.   Copy to Ramdisk, Make Ramdisk Image

이제 모든 작업이 끝났다. /usr/local/apache 디렉토리를 ramdisk 이미지 아래 
같은 위치에 복사만 해주면 된다. ^^ 그전에 /htdocs/manual 디렉토리는 메뉴얼 
페이지 인데 파일 용량(4.8Mbyte)이 너무 많으므로 삭제해준다. 여기까지 하면
2.4Mbyte의 아파치 크로스 컴파일이 완료된 것이다. 이제부터는 필요없는 
모듈들을 제외 시키면서 최소의 아파치 실행환경을 만든다. ARM 기반의 보드라면
다른 환경에서도 잘 동작하리라 예상된다. ㅡㅡ;;

/* ./htdocs의 메뉴얼 페이지를 삭제한 경우에 설치 크기이다. 
  필요없는 라이브러리와 모듈들을 삭제하면 더 줄일 수 있을 것이다.*/
[root@wc02 apache]# du -h
889k    ./bin
21k     ./man/man1
41k     ./man/man8
62k     ./man
153k    ./conf
512     ./logs
262k    ./icons/small
899k    ./icons
512     ./proxy
512     ./libexec
8.5k    ./htdocs
73k     ./include/xml
370k    ./include
8.5k    ./cgi-bin
2.4M    .


# 12.  설치후 아파치 설버 실행 법

conf 디렉토리에 있는 httpd.conf 에서 다음 항목들을 찾아 아래와 같이 변경한다.
Port 80
User nobody
Group nobody
ServerName 211.238.159.112

ServerName는 현재 보드의 IP를 입력해 주면된다.

그리고 bin 디렉토리의 ./apachectl start 라고 하면 아파치가 시작된다.
이 방법 말고도 ./httpd start 하면 아파치가 동작된다.
아파치 데몬을 구동 중지 시키려면 ./apachectl stop 하면 된다.

"사람은 자기가 보고 싶은 현실만 볼 뿐이다." - Gaius Julius Caesar
엮인글 :
http://www.aesop.or.kr/index.php?mid=Board_Documents_Linux_Applications&document_srl=105575&act=trackback&key=b8e

은민아빠

2013.05.21 19:38:47
*.232.56.1

감사합니다.^^


고도리

2013.05.21 22:22:27
*.200.239.210

falinux site의 6410에 올리는 것을 어제 해 보려고 했는데.....셋업하려니 시간이 너무 걸려서

못해봤습니다.........ㅠ.ㅠ



은민아빠

2013.05.22 04:28:25
*.232.56.1

우선 Falinux site의 글을보고 하다가 제가 문의드린 문제가 발생되서

질문을 올렸었습니다.

우선 알려주신 자료와 이것저것 확인해가면서 다시 처음부터 해보도록 하겠습니다.

감사합니다.^^

List of Articles
번호 제목 글쓴이 날짜 조회 수sort
93 GIT 사용법 (ProGIT) - 1.4. GIT 설치 JhoonKim 2010-01-11 21208
92 GIT 사용법 (ProGIT) - 1.1. 버전 관리 시스템의 개념 file [6] JhoonKim 2010-01-07 19510
91 GIT 사용법 (ProGIT) - 2.1. GIT 저장소(Repository)의 취득 JhoonKim 2010-01-20 18362
90 Makefile 문법 [3] 김재훈 2009-07-25 17143
89 GIT 사용법 (ProGIT) - 1.5. 최초 GIT의 환경 설정 [3] JhoonKim 2010-01-13 16603
88 GIT 사용법 (ProGIT) - 2.5. 원격 저장소의 사용 방법 [2] JhoonKim 2010-02-04 16060
87 GIT 사용법 (ProGIT) - 2.2. GIT 저장소(Repository)에 기록 file [2] JhoonKim 2010-01-21 16033
86 리눅스 Linked-List 구현 관련 참고 자료 김재훈 2009-07-11 15459
85 GIT 사용법 (ProGIT) - 2.6. 태그(TAGS) 붙이기 [2] JhoonKim 2010-02-09 15136
84 GIT 사용법 (ProGIT) - 2.4. 작업의 취소 [1] JhoonKim 2010-02-03 15113
83 GIT 사용법 (ProGIT) - 1.2. GIT 개발 역사 / 1.3. GIT 기본 ... file [3] JhoonKim 2010-01-10 14794
82 리눅스에서 네트워크 속도 측정 방법 [3] 김재훈 2009-07-04 13608
81 ffmpeg encoding option 고현철 2009-10-01 13408
80 GIT 사용법 (ProGIT) - 2.3. 위탁 이력의 열람 file [1] JhoonKim 2010-02-03 13308
79 uBuntu 8.10 에서의 리눅스 개발 환경 설정 [6] 김재훈 2009-01-29 12618
78 Useful Linux Wireless Commands [1] 김재훈 2009-06-05 11966
77 I.MX Multimedia and Applications Framework 기술자료 ... file [2] 장석원 2009-10-26 11059
76 uBuntu Linux - dash를 bash로 변경하는 방법 김재훈 2009-04-28 10965
75 리눅스 어셈블리 프로그래밍을 하자! [2] : ARM 부트코드와 실전... file [2] 김재훈 2009-08-25 10596
74 oss를 이용한 read, write, read/write program file [2] 고도리 2011-01-25 10531

사용자 로그인