"GRUB"의 두 판 사이의 차이

오픈소스 비즈니스 컨설팅
둘러보기로 가기 검색하러 가기
 
(같은 사용자의 중간 판 8개는 보이지 않습니다)
31번째 줄: 31번째 줄:
 
* https://msdn.microsoft.com/en-us/library/cc144200(VS.85).aspx
 
* https://msdn.microsoft.com/en-us/library/cc144200(VS.85).aspx
  
==Grub2 for windows==
+
==GRUB2 for windows==
 +
 
 +
GRUB 사용시 부팅 프로세스
 +
* MBR (Master Boot Record, 512 bytes, 주파티션으로 설정할 것) 실행
 +
* /boot/grub/core.img 실행 : MBR 다음 1MB 영역 이내에 저장됨
 +
:* /boot/grub/grub.cfg : GRUB 설정 파일
  
 
/boot/grub/ 폴더 구조
 
/boot/grub/ 폴더 구조
* grub.cfg : Grub 설정 파일
+
* grub.cfg : GRUB 설정 파일
* core.img
+
* core.img :
 
* lnxboot.img
 
* lnxboot.img
  
42번째 줄: 47번째 줄:
 
  # path to the partition holding ISO images (using UUID)              #--- 주석
 
  # path to the partition holding ISO images (using UUID)              #--- 주석
 
  probe -u $root --set=rootuuid
 
  probe -u $root --set=rootuuid
  set imgdevpath="/dev/disk/by-uuid/$rootuuid"
+
  set imgdevpath="/dev/disk/by-uuid/$rootuuid"                         #--- 환경 변수 설정
  
 
vi  /EFI/boot/grub.cfg
 
vi  /EFI/boot/grub.cfg
 
  # Menu Entry Created by YUMI - (Your USB Multiboot Integrator)
 
  # Menu Entry Created by YUMI - (Your USB Multiboot Integrator)
 +
insmod png                                                          #--- png GRUB 모듈을 추가
 +
insmod part_msdos
 +
insmod fat
 +
insmod ntfs
 +
insmod ext2
 +
set root='hd0,msdos1'                                                #--- root 디바이스 이름
 +
set timeout=30                                                      #--- 디폴트 부팅을 하기전 대기하는 시간(초)
 +
                                                                      #--- 0. 즉시 실행, -1. 무한 대기
 +
 +
if loadfont /boot/grub/fonts/unicode.pf2 ; then                      #--- Font 로드
 +
    set gfxmode=640x480                                              #--- 화면 해상도 설정 (Default. auto)
 +
                                                                      #--- width * height, width * height * depth
 +
    insmod efi_gop                                                  #--- GRUB 모듈을 추가
 +
    insmod efi_uga
 +
    insmod vbe
 +
    insmod vga
 +
    insmod gfxterm
 +
    terminal_output gfxterm                                          #--- 출력할 터미널을 지정
 +
fi
 +
 +
if background_image /boot/grub/yumi.png ; then                      #--- 배경 이미지 로드
 +
    set color_normal=white/black                                    #--- 색상 지정
 +
    set color_highlight=yellow/dark-gray
 +
    set menu_color_highlight=yellow/black
 +
    set menu_color_normal=white/blue
 +
else
 +
    set menu_color_normal=white/blue
 +
    set menu_color_highlight=yellow/black
 +
fi
 +
 +
set default=1                                                        #--- 디폴트로 선택하는 메뉴 번호 (0, 1, 2, ...)
 +
 +
menuentry "[Reboot]" {reboot}                                        #--- 0번 메뉴
 +
 +
menuentry ">Linux Distributions"{configfile /multiboot/menu/linux.cfg} #--- 1번 메뉴. 새로운 메뉴 표시
 +
 +
vi  /multiboot/menu/linux.cfg
 +
# Menu Entry Created by YUMI
 
  insmod png
 
  insmod png
 
  insmod part_msdos
 
  insmod part_msdos
55번째 줄: 98번째 줄:
 
   
 
   
 
  if loadfont /boot/grub/fonts/unicode.pf2 ; then
 
  if loadfont /boot/grub/fonts/unicode.pf2 ; then
set gfxmode=640x480
+
    set gfxmode=640x480
insmod efi_gop
+
    insmod efi_gop
insmod efi_uga
+
    insmod efi_uga
 
     insmod vbe
 
     insmod vbe
 
     insmod vga
 
     insmod vga
insmod gfxterm
+
    insmod gfxterm
terminal_output gfxterm
+
    terminal_output gfxterm
 
  fi
 
  fi
 
   
 
   
 
  if background_image /boot/grub/yumi.png ; then
 
  if background_image /boot/grub/yumi.png ; then
  set color_normal=white/black
+
    set color_normal=white/black
  set color_highlight=yellow/dark-gray
+
    set color_highlight=yellow/dark-gray
      set menu_color_highlight=yellow/black
+
    set menu_color_highlight=yellow/black
      set menu_color_normal=white/blue
+
    set menu_color_normal=white/blue
 
  else
 
  else
  set menu_color_normal=white/blue
+
    set menu_color_normal=white/blue
  set menu_color_highlight=yellow/black
+
    set menu_color_highlight=yellow/black
fi
+
  fi
+
 
  set default=1  
+
  set default=2                                                        #--- 디폴트로 선택하는 메뉴 번호 (0, 1, 2, ...)
 
   
 
   
  menuentry "[Reboot]" {reboot}
+
  menuentry "[Reboot]" {reboot}                                       #--- 0번 메뉴
 +
menuentry "< Go back to the Main Menu"{configfile /EFI/BOOT/grub.cfg}
 +
#START LINUX DISTROS
 +
#start CentOS-7-x86_64-Minimal-1708
 +
menuentry "CentOS-7-x86_64-Minimal-1708" {
 +
    set gfxpayload=keep                                              #--- keep. gfxmode를 계속 사용하도록 지정
 +
    set isofile='/multiboot/CentOS-7-x86_64-Minimal-1708/CentOS-7-x86_64-Minimal-1708.iso'
 +
    loopback loop $isofile                                          #--- $isofile에 loop라는 디바이스 이름을 지정
 +
                                                                      #--- 이후 (loop)라는 디바이스 이름을 사용할 것
 
   
 
   
menuentry ">Linux Distributions"{configfile /multiboot/menu/linux.cfg}
+
    linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:LABEL=MULTIBOOT:/$isofile  #--- Linux로 부팅 합니다.
 +
    echo "Loading - This may take several seconds..."
 +
    initrd (loop)/isolinux/initrd.img                                #--- Linux 커널 이미지로 ramdisk를 초기화 합니다.
 +
}
 +
#end CentOS-7-x86_64-Minimal-1708
  
 
참고 문헌
 
참고 문헌
 +
* https://www.gnu.org/software/grub/manual/grub/grub.html
 
* https://wiki.archlinux.org/index.php/GRUB
 
* https://wiki.archlinux.org/index.php/GRUB
  
161번째 줄: 217번째 줄:
 
  bootrec /fixboot
 
  bootrec /fixboot
 
  bootrec /fixmbr
 
  bootrec /fixmbr
 +
 +
==GRUB Minimal Bash-Shell==
 +
 +
#--- Disk 조회
 +
ls
 +
 +
#--- 폴더 조회
 +
ls (hd0,msdos1)/
 +
 +
#--- 파일 내용 보기
 +
cat (hd0,msdos1)/파일명
 +
 +
#--- 설정값 조회
 +
set
 +
 +
#--- 설정값 지정
 +
set name=value
 +
 +
참고 문헌
 +
* https://aty.sdsu.edu/bibliog/latex/debian/grub2rescue.html
  
 
==참고 문헌==
 
==참고 문헌==

2018년 4월 13일 (금) 18:44 기준 최신판

GNU 프로젝트의 부트로더인 GNU GRUB(GRand Unified Bootloader)를 정리 한다.


autorun.inf

파일 구조

[section]
key=value

autorun.inf 샘플

[AutoRun]
icon=setup.exe,0                               #--- USB의 아이콘(~.ico)
label=My Drive Label                           #--- USB의 레이블
open=[exepath\]exefile [param1 [param2] ...]   #--- 자동 실행되는 프로그램. 보안상 USB에서는 동작 않음

UseAutoPlay=1
shellexecute=[filepath\]filename[param1, [param2]...] 

shell=verb                                     #--- USB의 shortcut menu를 자동으로 실행하도록 설정
shell\verb=MenuText                            #--- USB의 shortcut menu 이름
shell\verb\command=Filename.exe                #--- USB의 shortcut menu를 선택한 경우 실행할 파일

action=@[filepath\]filename,-resourceID
CustomEvent=MyContentOnArrival

참고 문헌

GRUB2 for windows

GRUB 사용시 부팅 프로세스

  • MBR (Master Boot Record, 512 bytes, 주파티션으로 설정할 것) 실행
  • /boot/grub/core.img 실행 : MBR 다음 1MB 영역 이내에 저장됨
  • /boot/grub/grub.cfg : GRUB 설정 파일

/boot/grub/ 폴더 구조

  • grub.cfg : GRUB 설정 파일
  • core.img :
  • lnxboot.img

vi /boot/grub/grub.cfg

configfile /EFI/boot/grub.cfg                                        #--- 설정파일 지정
# path to the partition holding ISO images (using UUID)              #--- 주석
probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"                         #--- 환경 변수 설정

vi /EFI/boot/grub.cfg

# Menu Entry Created by YUMI - (Your USB Multiboot Integrator)
insmod png                                                           #--- png GRUB 모듈을 추가
insmod part_msdos
insmod fat
insmod ntfs
insmod ext2
set root='hd0,msdos1'                                                #--- root 디바이스 이름
set timeout=30                                                       #--- 디폴트 부팅을 하기전 대기하는 시간(초)
                                                                     #--- 0. 즉시 실행, -1. 무한 대기

if loadfont /boot/grub/fonts/unicode.pf2 ; then                      #--- Font 로드
    set gfxmode=640x480                                              #--- 화면 해상도 설정 (Default. auto)
                                                                     #--- width * height, width * height * depth
    insmod efi_gop                                                   #--- GRUB 모듈을 추가
    insmod efi_uga
    insmod vbe
    insmod vga
    insmod gfxterm
    terminal_output gfxterm                                          #--- 출력할 터미널을 지정
fi

if background_image /boot/grub/yumi.png ; then                       #--- 배경 이미지 로드
    set color_normal=white/black                                     #--- 색상 지정
    set color_highlight=yellow/dark-gray
    set menu_color_highlight=yellow/black
    set menu_color_normal=white/blue
else
    set menu_color_normal=white/blue
    set menu_color_highlight=yellow/black
fi

set default=1                                                        #--- 디폴트로 선택하는 메뉴 번호 (0, 1, 2, ...)

menuentry "[Reboot]" {reboot}                                        #--- 0번 메뉴

menuentry ">Linux Distributions"{configfile /multiboot/menu/linux.cfg} #--- 1번 메뉴. 새로운 메뉴 표시

vi /multiboot/menu/linux.cfg

# Menu Entry Created by YUMI
insmod png
insmod part_msdos
insmod fat
insmod ntfs
insmod ext2
set root='hd0,msdos1'
set timeout=30

if loadfont /boot/grub/fonts/unicode.pf2 ; then
   set gfxmode=640x480
   insmod efi_gop
   insmod efi_uga
   insmod vbe
   insmod vga
   insmod gfxterm
   terminal_output gfxterm
fi

if background_image /boot/grub/yumi.png ; then
   set color_normal=white/black
   set color_highlight=yellow/dark-gray
   set menu_color_highlight=yellow/black
   set menu_color_normal=white/blue
else
   set menu_color_normal=white/blue
   set menu_color_highlight=yellow/black
 fi
 
set default=2                                                        #--- 디폴트로 선택하는 메뉴 번호 (0, 1, 2, ...)

menuentry "[Reboot]" {reboot}                                        #--- 0번 메뉴
menuentry "< Go back to the Main Menu"{configfile /EFI/BOOT/grub.cfg}
#START LINUX DISTROS 
#start CentOS-7-x86_64-Minimal-1708
menuentry "CentOS-7-x86_64-Minimal-1708" {
    set gfxpayload=keep                                              #--- keep. gfxmode를 계속 사용하도록 지정
    set isofile='/multiboot/CentOS-7-x86_64-Minimal-1708/CentOS-7-x86_64-Minimal-1708.iso'
    loopback loop $isofile                                           #--- $isofile에 loop라는 디바이스 이름을 지정
                                                                     #--- 이후 (loop)라는 디바이스 이름을 사용할 것

    linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:LABEL=MULTIBOOT:/$isofile   #--- Linux로 부팅 합니다.
    echo "Loading - This may take several seconds..."
    initrd (loop)/isolinux/initrd.img                                #--- Linux 커널 이미지로 ramdisk를 초기화 합니다.
}
#end CentOS-7-x86_64-Minimal-1708

