[openwrt/openwrt] base-files: upgrade: fix efi partitions size calculation

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 27 04:56:35 PST 2021


chunkeey pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/018ada5403f02921be22ee0cf49b88b2700ee105

commit 018ada5403f02921be22ee0cf49b88b2700ee105
Author: Javier Marcet <javier at marcet.info>
AuthorDate: Sat Apr 4 17:52:29 2020 +0200

    base-files: upgrade: fix efi partitions size calculation
    
    We were missing (not using) the last sector of each partition,
    compared with the output of gparted.
    
    Signed-off-by: Javier Marcet <javier at marcet.info>
    [moved the dot]
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 package/base-files/files/lib/upgrade/common.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index ec198b2375..24ff77a8b3 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -245,7 +245,7 @@ get_partitions() { # <device> <filename>
 				local type="$1"
 				local lba="$(( $(hex_le32_to_cpu $4) * 0x100000000 + $(hex_le32_to_cpu $3) ))"
 				local end="$(( $(hex_le32_to_cpu $6) * 0x100000000 + $(hex_le32_to_cpu $5) ))"
-				local num="$(( $end - $lba ))"
+				local num="$(( $end - $lba + 1 ))"
 
 				[ "$type" = "00000000000000000000000000000000" ] && continue
 



More information about the lede-commits mailing list