2011년 11월 27일 일요일

network-demo/ntp 예제

ntp는 network time protocol 으로

인터넷상의 시간을 정확하게 유지시켜 주기 위한 통신망 시간 규약이다.

[rtems@localhost network-demos]$ cd ntp/
[rtems@localhost ntp]$ ls
ChangeLog  CVS  init.c  Makefile

파일도 간단하여 가벼운 마음으로 컴파일을 시도했다.

[rtems@localhost ntp]$ export PATH=/opt/rtems-4.10/bin:$PATH
[rtems@localhost ntp]$ export RTEMS_MAKEFILE_PATH=/home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/
[rtems@localhost ntp]$ make
i386-rtems4.10-gcc --pipe -B/home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/ -specs bsp_specs -qrtems   -g -Wall  -O2 -g -g      -mtune=i386      -c   -o o-optimize/init.o init.c
In file included from init.c:24:
../networkconfig.h: In function 'pci_check':
../networkconfig.h:197: warning: implicit declaration of function 'pci_initialize'
In file included from init.c:24:
../networkconfig.h:200: warning: 'cfg' may be used uninitialized in this function
i386-rtems4.10-gcc --pipe -B/home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/ -specs bsp_specs -qrtems   -g -Wall  -O2 -g -g      -mtune=i386      -Wl,-Ttext,0x00100000   -mtune=i386   -o o-optimize/ntpdemo.exe  o-optimize/init.o   /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-barrier.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-dpmem.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-msg.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-mp.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-part.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-region.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-signal.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-timer.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-rtmon.rel /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/no-ext.rel     
i386-rtems4.10-nm -g -n o-optimize/ntpdemo.exe > o-optimize/ntpdemo.num
i386-rtems4.10-size o-optimize/ntpdemo.exe
   text   data    bss    dec    hex filename
 324213  16632  23440 364285  58efd o-optimize/ntpdemo.exe
i386-rtems4.10-objcopy -O elf32-i386 --remove-section=.comment --remove-section=.note --strip-unneeded o-optimize/ntpdemo.exe o-optimize/ntpdemo.nxe
i386-rtems4.10-objcopy -O binary o-optimize/ntpdemo.nxe o-optimize/ntpdemo.bin
/home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/build-tools/bin2boot -v o-optimize/ntpdemo.ralf 0x00097E00 /home/rtems/rtems-4.10-work/building_work/console-rtems/i386-rtems4.10/pc386/lib/start16.bin 0x00097C00 0 o-optimize/ntpdemo.bin 0x00100000 0
header address       0x00097e00, its memory size 0x00000200
first  image address 0x00097c00, its memory size 0x00000200
second image address 0x00100000, its memory size 0x00054400
rm -f o-optimize/ntpdemo.nxe
[rtems@localhost ntp]$ ls
ChangeLog  CVS  init.c  Makefile  o-optimize
[rtems@localhost ntp]$ cd o-optimize/
[rtems@localhost o-optimize]$ ls
init.o  ntpdemo.bin  ntpdemo.exe  ntpdemo.num  ntpdemo.ralf

생성파일이 생긴 것을 확인. 이제 실행을 해보려 했다. 실행을 하기 위해서 'pc386' 명령어를 사용하고 'pc386' 명령어에서 네트워크 어뎁터 활성화 옵션을 주어서 동작을 확인하려고 하였다. 

[rtems@localhost o-optimize]$ . ~/rtems-4.10-work/setenv 
/home/rtems/rtems-4.10-work/rtems
/home/rtems/rtems-4.10-work/rtems-testing/bin:/opt/rtems-4.10/bin:/usr/lib/qt-3.3/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/rtems/bin
[rtems@localhost o-optimize]$ pc386 -i -N ntpdemo.exe
Simulator does not support a Network Interface Controller.

시뮬레이터가 네트워크 인터페이스 컨트롤러를 지원하지 않는다고 나왔다.

2011년 11월 21일 월요일

시리얼 메세지 출력을 위한 작업

시리얼을 이용한 메세지 출력을 확인하기 위한 옵션을 주어 RTEMS를 컴파일한다.
우선 컴파일을 하게 될 RTEMS가 위치할 폴더를 생성.

[rtems@localhost building_work]$ mkdir console-rtems
[rtems@localhost building_work]$ ls
build-network  console-rtems  pc386  test-build-rtems

폴더를 생성한 후에는 시리얼 메세지 출력을 RTEMS 컴파일을 시작.

[rtems@localhost console-rtems]$ export PATH=/opt/rtems-4.10/bin:$PATH
[rtems@localhost console-rtems]$ cd console-rtems/
[rtems@localhost console-rtems]$ ../../rtems/configure --target=i386-rtems4.10 --prefix=/home/rtems/rtems-4.10-work/building_work/console-rtems/ --disable-mutiprocessing --disable-cxx --disable-rdbg --enable-maintainer-mode --enable-tests --enable-networking --enable-posix --disable-itron --disable-deprecated --disable-ada --disable-expada --enable-rtemsbsp=pc386 USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0

