From 0d41e5101f2ada712045765f54044deb820f8085 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 3 Jan 2014 01:45:12 +0100 Subject: UEFI support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested with the IntelĀ® Desktop Board DH87RL, BIOS [RLH8710H.86A] version 0323. --- include/partition.sh | 14 ++++++++------ preseed.sh | 31 ++++++++++++++++++++----------- src/fripost-partman-udeb/base.sh | 4 +++- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/include/partition.sh b/include/partition.sh index fda2734..5418341 100755 --- a/include/partition.sh +++ b/include/partition.sh @@ -39,7 +39,9 @@ log "Created disklabel GPT for device $device" # Create a EFI partition if needed; otherwise, create a partition needed # to put GRUB on GPT disklabels. if [ -d /proc/efi -o -d /sys/firmware/efi ]; then + anna-install dosfstools-udeb part_efi=$( fripost_mkpart $device efi 256M +boot ) + fripost_mkfs vfat $part_efi -F 32 else fripost_mkpart $device bios_grub 8M +bios_grub fi @@ -94,10 +96,10 @@ mkswap /dev/$vg/swap # Stuff the fstab and mount the devices in the target -fripost_fstab $part_boot /boot ext2 noatime -fripost_fstab /dev/$vg/root / ext4 noatime,errors=remount-ro -fripost_fstab /dev/$vg/swap none swap sw -fripost_fstab /dev/$vg/home /home ext4 noatime +fripost_fstab $part_boot /boot ext2 noatime +[ -d /proc/efi -o -d /sys/firmware/efi ] && \ +fripost_fstab $part_efi /boot/efi vfat defaults +fripost_fstab /dev/$vg/root / ext4 noatime,errors=remount-ro +fripost_fstab /dev/$vg/swap none swap sw +fripost_fstab /dev/$vg/home /home ext4 noatime fripost_mount_partitions - -# TODO: EFI: format; add to fstab; how to populate? diff --git a/preseed.sh b/preseed.sh index 3fbc329..ff88535 100755 --- a/preseed.sh +++ b/preseed.sh @@ -17,7 +17,7 @@ test -r "$iso" || exit 1 shift; shift pwd=$(pwd) -for prog in fuseiso fusermount rsync md5sum genisoimage find; do +for prog in fuseiso fusermount rsync md5sum xorriso find; do if ! which "$prog" >/dev/null; then echo "Error: Missing $prog" >&2 exit 1 @@ -36,10 +36,10 @@ rmdir "$mountdir" cp preseed.cfg "$isoeditdir/" md5sum ./preseed.cfg >> "$isoeditdir/md5sum.txt" -isolinux=isolinux/adtxt.cfg -sed -ri "s@^\s+append\s(.*\s)?auto=true\b@& file=/cdrom/preseed.cfg @" \ - "$isoeditdir/$isolinux" -# ^ no need to update the checksum, $isolinux is not in './md5sum.txt'. +cfg="$isoeditdir/isolinux/*.cfg $isoeditdir/isolinux/*/*.cfg" +[ -d $isoeditdir/boot -a -d $isoeditdir/boot/grub ] && cfg="$cfg $isoeditdir/boot/grub/grub.cfg" +sed -ri "s@auto=true\s+priority=critical\b@& file=/cdrom/preseed.cfg @" $cfg +# ^ no need to update isolinux' checksum, as it's not in './md5sum.txt'. mkdir "$isoeditdir/include" rsync -aL ./include/ "$isoeditdir/include"/ @@ -76,7 +76,8 @@ gzip -fk ./"$packages" md5sums=$(mktemp) while read sum file; do if [ "$file" = "./${packages}" -o \ - "$file" = "./${packages}.gz" ]; then + "$file" = "./${packages}.gz" -o \ + "$file" = "./boot/grub/grub.cfg" ]; then md5sum "$file" else echo "$sum $file" @@ -84,10 +85,18 @@ while read sum file; do done < ./md5sum.txt > "$md5sums" mv "$md5sums" "$isoeditdir/md5sum.txt" -genisoimage -o "$newiso" -quiet -r -J \ - -no-emul-boot -boot-load-size 4 \ - -boot-info-table \ - -b isolinux/isolinux.bin \ - -c isolinux/boot.cat \ +if [ -f ./boot/grub/efi.img ]; then + efi_opts="--efi-boot boot/grub/efi.img -append_partition 2 0x01 ./boot/grub/efi.img" +else + efi_opts= +fi +xorriso -as mkisofs -r \ + -checksum_algorithm_iso all \ + -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \ + -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -partition_offset 16 \ + -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot $efi_opts \ + -o "$newiso" \ ./ + rm -rf "$isoeditdir" diff --git a/src/fripost-partman-udeb/base.sh b/src/fripost-partman-udeb/base.sh index e6a3bf9..c23dcc1 100644 --- a/src/fripost-partman-udeb/base.sh +++ b/src/fripost-partman-udeb/base.sh @@ -433,10 +433,12 @@ fripost_mkfs() { fripost_fstab() { local device="$1" mp="$2" type="$3" options="${4:-defaults}" pass - # TODO: EFI should be set with pass 1 if [ "$mp" = / ]; then log "Got root device, $device" pass=1 + elif [ "$mp" = /boot/efi ]; then + log "Got EFI device, $device" + pass=1 elif [ "$type" = swap ]; then log "Got swap device, $device" pass=0 -- cgit v1.2.3