顯示具有 UEFI 標籤的文章。 顯示所有文章
顯示具有 UEFI 標籤的文章。 顯示所有文章

Make a NanoBSD for GPT scheme on Freebsd9.0 RC1 + UEFI on VirtualBox

1. get freebsd 9.0 rc1, then install all srouce code

2. Install dmidecode ports on FreeBSD 9.0 RC1
    Path : /usr/local/sbin/dmidecode
  • # cd /usr/ports/sysutils/dmicode/
  • # make install clean
  • # ./usr/loacl/sbin/dmidecode | grep Name
    • Product Name : VirtualBox
3. Modify /usr/src/sys/amd64/amd64/machdep.c to add the string as follows
  • strncmp(sysenv, "VirtualBox", 10)  == 0 || 
4. Compile your kernel
  • # cd /sys/amd64/conf
  • # cp GENERIC NASBSD9
  • # ee NASBSD9
    • or put the file of NASBSD9 to /home/backup, and set soft link
      • #cd /usr/src/sys/amd64/conf
      • #ln -s /home/backup/NASBSD9
  • To compile your kernel
    • # cd /sys/amd64/conf
    • # config NASBSD9
    • # cd ../compile/NASBSD9
    • # make depend
    • # make
    • # make install
    • # reboot
    • # uname -a
5. Installing GRUB2
  1. Create an EFI system partition
    • On Ubuntu 11.10
      • $ apt-get install gdisk ufsutils
      • $ gdisk /dev/sdx 
      • EF00 
      • using 'gdisk' to partition an GPT format disk with an EFI system partition.
      • $ mkfs.vfat -F32 /dev/sdx1
    • On FreeBSD 8/9
      • # gpart create -s GPT /dev/adax








// ref to solve efi booting
// need to add product name from smibios, ex:VirtualBox
http://forums.freebsd.org/showthread.php?t=12198


//must to format FAT32 on flash disk in order to access EFI system for montherboard boot up.
mkfs.vfat -F32 /dev/sdc1

gpart create GPT /dev/ada0




build grub1.99 rc1


./configure LEX=/usr/local/bin/flex --with-platform=efi --target=x86_64
  • LEX=/usr/local/bin/flex
    • I installed the latest port (flex-2.5.35_4) from /usr/ports/textproc/flex
  • cd /usr/ports/lang/gcc44 
    • make install


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

// 宣告一塊虛擬memory disk -> md0
#mdconfig -a -t vnode -f _.disk.image

// 將_.disk.image 掛載在/mnt
#mount /dev/md0a /mnt

// 卸載 md0
#mdconfig -d -u 0

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

// Make a cpio+gz image
$find . | cpio -ocvB | gzip > /usr/src/tools/tools/nanobsd/nanobsd.cpio.gz

解壓縮
$gzip -dc folder1.cpio.gz | cpio -idv

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

mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk
mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/

Read more: http://www.linuxscrew.com/2010/03/24/fastest-way-to-create-ramdisk-in-ubuntulinux/#ixzz1ciIwVOz3

UEFI Firmware

ref: http://www.thinkwiki.org/wiki/UEFI_Firmware



Contents

[hide]

UEFI Firmware

UEFI (Unified Extensible Firmware Interface) is a modernized replacement to BIOS (Basic Input/Output System). The specification is maintained by the collaborative non-profit UEFI Forum. UEFI is supported by both recent versions of both Linux and Windows. UEFI firmware with legacy BIOS support has started appearing on Sandybrige (220,420,520,etc.) Thinkpads. On supported machines, the firmware configuration utility (Thinkvantage->F1 on machine startup) has the option of enabling one or both UEFI/BIOS as well as providing the option to specify the order with which the machine tries to boot.

Current Status

Though the specification has been around since the late '90s, UEFI only recently started appearing on commodity hardware. Macs are a slight exception, though they do not strictly adhere to the UEFI standard. Linux can boot as usual in BIOS mode, however the ELILO boot loader or recent versions of Grub 2 are necessary to boot in UEFI mode. Linux 3.0-rc1 is reported to successfully boot in UEFI mode (details below), but older versions hang after the kernel gets loaded by grub.

Enabling UEFI boot in Debian