RTEMS 빌드가 되면 make all 과 make install 명령어를 입력

[rtems@localhost console-rtems]$ make all
[rtems@localhost console-rtems]$ ls
config.log  config.status  i386-rtems4.10  make  Makefile  testsuites  tools
[rtems@localhost console-rtems]$ make install

잘 되었는지 BSP에 Makefile.inc가 잘 생겼는지 확인.

[rtems@localhost console-rtems]$ ls
bin         config.status   lib   Makefile  testsuites
config.log  i386-rtems4.10  make  share     tools
[rtems@localhost console-rtems]$ cd i386-rtems4.10/
[rtems@localhost i386-rtems4.10]$ ls
c  pc386
[rtems@localhost i386-rtems4.10]$ cd pc386/
[rtems@localhost pc386]$ ls
build-tools  lib  make  Makefile.inc
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
새로 빌드한 RTEMS 응용 프로그램이 어떻게 동작하는지 확인을 해보자.

[rtems@localhost pc386]$ cd ../console-rtems/
[rtems@localhost console-rtems]$ ls
bin            config.log     i386-rtems4.10  log   Makefile  testsuites
build-command  config.status  lib             make  share     tools
[rtems@localhost console-rtems]$ find . -name "*.exe"
(파일 엄청 많다.)

[rtems@localhost console-rtems]$ pc386 -i i386-rtems4.10/c/pc386/testsuites/samples/base_sp/base_sp.exe
qemu is /usr/bin/qemu
Initialized console on port COM1 9600-8-N-1



*** SAMPLE SINGLE PROCESSOR APPLICATION ***
Creating and starting an application task
Application task was invoked with argument (0) and has id of 0xa010002
*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

[rtems@localhost ~]$ ls
Desktop    Downloads          Music     Public  rtems-4.10-work  Videos
Documents  INSTALL-NOTES.txt  Pictures  qemu    Templates        workspace
[rtems@localhost ~]$ cd rtems-4.10-work/building_work/
[rtems@localhost building_work]$ ls
build-network  console-rtems  pc386  test-build-rtems
[rtems@localhost building_work]$ cd test-build-rtems/
[rtems@localhost test-build-rtems]$ find . -name "*.exe"
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/paranoia.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/base_sp.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/unlimited.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/fileio.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/capture.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/nsecs.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/ticker.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/hello.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/loopback.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/pppd.exe
./i386-rtems4.10/pc386/lib/rtems-4.10/tests/minimum.exe


--------------------------------------------------------------------------------------------------------------------------------------------------------------------

RTEMS 빌드 명령어

compile PATH 경로 설정 



[rtems@localhost ~]$ export PATH=/opt/rtems-4.10/bin:$PATH
[rtems@localhost ~]$ $PATH
bash: /opt/rtems-4.10/bin:/usr/lib/qt-3.3/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/rtems/bin: No such file or directory

테스트용 폴더를 생성

[rtems@localhost rtems-4.10-work]$ mkdir test-build-rtems
[rtems@localhost rtems-4.10-work]$ ls
bsp-install  examples-v2    rtems          setenv
build_bsp    network-demos  rtems-testing  test-build-rtems


[rtems@localhost rtems-4.10-work]$ cd test-build-rtems/
[rtems@localhost test-build-rtems]$ ls
[rtems@localhost test-build-rtems]$ ../rtems/configure --target=i386-rtems4.10 \
> --enable-networking --disable-cxx --enable-rtemsbsp="pc386" \
> --prefix=/home/rtems/rtems-4.10-work/test-build-rtems/

.................................중략..........................................


configure: creating ./config.status
config.status: creating Makefile

target architecture: i386.
available BSPs: pc386.
'gmake all' will build the following BSPs: pc386.
other BSPs can be built with 'gmake RTEMS_BSP="bsp1 bsp2 ..."'

config.status: creating Makefile
config.status: creating make/Makefile

[rtems@localhost test-build-rtems]$ make install

[rtems@localhost pc386]$ export RTEMS_MAKEFILE_PATH=/home/rtems/rtems-4.10-work/test-build-rtems/i386-rtems4.10/pc386/

[rtems@localhost rtems-4.10-work]$ $RTEMS_MAKEFILE_PATH
bash: /home/rtems/rtems-4.10-work/test-build-rtems/i386-rtems4.10/pc386/: is a directory

--------------------------------------------------------------------------------------------------------------------------------------------------------------------


[rtems@localhost rtems-4.10-work]$ cd b-test/
[rtems@localhost b-test]$ ls
[rtems@localhost b-test]$ ../rtems/configure -target=i386-rtems4.10 \
> --enable-networking --enable-multiprocessing --disable-cxx \
> --enable-rtemsbsp="pc386" --prefix=/home/rtems/rtems-4.10-work/b-test/

[rtems@localhost b-test]$ make all

2011년 11월 20일 일요일

pc386 옵션 내용 정리

