File: reduce_efirom_size.patch

package info (click to toggle)
ipxe 1.21.1%2Bgit20250602.5b3ebf8b%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 25,372 kB
  • sloc: ansic: 369,336; asm: 7,329; perl: 2,613; sh: 850; makefile: 468; python: 284
file content (110 lines) | stat: -rw-r--r-- 2,821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Description: remove unnecessary objects
Author: Miao Wang <shankerwangmiao@gmail.com>
Bug: https://github.com/ipxe/ipxe/pull/1417
Last-Update: 2025-02-27
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -1141,7 +1141,7 @@
 #		  --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
 #
 TGT_LD_FLAGS	= $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) \
-		    $(TGT_LD_DEVLIST) obj_config obj_config_$(PLATFORM),\
+		    $(TGT_LD_DEVLIST) obj_config_root obj_config_$(PLATFORM),\
 		    -u $(SYMBOL_PREFIX)$(SYM) \
 		    --defsym check_$(SYM)=$(SYMBOL_PREFIX)$(SYM) ) \
 		  $(patsubst %,--defsym %,$(TGT_LD_IDS)) \
--- a/src/config/config_efi.c
+++ b/src/config/config_efi.c
@@ -37,6 +37,7 @@
  *
  */
 
+#ifndef EFI_DOWNGRADE_UX
 #ifdef CONSOLE_EFI
 REQUIRE_OBJECT ( efi_console );
 #endif
@@ -49,3 +50,6 @@
 #ifdef DOWNLOAD_PROTO_FILE
 REQUIRE_OBJECT ( efi_local );
 #endif
+#endif
+
+PROVIDE_SYMBOL ( obj_config_efi_console );
--- /dev/null
+++ b/src/config/config_root.c
@@ -0,0 +1,5 @@
+#include <config/general.h>
+
+PROVIDE_REQUIRING_SYMBOL();
+
+REQUIRE_OBJECT ( device );
--- a/src/interface/efi/efi_init.c
+++ b/src/interface/efi/efi_init.c
@@ -30,6 +30,14 @@
 #include <ipxe/efi/efi_path.h>
 #include <ipxe/efi/efi_cmdline.h>
 #include <ipxe/efi/Protocol/LoadedImage.h>
+#include <config/general.h>
+
+#ifdef EFI_DOWNGRADE_UX
+static const wchar_t *dummy_efi_cmdline;
+static size_t dummy_efi_cmdline_len;
+#define efi_cmdline dummy_efi_cmdline
+#define efi_cmdline_len dummy_efi_cmdline_len
+#endif
 
 /** Image handle passed to entry point */
 EFI_HANDLE efi_image_handle;
--- a/src/interface/efi/efi_snp.c
+++ b/src/interface/efi/efi_snp.c
@@ -41,6 +41,8 @@
 #include <usr/autoboot.h>
 #include <config/general.h>
 
+PROVIDE_REQUIRING_SYMBOL();
+
 /** List of SNP devices */
 static LIST_HEAD ( efi_snp_devices );
 
@@ -81,6 +83,10 @@
 	{ 0x6e, 0x68, 0x65, 0x6c, 0x70, 0x66, 0x75, 0x6c }
 };
 #define efi_load_file_protocol_guid dummy_load_file_protocol_guid
+#define is_efi_downgrade_ux 1
+#else
+REQUIRE_OBJECT ( config_efi_console );
+#define is_efi_downgrade_ux 0
 #endif
 
 /**
@@ -1726,6 +1732,10 @@
 	struct net_device *netdev = snpdev->netdev;
 	int rc;
 
+	if ( is_efi_downgrade_ux ) {
+		return EFI_UNSUPPORTED;
+	}
+
 	/* Fail unless this is a boot attempt */
 	if ( ! booting ) {
 		DBGC ( snpdev, "SNPDEV %p cannot load non-boot file\n",
--- a/src/interface/efi/efidrvprefix.c
+++ b/src/interface/efi/efidrvprefix.c
@@ -89,3 +89,6 @@
 	.dev = { .name = "EFI" },
 	.driver = &efi_root_driver,
 };
+
+PROVIDE_REQUIRING_SYMBOL();
+REQUIRE_SYMBOL ( efi_snp_driver );
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -637,3 +637,6 @@
 		}
 	}
 }
+
+PROVIDE_REQUIRING_SYMBOL();
+REQUIRE_OBJECT ( config );