'rEFInd'에 해당되는 글 1건

  1. 2018.05.15 old mac에 linux 설치하기 2

old mac에 linux 설치하기

Personal Computer/MacBook 2008 2018. 5. 15. 11:16 posted by tolkien

가지고 있는 macbook 2008 early model은 64bit cpu이지만, 32bit EFI BIOS여서 mac OS update에서 버림받았다. 그래도 그럭저럭 쓰다가 이젠... 사파리, 크롬도 못 쓰고, firefox 32bit 간신히 사용중인 상태에서 얼마전부터 ssh로 접속 안되는 곳이 생기기 시작. 아마 openssl issue로 추정. 그외 다수...라는 핑계로 mac OS 버리고 linux로 이주 결정.

 

가지고 있는 mac book 사양:

 - macbook 2008 + 2.5G RAM

 - DVD/CD ROM이 뭔가 읽어본지 꽤 되었고, 멀쩡한 음악CD를 읽지 못하는 것으로 보아 못씀.

 - mac OS 10.7.5

더보기

http://mirror.kakao.com/.../ubuntu-18.04-desktop-amd64.iso 여기서 다운로드 받은 iso 파일을 ...

맥에서

ubuntu.iso 로 이름 바꾼 다음에 ..

hdiutil convert -format UDRW -o ubuntu.img ubuntu.iso
하면 ubuntu.img.dmg 파일이 나오는데, 이걸 ubuntu.img 로 이름 바꾸고 ..
usb 메모리를 usb 포트에 꽂고 diskutil list 하면 usb 파티션이 어딘지 나와요. (저는 /dev/disk3 ... )
그러면 diskutil unmountDisk /dev/disk3 하면 언마운트 됐다고 나오고 ...

sudo dd if=ubuntu.img of=/dev/disk3 bs=10m

라고 하고 기다리면 돼요..

그리고 리부팅하면서 option 키 누르고 있으면 부팅 미디어 선택 가능한데, 그때 USB 를 선택하면 되고 ..

파티션 나눌 때 /efi 파티션을 아마 몇백메가 만들어야 할 거에요 ...

뭐 따로 설치하거나 ... efi 파일을 복사하거나 .. 하지 않아도 요즘 건 거의 다 돼요 ...

 

어쨌든 내 macbook은 안된다. 일단, boot media로 인식하지 못한다. rufus, unetbootin등 다 해봤지만, 어쨌든 usb로 booting하는데 실패했다. 그러다가, custom efi binary를 써서 booting하는 방법을 따라해보니 된다. 이에 전산고고학을 전공하시는 후학을 위해서 간략하게 기록해본다.

 

boot-linux-from-usb-flash-drive-on-macbook의 본문에 있는 내용보다 댓글 마지막에 제공하는 link가 더 잘 되는 것같다. (linux 환경에서 하는 것을 추천한다. 닭이던 달걀이던)

1. usb memory disk에 GPT partition을 만든다. sdX는 sda, sdb, ...

  dd if=/dev/zero of=/dev/sdX bs=10M 으로 깨끗하게 밀어버리고 하는 것을 추천한다.

  gdisk로 GPT partition으로 disk map을 쓴다고 선언하고 (use blank GPT),

  partition 하나를 만든다. type은 0700 (Microsoft Basic Data)

2. mkfs.vfat -F 32 /dev/sdX1 로 포맷

3. mkdir -p /mnt/1; mount /dev/sdX1 /mnt/1 으로 mount한 다음

   mkdir -p /mnt/1/elf/boot 로 directory 생성

4. /mnt/1/elf/boot directory에 파일 복사.

   -

UEFI_boot_from_ISO.zip
다운로드

   - boot.iso는 linux 설치배포 iso image

   최종적으로 usb memory에 다음처럼 있으면 된다.

  /efi/boot/bootX64.efi
  /efi/boot/bootIA32.efi
  /efi/boot/boot.iso
더보기
Ubuntu-based ISOs and those that contain a \boot\grub\loopback.cfg file can be easily UEFI-booted to just by copying some files, no menu is needed!
 
1. Format a FAT32 USB flash drive (e.g. using RMPrepUSB)
2. Make a \efi\boot directory on the flash drive
3. Copy your Ubuntu-based ISO file (must be <4GB) to the \efi\boot directory and rename it as boot.iso
4. Extract the .efi files from the UEFI_boot_from_ISO.zip file and copy them to the \efi\boot directory
 
FAT32 volume
===========
\efi\boot\bootX64.efi
\efi\boot\bootIA32.efi
\efi\boot\boot.iso
 
Note: \efi\boot is lowercase and boot.iso is lowercase.
 
That's it!
 
Now you should be able to UEFI-boot (32-bit and 64-bit) from the USB flash drive (disable Secure Boot in the BIOS options first).
 
To use a different Ubuntu-based ISO which should contain a \boot\grub\loopback.cfg file, simply replace the boot.iso file.
 
A 64-bit version of Ubuntu will not boot on a 32-bit UEFI system. Use a 32-bit Ubuntu ISO on a 32-bit UEFI system and a 64-bit UEFI ISO on a 64-bit UEFI system.
 
This tutorial is based on an article here, but the.efi files in my download have been patched by me to load the loopback.cfg file and so ensure reliable booting.
 
 

In depth

The .efi file contains a version of grub2 with an embedded grub menu
 
The grub2 variable iso_path must be set before loopback.cfg is called (and exported).
 
An example of a simple embedded menu which boots to the loopback.cfg file inside the boot.iso is:
 
set efi_machtype='x86_64'
export efi_machtype
set efi_arch='EFI64'
export efi_arch
fix_video
set grub2efi_intel_gma_patch='enabled'
export grub2efi_intel_gma_patch
fakebios
set grub2efi_fakebios='generic'
export grub2efi_fakebios
 
set boot_iso='/efi/boot/boot.iso'
export boot_iso
set iso_path=${boot_iso}
export iso_path
 
set real_root=${root}
export real_root
set real_prefix=${prefix}
export real_prefix
 
loopback loop (${real_root})${boot_iso}
set root=(loop)
set gfxpayload=keep
configfile /boot/grub/loopback.cfg
boot
 
 
A typical Ubuntu menu entry inside loopback.cfg inside boot.iso would be:
 
menuentry "Try Ubuntu without installing" {
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} quiet splash ---
initrd /casper/initrd.lz
}
 
 
Note that no persistent parameter is specified in the loopback.cfg, which prevents us from booting with persistence...:-(


그후, option key를 눌러서 boot media을 EFIboot로 선택하면 booting 된다. 안되면 다른 글을 찾아볼 것. 여기서 커피 한잔. 이제 시작한 거다.

설치는 다른 얘기다.
1. 배포폰 + 32/64bit 조합만으로 많은 삽질이 있었다.
2. 일반 pc처럼 mac OS -> grub로 얌전하게 booting되지 않는다.
   -> rEFInd라는 emulator를 설치해주어야 한다.
3. 나는 겪지 않았지만, 주변장치관련 잡다한 작업이 필요할 수 있다고 한다.

 

일반 PC와 달리 rEFInd를 설치할 partition이 필요하다. ubuntu 설치 usb로 booting후 바로 설치로 들어가는 것이 아니라 terminal을 열고 partition을 만들고 파일을 복사해주어야 한다.

- 설치할 disk가 sdb라고 한다면

- gdisk /dev/sdb 해서 GPT partition map을 쓴다고 선택한 다음

   100M size의 partition을 만든다. type은 ef00 (EFI system)

- mkfs.vfat -F32 /dev/sdb1 으로 format 후 mount

  mkdir -p /boot/temp-efi

  mount /dev/sdb1 /boot/temp-efi

- rEFInd 를 설치한다.

refind-bin-0.7.7.zip
다운로드

# mkdir ~/rEFInd/ && cd ~/rEFInd/
# wget http://downloads.sourceforge.net/project/refind/0.7.7/refind-bin-0.7.7.zip
# unzip refind-bin-0.7.7.zip
# cd refind-bin-0.7.7/
# ./install.sh

 잘 설치되었으면, 다음으로 마무리

# cd /boot/temp-efi # Or wherever you mounted your UEFI partition
# mv EFI/refind/ EFI/boot/ # Rename the directory
# mv EFI/boot/refind_ia32.efi EFI/boot/boot.efi # Rename the file

 

그리고, ubuntu 설치로 들어가서 설치하는데, 설치할 disk 선택시 전부 쓰기를 선택하면 만들었던 rEFInd partition이 날라간다. 따라서, 설치할 partition을 수동으로 만들어주어야 한다.

 

그외...

나는 ubuntu 12.04.5 64bit desktop을 먼저 설치한 다음, 14.04 -> 16.04로 단계적으로 upgrade했다.

- Fedora Live는 boot 초반에 grub console로 떨어진다. 뭔가 문제가 있겠지.

- ubuntu 16.04 desktop 32/64bit 둘 다 설치후반 grub 설치에서 error 나오고 멈춤.

 

참고 site :

 1. boot-linux-from-usb-flash-drive-on-macbook

 2. 136 - UEFI-boot directly from Ubuntu-based ISO files

 3. Linux-only installation on a 2006 Macbook using rEFInd