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 컴파일을 한 이유가 뭐지? 이미 존재하는 걸 새로 해야 될지도 모르니까 한거 같기는 한데 너무 오랜 시간을 들인거 같은데?

댓글 없음:

댓글 쓰기