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

EFI approach and patches



Hi folks,

So, I've got EFI working in d-i, after a fashion. Here's a summary of
the changes I made. Feel free to suggest better ways of doing things,
but here's what I've got so far. Patches attached.

1. Add a new subarch of "efi" for i386 and amd64 in
   libdebian-installer, worked out (as usual for EFI) from whether
   /sys/firmware/efi is accessible. This filters through readily to
   archdetect, used all over the place elsewhere in d-i.

2. Build efi-reader for amd64 as well as ia64. Not sure if this
   provides anything important, but it doesn't hurt. :-)

3. Build elilo-installer for amd64 too, and mark it as installable for
   i386/efi|amd64/efi.

4. Mark grub-installer as not installable for i386/efi|amd64/efi

5. Mark lilo-installer as not installable for i386/efi|amd64/efi

6. Several tweaks to partman-auto:

  * Switch from fat16 to fat32 in ia64 recipes
  * Make the fat32 EFI partition bigger to meet fat32 recommendations
  * Clone the ia64 recipes for amd64-efi

  The first of these needs testing - is EFI on ia64 *definitely* ok
  with fat32, or must it have fat16? I've also upped the size of the
  EFI partition to 512MB, a more sensible minimum in case of multiple
  OS installs. I cloned tha ia64 recipes, then the diff shows the
  changes since. Not 100% sure of the best approach for partman-auto,
  I'll admit here. Thoughts?

7. partman-efi: change from fat16 to fat32; again, needs confirmation.

8. partman-partitioning: for amd64/efi and i386/efi, use gpt instead
   of msdos

Other changes: I've temporarily hacked elilo itself:

 * Use UTF-8 instead of ISO8859-1, etc. when mounting FAT fs in elilo
 * Pick up on "pci=" entries as well as "console=" in /proc/cmdline
   when generating append entries

The first one is because we don't include the nls modules in the
kernel that elilo wants when mounting the FAT partition for writing
files to it. The second is to make sure that the pci=nocrs setting I
needed for the OVMF emulator made it through from the initial boot
settings to the created elilo.conf. I think the former should be fixed
in the kernel modules built for amd64 and i386, The specific "pci="
change in elilo.sh *shouldn't* be necessary imho, so I think this is a
genuine bug - at the moment it will *only* pick up on "console="
entries in the boot command line.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
Is there anybody out there?
mr diff: /home/steve/debian/d-i/d-i/packages/libdebian-installer
diff --git a/debian/changelog b/debian/changelog
index ea88601..8e7866e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ libdebian-installer (0.82) UNRELEASED; urgency=low
   * Support for reading hardware model from Device Tree (armel).
   * Add Dreamplug device (Kirkwood)
 
+  [ Steve McIntyre ]
+  * Add "efi" as a subarch for amd64
+
  -- Ian Campbell <ijc@hellion.org.uk>  Tue, 10 Jul 2012 21:15:56 +0000
 
 libdebian-installer (0.81) unstable; urgency=low
diff --git a/src/system/subarch-x86-linux.c b/src/system/subarch-x86-linux.c
index 567d3c2..e8bf343 100644
--- a/src/system/subarch-x86-linux.c
+++ b/src/system/subarch-x86-linux.c
@@ -250,6 +250,17 @@ static char *dmi_system_manufacturer(void)
        return ret;
 }
 
