Skip to contentSkip to conversation

lib: Add early cpio decoder

tip:x86/acpi tip-bot for H. Peter Anvin 1 participant 1 message Sep 28, 2012 1 message not in the archive Library code

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Commit-ID:  684304887f5093a69343cd909f01c5b3ba914852
Gitweb:     http://git.kernel.org/tip/684304887f5093a69343cd909f01c5b3ba914852
Author:     H. Peter Anvin <[email protected]>
AuthorDate: Wed, 26 Sep 2012 14:18:56 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 27 Sep 2012 15:00:13 -0700

lib: Add early cpio decoder

Add a simple cpio decoder without library dependencies for the purpose of extracting components from the initramfs blob for early kernel uses. Intended consumers so far are microcode and ACPI override.

---
 include/linux/earlycpio.h |   17 +++++
 lib/Makefile              |    2 +-
 lib/earlycpio.c           |  145 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+), 1 deletions(-)
include/linux/earlycpio.h new file +17 -0
new file mode 100644
index 0000000..111f46d
@@ -0,0 +1,17 @@
+#ifndef _LINUX_EARLYCPIO_H
+#define _LINUX_EARLYCPIO_H
+
+#include <linux/types.h>
+
+#define MAX_CPIO_FILE_NAME 18
+
+struct cpio_data {
+	void *data;
+	size_t size;
+	char name[MAX_CPIO_FILE_NAME];
+};
+
+struct cpio_data find_cpio_data(const char *path, void *data, size_t len,
+				long *offset);
+
+#endif /* _LINUX_EARLYCPIO_H */
lib/Makefile +1 -1
index 42d283e..0924041 100644
@@ -12,7 +12,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
 	 idr.o int_sqrt.o extable.o prio_tree.o \
 	 sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
 	 proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \
-	 is_single_threaded.o plist.o decompress.o
+	 is_single_threaded.o plist.o decompress.o earlycpio.o
 
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
lib/earlycpio.c new file +145 -0

145 lines not on this page · raw message