pc386으로 qemu가 실행될 때 기본으로 들어가는 옵션.

-m 512                                     // 가상 RAM 크기 설정(MB) ( 기본 128)
-boot a
-cpu 486                                 // cpu 선택
-fda <pc386_fda>
-hda fat:<hd/test.exe>
-monitor null                           //
-nographic
-serial stdio
--no-reboot

pc386 명령어의 옵션

-v 진행 메세지 표시
-c 소스 계측 메세지 활성화 ( 기본 no )
-C 만약 대화형이 아닌 경우 테스트 output 출력 ( 기본 no )
-g 장치 트리와 종료(?) 생성
-D 디스플레이 어뎁터 사용 활성화 ( 기본 no )
-N 네트워크 어뎁터 사용 활성화 ( 기본 no )
-G GDB 서버 모드에 시뮬레이터 입력
-i 대화형 ( 기본 = 제한 시간 없음 )
-s V IPC 시스템 지원 ( 기본 no )
   -l limit 특정 시간 설정 ( 기본 BSP 의존적 )
   -L dir 특정 로그 디렉터리 ( 기본 'log' )
   -T rtems 테스트 커맨드 모드

2011년 11월 17일 목요일

RTEMS task


내가 현재 생각하고 있는 모습을 그림화 시킨 것.

2011년 11월 15일 화요일

프로세스 죽이기

ps -ef | grep qemu

kill -9 [PID]



./sim-script/pc386 -i PATH_TO_MY_EXE

network를 하려는 발버둥

export PATH=/opt/rtems-4.10/bin:$PATH

$PATH

mkdir build-network

cd build-network/

ls
../rtems/configure --target=i386-rtems4.10 --enable-networking \
> --enable-rtemsbsp="pc386" --prefix=/home/rtems/rtems-4.10-work/build-network/

make all

make install

여기까지가 RTEMS 빌드 과정 명령어 (누락되서 이렇게 적어 놓음)

[rtems@localhost pc386]$ export RTEMS_MAKEFILE_PATH=/home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/

[rtems@localhost pc386]$ $RTEMS_MAKEFILE_PATH
bash: /home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/: is a directory

[rtems@localhost pc386]$ cd ../../../network-demos/

[rtems@localhost network-demos]$ ls
ChangeLog    http             networkconfig-icecube.h      ntp       SUPPORT
CVS          Makefile         networkconfig-loopback.h     README    telnetd
DEBUG.hints  mcast            networkconfig-mpc8313erdb.h  rpc_demo  tftpTest
DEBUG.linux  netdemo          networkconfig-qemu.h         select    ttcp
dnstest      networkconfig.h  nfsClientTest

[rtems@localhost network-demos]$ cd netdemo/
[rtems@localhost netdemo]$ ls
ChangeLog  CVS  init.c  Makefile  README  test.c

[rtems@localhost netdemo]$ make
test -d o-optimize || mkdir o-optimize
i386-rtems4.10-gcc --pipe -B/home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/lib/ -specs bsp_specs -qrtems   -g -Wall  -O2 -g -g      -mtune=i386      -c   -o o-optimize/init.o init.c
In file included from init.c:23:
../networkconfig.h: In function 'pci_check':
../networkconfig.h:197: warning: implicit declaration of function 'pci_initialize'
In file included from init.c:23:
../networkconfig.h:200: warning: 'cfg' may be used uninitialized in this function
i386-rtems4.10-gcc --pipe -B/home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/lib/ -specs bsp_specs -qrtems   -g -Wall  -O2 -g -g      -mtune=i386      -c   -o o-optimize/test.o test.c
i386-rtems4.10-gcc --pipe -B/home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/lib/ -specs bsp_specs -qrtems   -g -Wall  -O2 -g -g      -mtune=i386      -Wl,-Ttext,0x00100000   -mtune=i386   -o o-optimize/netdemo.exe  o-optimize/init.o o-optimize/test.o        
i386-rtems4.10-nm -g -n o-optimize/netdemo.exe > o-optimize/netdemo.num
i386-rtems4.10-size o-optimize/netdemo.exe
   text   data    bss    dec    hex filename
 334053  16632  54496 405181  62ebd o-optimize/netdemo.exe
i386-rtems4.10-objcopy -O elf32-i386 --remove-section=.comment --remove-section=.note --strip-unneeded o-optimize/netdemo.exe o-optimize/netdemo.nxe
i386-rtems4.10-objcopy -O binary o-optimize/netdemo.nxe o-optimize/netdemo.bin
/home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/build-tools/bin2boot -v o-optimize/netdemo.ralf 0x00097E00 /home/rtems/rtems-4.10-work/build-network/i386-rtems4.10/pc386/lib/start16.bin 0x00097C00 0 o-optimize/netdemo.bin 0x00100000 0
header address       0x00097e00, its memory size 0x00000200
first  image address 0x00097c00, its memory size 0x00000200
second image address 0x00100000, its memory size 0x00056a00
rm -f o-optimize/netdemo.nxe
[rtems@localhost netdemo]$ ls
ChangeLog  CVS  init.c  Makefile  o-optimize  README  test.c

[rtems@localhost netdemo]$ cd o-optimize/
[rtems@localhost o-optimize]$ ls
init.o  netdemo.bin  netdemo.exe  netdemo.num  netdemo.ralf  test.o

[rtems@localhost o-optimize]$ cd ~
[rtems@localhost ~]$ ls
Desktop    Downloads          Music     Public  rtems-4.10-work  Videos
Documents  INSTALL-NOTES.txt  Pictures  qemu    Templates        workspace
[rtems@localhost ~]$ cd rtems-4.10-work/
[rtems@localhost rtems-4.10-work]$ ls
bsp-install  build-network  network-demos  rtems-testing  test-build-rtems
build_bsp    examples-v2    rtems          setenv

[rtems@localhost rtems-4.10-work]$ . ~/rtems-4.10-work/setenv 
/home/rtems/rtems-4.10-work/rtems
/home/rtems/rtems-4.10-work/rtems-testing/bin:/opt/rtems-4.10/bin:/usr/lib/qt-3.3/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/rtems/bin
[rtems@localhost rtems-4.10-work]$ find . -name "netdemo.exe"
./network-demos/netdemo/o-optimize/netdemo.exe

[rtems@localhost rtems-4.10-work]$ pc386 -i network-demos/netdemo/o-optimize/netdemo.exe
qemu is /usr/bin/qemu

이러고 멈춘다. 설정에 문제가 있는 것 같다.

2011년 11월 14일 월요일

Building Grub - 2

Grub 빌딩을 하기 위해서 압축을 풀 때 옵션을 다르게 주고 빌딩 시작

[rtems@localhost Downloads]$ tar -xvzf grub-1.94.tar.gz


압축을 다시 풀기를 완료하고 압축을 해제한 폴더로 들어감

[rtems@localhost Downloads]$ cd grub-1.94
[rtems@localhost grub-1.94]$ ls
aclocal.m4    configure       geninitheader.sh   install-sh     stamp-h.in
AUTHORS       configure.ac    geninit.sh         io             term
autogen.sh    COPYING         genkernsyms.sh.in  kern           THANKS
boot          disk            genmk.rb           loader         TODO
ChangeLog     DISTLIST        genmoddep.awk      Makefile.in    util
commands      font            genmodsrc.sh       mkinstalldirs  video
conf          fs              gensymlist.sh.in   NEWS
config.guess  gencmdlist.sh   hello              normal
config.h.in   gendistlist.sh  include            partmap
config.sub    genfslist.sh    INSTALL            README

./configure 을 입력

[rtems@localhost grub-1.94]$ ./configure
...................................................중간 생략............................................................
checking whether optimization for size works... yes
checking whether -falign-loops works... yes
checking whether objcopy works for absolute addresses... no
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils

처음에 했던 오류가 다시 발생. 그래서 다른 곳에서 다른 버전의 Grub를 다운 받고 압축을 해제

[rtems@localhost Downloads]$ tar -xvzf grub-0.97.tar.gz 

압축을 해제 이제 폴더를 이동해서 다시 ./configure 명령어를 입력


[rtems@localhost Downloads]$ ls
grub-0.97         grub-1.94.tar.gz  qemu-0.15.1.tar.gz  rtems-grub.cfg
grub-0.97.tar.gz  qemu-0.15.1       rtems-boot.img
[rtems@localhost Downloads]$ cd grub-0.97
[rtems@localhost grub-0.97]$ ls
acinclude.m4  config.guess  depcomp     MAINTENANCE    NEWS    util
aclocal.m4    config.h.in   docs        Makefile.am    README
AUTHORS       config.sub    grub        Makefile.in    stage1
BUGS          configure     INSTALL     missing        stage2
ChangeLog     configure.ac  install-sh  mkinstalldirs  THANKS
compile       COPYING       lib         netboot        TODO
[rtems@localhost grub-0.97]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... no
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils

여전히 오류가 존재.


[rtems@localhost grub-0.97]$ su -
Password:
[root@localhost ~]# yum search binutils
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
ftp://ftp.rtems.eu/pub/rtems/linux/4.10/fedora/14/i386/repodata/repomd.xml: [Errno 12] Timeout on : (28, '')
Trying other mirror.
rtems-4.10                                               | 3.0 kB     00:00     
updates/metalink                                         | 4.6 kB     00:00     
updates                                                  | 4.7 kB     00:00     
updates/primary_db                                       | 5.4 MB     00:10     
updates/pkgtags                                          |  75 kB     00:00     
============================== Matched: binutils ===============================
arm-gp2x-linux-binutils.i686 : Cross Compiling GNU binutils targeted at
                             : arm-gp2x-linux
avr-binutils.i686 : Cross Compiling GNU binutils targeted at avr
mingw32-binutils.i686 : MinGW Windows binutils
msp430-binutils.i686 : Cross Compiling GNU binutils targeted at msp430
rtems-4.10-arm-rtems4.10-binutils.i686 : Binutils for target arm-rtems4.10
rtems-4.10-avr-rtems4.10-binutils.i686 : Binutils for target avr-rtems4.10
rtems-4.10-bfin-rtems4.10-binutils.i686 : Binutils for target bfin-rtems4.10
rtems-4.10-binutils-common.noarch : Base package for RTEMS binutils
rtems-4.10-h8300-rtems4.10-binutils.i686 : Binutils for target h8300-rtems4.10
rtems-4.10-i386-rtems4.10-binutils.i686 : Binutils for target i386-rtems4.10
rtems-4.10-lm32-rtems4.10-binutils.i686 : Binutils for target lm32-rtems4.10
rtems-4.10-m32c-rtems4.10-binutils.i686 : Binutils for target m32c-rtems4.10
rtems-4.10-m32r-rtems4.10-binutils.i686 : Binutils for target m32r-rtems4.10
rtems-4.10-m68k-rtems4.10-binutils.i686 : Binutils for target m68k-rtems4.10
rtems-4.10-mips-rtems4.10-binutils.i686 : Binutils for target mips-rtems4.10
rtems-4.10-powerpc-rtems4.10-binutils.i686 : Binutils for target
                                           : powerpc-rtems4.10
rtems-4.10-sh-rtems4.10-binutils.i686 : Binutils for target sh-rtems4.10
rtems-4.10-sparc-rtems4.10-binutils.i686 : Binutils for target sparc-rtems4.10
sh-elf-binutils.i686 : Cross Compiling GNU binutils targeted at sh-elf
binutils.i686 : A GNU collection of binary utilities
spu-binutils.i686 : A GNU collection of binary utilities
binutils-devel.i686 : BFD and opcodes static and dynamic libraries and header
                    : files

이거 끝나고 다시 쳐도 역시 오류는 존재

configure: error: GRUB requires a working absolute objcopy; upgrade your binutils


[root@localhost ~]# yum install binutils
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Package binutils-2.20.51.0.7-8.fc14.i686 already installed and latest version
Nothing to do
[root@localhost ~]# yum update binutils
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Update Process
No Packages marked for Update

binutils 문제가 해결이 안 되는데 설치를 하려고 해도 이미 존재한다고 나오고 업데이트를 하려고 하니까 업데이트를 못하게 되고 이건 어떻게 해결을 해야할지... binutils까지 건들게 되면 너무 멀리가는거 같아서 왠지 하기가 꺼려진다.

이건 뭐지... 결국 안되서 grub 홈페이지를 찾았다. 

그래서 다운로드 페이지에서 새 버전을 다운로드 받았다.
ftp://ftp.gnu.org/gnu/grub/

그래서 압축을 해제하고 진행을 했다.(중간에 좀 짤렸음)

[rtems@localhost Downloads]$ tar -xvzf grub-1.99.tar.gz 

[rtems@localhost Downloads]$ ls
grub-0.97.tar.gz  grub-1.99         qemu-0.15.1         rtems-boot.img
grub-1.94.tar.gz  grub-1.99.tar.gz  qemu-0.15.1.tar.gz  rtems-grub.cfg

압축을 성공적으로 해제하고 grub 폴더로 이동해서 ./configure 명령어를 실행했다.

[rtems@localhost Downloads]$ cd grub-1.99
[rtems@localhost grub-1.99]$ ls
ABOUT-NLS       ChangeLog         geninit.sh   Makefile.tpl       THANKS
acinclude.m4    conf              gentpl.py    Makefile.util.am   TODO
aclocal.m4      config.h.in       grub-core    Makefile.util.def  unicode
AUTHORS         configure         include      NEWS               util
autogen.sh      configure.ac      INSTALL      po
autom4te.cache  config-util.h.in  m4           README
BUGS            COPYING           Makefile.am  stamp-h.in
build-aux       docs              Makefile.in  tests
[rtems@localhost grub-1.99]$ ./configure
..................................................중간 생략...............................................................
configure: creating ./config.status
config.status: creating Makefile
config.status: creating grub-core/Makefile
config.status: creating grub-core/gnulib/Makefile
config.status: creating po/Makefile.in
config.status: creating docs/Makefile
config.status: creating util/bash-completion.d/Makefile
config.status: creating stamp-h
config.status: creating config.h
config.status: creating config-util.h
config.status: linking include/grub/i386 to include/grub/cpu
config.status: linking include/grub/i386/pc to include/grub/machine
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
*******************************************************
GRUB2 will be compiled with following components:
Platform: i386-pc
With devmapper support: No (need libdevmapper header)
With memory debugging: No
efiemu runtime: No (cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib)
grub-mkfont: Yes
*******************************************************

이건 뭔가 된거 같은데? make 명령어 후에 make install 명령어를 해보자.

[rtems@localhost grub-1.99]$ make
이거 되게 길다. 패스 하겠다.

