1. 가장먼저 boot loader를 보드에 전달한다. 

boot loader를 fusing한다. (이미지를 굽는다.)
보드사에서 제공하는 boot loader를 굽는다. 

[root@linux2 src]# ./Jflash-XHYPER255  x-boot255
JFLASH Version 2003.06.03 - HyBus - XHYPER255B
COPYRIGHT (C) 2000, 2001 Intel Corporation
JTAG Test Passed

ACT: 0110 1001001001100100 00000001001 1
EXP: **** 1001001001100100 00000001001 1

PXA255 revision ?? + 6

There are two 16-bit Flash devices in parallel

Characteristics for one device:
 Number of blocks in device = 128
 Block size = 65536 0x10000 word(16-bit)
 Device size = 8388608 0x800000 word(16-bit)

Sample block to address list:

 Block 0 = hex address: 00000000
 Block 40 = hex address: 00A00000
 Block 80 = hex address: 01400000
 Block 120 = hex address: 01E00000

Starting erase
Erasing done
Starting programming
Writing flash at hex address     2dc0, 56.43% done

Verification successful!



잘 되었다. 

보드에 맞는  커널 소스 압축풀고,  corss tool chain 설치한다.
설치 후 path등록하여 편하게 사용하도록 한다.

이걸 가지고, 나중에 커널 모듈 컴파일시 KERNEL_DIR에 넣어서 타겟 보드에서 정상적으로 동작되게 한다.


2. minicom을 실행한다.
 
minicom은 auto loading 모드과 명령어 모드가 있다.
명령어 모드를 사용하려면, 3초안으로 키보드 입력을 한다.

명령어도 모드를 사용한다.

Welcome to minicom 2.00.0

OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Mar  7 2005, 10:29:09.

Press CTRL-A Z for help on special keys



 XHYPER255B-R1
 Copyright (C) 2002 Hybus Co,. ltd.
 Support: http://www.hybus.net

Autoboot in progress, press any key to stop ..
Autoboot aborted
Type "help" to get a list of commands
XHYPER255B>

 

3. 커널 컴파일을 해보자.
다른 터미넝을 띄운다. 보드에서 준 커널 설정을 한다.
 


[root@linux2 ~]# cd linux/
[root@linux2 linux]# make menuconfig
rm -f include/asm-arm/arch include/asm-arm/proc
(cd include/asm-arm; ln -sf arch- arch; ln -sf proc- proc)
rm -f include/asm
( cd include ; ln -sf asm-arm asm)
make -C scripts/lxdialog all
make[1]: Entering directory `/root/linux/scripts/lxdialog'
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o checklist.o checklist.c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o menubox.o menubox.c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o textbox.o textbox.c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o yesno.o yesno.c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o inputbox.o inputbox.c
inputbox.c: In function ‘dialog_inputbox’:
inputbox.c:107: warning: pointer targets in passing argument 1 of ‘strcpy’ differ in signedness
inputbox.c:109: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
inputbox.c:117: warning: pointer targets in passing argument 2 of ‘waddnstr’ differ in signedness
inputbox.c:147: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o util.o util.c
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o lxdialog.o lxdialog.c
lxdialog.c: In function ‘j_inputbox’:
lxdialog.c:211: warning: pointer targets in passing argument 2 of ‘fprintf’ differ in signedness
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -DLOCALE  -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -c -o msgbox.o msgbox.c
gcc -o lxdialog checklist.o menubox.o textbox.o yesno.o inputbox.o util.o lxdialog.o msgbox.o -lncurses
make[1]: Leaving directory `/root/linux/scripts/lxdialog'
/bin/sh scripts/Menuconfig arch/arm/config.in
Using defaults found in arch/arm/defconfig
Preparing scripts: functions, parsing.............................................................................done.

Saving your kernel configuration...

*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you must run 'make dep'.

[root@linux2 linux]#



가장 중요한 것은 .config 파일이 있어야 커널 컴파일이 가능하다. 이는 menuconfig를 잘 저장할 때 나오는 것이다.
 

[root@linux2 linux]# ls -al
합계 284
dr-xr-xr-x  14 root root  4096  4월 19 10:02 .
drwxr-x---  20 root root  4096  4월 19 09:52 ..
-rw-r--r--   1 root root 22099  4월 19 10:02 .config
-rw-r--r--   1 root root    96  4월 19 10:02 .menuconfig.log

4. 보드가 2.4보드라서 make dep를 한다.
 
make dep
2.6은 make dep를 하지 않아도 된다. 알아서 해결.
2.4는 make dep를 해야 한다.


<기타>
make clean : config 빼고, object만 지운다.
make mrproper   : 설정(config)까지 지운다. 


5. 커널 이미지를 만든다.
make zImage
(커널 이미지 + piggy + relocate 코드를 압축한다. )


6. 커널을 보드로 전달한다.
tftp , bootp를 이용해야 한다.

임베디드 보드에서는 bootloader에서 bootp를 이용해서 서버에 연결하여 ip를 할당받아야 한다.
따라서, 즉, 보드에 넣는 서버는 미리 bootp 데몬이 떠있어야 한다. 
vi /etc/xinetd.d/bootp, vi /etc/xinetd.d/tftp 를 수정

잘보면, 모두 udp 이다.

[root@linux2 linux]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}



zImage 이미지 복사
[root@linux2 linux]# ls -al arch/arm/boot/zImage
-rwxr-xr-x  1 root root 928704  4월 19 10:06 arch/arm/boot/zImage
[root@linux2 linux]# cp arch/arm/boot/zImage /tftpboot/
cp: overwrite `/tftpboot/zImage'? y
[root@linux2 linux]# ls -al /tftpboot/zImage
-rwxr-xr-x  1 root root 928704  4월 19 10:21 /tftpboot/zImage

root 파일 시스템 복사
[root@linux2 Image]# cp rootfs.img /tftpboot/
 


[root@linux2 linux]# netstat -au
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 *:32768                     *:* 
udp        0      0 *:bootps                    *:* 
udp        0      0 *:tftp                      *:* 
udp        0      0 *:978                       *:* 
udp        0      0 *:sunrpc                    *:* 
udp        0      0 *:ipp                       *:* 


자.. minicom에서 실행해보자..


minicom 의 명령어모드 창에서... 서버쪽으로 요청하도록 해야함


XHYPER255B> bootp
Our Ethernet address is 1234 5678 9A00.
        Sending bootp packet...
....................
Bootp packet is not received.



IP를 전달하지 못한것이다.

vi /etc/bootptab

xhyper255:\
ht=1:\
ha=0x123456789A00:\
ip=192.168.1.50:\
sm=255.255.255.0




ha는 맞네.. host ip가 안잡혀서 문제였다.
내 컴퓨터를 192.168.1.x 대로 변경해야 한다.


[root@linux2 linux]# ifconfig eth0 192.168.1.51 netmask 255.255.255.0

[root@linux2 linux]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F2:5E:B0
          inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0


minicom에서 확인해 본다.

XHYPER255B> bootp
Our Ethernet address is 1234 5678 9A00.
        Sending bootp packet...
.
Bootp Packet received.
        Host   (server) Ethernet : 000C 29F2 5EB0
        Host   (server) IP       : 127.0.0.1
        Client (target) Ethernet : 1234 5678 9A00
        Client (target) IP       : 192.168.1.50


bootp서버가 ip변경사항을 catch하지 못했다.


service xinetd restart 했는데. bootp가 제대로 반영이 되지 않았다.
이런 황당한 일이.... 확인해보니.. bootp가 제대로 죽지 않았다.. (이래서 다들 fix시킬 수 있는 임베디드 보드를 주는구나..bootp 는 최대한 적게 사용하여 개발의 편리성을 주는 이유가 그랬다.. 예전에 삼성이나 LG 임베디드 기기에서는 rom에서 ip를 지정해주고 바로 pc에서 이미지를 구울 수 있게 해주었던 것이 기억이 낫다.)

bootp를 확인해보니.. xinetd 중단시키고, 보니. 데몬이 떠있다... kill로 죽여주고.

[root@linux2 linux]# service xinetd stop
xinetd 를 정지함:                                          [실패]
[root@linux2 linux]# netstat -au
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 *:32768                     *:* 
udp        0      0 *:bootps                    *:* 
udp        0      0 *:978                       *:* 
udp        0      0 *:5353                      *:* 
udp        0      0 *:sunrpc                    *:* 
udp        0      0 *:ipp                       *:* 
[root@linux2 linux]# ps -ef | grep bootp
root      4862     1  0 10:23 ?        00:00:00 bootpd
root      5108 32262  0 10:31 pts/6    00:00:00 grep bootp
[root@linux2 linux]# kill -9 4862
[root@linux2 linux]#

 


xinetd 데몬을 시작시킨다.



[root@linux2 linux]# service xinetd start
xinetd (을)를 시작합니다:                                  [  확인  ]
[root@linux2 linux]#
[root@linux2 linux]#
[root@linux2 linux]# netstat -au
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 *:32768                     *:* 
udp        0      0 *:bootps                    *:* 
udp        0      0 *:tftp                      *:* 
udp        0      0 *:978                       *:* 
udp        0      0 *:5353                      *:* 
udp        0      0 *:sunrpc                    *:* 
udp        0      0 *:ipp                       *:* 


minicom에서 bootp를 쳤다. 

XHYPER255B> bootp
Our Ethernet address is 1234 5678 9A00.
        Sending bootp packet...
.
Bootp Packet received.
        Host   (server) Ethernet : 000C 29F2 5EB0
        Host   (server) IP       : 192.168.1.51
        Client (target) Ethernet : 1234 5678 9A00
        Client (target) IP       : 192.168.1.50


ip를 잡은 것을 확인했고, kernel 을 tftp로 보드에 잘 전송한다. 

XHYPER255B> tftp zImage kernel
TFTP Start...
        Host   (server) IP       : 192.168.1.51
        Client (target) IP       : 192.168.1.50
        Loading Filename         : zImage
        Save Address             : 0xA0008000

Loading start...
        0x000E2BC0 (928704) bytes received.
        tftp done.

XHYPER255B>


그 다음 root 파일 시스템을 보드에 잘 전송한다. 파일시스템이 있어야.. 내가 먼가를 할 수 있지..
보드에서 제공해주는 걸 사용한다.
 

XHYPER255B> tftp rootfs.img root
TFTP Start...
        Host   (server) IP       : 192.168.1.51
        Client (target) IP       : 192.168.1.50
        Loading Filename         : rootfs.img
        Save Address             : 0xA0000000

Loading start...
        0x00800000 (8388608) bytes received.
        tftp done.

이미지를 굽는다.
XHYPER255B> flash root



이미지가 잘 구워지면(fusing) 보드의 reset 버튼을 눌러 restart 한다.
login 명은 root로 한다.
 

seblock(): Magic bitmask 0x1985 not found at 0x01dc0020: 0xfbfc idjffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x01dc0024: 0xfdff idFurther such events for this erase block will not be printed
Old JFFS2 bitmask found at 0x01dff410
You cannot use older JFFS2 filesystems with newer kernels
JFFS2: Erase block at 0x01dc0000 is not formatted. It will be erased
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 368K
Setting up RAMFS, please wait ...
done and exiting
INIT: version 2.78 booting
INIT: Entering runlevel: 3
Starting syslog Starting system logger:

Starting etwork Starting network

Xhyper255 login: root
[root@Xhyper255 /root]$



* 파일 전달하는 것은 serial케이블을 통한 zmodem 또는 이더넷을 통한 NFS를 사용할 수 있다.(NFS를 이용해서 shared 폴더를 구성하고 데이터를 주고 받을 수 있다..)
인터넷은 해야 하니.. NFS는 나중에 하던가 하고.. 파일들이 워낙 간단하니. serial 케이블을 사용한다.
 
1. serial 케이블 이용

ctrl  A 누르고, Z를 눌러 help 명령어가 나오게 한다.

key mode....I |bfc idjffs2| lineWrap on/off....W  local Echo on/off..E | Help screen........Z |dff idFurth|                                            | scroll Back........B |
Old J|                                                                   |
You c|      Select function or press Enter for none.                     |
JFFS2|                                                                   |
VFS: |             Written by Miquel van Smoorenburg 1991-1995           |
Freei|             Some additions by Jukka Lahtinen 1997-2000            |
Setti|             i18n by Arnaldo Carvalho de Melo 1998                 |
done +-------------------------------------------------------------------+
INIT: version 2.78 booting



커널 모듈 파일을 전송해본다...
 
Sendfile->Zmodem를 선택하면, 디렉토리 리스트가 나온다.
여기에서 space 두번을 눌러 선택해서 내가 올리고 싶은 커널 모듈을 찾는다.
선택하면 space 한번을 누르고 엔터를 친다.

커널 모듈 추가한다.


[root@Xhyper255 /root]$insmod hello_mod.o
 Hello Module id Loaded ....


[root@Xhyper255 /root]$dmesg
....
 Hello Module id Loaded ....


[root@Xhyper255 /root]$lsmod
Module                  Size  Used by
hello_mod                432   0  (unused)


모듈만 올라갔지. 실제로는 open/close/read/write/ioctl은 할 수 없다..

mknod를 해야 한다... 

mknod 편은 다음편에...  







Posted by '김용환'
,