pentoo / pentoo-historical

read-only historical backup of pentoo from googlecode
https://code.google.com/p/pentoo/
2 stars 1 forks source link

livecd should be UEFI compatable #149

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A UEFI compatible livecd allows to install a distro without unnecessary 
/boot/efi partition and other stuff.

As an example, we could probably copy a code from Sabayon, since they seems 
released an image with UEFI support.

Original issue reported on code.google.com by blshkv on 26 May 2013 at 4:21

GoogleCodeExporter commented 9 years ago
I set my laptop to uefi mode and it boots from a usb with rc 1.8 on it.  can 
anyone else test this?

Original comment by sidhayn on 4 Jul 2013 at 5:58

GoogleCodeExporter commented 9 years ago
Doesn't work for me. I locked it to "UEFI only" in the BIOS, rebooted machine 
and chose "USB media" (F12). Booting goes not where, keep coming back to the 
same boot menu.
The same steps works fine with the "Legitimate only" setting.

Original comment by blshkv on 4 Jul 2013 at 11:45

GoogleCodeExporter commented 9 years ago
I was hoping to use other distros (sabayon) as an example. However, their iso 
is not compatible either. Lowing down the priority.

Original comment by blshkv on 27 Aug 2013 at 3:07

GoogleCodeExporter commented 9 years ago
these steps might help at some point (kernel settings)
http://kroah.com/log/blog/2013/09/02/booting-a-self-signed-linux-kernel/

Original comment by blshkv on 4 Sep 2013 at 12:48

GoogleCodeExporter commented 9 years ago
i was hacking at this for my own project and came across wuodan's notes at 
http://code.google.com/p/pentoo/wiki/UEFI#UEFI_Creating_an_UEFI-bootable_ISO

i got UEFI + BIOS booting from the same ISO, and it's a hybrid ISO to boot.

take note of 
http://git.project-phree.org/phree_cd/tree/bin/phreecd.build.sh?id=df114fc98c524
2826cd7fa0f3546637cc19467fd

lines 313-407 (function "stuffy") and lines 517-538 (the actual generation of 
the ISO image) are where the magic happen.

http://git.project-phree.org/phree_cd/tree/notes/README?id=df114fc98c5242826cd7f
a0f3546637cc19467fd has a list of prerequisite software (lines 11-31). do note 
that this is ArchLinux-based, however; not Gentoo. I'm sure with the 
appropriate packages hunted down and installed and some tweaking of my 
function, it shouldn't be too hard to get working for y'all.

Original comment by brent.sa...@gmail.com on 20 Feb 2014 at 3:36

GoogleCodeExporter commented 9 years ago
Issue 249 has been merged into this issue.

Original comment by blshkv on 4 Apr 2014 at 2:43

GoogleCodeExporter commented 9 years ago
Seems we are waiting for syslinux-6 which supports uefi.

In the meantime, here's my quick way to make an usb stick uefi-bootable:

1. Burn iso to fat-formatted usb with unetbootin
2. cd to the root of the usb partition
3. then enter:
[code]
wget http://pentoo-uefi.googlecode.com/files/grub-2.00-r1-image.tar.bz2
tar xfvz grub-2.00-r1-image.tar.bz2
rm grub-2.00-r1-image.tar.bz2
cat > boot/grub2/grub.cfg <<EOF
timeout=5
menuentry 'Pentoo' {
    insmod efi_gop
    insmod efi_uga
    insmod part_msdos
    root=hd0,1
    linux /isolinux/pentoo root=/dev/ram0 init=/linuxrc nox aufs max_loop=256 dokeymap looptype=squashfs loop=/image.squashfs cdroot video=uvesafb:mtrr:3,ywrap,1024x768-16 usbcore.autosuspend=1 console=tty0 net.ifnames=0
    initrd /isolinux/pentoo.igz
}
EOF
[/code]

This installs 'EFI/BOOT/BOOTX64.EFI' and 'boot/grub2/x86_64-efi/*'.
The former is the uefi-image by grub2, the latter the grub2-modules.
A crude grub2 menu is created in 'boot/grub2/grub.cfg' with the same params as 
in isolinux.cfg.

Just a quick way for now, works here.

Original comment by Wuod...@gmail.com on 1 May 2014 at 1:52

GoogleCodeExporter commented 9 years ago
What is wrong with putting a grub2 efi-image, some modules and a tiny menu on 
the ISO?
All in <ISO-root>/EFI, nowhere outside.
This should help if booting an unetbootin USB drive, have to check for plain 
ISO.

Please view the attached simple script, the tools are already installed and it 
only takes up 6.4M

Or at least let me know what's wrong with that!

Original comment by Wuod...@gmail.com on 23 Nov 2014 at 9:55

Attachments:

GoogleCodeExporter commented 9 years ago
Few questions about the topic:
- shouldn't /EFI partition be FAT32?
- what is point in grub2 if UEFI can boot /EFI/mykernel directly?

ps. I have zero knowledge about ISO format, just comparing with my SSD setup.  
I'm also using sys-boot/gummiboot instead.

Original comment by blshkv on 23 Nov 2014 at 12:53

GoogleCodeExporter commented 9 years ago
if you really think this is enough, I will add the results to the cdtar for 
RC3.7 and we can test it.  seems easy enough to test.

Original comment by sidhayn on 23 Nov 2014 at 7:07

GoogleCodeExporter commented 9 years ago
@blshkv

- shouldn't /EFI partition be FAT32?

Yes. UEFI can only read fat, good enough for installation to USB-stick with
unetbootin.
(Saw some tool on Gentoo wiki to extend UEFI to read ext-fs, I don't need
it.)

- what is point in grub2 if UEFI can boot /EFI/mykernel directly?

You can define the boot-option directly in UEFI, mainly:
 * $label
 * $path_kernel (including disk/partition)
 * $params_kernel
 * $path_initrd

But this does not help when booting the LiveISO!

Then there's the default path of:
<first partition of disk>/EFI/BOOT/BOOTX64.EFI
which is booted without any parameters.

[ You can also name your kernel file BOOTX64.EFI and compile the boot
options/initramfs directly into the kernel. ]

Here the grub image at the above default path comes into play.
It loads the text config at:
<whatever-partition-it-is>/EFI/grub2/grub.cfg
Where the kernel, kernel-params and initrd are defined.

This way the kernel on the LiveCD and isolinux are untouched.

Reason for all this:
An installation to disk does not need a bootloader, just set the boot-options 
directly in UEFI. But ...
To set UEFI boot-options, 'you need to have booted the system WITH UEFI. 
So you can grab any linux distribution that support boot in UEFI mode, and do 
the work. ...'

Used the attached 'cmd_efibootmgr' today.
See output of 'efibootmgr -v' after it in 'efibootmgr.out'

- sys-boot/gummiboot
Thanks, maybe one could use that to create the BOOTX64.EFI on the LiveISO.

Original comment by Wuod...@gmail.com on 24 Nov 2014 at 10:01

GoogleCodeExporter commented 9 years ago
Non binary file.

Original comment by Wuod...@gmail.com on 24 Nov 2014 at 10:06

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Wuod...@gmail.com on 24 Nov 2014 at 10:23

Attachments:

GoogleCodeExporter commented 9 years ago
http://blog.siphos.be/2014/12/added-uefi-instructions-to-amd64x86-handbooks/

Original comment by blshkv on 25 Dec 2014 at 2:21

GoogleCodeExporter commented 9 years ago
Heureka !!!
I now have Pentoo RC3.7 booting with UEFI both as ISO and as fat32 usb-stick.

Basically we need an EFI-image at /efi/boot/bootx64.efi (case-insensitive path).
This can be a kernel, grub-efi-img, gummiboot, maybe syslinux - as long as it's 
uefi capable.  

This is sufficient for usb-sticks, uefi picks it up from the default path.
In VirtualBox, be patient after grub, it takes 1-2 minutes (same with 
ArchLinux).

For ISOS: This efi-image can be added to the ISO as 2nd MBR.
Example:
mkisofs <normal parameters> \
    -eltorito-alt-boot \
    -b EFI/BOOT/BOOTX64.EFI \
    -no-emul-boot \
    -z \
    <rest of normal parameters>

Todo:
-----
brent.saner (see commment #5) uses an 'EFI embedded FAT filesystem'.
Thanks for that, might be usefull!

PoC script (see attachement, pentoo-convertIso2Uefi):
-----------------------------------------------------
Requirements: mkisofs (emerge app-cdr/cdrtools), grub2 is already present.
Usage:
    pentoo-convertIso2Uefi $path_to_iso $path_to_new_iso
Info:
    1. mounts the iso
    2. copies the contents
    3. adds grub2-efi-image with minimal menu
    4. runs mkisofs as described above
    5. clean up

Original comment by Wuod...@gmail.com on 10 Jan 2015 at 11:41

Attachments: