diff options
author | James Ruan <[email protected]> | 2018-03-02 01:52:26 +0800 |
---|---|---|
committer | XECDesign <[email protected]> | 2018-03-01 17:52:26 +0000 |
commit | 40eae05204c00a4c4a070ea651fa4c11b12f5beb (patch) | |
tree | 19f0209858154f2e2ebeae61acf28ae27e2d4c0e /export-image/prerun.sh | |
parent | e6f7cd5cd6f45a5917d8453c19104e42eefcfe65 (diff) |
make root filesystem 4M aligned (#154)
Diffstat (limited to 'export-image/prerun.sh')
-rwxr-xr-x | export-image/prerun.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/export-image/prerun.sh b/export-image/prerun.sh index cec133c..3acc248 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -13,6 +13,7 @@ BOOT_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR}/boot --block-size=1 | cut TOTAL_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/archives --block-size=1 | cut -f 1) ROUND_SIZE="$((4 * 1024 * 1024))" +ROUNDED_ROOT_SECTOR=$(((2 * BOOT_SIZE + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE / 512 + 8192)) IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE)) truncate -s ${IMG_SIZE} ${IMG_FILE} @@ -29,7 +30,7 @@ c n -8192 +${ROUNDED_ROOT_SECTOR} p |