The following are steps to successfully boot in pure UEFI mode ("UEFI only" startup config menu). There are likely some that are redundant or unnecessary.
  1. Install 64-bit Debian in BIOS mode to an MBR partitioned disk.
  2. Install Kernel 3.0-rc1 or later. Enable CONFIG_EFI,CONFIG_FB_EFI,CONFIG_EFI_VARS,CONFIG_EFI_PARTITION.
  3. Create a small ~ 200MB Partition formatted to fat32 and enable the "boot" flag. The first partition is a good choice, but is not strictly required. The "boot" flag is also likely superstitious.
  4. Burn some form of live cd that allows you access your Debian install in case something goes wrong and you are unable to boot.
  5. Mount the fat32 partition at /boot/efi
    sudo mkdir /boot/efi
    sudo mount /dev/sda1 /boot/efi
  6. Install the efi version of grub
    aptitude install grub-efi-amd64
  7. Now run grub-install (ignore warnings about efivars)
    sudo grub-install /dev/sda
    sudo update-grub
  8. This should have created /boot/efi/efi/debian/grubx64.efi. In order to make this actually work without running efibootmgr (which is not possible in bios mode), just copy it to /boot/efi/efi/boot/bootx64.efi
    sudo mkdir /boot/efi/efi/boot/
    sudo cp /boot/efi/efi/debian/grubx64.efi /boot/efi/efi/boot/bootx64.efi
  9. Reboot, enter the Thinkvantage menu and set "UEFI only" or "UEFI First". Hopefully you still get a grub menu and it will actually boot the 3.0 kernel. Older kernels appear to freeze with a blank screen as soon as grub loads them.

Links

Combine GRUB2, GPT, UEFI and NanoBSD on Ubuntu 11.04 ?


1. Installing Ubuntu 11.04
  • please change sources.list with apt-get install from ... 
  • tw.archive.ubuntu.com  ->  mirror.nttu.edu.tw
2. Installing ufsutils/gdisk package ...

  • apt-get install ufsutils
  • apt-get install gdisk
3. Partition your hard drive
  • my plan as follows.
    • /dev/sdb1 -> EFI system partition "EF00"
    • /dev/sdb2 -> NanoBSD #1 "A500"
    • /dev/sdb3 -> NanoBSD #1 "A500"
    • /dev/sdb4 -> Data "A503"
  • gdisk /dev/sdb 
  • ...
  • mkfs.vfat -F32 /dev/sdb1
  • mkfs.ufs -O 2 /dev/sdb2
  • mkfs.ufs -O 2 /dev/sdb3
  • mkfs.ufs -O 2 /dev/sdb4
4. Mount EFI system partition
  • mkdir /boot/efi
  • mount /dev/sdb1 /boot/efi
  • mkdir -p /boot/efi/efi
5. Install grub for efi
  • apt-get install grub-efi-amd64
6. Setup your grub2 into the EFI system partition
  • modprobe dm-mod
  • grub-install --boot-directory=/boot/efi/efi --bootloader-id=GRUB2 --no-floppy --recheck
  • cp /usr/share/grub/unicode.pf2 /boot/efi/efi/grub/
  • cp /boot/grub/grub.cfg /boot/efi/efi/grub/grub.cfg
    • grub.cfg context as follows.
      • insmod ufs2
      • set root='(hd0,1,a)'
      • search --no-floppy --fs-uuid --set 4ea7f1272cbdb23e
      • echo Loading kernel of FreeBSD kernel ...
      • kfreebsd /boot/kernel/kernel
      • kfreebsd_loadenv /boot/device.hints
      • set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ad0s1a
      • set kFreeBSD.vfs.root.mountfrom.options=rw
      • ...
7. Copy my old grub.cfg and seting up the EFI boot entry.
  • modprobe efivars
  • efibootmgr --create --gpt --disk /dev/sdb --part 1 --write-signature --label "GRUB2" --loader "\\EFI\\grub\\grub.efi"
note. GRUB2 is the entry that would appear on the EFI bootloader










Linux_Windows_BIOS_UEFI_boot_USB


https://gitorious.org/tianocore_uefi_duet_builds/pages/Linux_Windows_BIOS_UEFI_boot_USB



Manual setup of UEFI, GPT and GRUB2

http://jkyamog.blogspot.com/2011/09/manual-setup-of-uefi-gpt-and-grub2.html

虹光大成就-密教灌頂(一)