loader: Move some support things around, maybe lame?

Sponsored by:		Netflix
This commit is contained in:
Warner Losh committed 2026-09-12 10:59:17 -06:00
1 parent 197df29edb
commit 6413a870fa
6 files changed
+25 -5

No files matched your search

+6
View File
@@ -127,6 +127,12 @@ CFLAGS+= -I${SASRC}/geli
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
CFLAGS+= -DLOADER_DISK_SUPPORT
.endif
.if ${LOADER_NET_SUPPORT:Uno} == "yes"
CFLAGS+= -DLOADER_NET_SUPPORT
.endif
.if ${LOADER_MD_SUPPORT:Uno} == "yes"
CFLAGS+= -DLOADER_MD_SUPPORT
.endif
# Machine specific flags for all builds here
+3
View File
@@ -1,3 +1,6 @@
LOADER_NET_SUPPORT?= yes
LOADER_MD_SUPPORT?= yes
.include <bsd.init.mk>
LIB= efi
+6
View File
@@ -452,9 +452,13 @@ efi_env_net_params(struct iodesc *desc)
* There must be a rootpath. It may be ip:/path or it may be just the
* path in which case the ip needs to be serverip.
*/
#ifdef LOADER_NET_SUPPORT
rootaddr = net_parse_rootpath();
if (rootaddr == INADDR_NONE)
rootaddr = serveraddr;
#else
rootaddr = serveraddr;
#endif
rootip.s_addr = rootaddr;
#ifdef EFINET_DEBUG
@@ -662,10 +666,12 @@ efinet_dev_init(void)
*/
efi_pxe_snapshot_all(nifs);
#ifdef LOADER_NET_SUPPORT
efinet_dev.dv_cleanup = netdev.dv_cleanup;
efinet_dev.dv_open = netdev.dv_open;
efinet_dev.dv_close = netdev.dv_close;
efinet_dev.dv_strategy = netdev.dv_strategy;
#endif
done:
free(handles2);
+2
View File
@@ -1275,6 +1275,7 @@ testmd(pdinfo_t *md)
void
efiblk_memdisk_preload(void)
{
#ifdef LOADER_MD_SUPPORT
MEDIA_RAM_DISK_DEVICE_PATH *ram;
uint64_t start, end;
pdinfo_t *md;
@@ -1289,4 +1290,5 @@ efiblk_memdisk_preload(void)
end = ((uint64_t)ram->EndingAddr[1] << 32) | ram->EndingAddr[0];
md_export_to_kernel(start, end - start + 1);
}
#endif
}
+7
View File
@@ -136,6 +136,7 @@ download_finish(IN VOID *Context, IN EFI_STATUS Status)
static int
fallback_to_md(EFI_PHYSICAL_ADDRESS pa, size_t len)
{
#ifdef LOADER_MD_SUPPORT
int unit;
unit = md_register((void *)(uintptr_t)pa, len, MD_FLAG_KERNEL);
@@ -146,6 +147,10 @@ fallback_to_md(EFI_PHYSICAL_ADDRESS pa, size_t len)
}
setenv("uefi_ignore_boot_mgr", "true", 1);
return (0);
#else
printf("No memory disk support in this loader\n");
return (EOPNOTSUPP);
#endif
}
int
@@ -218,6 +223,7 @@ out_close:
void
maybe_download_initmd(void)
{
#ifdef LOADER_NET_SUPPORT
struct devdesc dev;
const char *url;
int error;
@@ -243,6 +249,7 @@ maybe_download_initmd(void)
error = download_md_image(url);
if (error != 0 && error != ECANCELED)
printf("Could not download initmd: %s\n", strerror(error));
#endif
}
static void
+1 -5
View File
@@ -75,7 +75,6 @@ SRCS+= bcache.c
.if defined(MD_IMAGE_SIZE)
CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
.endif
CFLAGS+= -DLOADER_MD_SUPPORT
SRCS+= md.c
CLEANFILES+= md.o
.endif
@@ -138,10 +137,7 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT
CFLAGS+= -DLOADER_XZ_SUPPORT
.endif
# Network related things
.if ${LOADER_NET_SUPPORT:Uno} == "yes"
CFLAGS+= -DLOADER_NET_SUPPORT
.endif
# Network related things (LOADER_NET_SUPPORT itself: see defs.mk)
.if ${LOADER_NFS_SUPPORT:Uno} == "yes"
CFLAGS+= -DLOADER_NFS_SUPPORT
.endif