WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: UEFI Boot  (Read 95440 times)

Offline genec

  • Full Member
  • ***
  • Posts: 240
Re: UEFI Boot
« Reply #45 on: June 21, 2012, 08:12:03 AM »
Having said that, it's only a question of time before all new pc's use EFI, I would say at least withing two years.
Most systems I've seen made in the last 1-2 years are uEFI capable.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #46 on: June 21, 2012, 08:12:35 AM »
Code: [Select]
ioreg -l -p IODeviceTree | grep firmware-abi
..from a mac terminal will show it, but yes, the 32bit one is BOOTIA32.EFI


Offline genec

  • Full Member
  • ***
  • Posts: 240
Re: UEFI Boot
« Reply #47 on: June 21, 2012, 08:15:06 AM »
Since the laptop boots from the usb stick (albeit with uefi v2.x), you'd think the mac would boot from the same usb stick (albeit with efi v1.x).
If I recall correctly, they are quite different in certain aspects, hence the name and major version change.  From what I remember, EFI left too much up to the implementer to fudge with while uEFI "leveled the playing field" by ensuring consistency.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #48 on: June 21, 2012, 06:05:53 PM »
Juanito,  LABEL's should work just as good and will be more flexible then UUID's I believe (well am hoping we don't need to go either of those routes).   Some efi boot loaders use the find function to overcome this.

elilo has pre-built binaries available,  this just need renaming bootx64.efi  and works well, except with tc's initrd.

I have found that Installing the boot loader at (USB_Stick)/EFI/BOOT/BOOTX64.EFI on a gpt partition formatted with either FAT or HFS+ (while Fat32 is not case sensitive capitalization is a wise fall back method),  the obscure Apple efi will list the USB as a choice to boot without needing for either rEFIt or refind, Bless or anything else.  Place the USB stick in the mac and hold "Option Key" during boot.

Grup is expected in (USB_Stick)/BOOT/GRUB/grub.efi   but with refind installed to the USB stick it will find any kernel or boot loader no matter how deep you bury it (within reason).  Additionally, refind will boot the linux kernel directly (without any boot loader required) as long as the kernel has been compiled with the efi stub enabled (I think available only from 3.3..0 onwards   whilst kernels since 2.6.34 which are efi aware will need a boot loader apparently).   


I have yet to boot tc from a USB stick on a UEFI mac despite having all these tools and options available.   :(

I did find an interesting distro which after extracting to the gpt/FAT32 USB stick booted immediately on my mac, and has some very interesting cfg file(s)  ( check out grml small )

Am not 100% sure but the issue appears to be related to extracting the file system to memory.   So am wondering if we can specify the starting location for creation of the ram disk in memory? 
« Last Edit: June 21, 2012, 11:23:18 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #49 on: June 21, 2012, 08:07:30 PM »
Not wanting to jump the gun here,, but I think we have a solution :)   the noefi boot option allowed both the kernel and initrd to finish loading without crashing.    Working on fixing the black video now.

Hav installed to the USB stick

refind
grub 1.99-21
core
core64
vmlinuz
vmlinuz64
« Last Edit: June 21, 2012, 11:22:45 PM by coreplayer2 »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #50 on: June 22, 2012, 05:43:30 AM »
So - despairing of ever finding a way to make this work, I recompiled the core64 kernel with only the following changes:
Code: [Select]
CONFIG_EFI=y
CONFIG_FB_EFI=y
CONFIG_EFI_VARS=y
CONFIG_EFI_PARTITION=y
..and the mac mini boots from power-on <alt gr> and I get a display, usb keyboard/mouse and (icing on the cake) the ahci driver loads automatically  8)

From dmesg:
Code: [Select]
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000008e000 (usable)
 BIOS-e820: 000000000008e000 - 0000000000090000 (reserved)
...
 BIOS-e820: 0000000100000000 - 000000026fe00000 (usable)
NX (Execute Disable) protection: active
EFI v1.10 by Apple
 ACPI=0x8ad8e000  ACPI 2.0=0x8ad8e014  SMBIOS=0x8ad3b000
Kernel-defined memdesc doesn't match the one from EFI!
EFI: mem00: type=7, attr=0x80000000000000f, range=[0x0000000000000000-0x000000000008e000) (0MB)
EFI: mem01: type=0, attr=0x80000000000000f, range=[0x000000000008e000-0x0000000000090000) (0MB)
EFI: mem02: type=7, attr=0x80000000000000f, range=[0x0000000000090000-0x00000000000a0000) (0MB)
EFI: mem03: type=2, attr=0xf, range=[0x0000000000100000-0x0000000000d1f000) (12MB)
...
EFI: mem304: type=11, attr=0x8000000000000000, range=[0x00000000ffed0000-0x00000000fff00000) (0MB)
DMI 2.4 present.
DMI: Apple Inc. Macmini5,3/Mac-7BA5B2794B2CDB12, BIOS MM51.88Z.0077.B10.1201241549 01/24/2012
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
...
efifb: probing for efifb
efifb: framebuffer at 0x91000000, mapped to 0xffffc90009e00000, using 5120k, total 5120k
efifb: mode is 1280x1024x32, linelength=5120, pages=1
efifb: scrolling: redraw
efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
Console: switching to colour frame buffer device 160x64
fb0: EFI VGA frame buffer device
...
EFI Variables Facility v0.08 2004-May-17
...
fb: conflicting fb hw usage inteldrmfb vs EFI VGA - removing generic driver
fbcon: inteldrmfb (fb1) is primary device
fbcon: Remapping primary device, fb1, to tty 1-63
fb1: inteldrmfb frame buffer device
drm: registered panic notifier
input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input12
ACPI: Video Device [IGPU] (multi-head: yes  rom: no  post: no)
[drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0

So far everything seems to be working - I still need to mess with HDA Analyser to get sound line out, but otherwise OK.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #51 on: June 22, 2012, 06:32:18 AM »
To summarise:

Dell Latitude E6220 UEFI:
Code: [Select]
EFI v2.00 by American Megatrends
 ACPI 2.0=0xdffff98  SMBIOS=0xc8846f98
..will boot both stock and efi modified tinycore kernel from usb stick (hd not tested as ntfs)

Apple Mac Mini EFI:
Code: [Select]
EFI v1.10 by Apple
 ACPI=0x8ad8e000  ACPI 2.0=0x8ad8e014  SMBIOS=0x8ad3b000
..will boot efi modified tinycore kernel from hd and usb stick

All tests using grub from bzr 20-Jun-12 (grub2~beta6)

Compiled with:
Code: [Select]
./configure --prefix=/usr/local --with-platform=efi --target=x86_64
..and installed with:
Code: [Select]
$ sudo x86_64-grub-install --target=x86_64-efi --boot-directory=/mnt/sdb1/EFI/BOOT --efi-directory=/mnt/sdb1 --removable
grub.cfg as follows:
Code: [Select]
$ cat /mnt/sdb1/EFI/BOOT/grub/grub.cfg

search --no-floppy --fs-uuid --set=root e94de7a3-149b-4554-bc02-6129467534a9

menuentry "core64" {
  linux /boot/vmlinuz64 quiet noswap waitusb=10 tce=sdb2 tz=GMT-4 host=boxdell blacklist=bcma blacklist=ssb blacklist=b43
  initrd /boot/core64.gz
}

usb stick partitioned using gdisk:

partition 1: ef00 efi system formatted vfat
partition 2: 0700 linux/windows data formatted ext2
« Last Edit: June 22, 2012, 06:38:10 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #52 on: June 22, 2012, 04:32:36 PM »
Finally, Juanito cracked it!!!!   Great job,   8)



Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #53 on: June 23, 2012, 12:47:17 AM »
Hav installed to the USB stick

refind
grub 1.99-21
core
core64
vmlinuz
vmlinuz64

On the mac (with 64bit efi) neither the stock nor efi modified tinycore 32bit kernels will boot. The stock 64bit kernel will not boot, but the efi modified 64bit kernel does boot.

On the dell (with 64bit uefi), all four 32bit/64bit stock/efi modified kernels will boot, but only the 64bit efi modified kernel shows "Kernel-defined memdesc doesn't match the one from EFI!" and efifb messages in dmesg.

The above makes me wonder if the dell uefi boot "fakes" a bios for a non-efi kernel and/or non 64bit kernel.

So you finally got the usb stick boot to work then?

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #54 on: June 23, 2012, 02:02:51 AM »
No I didn't :(   I managed only to load the kernels and initrd without crashing but that's as far as I have manged to get with core. However I believe I can loop mount the 32 bit and x64 ISO, just need more time.  The grub version I've listed above appears to be compatible,  It's clear we need an efi configured kernel,  I believe those from 2.6.35 (?) and up are good,  I was contemplating getting a new kernel and attempt to build it with efi stub loader support to discard grub entirely, you know that is coming..

If you have compiled a 64 bit kernel with standard core configuration + efi  from 3.0.21  then we'd be really grateful for a copy  ;D 

Or are there plans to upload the new x64 kernel supporting efi to the core download site ??

I never had any doubt about booting tinycore after the kernel from grml64 with it's ramdisk copied to a USB just booted up with the minimal grub configuration, of course was using refind as a boot manager and grug 1.99-21 for the boot loader.  In fact I'm really content with refind as a boot manager, am thinking about a custom gui for it already.
« Last Edit: June 23, 2012, 02:18:24 AM by coreplayer2 »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #55 on: June 23, 2012, 03:33:14 AM »
No I didn't :(   I managed only to load the kernels and initrd without crashing but that's as far as I have manged to get with core.

How do you know - unless you're using ssh from another machine?

Without efifb enabled in the tinycore kernel, I'd have thought you'd get a blank screen from the time you boot from the grub-efi prompt until graphics-3.0.21-tinycore64 loads "onboot"...

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #56 on: June 23, 2012, 03:54:25 AM »
Well there is always the headless connection approach thanks, I was thinking next plan was to insmod the video modules and fonts.

via this handy script


insmod efi_gop
insmod efi_uga
insmod font

if loadfont ${prefix}/unicode.pf2
then
    insmod gfxterm
    set gfxmode=auto
    set gfxpayload=keep
    terminal_output gfxterm
fi

Though iirc you had gone that route earlier without any success, it's still an option though I guess.

Am really liking the idea of loop booting the ISO   meanwhile I have work to do  lol
:)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #57 on: June 23, 2012, 03:56:56 AM »
And Juanito  thanks for persevering, I know this has been a lot of hard work  Am glad you made headway, it is greatly appreciated

You deserve a beer or two :)

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14798
Re: UEFI Boot
« Reply #58 on: June 23, 2012, 04:07:36 AM »
via this handy script

If grub-efi is installed as mentioned below, this is enough to switch the grub-efi display
Code: [Select]
loadfont unicode
insmod efi_gop
set gfxterm=auto
terminal_output gfxterm
..but, in my testing at least, on booting the kernel, the display will be blank without efifb enabled until graphics-3.0.21-tinycore64 loads.

When efifb is enabled in the kernel, then the tinycore image and boot messages appear

..such as:
Code: [Select]
irq17: nobody cared (try booting with the "irqpoll" option)
handles:
[<ffffffffa001d105>] ffffffffa001d105
Disabling IRQ #17
..but things still seem to work
« Last Edit: June 23, 2012, 04:12:31 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: UEFI Boot
« Reply #59 on: July 05, 2012, 04:12:37 PM »
Thanks to Juanito  for recompiling the linux 64 bit kernel  we now have a solution to booting efi, Huge thanks to Juanito.

My working EFI USB frugal configuration uses rEFInd and Grub2 with Core64 + vmlinuz64 (Juanito modded version).  I can make an image,  copy to any USB and boot efi based mac's (and possibly pc's).  no matter what drive configuration exists.

Now I really appreciate the use of Label's.   Never thought I'd need to but without a label on the USB file system Core would never find the tce directory during boot.  That is unless I renamed tce to cde (but I think that has some drawbacks).

USB is GPT partitioned and formatted with FAT32

USB Directory structure:

/EFI/
/EFI/BOOT/
/EFI/BOOT/BOOTX64.EFI
/EFI/BOOT/grub64.EFI
/EFI/BOOT/refind.conf
/EFI/BOOT/icons/(icon's)
/EFIBOOT/linux64/(core kernel)

/boot/grub/
/boot/grub/(all grub module's)
/boot/grub/grub.cfg

/tce/
/tce/mydata.tgz
/tce/onboot.lst
/tce/xwbar.lst
/tce/ondemand/ 
/tce/optional/(all.tcz's)



Configuration file : refind.conf
Code: [Select]
timeout 30
#textonly
scan_driver_dirs EFI/tools/drivers,drivers
scanfor internal,external,optical,manual,cd,bio.ternal
also_scan_dirs boot,EFI
scan_all_linux_kernels
maxtags=0
default_selection 1

# Minimal Grub entry
menuentry "MYTOOLS" {
icon EFI/boot/icons/os_linux.icns
label="LINUX"
loader /EFI/boot/grub64.efi
}


Configuration file : grub.conf
Code: [Select]
# grub2 configuration

loadfont unicode
insmod part_apple
insmod part_bsd
insmod part_gpt
insmod part_msdos
insmod search
insmod all_video
insmod gfxterm

set gfxmode=640x480x32
set gfxpayload=1024x768x32
terminal_output gfxterm
insmod fixvideo

#Timeout for menu
set default=0
set timeout=10

#search --no-floppy --fs-LABEL --set=root LINUX

#FrameBuffer Menu Entry
menuentry " EFI Desktop Mode " {
  linux /boot/linux64/vmlinuz64 quiet tce=LABEL=<MyDriveLabel> vga=792 waitusb=10 noswap tz=GMT blacklist=bcma blacklist=ssb blacklist=b43
  initrd /boot/linux64/core64.gz
}

#Text Mode Menu Entry
menuentry "EFI Text Mode (Recovery) " {
  linux /boot/linux64/vmlinuz64 quiet tce=LABEL=<MyDriveLabel> vga=792 waitusb=10 noswap text tz=GMT blacklist=bcma blacklist=ssb blacklist=b43
  initrd /boot/linux64/core64.gz
}



I had renamed the modded linux kernel to vmlinuz64 due to testing with ELILO boot loader (which was unsuccessful.


My only weird issue remaining is that colors displayed on a MACbook screen are currently switched/inverted if you like.  ie:  Red is displayed as Blue, Yellow is Cyan and Blue is some kind of dirty Red, which can make for some memories of psychedelic days!      The video adapter / driver is displaying the correct colors as shown in a screenshot (or aiui another monitor out).
I think this is due to Grub2 v1.99-21 being compiled on a PC  instead of a MAC.   Am going to recompile, then try again., heck I might even try Grub2 EFIv2.0  ?

« Last Edit: July 09, 2012, 04:50:06 PM by coreplayer2 »