+/* Are we on an EFI system? Check to see if /sys/firmware/efi
+ * exists */
+static int is_efi(void)
+{
+       int ret = access("/sys/firmware/efi", R_OK);
+    if (ret == 0)
+               return 1;
+    else
+               return 0;
+}
+
 struct map {
        const char *entry;
        const char *ret;
@@ -267,6 +278,11 @@ const char *di_system_subarch_analyze(void)
        const char *ret = "generic";
        int i;
 
+       /* Look for generic EFI first; this will be over-ridden by the mac
+        * detection next if we're on a mac. */
+       if (is_efi())
+               ret = "efi";
+
        if (manufacturer)
        {
                for (i = 0; map_manufacturer[i].entry; i++)

mr diff: /home/steve/debian/d-i/d-i/packages/efi-reader
diff --git a/debian/changelog b/debian/changelog
index 2650718..40351e3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+efi-reader (0.11) unstable; urgency=low
+
+  [ Steve McIntyre ]
+  * Build on amd64 as well as ia64, now we have EFI support there too.
+
+ -- Steve McIntyre <93sam@debian.org>  Wed, 08 Aug 2012 18:29:59 +0100
+
 efi-reader (0.10) unstable; urgency=low
 
   [ Frans Pop ]
diff --git a/debian/control b/debian/control
index a0e68a9..3b39eb8 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Vcs-Browser: http://git.debian.org/?p=d-i/efi-reader.git
 Vcs-Git: git://git.debian.org/d-i/efi-reader.git
 
 Package: efi-reader
-Architecture: ia64
+Architecture: ia64 amd64
 Depends: ${shlibs:Depends}
 Description: Select default values from EFI configuration.
 XC-Package-Type: udeb

mr diff: /home/steve/debian/d-i/d-i/packages/elilo-installer
diff --git a/debian/changelog b/debian/changelog
index 8d8a217..0a357e5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+elilo-installer (1.21) unstable; urgency=low
+
+  [Steve McIntyre]
+  * Use elilo for amd64/efi and i386/efi
+
+ -- Christian Perrier <bubulle@debian.org>  Sat, 16 Jun 2012 12:39:39 +0200
+
 elilo-installer (1.20) unstable; urgency=low
 
   * Team upload
diff --git a/debian/control b/debian/control
index acca7f2..c91f77f 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Vcs-Git: git://git.debian.org/d-i/elilo-installer.git
 
 Package: elilo-installer
 Package-Type: udeb
-Architecture: i386 ia64
+Architecture: i386 ia64 amd64
 Provides: bootable-system
 Depends: cdebconf-udeb, installed-base, partconf-find-partitions (>= 1.08), di-utils-mapdevfs, fat-modules, efi-modules
 XB-Installer-Menu-Item: 7600
diff --git a/debian/isinstallable b/debian/isinstallable
index 4914855..164bccd 100755
--- a/debian/isinstallable
+++ b/debian/isinstallable
@@ -4,9 +4,10 @@ set -e
 ARCH="$(archdetect)"
 
 case $ARCH in
-    i386/mac|amd64/mac)
-       # x86-based Apple systems use elilo, but only if EFI is available
-       # (not booting in BIOS compatibility mode).
+    i386/mac|amd64/mac|i386/efi|amd64/efi)
+       # x86-based Apple and newer EFI-compatible systems use elilo, but
+       # only if EFI is available (not booting in BIOS compatibility
+       # mode).
        # Note: depends on partman-efi to load the efivars module!
        if [ -d /sys/firmware/efi ]; then
                exit 0

mr diff: /home/steve/debian/d-i/d-i/packages/grub-installer
diff --git a/debian/changelog b/debian/changelog
index 979eddd..dce9320 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+grub-installer (1.78) unstable; urgency=low
+
+  [ Steve McIntyre ]
+  Don't use grub for amd64/efi
+
+ -- Christian Perrier <bubulle@debian.org>  Sun, 05 Aug 2012 10:59:40 +0200
+
 grub-installer (1.77) unstable; urgency=low
 
   [ Cyril Brulebois ]
diff --git a/debian/isinstallable b/debian/isinstallable
index e66bac1..313980c 100755
--- a/debian/isinstallable
+++ b/debian/isinstallable
@@ -8,7 +8,7 @@ log() {
 ARCH="$(archdetect)"
 
 case $ARCH in
-    i386/mac|amd64/mac)
+    i386/mac|amd64/mac|i386/efi|amd64/efi)
        # Note: depends on partman-efi to load the efivars module!
        if [ -d /sys/firmware/efi ]; then
                log "GRUB not yet usable on Intel-based Macs booted using EFI"

mr diff: /home/steve/debian/d-i/d-i/packages/lilo-installer
diff --git a/debian/changelog b/debian/changelog
index c84a0c2..94d8cd1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+lilo-installer (1.38) unstable; urgency=low
+
+  [ Steve McIntyre]
+  * Don't use lilo for */efi
+
+ -- Christian Perrier <bubulle@debian.org>  Fri, 22 Jun 2012 06:48:03 +0200
+
 lilo-installer (1.37) unstable; urgency=low
 
   * Team upload
diff --git a/debian/isinstallable b/debian/isinstallable
index 829ca29..0c87b09 100755
--- a/debian/isinstallable
+++ b/debian/isinstallable
@@ -7,12 +7,12 @@ log() {
 
 ARCH="$(archdetect)"
 case $ARCH in
-    i386/mac|amd64/mac)
+    i386/mac|amd64/mac|i386/efi|amd64/efi)
        # LILO stands a better chance of working in BIOS compatibility mode,
        # where /sys/firmware/efi doesn't exist.
        # Note: depends on partman-efi to load the efivars module!
        if [ -d /sys/firmware/efi ]; then
-               log "LILO not usable on Intel-based Macs without BIOS compatibility; use elilo"
+               log "LILO not usable on EFI machines without BIOS compatibility; use elilo"
                exit 1
        fi
        ;;

mr diff: /home/steve/debian/d-i/d-i/packages/partman-auto
diff --git a/debian/changelog b/debian/changelog
index 816e0f0..27a24b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+partman-auto (104) unstable; urgency=low
+
+  [ Steve McIntyre ]
+  * Switch from fat16 to fat32 in ia64 recipes
+  * Make the fat32 EFI partition bigger to meet fat32 recommendations
+  * Clone the ia64 recipes for amd64-efi
+
+ -- Christian Perrier <bubulle@debian.org>  Sat, 04 Aug 2012 09:20:23 +0200
+
 partman-auto (103) unstable; urgency=low
 
   [ Milan Kupcevic ]
diff --git a/recipes-amd64-efi/atomic b/recipes-amd64-efi/atomic
index ba5060f..7634acb 100644
--- a/recipes-amd64-efi/atomic
+++ b/recipes-amd64-efi/atomic
@@ -2,6 +2,7 @@ partman-auto/text/atomic_scheme ::
 
 512 512 1024 fat32
        $primary{ }
+    $bootable{ }
        method{ efi }
        format{ } .
 
diff --git a/recipes-amd64-efi/home b/recipes-amd64-efi/home
index dcac910..ca97eac 100644
--- a/recipes-amd64-efi/home
+++ b/recipes-amd64-efi/home
@@ -2,6 +2,7 @@ partman-auto/text/home_scheme ::
 
 512 512 1024 fat32
        $primary{ }
+    $bootable{ }
        method{ efi }
        format{ } .
 
diff --git a/recipes-amd64-efi/multi b/recipes-amd64-efi/multi
index 591adc2..adfc84b 100644
--- a/recipes-amd64-efi/multi
+++ b/recipes-amd64-efi/multi
@@ -2,6 +2,7 @@ partman-auto/text/multi_scheme ::
 
 512 512 1024 fat32
        $primary{ }
+    $bootable{ }
        method{ efi }
        format{ } .
 
diff --git a/recipes-ia64/atomic b/recipes-ia64/atomic
index d369f9a..ba5060f 100644
--- a/recipes-ia64/atomic
+++ b/recipes-ia64/atomic
@@ -1,6 +1,6 @@
 partman-auto/text/atomic_scheme ::
 
-100 100 150 fat16
+512 512 1024 fat32
        $primary{ }
        method{ efi }
        format{ } .
diff --git a/recipes-ia64/home b/recipes-ia64/home
index 29c0242..dcac910 100644
--- a/recipes-ia64/home
+++ b/recipes-ia64/home
@@ -1,6 +1,6 @@
 partman-auto/text/home_scheme ::
 
-100 100 150 fat16
+512 512 1024 fat32
        $primary{ }
        method{ efi }
        format{ } .
diff --git a/recipes-ia64/multi b/recipes-ia64/multi
index 2b133c1..591adc2 100644
--- a/recipes-ia64/multi
+++ b/recipes-ia64/multi
@@ -1,6 +1,6 @@
 partman-auto/text/multi_scheme ::
 
-100 100 150 fat16
+512 512 1024 fat32
        $primary{ }
        method{ efi }
        format{ } .

mr diff: /home/steve/debian/d-i/d-i/packages/partman-partitioning
diff --git a/debian/changelog b/debian/changelog
index b5a529c..7271ed4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+partman-partitioning (87.1) unstable; urgency=low
+
+  * On amd64 machines booted in EFI mode, use gpt disk label by default.
+
+ -- Steve McIntyre <93sam@debian.org>  Wed, 08 Aug 2012 18:22:32 +0100
+
 partman-partitioning (87) unstable; urgency=low
 
   * Team upload
diff --git a/lib/disk-label.sh b/lib/disk-label.sh
index c981cd9..d8a80f2 100644
--- a/lib/disk-label.sh
+++ b/lib/disk-label.sh
@@ -22,7 +22,7 @@ default_disk_label () {
                echo msdos;;
            amd64|kfreebsd-amd64)
                case "$sub" in
-                   mac)
+                   mac|efi)
                        echo gpt;;
                    *)
                        echo msdos;;

mr diff: /home/steve/debian/d-i/d-i/packages/partman-efi
diff --git a/debian/changelog b/debian/changelog
index 30667a4..ffb1b0b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+partman-efi (26.1) unstable; urgency=low
+
+  * Switch to fat32 instead of fat16, needed for amd64 EFI and expected to
+    still work for ia64
+
+ -- Steve McIntyre <93sam@debian.org>  Wed, 08 Aug 2012 18:22:32 +0100
+
 partman-efi (26) unstable; urgency=low
 
   * Team upload
