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

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

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

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