노력과 삽질 퇴적물
Embedded: boa 본문
root@desktop:/usr/local# ls
arm-linux boa-0.94.12.tar.gz games info man sbin src
bin etc include lib pxa255 share
root@desktop:/usr/local# tar xvfz boa-0.94.13.tar.gz
root@desktop:/usr/local/boa-0.94.13/src# vim Makefile
...
CC = arm-linux-gcc
CPP = arm-linux-gcc
...
root@desktop:/usr/local/boa-0.94.13/src# vim defines.h
...(:set nu COMMAND)
27 /***** Change this, or use -c on the command line to specify it *****/
28
29 #ifndef SERVER_ROOT
30 #define SERVER_ROOT "/usr/local/boa"
31 #endif
...
root@desktop:/usr/local/boa-0.94.13/src# vim compat.h
...(:set nu COMMAND)
119 #ifdef HAVE_TM_GMTOFF
120 #define TIMEZONE_OFFSET(foo) foo->tm_gmtoff
...
root@desktop:/usr/local/boa-0.94.13/src# ac_cv_func_setvbuf_reversed=no CC=arm-linux-gcc ./configure --target=arm-linux
loading cache ./config.cache
checking for gunzip... (cached) /bin/gunzip
checking for flex... (cached) flex
checking for yywrap in -lfl... (cached) yes
checking for bison... (cached) bison -y
checking for gcc... (cached) gcc
...
...
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h
root@desktop:/usr/local/boa-0.94.13/src# make
yacc -d boa_grammar.y
make: yacc: 명령을 찾지 못했음
make: *** [y.tab.c] 오류 127
root@desktop:/usr/local/boa-0.94.13/src# apt-get install flex
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 꾸러미를 더 설치할 것입니다:
m4
제안하는 꾸러미:
bison
다음 새 꾸러미를 설치할 것입니다:
flex m4
0개 업그레이드, 2개 새로 설치, 0개 지우기 및 18개 업그레이드 안 함.
446k바이트 아카이브를 받아야 합니다.
이 작업 후 1491k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]? y
...
...
root@desktop:/usr/local/boa-0.94.13/src# apt-get install bison
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
제안하는 꾸러미:
bison-doc
다음 새 꾸러미를 설치할 것입니다:
bison
...
...
root@desktop:/usr/local/boa-0.94.13/src# make
yacc -d boa_grammar.y
arm-linux-gcc -g -O2 -pipe -Wall -I. -c -o y.tab.o y.tab.c
y.tab.c: In function `yyparse':
...
...
arm-linux-gcc -g -O2 -pipe -Wall -I. -c -o util.o util.c
arm-linux-gcc -o boa y.tab.o lex.yy.o alias.o boa.o buffer.o cgi.o cgi_header.o config.o escape.o get.o hash.o ip.o log.o mmap_cache.o pipe.o queue.o read.o request.o response.o select.o signals.o util.o sublog.o timestamp.o -g
arm-linux-gcc -o boa_indexer index_dir.o escape.o -g
root@desktop:/usr/local/boa-0.94.13/src# cd ..
root@desktop:/usr/local/boa-0.94.13# ls
CREDITS Gnu_License boa.conf docs extras
ChangeLog README contrib examples src
root@desktop:/usr/local/boa-0.94.13# vim /usr/local/boa-0.94.13/boa.conf
# Boa v0.94 configuration file
Port 80
User nobody
Group nobody
ErrorLog /usr/local/boa/log
AccessLog /usr/local/boa/log
ServerName 192.168.1.32
DocumentRoot /usr/local/boa
UserDir public_html
DirectoryIndex /usr/local/boa/index.html
DirectoryMaker /usr/bin/boa_indexer
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
CGIPath /bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
AddType application/x-httpd-cgi cgi
Alias /doc /usr/doc
ScriptAlias /cgi-bin/ /usr/local/boa/cgi-bin/
root@desktop:~# cp /usr/local/boa-0.94.13/src/boa /root/work/nfsboot/boa/boa
root@desktop:~# cp /usr/local/boa-0.94.13/boa.conf /root/work/nfsboot/boa/boa.conf
root@desktop:~# cp /usr/local/boa-0.94.13/src/boa_indexer /root/work/nfsboot/boa/boa_indexer
root@desktop:~# cp /etc/mime.types /root/work/nfsboot/boa/mime.typespes
root@desktop:~# ufw disable
root@desktop:~# ifconfig eth0 192.168.1.100
root@desktop:~# /usr/sbin/bootpd -s
root@desktop:~# /etc/init.d/tftpd-hpa restart
root@desktop:~# /etc/init.d/xinetd restart
root@desktop:~# minicom
set ip_addr → Server IP는 192.168.1.100, Target IP 192.168.1.40
set mac_addr → 01:23:45:67:89:ab
BOARD REBOOT
PXA255-Pro login: root
login[53]: root login on `ttyS0'
# pwd
/usr/local
# ls
arm-linux boa
# mv /usr/local/boa /usr/local/boa_old
# mkdir /usr/local/boa
# mkdir /usr/local/boa/cgi-bin
# cp /usr/local/boa_old/cgi-bin/led.cgi /usr/local/boa/cgi-bin
# vi /usr/local/boa/log
# vi /usr/local/boa/index.html
<html>
<body>
<h1>
test: analog-green MTG
</h1>
</body>
</html>
# mount -t nfs 192.168.1.100:/root/work/nfsboot/ /mnt
# cp /mnt/boa/boa /usr/sbin/boa
# cp /mnt/boa/boa.conf /usr/local/boa/boa.conf
# cp /mnt/boa/index.html /usr/local/boa/index.html
# cp /mnt/boa/mime.types /etc/mime.types
# cp /mnt/boa/boa_indexer /usr/bin/boa_indexer
# cd /usr/sbin
# chmod a+x /usr/sbin/boa
# chmod a+x /usr/local/boa/index.html
# ps -e | grep boa
# kill 42
# cd /usr/sbin
# vi /etc/init.d/rc.sysinit
# boa start
/bin/echo "boa web server start.. with cgi.."
/usr/sbin/boa -c /usr/local/boa
# ./boa -c /usr/local/boa
# ps -e OR # ps aux
http://192.168.1.32/index.html
<<<index.html>>>
<html>
<head>
<title> LED 제어</title>
</head>
<frameset border="0" row = "20%, 60%, 20%">
<frame name = "frame1" src = "top.html">
<frame name = "frame2" src = "body.html">
<frame name = "frame3" src = "bottom.html">
</frameset>
</html>
<<<top.html>>>
<html>
<body>
<form method = "GET" action = "cgi-bin/led.cgi">
<table boarder = "1" align="CENTER">
<tr><td><td bgcolor="BLUE">
<font color="WHITE" face="ARIAL"><b>LED</b></font>
</tr>
<tr>
<td> <input type="RADIO" name="n" value="1"> 1
<td> <input type="RADIO" name="n" value="2"> 2
<td> <input type="RADIO" name="n" value="3"> 3
</tr>
<tr>
<td> <input type="RADIO" name="n" value="4"> 4
<td> <input type="RADIO" name="n" value="5"> 5
<td> <input type="RADIO" name="n" value="6"> 6
</tr>
<tr>
<td> <input type="RADIO" name="n" value="7"> 7
<td> <input type="RADIO" name="n" value="8"> 8
<td> <input type="RADIO" name="n" value="9"> 9
</tr>
</table>
<br>
<center>
<input type="submit" value="submit">
</form>
</body>
</html>
<<<bottom.html>>>
<html>
<body>
<center>
analog-green MTG
</body>
</html>
<<<led.c>>>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <signal.h>
#define ADDRESS_LED 0x0C000000
#define GPLR0 0x40E00000
#define GPCR2 0x40E00020//LED_OFF
#define GPSR3 0x40E0002C//LED ON
typedef struct
{
char name[128];
char val[128];
}entry;
void getword(char *word, char *line, char stop)
{
int x =0, y = 0;
for (x=0; ((line[x]) && (line[x] != stop)); x++)
word[x] = line[x];
word[x] = '\0';
if (line[x])
++x;
while(line[y++] = line[x++]);
}
void lightLed(unsigned short val)
{
int mem_fd;
int i;
unsigned int *addr_led, *test;
if( (mem_fd=open("/dev/mem", O_RDWR|O_SYNC)) < 0 )
{
printf("mem open FAIL!(mem_fd = %d)\n", mem_fd);
exit(1);
}
addr_led = (unsigned int *) mmap(0, 0x100, (PROT_READ|PROT_WRITE), MAP_SHARED, mem_fd, GPLR0);
*(addr_led+4) &= ~(1<<0);
*(addr_led+5) |= (1<<19) | (1<<18);
if (val == 2)
{
*(addr_led+8) |= (1<<18) | (1<<19);
printf("<br><br><br><br>LED_OFF");
}
if (val == 1)
{
*(addr_led+11) |= (1<<18) | (1<<19);
printf("<br><br><br><br>LED_ON");
}
usleep(100000);
close(mem_fd);
}
int main()
{
char *cl;
unsigned short val;
entry entries;
puts("CONTENT-type: test/html\n");
cl = (char *)getenv("QUERY_STRING");
getword(entries.name, cl, '=');
getword(entries.val, cl, '&');
val = (unsigned short)strtol(entries.val, NULL, 16);
if(val == 0)
{
if (!((entries.val[0] == '0' && entries.val[1] == '\0') ||
(entries.val[0] == '0' && entries.val[1] == '0')))
{
printf("<p>wrong VALUE!");
return 0;
}
}
lightLed(val);
return 0;
}
arm-linux-gcc -o led.cgi led.c
chmod 4755 led.cgi
# mkdir /mnt/boa/cgi-bin
# chmod 777 /mnt/boa/cgi-bin
# cp /mnt/boa/cgi-bin/led.cgi /usr/local/boa/cgi-bin
# chmod 4755 /usr/local/boa/cgi-bin/led.cgi
# cp /mnt/boa/top.html /usr/local/boa/top.html
# cp /mnt/boa/index.html /usr/local/boa/index.html
# cp /mnt/boa/bottom.html /usr/local/boa/bottom.html
# chmod a+x /usr/local/boa/index.html
# ./boa -c /usr/local/boa
http://192.168.1.32/index.html
'📂기초 및 세팅 note > 미분류.' 카테고리의 다른 글
어셈블리 기초 PDF (0) | 2015.11.18 |
---|---|
링크: 무료 강좌 사이트 모음. (1) | 2014.06.28 |
프로그래밍 및 각종 게임개발파트 관련자료 (0) | 2011.10.27 |
분산시스템 관련 링크 (0) | 2011.09.21 |
Adam and Jamie explain parallel processing on GPU's (0) | 2011.05.22 |