FreeBSD로 DOM 이미지를 작성해 보기로 한다. 사실 이 작업도 매우 쉬운 작업이라고 할 수 있다. (이미지만 쉽게 만들어지면 솔직히 모든 것이 쉽다! 이 바닥에 노가다가 아닌게 어딨니!) FreeBSD에서는 Embedded를 위해서 여러가지 프로젝트가 있었고, 현재도 진행중이라고 알고 있다.
이 프로젝트는 port에 포함되어 있고 (/usr/ports/sysutils/tinybsd), 별도의 컴파일 작업 없이 스크립트 형식으로 인스톨 되기 때문에 설치가 빠르고 간편하다. (5.4 RELEASE 이하 버젼에서는 port에 포함이 되지 않은 것으로 확인된다. 이 작업은 6.1 와 6.2 RELEASE 버젼에서 확인되었다.)
elenoa-freebsd# cd /usr/ports/sysutils/tinybsd/ elenoa-freebsd# make install ===> Vulnerability check disabled, database not found => tinybsd-0.9.tar.gz doesn't seem to exist in /usr/ports/distfiles/. => Attempting to fetch from http://www.tinybsd.org/download/. tinybsd-0.9.tar.gz 100% of 48 kB 21 kBps ===> Extracting for tinybsd-0.9 => MD5 Checksum OK for tinybsd-0.9.tar.gz. => SHA256 Checksum OK for tinybsd-0.9.tar.gz. tar: Failed to set default locale ===> Patching for tinybsd-0.9 ===> Configuring for tinybsd-0.9 ===> Installing for tinybsd-0.9 ===> Generating temporary packing list ===> Checking if sysutils/tinybsd already installed ***************************************************************************** You have installed the tinybsd package.
The configuration files is in /usr/local/share/tinybsd/conf.
You can customize your tinybsd image editing /usr/local/share/tinybsd/conf/IMAGE/tinybsd.basefiles to add or to remove the system binaries.
Edit /usr/local/share/tinybsd/conf/IMAGE/TINYBSD to add or to remove kernel options and then run /usr/local/bin/tinybsd script to build your system according your device information.
After the embedded system build is done, the resulting system will be avaliable in the /usr/local/share/tinybsd/tinybsd.bin file. To write this system image to your medium use dd(1) according to the following:
For more information read the README file on /usr/local/share/tinybsd. ===> Registering installation for tinybsd-0.9 elenoa-freebsd#
위는 port에서 make install을 했을때 볼 수 있는 메시지이다.
tinybsd는 /usr/local/bin/ 에 tinybsd라는 스크립트 파일을 생성한다. 해당 파일은 media의 sector당 크기와 head 수, sector 수를 입력받아 이미지를 생성한다.
elenoa-freebsd# cd /usr/local/share/tinybsd elenoa-freebsd# ls CHANGES COPYRIGHT README TODO conf elenoa-freebsd# rehash elenoa-freebsd# which tinybsd /usr/local/bin/tinybsd elenoa-freebsd# tinybsd Woops! Usage: /usr/local/bin/tinybsd <mediasize in sectors> <heads according to firmware> <sectors according to firmware> <conf> [<tinybsd image name>]
Example: /usr/local/bin/tinybsd 62592 4 32
or
/usr/local/bin/tinybsd 62592 4 32 wireless
Run diskinfo(8) -v against your CF device to get correct information about your disk. elenoa-freebsd#
위와 같이 argument로 입력해야 할 숫자들은 해당 media를 diskinfo -v 커맨드로 확인함으로써 쉽게 알 수 있다. (위에서 보다시피, tinybsd는 설명이 아주 잘 되어 있는 편이다) 또한 아래 설명할 많은 내용들은 README 파일에 모두 설명되어 있다. 하지만 간단하게 한번 더 설명을 하고 넘어간다.
tinybsd를 설치한다. port를 이용하는 것이 간편하고 빠르다. (FreeBSD 버젼 6.1 RELEASE 이상)
tinybsd로 Embedded 작업을 할 media를 서버에 설치하고, diskinfo -v 옵션으로 media의 물리적인 정보를 알아낸다.
어떤 tinybsd 이미지를 사용할 것인지 선택한다.
bridge, firewall, vpn, wrap, minimal, wireless, default 이렇게 7개의 모드를 지원한다. (default만 시험해봤다)
모드마다 설치되는 파일들이 약간씩 다르고, 각각의 커널 옵션들도 조금씩 다르다.
해당 모드들은 /usr/local/share/tinybsd/conf 디렉토리 아래에 각각의 이름으로 설정이 담겨있는 디렉토리들이 존재하며, 필요하면 편집이 가능하다.
이미지를 생성하기 전에 마지막으로 주의해야 할 것은 kernel이다.
tinybsd에 기본적으로 가지고 있는 kernel은 i386 버젼이다.
/usr/local/share/tinybsd/conf/(이미지 이름)/TINYBSD 파일은 커널 옵션을 담고 있다. 필요하다면 수정한다.
tinybsd를 실행한다. 이때 커널 이미지를 Build하기 때문에 시간이 약 2-3시간 소요된다.
tinybsd를 실행하면서 argument로 tinybsd 이미지 이름을 입력했다면 해당 이름으로 이미지 파일이 생성되고, 입력하지 않았으면 기본적으로 /usr/local/shard/tinybsd/tinybsd.bin 파일로 생성된다.
이미지를 편집하고 싶으면,
mdconfig -a -t vnode -f /usr/local/share/tinybsd/tinybsd.bin -u 0
위의 커맨드를 입력하면 해당 파일로 /dev/md0 라는 memory device를 생성해준다.