Add UEFI netboot support

If grub's been netbooted, pull the uuid and serial number out of smbios and
hit the API server to get the appropriate configuration.
This commit is contained in:
Matthew Garrett 2016-01-06 10:01:45 -08:00
parent db5d937aab
commit 1f7c749b2d
2 changed files with 20 additions and 1 deletions

View File

@ -30,6 +30,25 @@ if [ "$grub_platform" = "efi" ]; then
fi fi
fi fi
if [ "$net_default_server" != "" ]; then
smbios --type 1 --get-uuid 8 --set uuid
smbios --type 1 --get-string 7 --set serial
set mac=$net_default_mac
# Re-DHCP as grub to get the API endpoint
net_bootp $net_default_interface
# This is awful, but grub doesn't support a nice way to do this
for i in "$net_efinet0_dhcp_boot_file" "$net_efinet1_dhcp_boot_file" "$net_efinet2_dhcp_boot_file" "$net_efinet3_dhcp_boot_file" "$net_efinet4_dhcp_boot_file" "$net_efinet5_dhcp_boot_file" "$net_efinet6_dhcp_boot_file" "$net_efinet7_dhcp_boot_file" "$net_efinet8_dhcp_boot_file" "$net_efinet9_dhcp_boot_file"; do
if [ "$i" != "" ]; then
set endpoint="$i"
break
fi
done
if [ "$endpoint" != "" ]; then
set url="${endpoint}?uuid=$uuid&serial=$serial&mac=$mac"
configfile $url
fi
fi
# Search for the OEM partition, load additional configuration if found. # Search for the OEM partition, load additional configuration if found.
if [ "$secure_boot" = "0" ]; then if [ "$secure_boot" = "0" ]; then
search --no-floppy --set oem --part-label OEM --hint "$root" search --no-floppy --set oem --part-label OEM --hint "$root"

View File

@ -43,7 +43,7 @@ case "${FLAGS_target}" in
CORE_NAME="core.img" CORE_NAME="core.img"
;; ;;
x86_64-efi) x86_64-efi)
CORE_MODULES+=( serial linuxefi efi_gop getenv ) CORE_MODULES+=( serial linuxefi efi_gop getenv smbios efinet http )
CORE_NAME="core.efi" CORE_NAME="core.efi"
;; ;;
x86_64-xen) x86_64-xen)