xref: /DragonStub/apps/stub.c (revision f412fd2a1a248b546b7085648dece8d908077fab)
1 #include <efi.h>
2 #include <efilib.h>
3 #include <dragonstub/dragonstub.h>
4 
5 EFI_STATUS efi_handle_cmdline(EFI_LOADED_IMAGE *image, char **cmdline_ptr)
6 {
7 	int cmdline_size = 0;
8 	EFI_STATUS status;
9 	char *cmdline;
10 
11 	/*
12 	 * Get the command line from EFI, using the LOADED_IMAGE
13 	 * protocol. We are going to copy the command line into the
14 	 * device tree, so this can be allocated anywhere.
15 	 */
16 	cmdline = efi_convert_cmdline(image, &cmdline_size);
17 	if (!cmdline) {
18 		efi_err("getting command line via LOADED_IMAGE_PROTOCOL\n");
19 		return EFI_OUT_OF_RESOURCES;
20 	}
21 
22 // 	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
23 // 	    IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
24 // 	    cmdline_size == 0) {
25 // 		status = efi_parse_options(CONFIG_CMDLINE);
26 // 		if (status != EFI_SUCCESS) {
27 // 			efi_err("Failed to parse options\n");
28 // 			goto fail_free_cmdline;
29 // 		}
30 // 	}
31 
32 // 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0) {
33 // 		status = efi_parse_options(cmdline);
34 // 		if (status != EFI_SUCCESS) {
35 // 			efi_err("Failed to parse options\n");
36 // 			goto fail_free_cmdline;
37 // 		}
38 // 	}
39 
40 // 	*cmdline_ptr = cmdline;
41 // 	return EFI_SUCCESS;
42 
43 // fail_free_cmdline:
44 // 	efi_bs_call(free_pool, cmdline_ptr);
45 // 	return status;
46 }