From 0a6624b26dd8006a75725e5379431abf1c5b0f09 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Fri, 24 Jan 2020 12:48:57 +0000 Subject: [PATCH] Update ROOT_MARGIN --- Dockerfile | 2 +- README.md | 2 +- depends | 1 + export-image/prerun.sh | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 706a5fb..35f483a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get -y update && \ apt-get -y install \ git vim parted \ quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ - bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod\ + bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\ && rm -rf /var/lib/apt/lists/* COPY . /pi-gen/ diff --git a/README.md b/README.md index bf681fa..ec4f65c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To install the required dependencies for pi-gen you should run: ```bash apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ -dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl +dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl bc ``` The file `depends` contains a list of tools needed. The format of this diff --git a/depends b/depends index 6238eb1..a86bc82 100644 --- a/depends +++ b/depends @@ -16,3 +16,4 @@ xxd file git lsmod:kmod +bc diff --git a/export-image/prerun.sh b/export-image/prerun.sh index cecde32..8bbc566 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -18,7 +18,7 @@ ALIGN="$((4 * 1024 * 1024))" # some overhead (since actual space usage is usually rounded up to the # filesystem block size) and gives some free space on the resulting # image. -ROOT_MARGIN=$((800*1024*1024)) +ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)" BOOT_PART_START=$((ALIGN)) BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN))