legacy_disk_layout: rootfs fs_size to the (almost) max

Copy some of the info from CL:1842312 and CL:1865692 that talks about
exactly what the extra space in the rootfs partition is used for.

Copied from those CLs:

Here the maximum is calculated as follows, solving for the unknown
variable "fs_MiB":

total_MiB = 2048
total_bytes = total_MiB * 1024 * 1024
fs_bytes = fs_MiB * 1024 * 1024
fs_blocks = fs_bytes / 4096

verity_blocks = div_round_up(fs_blocks, 128) + div_round_up(fs_blocks, 16384) + 1
verity_bytes = fs_bytes / 128 + fs_bytes / 16384 + 4096

fs_bytes + verity_bytes < total_bytes
fs_bytes + fs_bytes / 128 + fs_bytes / 16384 + 4096 < total_bytes
fs_bytes < (total_bytes - 4096) * 16384 / 16513
fs_MiB <= ((total_bytes - 4096) * 16384 / 16513) / (1024 * 1024)

fs_MiB <= ((total_MiB * 1024 * 1024 - 4096) * 16384 / 16513) / (1024 * 1024)

This gives us fs_MiB <= 2031.  ...sure enough if you build with 2032
the build fails and with 2031 it passes.

As an emergency warning we'll leave an extra 40 and use 1991 vs. 2031.

BUG=chromium:1012296
TEST=build_image

Change-Id: I81918feed95cde45486031b4ae16f5c88e065535
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1907026
Tested-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Will Bradley <wbbradley@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
1 file changed