diff --git a/init.d/efi b/init.d/efi
index 6af77ce..9783fad 100755
--- a/init.d/efi
+++ b/init.d/efi
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-# This script sets method "efi" for all fat16 partitions that have the boot
-# flag set.
+# This script sets method "efi" for all fat32 partitions that have the
+# boot flag set.
 
 # Give the kernel a chance to create /proc/efi if appropriate.
 modprobe efivars >/dev/null 2>&1 || true
@@ -18,7 +18,7 @@ for dev in /var/lib/partman/devices/*; do
        partitions=
        open_dialog PARTITIONS
        while { read_line num id size type fs path name; [ "$id" ]; }; do
-               if [ "$fs" = fat16 ]; then
+               if [ "$fs" = fat32 ]; then
                        partitions="$partitions $id"
                fi
        done
diff --git a/parted_names/efi b/parted_names/efi
index 2d7b7ac..a3d76e7 100644
--- a/parted_names/efi
+++ b/parted_names/efi
@@ -1 +1 @@
-fat16
+fat32

mr diff: /home/steve/debian/d-i/d-i/packages/partman-partitioning
diff --git a/debian/changelog b/debian/changelog
index b5a529c..7271ed4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+partman-partitioning (87.1) unstable; urgency=low
+
+  * On amd64 machines booted in EFI mode, use gpt disk label by default.
+
+ -- Steve McIntyre <93sam@debian.org>  Wed, 08 Aug 2012 18:22:32 +0100
+
 partman-partitioning (87) unstable; urgency=low
 
   * Team upload
diff --git a/lib/disk-label.sh b/lib/disk-label.sh
index c981cd9..d8a80f2 100644
--- a/lib/disk-label.sh
+++ b/lib/disk-label.sh
@@ -22,7 +22,7 @@ default_disk_label () {
                echo msdos;;
            amd64|kfreebsd-amd64)
                case "$sub" in
-                   mac)
+                   mac|efi)
                        echo gpt;;
                    *)
                        echo msdos;;

diff -Nru elilo-3.14/debian/changelog elilo-3.14/debian/changelog
--- elilo-3.14/debian/changelog	2012-06-29 18:42:58.000000000 +0100
+++ elilo-3.14/debian/changelog	2012-08-12 02:34:01.000000000 +0100
@@ -1,3 +1,13 @@
+elilo (3.14-1.1) unstable; urgency=low
+
+  * NMU
+  * Quick hacks for amd64 EFI CD testing:
+    + Use UTF-8 instead of ISO8859-1, etc. when mounting FAT fs in elilo
+    + Pick up on "pci=" entries as well as "console=" in /proc/cmdline
+      when generating append entries
+
+ -- Steve McIntyre <93sam@debian.org>  Sun, 12 Aug 2012 13:30:28 +0100
+
 elilo (3.14-1) unstable; urgency=low
 
   * new upstream version
diff -Nru elilo-3.14/debian/elilo.sh elilo-3.14/debian/elilo.sh
--- elilo-3.14/debian/elilo.sh	2012-06-29 18:42:58.000000000 +0100
+++ elilo-3.14/debian/elilo.sh	2012-08-12 02:32:37.000000000 +0100
@@ -345,7 +345,7 @@
     fi
 
     [ "$VERBOSE" = 1 ] && echo "$PRG: Mounting $boot..."
-    mount -t "$fstype" -o codepage=437,iocharset=iso8859-1,rw,noexec,umask=077$loop "$boot" "$TMP/bootstrap.$$"
+    mount -t "$fstype" -o rw,noexec,umask=077$loop "$boot" "$TMP/bootstrap.$$"
     if [ $? != 0 ] ; then
 	echo 1>&2 "$PRG: An error occured mounting $boot"
 	return 1
@@ -521,9 +521,12 @@
   cmdline=""
 fi
 
-append=`echo $cmdline | tr ' ' '\n' | grep "^console=" | tr '\n' ' '`
+append=`echo $cmdline | tr ' ' '\n' | grep -e "^console=" -e "^pci="| tr '\n' ' '`
 if [ ! -z "$append" ]; then append="append=\"$append\""; fi
 
+echo "$PRG: cmdline $cmdline"
+echo "$PRG: append now $append"
+
 echo \
 "## elilo configuration file generated by elilo $VERSION
 

Reply to: