Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Patch to bludgeon snponly.efi back to life. For discussion purposes o…
…nly for now
  • Loading branch information
Jarrod Johnson committed Jul 1, 2013
1 parent 5cc2a55 commit 73d1ff0
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/image/efi_image.c
Expand Up @@ -142,35 +142,42 @@ static int efi_image_exec ( struct image *image ) {
void *interface;
} loaded;
EFI_HANDLE handle;
EFI_HANDLE nethandle;
EFI_DEVICE_PATH_PROTOCOL *netpath;
wchar_t *cmdline;
EFI_STATUS efirc;
int rc;

/* Find an appropriate device handle to use */
snpdev = last_opened_snpdev();
if ( ! snpdev ) {
netpath=NULL;
if ( snpdev ) {
} else if (1) {
nethandle = efi_loaded_image->DeviceHandle;
netpath = efi_loaded_image->FilePath;
} else {
DBGC ( image, "EFIIMAGE %p could not identify SNP device\n",
image );
rc = -ENODEV;
goto err_no_snpdev;
}

/* Install file I/O protocols */
if ( ( rc = efi_file_install ( &snpdev->handle ) ) != 0 ) {
if ( ( rc = efi_file_install ( &nethandle ) ) != 0 ) {
DBGC ( image, "EFIIMAGE %p could not install file protocol: "
"%s\n", image, strerror ( rc ) );
goto err_file_install;
}

/* Install iPXE download protocol */
if ( ( rc = efi_download_install ( &snpdev->handle ) ) != 0 ) {
if ( ( rc = efi_download_install ( &nethandle ) ) != 0 ) {
DBGC ( image, "EFIIMAGE %p could not install iPXE download "
"protocol: %s\n", image, strerror ( rc ) );
goto err_download_install;
}

/* Create device path for image */
path = efi_image_path ( image, &snpdev->path );
path = efi_image_path ( image, netpath );
if ( ! path ) {
DBGC ( image, "EFIIMAGE %p could not create device path\n",
image );
Expand Down Expand Up @@ -210,7 +217,9 @@ static int efi_image_exec ( struct image *image ) {

/* Sanity checks */
assert ( loaded.image->ParentHandle == efi_image_handle );
assert ( loaded.image->DeviceHandle == snpdev->handle );
loaded.image->ParentHandle = efi_loaded_image;
loaded.image->DeviceHandle = nethandle;
//assert ( loaded.image->DeviceHandle == nethandle );
assert ( loaded.image->LoadOptionsSize == 0 );
assert ( loaded.image->LoadOptions == NULL );

Expand Down Expand Up @@ -245,9 +254,9 @@ static int efi_image_exec ( struct image *image ) {
err_cmdline:
free ( path );
err_image_path:
efi_download_uninstall ( snpdev->handle );
efi_download_uninstall ( nethandle );
err_download_install:
efi_file_uninstall ( snpdev->handle );
efi_file_uninstall ( nethandle );
err_file_install:
err_no_snpdev:
return rc;
Expand Down

0 comments on commit 73d1ff0

Please sign in to comment.