Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 05ba6568 authored by Yinghai Lu's avatar Yinghai Lu Committed by alexax66
Browse files

initramfs: Support initrd that is bigger than 2GiB



When initrd (compressed or not) is used, kernel report data corrupted
with /dev/ram0.

The root cause:
During initramfs checking, if it is initrd, it will be transferred to
/initrd.image with sys_write.
sys_write only support 2G-4K write, so if the initrd ram is more than
that, /initrd.image will not complete at all.

Add local xwrite to loop calling sys_write to workaround the
problem.

Also need to use xwrite in write_buffer() to handle:
image is uncompressed cpio and there is one big file (>2G) in it.
   unpack_to_rootfs ===> write_buffer ===> actions[]/do_copy

At the same time, we don't need to worry about sys_read/sys_write in
do_mounts_rd.c::crd_load. As decompressor will have fill/flush and
local buffer that is smaller than 2G.

Test with uncompressed initrd, and compressed ones with gz, bz2, lzma,xz,
lzop.

-v2: according to HPA, change name to xwrite.
-v3: change xwrite to HPA's version. The normal behavior of xwrite(),
     like fwrite() and write(), is to return the total number of bytes
     written if any bytes are written at all.

Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 18d45b2d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment