comparison bootx64.c @ 12:56e8a3d49069

add README to how to use efi executable.
author taiki
date Sun, 30 Mar 2014 19:39:52 +0900
parents 7d337b6fb379
children
comparison
equal deleted inserted replaced
11:7d337b6fb379 12:56e8a3d49069
50 Print(L"optioins -%s-, start_ptr -%s-\n", options, start_ptr); 50 Print(L"optioins -%s-, start_ptr -%s-\n", options, start_ptr);
51 51
52 CHAR16 *kernel_name = (CHAR16 *)AllocatePool((options - start_ptr + 1) * sizeof(CHAR16)); 52 CHAR16 *kernel_name = (CHAR16 *)AllocatePool((options - start_ptr + 1) * sizeof(CHAR16));
53 53
54 RtCopyMem(kernel_name, start_ptr, (options - start_ptr) * sizeof(CHAR16)); 54 RtCopyMem(kernel_name, start_ptr, (options - start_ptr) * sizeof(CHAR16));
55
56 // delete last 0
55 kernel_name[options - start_ptr] = 0; 57 kernel_name[options - start_ptr] = 0;
56 58
57 Print(L"kernel name: -%s- name size: %d\n", kernel_name, (options - start_ptr)); 59 Print(L"kernel name: -%s- name size: %d\n", kernel_name, (options - start_ptr));
58 60
59 return kernel_name; 61 return kernel_name;
89 for (handle_idx = 0; handle_idx < handle_count; handle_idx++) { 91 for (handle_idx = 0; handle_idx < handle_count; handle_idx++) {
90 EFI_HANDLE device_handle; 92 EFI_HANDLE device_handle;
91 93
92 path = FileDevicePath(handle_buffer[handle_idx], kernel_name); 94 path = FileDevicePath(handle_buffer[handle_idx], kernel_name);
93 95
94 Print(L"Path Type %d\n", path->Type);
95 if (!path) { 96 if (!path) {
96 status = EFI_NOT_FOUND; 97 status = EFI_NOT_FOUND;
97 break; 98 break;
98 } 99 }
99 100
100 Print(L"OpenSimpleReadFile\n");
101 status = OpenSimpleReadFile(TRUE, NULL, 0, &path, &device_handle, &read_handle); 101 status = OpenSimpleReadFile(TRUE, NULL, 0, &path, &device_handle, &read_handle);
102 102
103 if (!EFI_ERROR(status)) { 103 if (!EFI_ERROR(status)) {
104 break; 104 break;
105 } 105 }
111 if (!EFI_ERROR(status)) { 111 if (!EFI_ERROR(status)) {
112 status = load_image(read_handle); 112 status = load_image(read_handle);
113 } 113 }
114 114
115 if (read_handle) { 115 if (read_handle) {
116 Print(L"CloseSimpleReadFile.\n"); 116 Print(L"Should execute CloseSimpleReadFile function.\n");
117 CloseSimpleReadFile(read_handle); 117 //CloseSimpleReadFile(read_handle);
118 } 118 }
119 119
120 if (path) { 120 if (path) {
121 FreePool(path); 121 FreePool(path);
122 } 122 }