Embedded: 타겟보드 포팅(porting), zImage, 램디스크(Ramdisk)
VMware 5.5.0
우분투 8.10
<01> 방화벽 끄기
root@root-desktop:~# ufw disable
Firewall stopped and disabled on system startup
<02> bootp설치
이때 이더넷 아직은 custom이 아니다.
root@root-desktop:~# apt-get install bootp
꾸러미 목록을 읽는 중입니다...
완료의존성 트리를 만드는 중입니다상태 정보를 읽는 중입니다...
완료다음 새 꾸러미를 설치할 것입니다:
...
...
<03> boot관련 코드수정
root@root-desktop:~# vim /etc/xinetd.d/bootp
root@root-desktop:~# cat /etc/xinetd.d/bootp
service bootps
{
disable = no
socket_type = dgram
flags = REUSE NAMEI NARGS
protocol = udp
wait = yes
user = root
server = /usr/sbin/bootpd
server_args = -s
}
root@root-desktop:~# vim /etc/bootptab
root@root-desktop:~# cat /etc/bootptab
pxa255_pro:\
ht = 1:\
ha = 0x0123456789ab:\
ip = 192.168.1.40:\
sm = 255.255.255.0
<04> hpa설치
root@root-desktop:~# apt-get install tftpd-hpa tftp-hpa
꾸러미 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 꾸러미를 지울 것입니다:
tftp tftpd
다음 새 꾸러미를 설치할 것입니다:
tftp-hpa tftpd-hpa
0개 업그레이드, 2개 새로 설치, 2개 지우기 및 18개 업그레이드 안 함.
58.5k바이트 아카이브를 받아야 합니다.
이 작업 후 77.8k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]? y
<05> hpa관련 코드 수정
root@root-desktop:/# vim /etc/default/tftpd-hpa
root@root-desktop:/# cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /root/work/tftpboot" // -l: 단독실행, -s: 디렉토리지정
<06> 슈퍼데몬(xinetd)재시작
root@root-desktop:/# /usr/sbin/bootpd -s
root@root-desktop:/# service xinetd restart
* Stopping internet superserver xinetd [ OK ]
* Starting internet superserver xinetd [ OK ]
<07> hpa재시작
root@root-desktop:/# /etc/init.d/tftpd-hpa restart
<08> netstat확인
root@root-desktop:~# netstat -a | grep bootp
netstat -a | grep bootp
udp 0 0 *:bootpc *:*
<09> minicom
root@root-desktop:~# minicom
OPTIONS: I18n
Compiled on Dec 10 2007, 10:36:19.
Port /dev/ttyS0
Press CTRL-A Z for help on special keys
boot> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
*** invalid command
boot> set mac_addr
Newvalue : 01:23:45:67:89:ab
mac address is 01:23:45:67:89:ab
fusing mac_addr........00000008 (8) words from 0xa0407898 to 0x00040008
8 words source image
0 words written to flash
8 words skipped
0 erase operations
0 words scanned down
boot> set ip_addr
Newhostip : 192.168.1.100 //서버IP
Newtargetip : 192.168.1.40
host ip address is 192.168.1.100
target address is 192.168.1.40
fusing mac_addr........00000004 (4) words from 0xa0407894 to 0x00040030
Writing at 0x00040030
4 words source image
4 words written to flash
0 words skipped
0 erase operations
0 words scanned down
00000004 (4) words from 0xa04078a0 to 0x00040058
Writing at 0x00040058
4 words source image
3 words written to flash
1 words skipped
0 erase operations
0 words scanned down
* 이후에라도 확인을 하는 방법은 minicom내에서 명령어 'status'를 실행.
<10> 이더넷과 IP
* 이전까지 작업을 저장하고서 가상머신은 종료시킨다.
* 이더넷 설정을 'custom'으로 하고, 컴퓨터와 타겟보드를 랜선등으로 직접연결.
root@root-desktop:~# ifconfig eth0 192.168.1.100
root@root-desktop:/# /usr/sbin/bootpd -s
root@root-desktop:/# service xinetd restart
* Stopping internet superserver xinetd [ OK ]
* Starting internet superserver xinetd [ OK ]
<11> btp
root@root-desktop:~# minicom
boot> btp
<01> 램디스크이미지 준비
root@root-desktop:~# cd /usr/local/pxa255
root@root-desktop:~# gzip -d ramdisk.gz
<02> 램디스크 마운트
root@root-desktop:~# cd /root/work/test
root@root-desktop:~# umount /mnt/ramdisk
root@root-desktop:~# ifconfig eth0 192.168.1.100
root@root-desktop:/# /usr/sbin/bootpd -s
root@root-desktop:/# /etc/init.d/tftpd-hpa restart
Restarting HPA's tftpd: in.tftpd.
<04> minicom설정 <----------------------------------------- 가상머신을 재 시작할때마다 작업해야 한다.(2)
OPTIONS: I18n
Compiled on Dec 10 2007, 10:36:19.
Port /dev/ttyS0
Press CTRL-A Z for help on special keys
boot> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
*** invalid command
boot> set mac_addr
Newvalue : 01:23:45:67:89:ab
mac address is 01:23:45:67:89:ab
fusing mac_addr........00000008 (8) words from 0xa0407898 to 0x00040008
8 words source image
0 words written to flash
8 words skipped
0 erase operations
0 words scanned down
boot> set ip_addr
Newhostip : 192.168.1.100 //서버IP
Newtargetip : 192.168.1.40
host ip address is 192.168.1.100
target address is 192.168.1.40
fusing mac_addr........00000004 (4) words from 0xa0407894 to 0x00040030
Writing at 0x00040030
4 words source image
4 words written to flash
0 words skipped
0 erase operations
0 words scanned down
<05> btp
boot> btp
...
boot> erase 0x00280000 0x200000
...
boot> flash ramdisk
...
* 여기서 보드만 재시작하면, 미니컴도 같이 반응이 있는데 여기서 아무런 입력없이 기다른다.
참고로, 나중에 보드에서 하던 작업을 이어서 할떄는 환경값설정과 minicom설정후 보드만 재시작하면 된다.
* 로그인이 나올때까지 기다린다.
welcome to PXA255-Pro (armv5tel-Linux-2.4.19-huins@ttyS0/b)
Huins ramdisk 1.0 (glibc-2.2.5)
PXA255-Pro login: root
login[53]: root login on 'ttyS0'
...
...
# pwd
/root