[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: i386 EFI - Identifying Parts of the Install Process



On Monday 24 March 2008, Charles Abdouch wrote:
> I originally sent this email out 12-Dec-2007 but with the apparent
> workload everyone had, and the fact this was certainly a low priority for
> most people, I waited till now to resend it. I am hoping all these issues

Glad you did.

> can be resolved for the official release of Lenny, but if not, at least
> soon afterwards.

Well, that completely depends on having people (such as you) who are 
motivated to work on this (probably by having the hardware) not only 
identifying the problems, but also doing most of the work to get them fixed 
by testing, debugging and providing patches.
You seem to be off to a good start, but you may also want to try and see if 
anyone wants to help.

I personally have no interest in this beyond wanting to see D-I work as well 
as possible on all hardware supported by Debian, so I'll limit myself to 
giving pointers.

Most work on the installer is really very easy because it is all just shell 
script: start by running an installation with 'priority=medium', learn what 
steps make up an installation and what components (udebs) provide them, 
find out what program is executed where (every menu item calls a postinst 
script in /var/lib/dpkg/info/<component>.postinst, learn how the steps you 
want to improve work by adding 'set -x' in its postinst script and any 
scripts it calls.

Use the webserver from the "Save debug logs" option to check the debugging 
output in the syslog.

Some basic info about all this can be found here:
- http://d-i.alioth.debian.org/manual/en.i386/ch06s02.html
- http://d-i.alioth.debian.org/doc/talks/debconf6/paper/

> Issue 1: Booting the Install CD: Bug #455914
> Need to have i386 EFI boot files included to kick off the install on an
> i386 EFI based system.

I've pinged the debian-cd maintainer about that BR, but it should not block 
work on this. I assume these boxes can netboot or boot from an USB stick?

> Issue 2: Guided Partitioning program needs to support EFI: (parted-efi or
> its scripts)

First you need to get manual partitioning working, then we can look at 
guided partitioning. In principle it should be fairly easy.
Basically, this is not issue 2, but issue 7 or 8 or so.

You'll probably need to create separate recipes for these systems. The only 
thing really needed is to correctly identify when they should be used.
Partman normally decides this on the basis of archdetect (see below), but 
additional conditions are possible. The basic recipe selection happens in 
the function get_recipedir() in /lib/partman/lib/recipes.sh (from 
partman-auto).

> I am not sure if this is a 'parted-efi' problem or if there is some
> script that just invokes it after querying the user.

AFAIK there's no such thing as parted-efi, you probably mean partman-efi.
The component "in charge" of guided partitioning is partman-auto.

> The "Guided Partitioning" scripts should detect if 'efivars.ko' is loaded
> (or /sys/firmware/efi exists).
> If it is not loaded then we can assume this is a standard Legacy system
> and install normally.

Does it matter here if the system is running pure or with Boot Camp. 
Whatever changes are done should ensure that both are supported.

Note that checking /sys/firmware/efi is only one thing, the system can also 
be identified by the output of archdetect: that should be i386/mac or 
amd64/mac.
The efivars module should already get loaded right at the beginning of 
partman (see /lib/partman/init.d/XXefi).

> If we find that 'efivars.ko' (or /sys/firmware/efi) is present, then we
> can assume this is an EFI based system and do the following:
>     1. If the hard drive is currently "raw", create a GPT (GUIDed
> Partition Table) on it.
>     2. If the hard drive has a MBR but no other File System (no Windows
> or Linux already on it), then offer the primary choice of creating a GPT
> with a secondary choice of leaving the MBR on it.
>     3. If the hard drive has a MBR and an OS taking the entire drive
> (like Windows normally does) among the offers of resizing the Windows
> partition, or wiping the drive and install Linux only, should be a GPT
> offer.
>         a. If the drive is being wiped, then a GPT should be recommended.
>         b. If the drive is being resized, then the MBR should remain.

Don't try to redesign partman here. As said before, first make it work for 
manual partitioning, that should give all the freedom you need.
AFAIK partitioning does not touch the MBR; in general writing to the MBR is 
the responsibility of the bootloader installer, not the partioner.

AFAICT the main thing that is really needed is that GPT should be the 
default for these systems. This _should_ already be the case 
as /lib/partman/lib/disk-label.sh (from the partman-partitioning component) 
has:
            i386)			#same for amd64
                case "$sub" in
                    mac)
                        echo gpt;;
                    *)
                        echo msdos;;

> In addition, there needs to be a FAT File System partition which EFI can
> use to boot the OS.

Should be relatively simple to do with 

> Issue 3: Parted-efi should support creating a GPT drive:
>
> There should be an option of creating a GPT or MBR in parted for users
> using the manual process on EFI BIOS based systems.

See above. It should already be doing so.

> Issue 4: Base packages being loaded on EFI-BIOS based systems need to
> include the package 'elilo': (which I believe has a dependency on
> including 'efibootmgr' and 'DosFsTools')

The thing to do here is to get the installer to use elilo-installer. That 
will take responsibility for installing elilo in the target system.

> This is a bug I need to file.

No. What is needed is to find out why the installer is not already using 
elilo-installer automatically. What's needed is debugging.

> Issue 5: The custom built kernel should load efivars.ko:

If the kernel does not detect that efivars is needed automatically, the 
correct thing to do is to have the installer can 'register-module efivars' 
at some point, probably in a /usr/lib/base-installer.d hook script.
That will add it in /etc/modules for the target system.

> Issue 6: EFI Boot Files are not being copied to the EFI Partition during
> the install process:

That should be done by elilo-installer.

> Issue 7: GRUB or LILO should not run, nor be required to run on an EFI
> BIOS Based system install.

This should already not be happening.
The scripts /var/lib/dpkg/info/{grub,lilo}-installer already contain code to 
make it skip in EFI based systems. Again, debugging is needed.


I hope the info above can help you further. The installer already has a lot 
of code to support these systems. What is needed is checking exactly why 
things are not working as they should and what we need to fix this is _very 
specific_ bug reports about what is going wrong, preferably with patches.
IMO in most cases only minor adjustments should be needed.

Things to check are:
- are partman-efi and elilo-installer getting loaded during anna (check
  contents of /var/lib/dpkg/status and syslog)?
- is efivars getting loaded at start of partman?
- is /sys/firmware/efi created at that point?
- try running archdetect both before and after partman; does it return
  {i386,amd64}/mac?
- ...

Try to work from the bottom up, not from the top down.

Cheers,
FJP

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: