aboutsummaryrefslogtreecommitdiffstats
path: root/linux/patches/initramfs.c.patch
blob: dc8a3045a74b6f6a1b99b9ef0533699cd595ab5b (plain)
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
--- init/initramfs.c.new	2022-04-21 10:43:58.644900319 -0400
+++ init/initramfs.c	2022-04-21 10:46:57.309758246 -0400
@@ -461,7 +461,7 @@
 
 #include <linux/decompress/generic.h>
 
-static char * __init unpack_to_rootfs(char *buf, unsigned long len)
+static char * __init do_unpack_to_rootfs(char *buf, unsigned long len, char *output)
 {
 	long written;
 	decompress_fn decompress;
@@ -497,7 +497,7 @@
 		decompress = decompress_method(buf, len, &compress_name);
 		pr_debug("Detected %s compressed data\n", compress_name);
 		if (decompress) {
-			int res = decompress(buf, len, NULL, flush_buffer, NULL,
+			int res = decompress(buf, len, NULL, flush_buffer, output,
 				   &my_inptr, error);
 			if (res)
 				error("decompressor failed");
@@ -523,6 +523,11 @@
 	return message;
 }
 
+static char * __init unpack_to_rootfs(char *buf, unsigned long len)
+{
+    return do_unpack_to_rootfs(buf, len, NULL);
+}
+
 static int __initdata do_retain_initrd;
 
 static int __init retain_initrd_param(char *str)
@@ -683,7 +688,11 @@
 	else
 		printk(KERN_INFO "Unpacking initramfs...\n");
 
-	err = unpack_to_rootfs((char *)initrd_start, initrd_end - initrd_start);
+	//err = unpack_to_rootfs((char *)initrd_start, initrd_end - initrd_start);
+    void *output = vmalloc(0x80000);
+    err = do_unpack_to_rootfs((char *)initrd_start, initrd_end - initrd_start, output);
+    vfree(output);
+
 	if (err) {
 #ifdef CONFIG_BLK_DEV_RAM
 		populate_initrd_image(err);