[rtems@localhost grub-1.99]$ ls
00_header                       grub-mknetdir
10_linux                        grub-mkpasswd-pbkdf2
20_linux_xen                    grub-mkrelpath
30_os-prober                    grub-mkrescue
40_custom                       grub-probe
41_custom                       grub-reboot
ABOUT-NLS                       grub-script-check
acinclude.m4                    grub_script.tab.c
aclocal.m4                      grub_script.tab.h
AUTHORS                         grub_script.yy.c
autogen.sh                      grub_script.yy.h
autom4te.cache                  grub-set-default
BUGS                            grub-setup
build-aux                       grub-shell
ChangeLog                       grub-shell-tester
conf                            include
config.h                        INSTALL
config.h.in                     libgrub_a_init.c
config.log                      libgrub_a_init.lst
config.status                   libgrubkern.a
configure                       libgrubmods.a
configure.ac                    libgrubmods_a-grub_script.tab.o
config-util.h                   libgrubmods_a-grub_script.yy.o
config-util.h.in                libgrubmods_a-libgrub_a_init.o
COPYING                         libgrub.pp
docs                            m4
geninit.sh                      Makefile
gentpl.py                       Makefile.am
grub-bin2h                      Makefile.in
grub-core                       Makefile.tpl
grub-editenv                    Makefile.util.am
grub-fstest                     Makefile.util.def
grub_fstest-grub_fstest_init.o  NEWS
grub_fstest_init.c              po
grub_fstest_init.lst            README
grub_fstest.pp                  stamp-h
grub-install                    stamp-h1
grub-kbdcomp                    stamp-h.in
grub-menulst2cfg                tests
grub-mkconfig                   THANKS
grub-mkconfig_lib               TODO
grub-mkdevicemap                unicode
grub-mkfont                     update-grub_lib
grub-mkimage                    util
grub-mklayout

