aboutsummaryrefslogtreecommitdiff
path: root/stand/efi/loader/decompress.h
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-06-26 14:47:36 +0000
committerWarner Losh <imp@FreeBSD.org>2026-06-26 14:54:37 +0000
commitafee781523e45198c7be0a19281bcae2c4ab66db (patch)
tree098dc039f55b492b6af56875d8893bf47d17a6c2 /stand/efi/loader/decompress.h
parent59219fc76a4bde45039695373a662ad59432d451 (diff)
loader.efi: Recognize new memdisk=<url> and memcd=<url> options
Support ipxe downloading of a memory disk (either presented to the OS as a harddisk or a cd). This requires an ipxe server since it uses the ipxe download protocol to grab the disk. If there is a disk, we add it to the environment as a disk, and then the rest of the bootloader just sees it and boots from it. I've cribbed code from https://github.com/russor/memdisk_uefi and adapted it to work in the context of the FreeBSD bootloader. The ipxe_download.h file was created from the documentation of the interface. So a .ipxe file with the line chain http://10.2.0.1/loader.efi memdisk=${cwduri}FreeBSD-15.1-RELEASE-amd64-bootonly.iso would use the FreeBSD boot loader to boot the FreeBSD 15.1 release. md(9) has a bug at the moment that prevents it from probing the partitions on it. Also, we'll automatically decompress gzip, bzip2 and zstd files automatically. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57677
Diffstat (limited to 'stand/efi/loader/decompress.h')
-rw-r--r--stand/efi/loader/decompress.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/stand/efi/loader/decompress.h b/stand/efi/loader/decompress.h
new file mode 100644
index 000000000000..43c48078f822
--- /dev/null
+++ b/stand/efi/loader/decompress.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2026 Netflix, Inc. Written by Warner Losh
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+enum compression { none, zlib, bzip2, zstd };
+enum step_return { ok, done, err };
+
+typedef struct decomp_state decomp_state;
+
+decomp_state *decomp_init(uint8_t *buf, size_t buflen, size_t size_hint);
+enum step_return decomp_step(decomp_state *dctx, uint8_t *buf, size_t len, size_t offset);
+void decomp_fini(decomp_state *dctx, bool flush);
+EFI_PHYSICAL_ADDRESS decomp_buffer(decomp_state *dctx);
+size_t decomp_buffer_length(decomp_state *dctx);
+