====== 개발환경 구축하기 - 2.위성 STB ====== 위성 STB 개발을 위해서 필요한 개발환경을 만들기 위한 여러가지 방법들을 기술하고 있다. 주로 노트북(개발 PC)를 사용하기 때문에 여기서 설명하는 모든 것들은 필자가 사용하는 노트북(XNOTE LS40)을 기준으로 한다. 여기서는 앞의 문서([[pc|업무 PC 세팅하기]], [[dev_pc|개발 PC 설정 팁]], [[dev_env_1|개발환경 구축하기 - 1.X86 기반의 QT]])를 읽었다는 가정하에서 설명한다. 그러므로 중복되는 것은 최대한 피하도록 할 것이다. 개발환경 구축을 몇가지로 분류해보면 다음과 같다. - usbtoserial 과 pcmcia card 잡기 - 커널 컴파일하기 - 필요한 패키지설치 - 세부 설정 - 테스트 위와 같은 순서대로 설명하도록 하겠다. ====== 개념잡기 ====== 여기서는 대충 어떤 식으로 개발이 진행되는지 간략히 설명해보겠다. 우선 개발 PC 와 STB 은 시리얼 케이블과 LAN 케이블로 연결되어 있다. 개발 PC 가 노트북인 관계로 이런 이유 때문에 usbtoserial 케이블과 pcmcia card 가 추가적으로 필요하며, 리눅스에서 잡아줘야 한다. 시리얼의 경우, 터미널의 역할로서 사용되어지고, LAN 의 경우에는 개발 PC 가 DHCP 서버 역할을 하고 STB 가 클라이언트 역할을 해서 STB 가 부팅시에 LAN 으로 연결된 개발 PC로 부터 MAC Address 로 지정된 IP 를 할당받고, bootp 와 tftp 를 이용해서 NFS 부팅을 하게된다. NFS 부팅을 함으로서, 컴파일 후 STB 으로 올릴 필요없이, 바로 개발 PC 에서 실행이 가능하다. ====== usbtoserial 과 pcmcia card 잡기 ====== 내가 가장 고생(?)을 했던 부분이다. 처음에 keyspan 에서 나온 usbtoserial 케이블을 사용했는데, 공교롭게도 2.6.8 커널에서는 지원이 안되었다. 결국 최신 커널 2.6.16 으로 올린 후에야 잡을 수 있었다. 커널 옵션은 'Device Drivers -> USB support -> USB Serial Converter support -> USB Keyspan USA-xxx Serial Driver' 뿐만 아니라 하부 Firmware 도 모두 선택한다. pcmcia card 의 경우, 기본 바닐라 커널에서는 문제없이 동작하지만, 새로 컴파일하게 된다면, 'Bus options (PCI, PCMCIA, EISA, MCA, ISA) -> PCCARD (PCMCIA/CardBus) support' 하부의 모든 옵션을 선택한다. 커널 컴파일 후에 재부팅했다면, PCMCIA 카드의 경우 #/etc/init.d/pcmcia restart 서비스를 재시작한다. pcmcia card 에 불이 들어왔다면, 잡힌것이다. ===== 주의할 사항 ===== 뒤에 가서 설명이 나오겠지만, pcmcia card 는 일반 LAN 카드이기 때문에 ethX 로 잡힌다. 그런데, 부팅후 pcmcia card 를 꽂으면 eth2 로 잡힌다. 하지만, 꽂은 상태에서 전원 부팅을 eth1 로 잡힌다. 이유는 노트북이 ieee1394 를 ethX 로 잡기 때문이다. 그래서 먼저 인식하는 순서대로 번호가 부여된다. 디바이스 번호는 항상 일정해야 하므로 한가지를 정해야 한다. 나의 경우 pcmcia card 를 eth1 로 잡기로 결정했다. 그래서 항상 부팅을 하기전에 pcmcia card 를 꼽아두어야 한다. ====== 커널 컴파일하기 ====== [[computer:os:devian_kernel_compile|데비안에서 커널 컴파일하기]] 를 참고하기 바란다. 만일 keyspan 이 아닌 다른 제품이라면 바로 잡을 수도 있기 때문에, 이 과정이 필요 없을 수도 있다. ====== 필요한 패키지설치 ====== 앞에서 설명한대로 개발 PC 에서 필요한 패키지는 다음과 같다. - dhcp3-client, dhcp3-common, dhcp3-server - minicom - nfs-kernel-server - pcmcia-cs - tftp, tftpd apt-get 을 이용해서 모두 설치한다. 여기서 주의할 것은 dhcp3 을 설치하는 것이다. dhcp 패키지와 혼동하지 않길 바란다. ====== 세부 설정 ====== ===== tftp ===== #mkdir /tftpboot #cd /tftpboot #tar xzvf tftpboot.tgz // tftpboot.tgz 파일은 별로도 다운로드 받던지 구해야 한다 inted 데몬으로 돌리기 때문에 /etc/inetd.conf 파일에 다음을 추가한다. tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot ===== dhcp ===== /etc/dhcp3/dhcpd.conf 파일을 다음과 같이 수정한다. # # Sample configuration file for ISC dhcpd for Debian # # $Id: _ea_b0_9c_eb_b0_9c_ed_99_98_ea_b2_bd_ea_b5_ac_ec_b6_95_ed_95_98_ea_b8_b0_2d_e2_91_a1_ec_9c_84_ec_84_b1STB,v 1.1 2013/06/07 03:35:46 root Exp root $ # # The ddns-updates-style parameter controls whether or not the server will # attempt to do a DNS update when a lease is confirmed. We default to the # behavior of the version 2 packages ('none', since DHCP v2 didn't # have support for DDNS.) ddns-update-style none; # option definitions common to all supported networks... option domain-name "kevin.tcom-dtvro.com"; option domain-name-servers 211.111.136.2; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. #subnet 10.152.187.0 netmask 255.255.255.0 { #} # This is a very basic subnet declaration. #subnet 10.254.239.0 netmask 255.255.255.224 { # range 10.254.239.10 10.254.239.20; # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; #} # This declaration allows BOOTP clients to get dynamic addresses, # which we don't really recommend. #subnet 10.254.239.32 netmask 255.255.255.224 { # range dynamic-bootp 10.254.239.40 10.254.239.60; # option broadcast-address 10.254.239.31; # option routers rtr-239-32-1.example.org; #} # A slightly different configuration for an internal subnet. allow bootp; subnet 10.0.2.0 netmask 255.255.255.0 { range 10.0.2.100 10.0.2.199; # option domain-name-servers ns1.internal.example.org; # option domain-name "internal.example.org"; option routers 10.0.2.1; option broadcast-address 10.0.2.255; default-lease-time 600; max-lease-time 7200; group { host redwood61.kevin.tcom-dtvro.com { hardware ethernet 00:02:14:00:10:97; fixed-address 10.0.2.151; filename "zImage.etbdb"; option root-path "/DATA/HardHat/devkit/ppc/405/target_td9000"; } host redwood62.kevin.tcom-dtvro.com { #hardware ethernet 00:0d:84:ff:ef:ff; hardware ethernet 00:02:14:00:10:B0; # MAC 주소의 경우, STB bootloader 의 bdinfo 명령어를 통해서 알 수 있다 #hardware ethernet 00:02:14:00:10:B2; #hardware ethernet 00:02:14:00:10:B3; #hardware ethernet 00:02:14:00:14:ee; #hardware ethernet 00:02:14:00:14:ac; #hardware ethernet 00:02:14:00:15:59; #hardware ethernet 00:02:14:00:15:42; #hardware ethernet 00:02:14:00:13:e4; #hardware ethernet 00:02:14:00:16:9a; fixed-address 10.0.2.152; filename "zImage.etbdb"; option root-path "/DATA/HardHat/devkit/ppc/405/target_td9000"; #option root-path "/DATA/HardHat/devkit/ppc/405/target_mac"; } host redwood63.kevin.tcom-dtvro.com { hardware ethernet 00:02:14:00:0a:a3; fixed-address 10.0.2.153; filename "zImage.treeboot"; #option root-path "/DATA/HardHat/devkit/ppc/405/target_mac"; option root-path "/DATA/HardHat/devkit/ppc/405/target_td100"; } host redwood64.kevin.tcom-dtvro.com { hardware ethernet 00:02:14:00:09:ec; fixed-address 10.0.2.154; filename "zImage.treeboot"; option root-path "/DATA/HardHat/devkit/ppc/405/target_td100"; } host mitv.kevin.tcom-dtvro.com { hardware ethernet 00:FF:AA:00:0D:59; fixed-address 10.0.2.99; # filename "zImage.etbdb"; option root-path "/DATA/Black/Working/SigmaDesign86xxARM/armutils/build_arm/root"; } } } # Hosts which require special configuration options can be listed in # host statements. If no address is specified, the address will be # allocated dynamically (if possible), but the host-specific information # will still come from the host declaration. #host passacaglia { # hardware ethernet 0:0:c0:5d:bd:95; # filename "vmunix.passacaglia"; # server-name "toccata.fugue.com"; #} # Fixed IP addresses can also be specified for hosts. These addresses # should not also be listed as being available for dynamic assignment. # Hosts for which fixed IP addresses have been specified can boot using # BOOTP or DHCP. Hosts for which no fixed address is specified can only # be booted with DHCP, unless there is an address range on the subnet # to which a BOOTP client is connected which has the dynamic-bootp flag # set. #host fantasia { # hardware ethernet 08:00:07:26:c0:a5; # fixed-address fantasia.fugue.com; #} # You can declare a class of clients and then do address allocation # based on that. The example below shows a case where all clients # in a certain class get addresses on the 10.17.224/24 subnet, and all # other clients get addresses on the 10.0.29/24 subnet. #class "foo" { # match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; #} #shared-network 224-29 { # subnet 10.17.224.0 netmask 255.255.255.0 { # option routers rtr-224.example.org; # } # subnet 10.0.29.0 netmask 255.255.255.0 { # option routers rtr-29.example.org; # } # pool { # allow members of "foo"; # range 10.17.224.10 10.17.224.250; # } # pool { # deny members of "foo"; # range 10.0.29.10 10.0.29.230; # } #} 위의 파일에서 주의해서 봐야 할 것은 MAC 주소와 root-path 의 경로이다. 다음은 /etc/default/dhcp3-server 이다. # Defaults for dhcp initscript # sourced by /etc/init.d/dhcp # installed at /etc/default/dhcp3-server by the maintainer scripts # # This is a POSIX shell fragment # # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="eth1" # 앞에서 설명했듯이 pcmcia card 가 eth1 로 잡히기 때문이다 ===== nfs ===== STB 가 개발 PC 로 NFS 마운트를 해야하기 때문에 설정이 필요하다. 설정 파일은 /etc/export 이다. 다음과 같이 설정한다. # /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). /DATA/MPEG *(rw,sync) /DATA/uClinux-ARMpT110/target/DTVRo *(rw,sync) /DATA/Black/Working/SigmaDesign86xxARM/armutils/build_arm/root *(rw,no_root_squash,no_all_squash,sync) /DATA/HardHat/devkit/ppc/405/target_newmi *(rw,no_root_squash,no_all_squash,sync) /DATA/HardHat/devkit/ppc/405/target_td100 *(rw,no_root_squash,no_all_squash,sync) /DATA/HardHat/devkit/ppc/405/target_td9000 *(rw,no_root_squash,no_all_squash,sync) /DATA/HardHat/devkit/ppc/405/target_mac *(rw,no_root_squash,no_all_squash,sync) ===== network 설정 ===== pcmcia card 에 IP 를 할당해야 한다. 설정파일은 /etc/network/interface 이다. # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 # 앞에서 언급했듯이 pcmcia card 는 eth1 로 할당 된다 iface eth1 inet static address 10.0.2.1 # 할당 IP netmask 255.255.255.0 ===== minicom ===== 연결 설정은 다음과 같다. | Serial Device | /dev/ttyUSB0 | | Lockfile Location | /var/lock | | Callin Program | | | Callout Program| | | Bps/Par/Bits | 115200 8N1 | | Hardware Flow Control | No | | Software Flow Control | No | ===== 소스파일 복사 ===== 전체 소스파일의 용량이 1G 가 넘는 관계로 외장 하드를 이용해서 다음과 같이 복사해야 한다. #mkdir /DATA #mount /dev/sda2 /mnt #cd /mnt #cd 20051231 #tar xzf DATA_Green_20051231.tgz -C /DATA #tar xzf DATA_Red_20051231.tgz -C /DATA #tar xzf DATA_PPC405_20051231.tgz -C /DATA 압축을 푸는데 오랜시간이 걸리기 때문에, 커피한잔의 여유를 즐겨도 좋을 듯 하다. ====== 테스트 ====== 이제 재부팅하자. 그리고 pcmcia card 에 제대로 IP 가 할당되었는지 확인한다. STB 과 연결된 케이블을 개발 PC 에 연결한다. 참고로 개발 PC 와 STB 은 크로스 케이블을 사용해야 한다. #minicom STB 의 전원을 넣는다. 콘솔에 부팅 메세지가 보이면, Serial 쪽은 성공이다. 나머지 부분을 테스트하기 위해서 SVR3000>nfsboot 개발 PC 로부터 자동으로 파일 시스템을 부팅해서 프롬프트까지 별다른 에러가 없다면 성공이다. root 로 로그인 해보자! ====== 알려진 문제점 ====== 소스파일을 복사한 후 압축을 풀고나서 디렉토리들의 이름을 잘 확인하기 바란다. 나의 경우 HardHat-PPC405 라는 디렉토리가 생성되었는데, 나중에 디렉토리 이름때문에 STB 의 nfs 부팅이 제대로 안되는 문제가 발생했다. 결국 HardHat 으로 변경하고, /etc/export 파일의 디렉토리명을 바꿨더니, 잘 동작했다. ---- {{indexmenu>:#1|skipns=/^(wiki|etc|diary|playground)$/ skipfile=/^(todays|about|guestbook)$/ nsort rsort}} ----