[rtems@localhost grub-1.99]$ make install
make  install-recursive
make[1]: Entering directory `/home/rtems/Downloads/grub-1.99'
Making install in grub-core/gnulib
make[2]: Entering directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make  install-recursive
make[3]: Entering directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make[4]: Entering directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make[5]: Entering directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
if test yes = no; then \
  case 'linux-gnu' in \
    darwin[56]*) \
      need_charset_alias=true ;; \
    darwin* | cygwin* | mingw* | pw32* | cegcc*) \
      need_charset_alias=false ;; \
    *) \
      need_charset_alias=true ;; \
  esac ; \
else \
  need_charset_alias=false ; \
fi ; \
if $need_charset_alias; then \
  /bin/sh /home/rtems/Downloads/grub-1.99/build-aux/install-sh -d /usr/local/lib ; \
fi ; \
if test -f /usr/local/lib/charset.alias; then \
  sed -f ref-add.sed /usr/local/lib/charset.alias > /usr/local/lib/charset.tmp ; \
  /usr/bin/install -c -m 644 /usr/local/lib/charset.tmp /usr/local/lib/charset.alias ; \
  rm -f /usr/local/lib/charset.tmp ; \
else \
  if $need_charset_alias; then \
    sed -f ref-add.sed charset.alias > /usr/local/lib/charset.tmp ; \
    /usr/bin/install -c -m 644 /usr/local/lib/charset.tmp /usr/local/lib/charset.alias ; \
    rm -f /usr/local/lib/charset.tmp ; \
  fi ; \
fi
make[5]: Nothing to be done for `install-data-am'.
make[5]: Leaving directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make[4]: Leaving directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make[3]: Leaving directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
make[2]: Leaving directory `/home/rtems/Downloads/grub-1.99/grub-core/gnulib'
Making install in .
make[2]: Entering directory `/home/rtems/Downloads/grub-1.99'
make[3]: Entering directory `/home/rtems/Downloads/grub-1.99'
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
  /usr/bin/install -c grub-bin2h grub-mkimage grub-mkrelpath grub-script-check grub-editenv grub-mkpasswd-pbkdf2 grub-fstest grub-mkfont grub-mklayout grub-menulst2cfg '/usr/local/bin'
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-bin2h': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-mkimage': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-mkrelpath': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-script-check': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-editenv': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-mkpasswd-pbkdf2': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-fstest': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-mkfont': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-mklayout': Permission denied
/usr/bin/install: cannot create regular file `/usr/local/bin/grub-menulst2cfg': Permission denied
make[3]: *** [install-binPROGRAMS] Error 1
make[3]: Leaving directory `/home/rtems/Downloads/grub-1.99'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/rtems/Downloads/grub-1.99'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/rtems/Downloads/grub-1.99'
make: *** [install] Error 2

make 명령어는 되는데 make install 명령어는 안되네? 이런 거지같은 상황은 뭐지?

근데 이걸 왜 했지? grub 컴파일을 한 이유가 뭐지? 이미 존재하는 걸 새로 해야 될지도 모르니까 한거 같기는 한데 너무 오랜 시간을 들인거 같은데?

영어 해석 (Qemu/Making a Boot Flooppy Disk)

The default grub.cfg file will attempt to read a GRUB configuration file called rtems-grub.cfg from the root directory of the harddisk.

기본 grub.cfg 파일은 GRUB 환경설정 파일을 읽으려고 시도하는데 하드디스크의 루트 디렉토리에서 rtems-grub.cfg을 불러온다.

This lets you create a specific GRUB configuration for you testing without needing to rebuild the floppy image.

이렇게 하면 플로피 이미지를 다시 빌드를 하지 않고 당신의 테스팅을 위한 특정 GRUB 환경설정을 만들 수 있다.

GRUB 사용법 설명 웹 페이지

http://blog.naver.com/mpls?Redirect=Log&logNo=40002216215

2004년 자료 내용이 길다.

http://blog.naver.com/da2mon?Redirect=Log&logNo=50001619038

2006년 자료 내용은 짧은데 괜찮은 듯 보인다.

http://chaotic21c.egloos.com/9180251

command line으로 부팅하기 라는 웹 페이지

http://docs.redhat.com/docs/ko-KR/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-grub-commands.html

redhat 자료인듯 한데 왠지 이게 알아 보라고 한건지는 잘 모르겠네

http://www.ibm.com/developerworks/kr/library/l-bootload.html

GRUB만 다룬 내용은 아니지만 괜찮은거 같아서 추가

http://qaos.com/article.php?sid=2196

grub 설정에 대한 내용

2011년 11월 13일 일요일

qemu 진행

[rtems@localhost bin]$ qemu -m 128 -boot a -fda /home/rtems/rtems-boot.img \
> -hda /home/rtems/hda.img -hdb fat:. -no-reboot -s

명령어를 풀로 다 적었을 때


















TAB 키 눌렀을 때와 ls 명령어를 넣었을 때
화면을 캡처

ls 명령어 눌렀을 때
(fd0) (hd0) (hd1) (hd1,1) (cd0) 가 보임




[rtems@localhost bin]$ qemu -m 128 -boot a -fda /home/rtems/rtems-boot.img \
> -no-reboot -s

위에 풀 명령어에서 fda 만 있고 hda와 hdb는 생략한 명령어


















TAB 키 눌렀을 때와 ls 명령어를 넣었을 때 
화면을 캡처

ls 명령어 눌렀을 때
(fd0) (cd0) 가 보임




문제를 해결하기 위해 참고해야 할 사이트 목록

http://www.rtems.com/wiki/index.php/Simulate_Serial_Communication_Application

http://www.rtems.com/wiki/index.php/RTEMS_Eclipse_Plug-in

http://www.rtems.com/wiki/index.php/Qemuprep

Building Grub

Grub-1.94 버전 빌드

[rtems@localhost grub-1.94]$ ./configure --prefix=/tmp/g2/build
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for cmp... cmp
checking for bison... bison
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for ruby... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for _LARGE_FILES value needed for large files... no
checking whether byte ordering is bigendian... no
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for void *... yes
checking size of void *... 4
checking for long... yes
checking size of long... 4
checking for __lzo_init_v2 in -llzo2... no
checking for __lzo_init_v2 in -llzo... no
checking for __lzo_init2 in -llzo... no
configure: error: LZO library version 1.02 or later is required

LZO 라이브러리 버전이 낮아서 문제인가... 일단 설치를 고고씽



[rtems@localhost grub-1.94]$ su -
Password:
[root@localhost ~]# yum install socat
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Package socat-1.7.1.3-1.fc14.i686 already installed and latest version
Nothing to do
[root@localhost ~]# yum install lzo-devel
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lzo-devel.i686 0:2.03-3.fc12 set to be installed
--> Processing Dependency: lzo-minilzo = 2.03-3.fc12 for package: lzo-devel-2.03-3.fc12.i686
--> Processing Dependency: libminilzo.so.0 for package: lzo-devel-2.03-3.fc12.i686
--> Running transaction check
---> Package lzo-minilzo.i686 0:2.03-3.fc12 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
lzo-devel i686 2.03-3.fc12 fedora 29 k
Installing for dependencies:
lzo-minilzo i686 2.03-3.fc12 fedora 13 k

Transaction Summary
================================================================================
Install 2 Package(s)

Total download size: 42 k
Installed size: 173 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 42 k
(1/2): lzo-devel-2.03-3.fc12.i686.rpm | 29 kB 00:00
(2/2): lzo-minilzo-2.03-3.fc12.i686.rpm | 13 kB 00:00
--------------------------------------------------------------------------------
Total 54 kB/s | 42 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lzo-minilzo-2.03-3.fc12.i686 1/2
Installing : lzo-devel-2.03-3.fc12.i686 2/2

Installed:
lzo-devel.i686 0:2.03-3.fc12

Dependency Installed:
lzo-minilzo.i686 0:2.03-3.fc12

Complete!

일단 lzo-devel 패키지 설치완료
그렇다면 이제 다시 Grub 빌드를 해보자.



[rtems@localhost grub-1.94]$ ./configure --prefix=/tmp/build
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for cmp... cmp
checking for bison... bison
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for ruby... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for _LARGE_FILES value needed for large files... no
checking whether byte ordering is bigendian... no
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for void *... yes
checking size of void *... 4
checking for long... yes
checking size of long... 4
checking for __lzo_init_v2 in -llzo2... yes
checking for lzo1x_999_compress... yes
checking lzo/lzo1x.h usability... yes
checking lzo/lzo1x.h presence... yes
checking for lzo/lzo1x.h... yes
checking lzo1x.h usability... no
checking lzo1x.h presence... no
checking for lzo1x.h... no
checking for wgetch in -lncurses... yes
checking ncurses/curses.h usability... yes
checking ncurses/curses.h presence... yes
checking for ncurses/curses.h... yes
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking for objcopy... objcopy
checking for strip... strip
checking for nm... nm
checking whether optimization for size works... yes
checking whether -falign-loops works... yes
checking whether objcopy works for absolute addresses... no
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils

이건 또 뭔 에러냐...


[root@localhost ~]# yum install binutils
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Package binutils-2.20.51.0.7-8.fc14.i686 already installed and latest version
Nothing to do
[root@localhost ~]# yum upgrade binutils
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Upgrade Process
No Packages marked for Update

이건 뭐 설치도 업데이트도 안되는데.... 어떻게 해결 하라는 건지....
이건 해결하고 싶어도 해결하기가 쉽지 않겠는데.. 현재 상태로는 이건 풀지 못할듯 일단 패스!

dd 명령어 옵션

기능 : 부트 플로피나 스왑파일을 만드는 특수한 복사를 위한 명령어이다.

사용법 : dd [옵션]

of=file : 표준출력대신 지정한 파일에 작성한다.
if=file : 표준입력대신 지정한 파일에서 불러들인다.
ibs=size : 지정한 사이즈만큼 읽는다.
obs=size : 지정한 사이즈만큼 쓴다.
bs=size : 지정한 사이즈만큼 읽고 쓴다.
count=n 입력블록의 ibs 크기만큼 복사한다.
conv=ascii : EBCDIC->ASCII로 변환
conv=ebcdic : ASCII->EBCDIC로 변환
conv=ibm : ASCII 코드호환을 EBCDIC 코드로 변환
conv=swab : 입력되는 두 바이트의 순서를 바꾼다. 입력파일에서 짝이 맞지 않는 하나의 비트가 남으면, 마지막 바이트는 단순히 복사된다.


----------------------------------------------------------------------------------


블록단위로 파일을 복사하거나 파일변환을 할 수 있는 명령어

dd의 입출력시에 사용되는 단위들
   c : 케릭터, 1byte
   w : 워드, 2bytes
   k : 키로 바이트, 1024bytes
   b : 블럭, 512bytes

주요옵션
bs=BYTES : 한 번에 BYTES씩 읽어 들이고 출력. ibs와 obs를 한 번에 지정한 것과 같음
cbs=BYTES : 한 번에 BYTES씩 변환 작업을 함
conv=CONVS : ,로 분리된 단어들을 파일로 변환
count=BLOCKS : 입력 블록의 ibs 크기만큼만 복사
ibs=BYTES : 입력 단위로 한 번에 BYTES 단위로 읽어 들임

if=FILE : 표준입력대신 지정한 파일을 입력으로 받음
obs=BYTES : 출력 단위로 한번에 BYTES 단위로 출력
of=FILE : 표준출력대신 지정된 파일에 출력
seek=BLOCKS : 출력 시작시 지정된 BLOCKS의 단위만큼 obs 크기를 건더뛰고 출력을 시작함
skip=BLOCKS : 입력 시작시 지정된 BLOCKS의 단위만큼 ibs 크기를 건너뛰고 입력을 시작함

ascii : EBCDIC 코드를 ASCII 코드로 변환함
ebcdic : ASCII 코드를 EBCDIC 코드로 변환함
ibm : ASCII 코드를 EBCDIC 코드로, EBCDIC 코드를 ASCII 코드로 변환함
block : cbs로 변환 작업과정에서 입력문자내에 있는 개행 문자들을 공백문자로 변환함
unblock : block와는 반대로 cbs로 변환 작업과정에서 입력 문자내에 있는 공백 문자들을 개행 문자로 변환함

lcase : 영문 대문자를 영문 소문자로 변환
notrunc : 출력 파일을 자르지 않고 출력
ucase : 영문 소문자를 영문 대문자로 변환
swap : 입력된 두 바이트를 바꿈
noerror : 입력 데이터를 읽을 때에 에러가 발생하더라도 계속 진행
sync : 입력된 ibs와 출력하는 obs 사이에 차이가 있을 경우 그 여백공간을 NULL 문자로 채움

부팅 디스크 제작
#fdformat /dev/포멧할장치   //포멧
#dd if=/boot/vmlinuz of=/dev/장치   //부팅디스크 제작

출처 : http://rooby.tistory.com/93