참고 문헌

설정 가이드

Windows용 설정 가이드

Ubuntu용 설정 가이드

CentOS용 설정 가이드

  • grub 설치
yum -y install grub
  • 설치 폴더 및 파일
/boot/grub/                    #--- 설치 폴더
vi /boot/grub/grub.conf        #--- 설정 파일
vi /boot/grub/divice.map       #--- 장치
/boot/~.img                    #--- Booting images
/boot/grub/~.lst               #--- Help files
/sbin/grub, grub-install, grub-md5-crypt, grub-terminfo, grubby

  • GRUB 2용 폴더
/etc/default/grub/
/etc/grub.d/
  • vi /boot/grub/grub.conf
   #--- 첫번째 엔트리(0, 여기서는 첫번째 title)에서 부트
   default=0
   #--- 5초 후 자동 부팅
   timeout=5
   #--- 디폴트 엔트리에 문제가 있어 부팅이 되지 않을 경우
   #--- 두번째 엔티리(1)에서 부트
   fallback 1
   #--- 부트 화면의 배경이미지, 여기서는 xpm 형태의 그림이미지 사용
   splashimage=(hd0,0)/grub/splash.xpm.gz
   #--- 부팅 메뉴 보이지 않기
   hiddenmenu
   #--- 첫번째 엔트리
   title CentOS (2.6.18-164.el5)
       #--- 첫번째 하드 디스크(hd0)의 첫번째 파티션(0)을 루트 디렉토리로 한다.
       root (hd0,0)
       #--- /vmlinuz-2.6.18-164.el5 : 커널 이미지, /boot 파티션을 따로 잡았을 경우
       #--- /root/vmlinuz-2.6.18-164.el5 : 커널 이미지, /boot 파티션을 따로 잡지 않았을 경우
       #--- root=/dev/VolGroup00/LogVol00 : root 파티션 명
       #--- rhgb quiet : 커널에 전달하는 파라메터
       kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
       #--- 초기화에 필요한 이미지
       initrd /initrd-2.6.18-164.el5.img
   #--- 두번째 엔트리
   title CentOS (2.6.18-128.el5)
       root (hd0,0)
       kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
       initrd /initrd-2.6.18-128.el5.img
   #--- 세번째 엔트리
   title DOS
       #--- Windows가 설치된 디바이스, 파티션
       rootnoverify (hd0,0)
       #--- Windows 부팅 호출
       chainloader +1

사용자 가이드

명명 규칙

  • (hd0,4)
  • fd : 플로피 디스크, fd0, 첫번째 플로피 디스크 (Linux에서는 /dev/fd0)
  • hd : 하드 디스크, hd0. 첫번째 하드 디스크 (Linux에서는 /dev/hda)
  • 4 : 5번째 파티션 (Linux에서는 /dev/hda4)

지원 파일 시스템

  • ext2, ext3, ReiserFS, JFS, FAT, minix, FFS 파일시스템을 지원
  • GRUB 2에서는 LVM도 지원

관리자 가이드

Windows MBR 복구

  • Grub 2가 하드 디스크의 MBR에 설치 되었을 경우 복구 하는 방법은 다음과 같다.
  • Windows XP에서 복구 방법
  • Windows XP CD의 복구 모드로 부팅한 후, 도스창에서 다음 명령을 실행 한다.
fixboot
fixmbr
  • Windows Vista 이상에서 복구 방법
  • Windows Vista CD의 복구 모드로 부팅한 후, 도스창에서 다음 명령을 실행 한다.
bootrec /fixboot
bootrec /fixmbr

GRUB Minimal Bash-Shell

#--- Disk 조회
ls

#--- 폴더 조회
ls (hd0,msdos1)/

#--- 파일 내용 보기
cat (hd0,msdos1)/파일명

#--- 설정값 조회
set

#--- 설정값 지정
set name=value

참고 문헌

참고 문헌