Skip to content

Commit

Permalink
linux: use PKG_UIMAGE_*ADDR for the used address
Browse files Browse the repository at this point in the history
If a package is sources multiple times, the destination address
may be recalculated and overwritten a few times. Prevent this by
using PKG-prefixed variables for results.

Thanks to MilhouseVH for suggesting this.
kszaq committed May 3, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 33e4a6a commit a87ec68
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/linux/package.mk
Original file line number Diff line number Diff line change
@@ -255,16 +255,19 @@ make_target() {
COMPRESSED_SIZE=$(stat -t "arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET" | awk '{print $2}')
# align to 1 MiB
COMPRESSED_SIZE=$(( (($COMPRESSED_SIZE - 1 >> 20) + 1) << 20 ))
KERNEL_UIMAGE_LOADADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_LOADADDR + $COMPRESSED_SIZE ))")
KERNEL_UIMAGE_ENTRYADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_ENTRYADDR + $COMPRESSED_SIZE ))")
PKG_KERNEL_UIMAGE_LOADADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_LOADADDR + $COMPRESSED_SIZE ))")
PKG_KERNEL_UIMAGE_ENTRYADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_ENTRYADDR + $COMPRESSED_SIZE ))")
else
PKG_KERNEL_UIMAGE_LOADADDR=${KERNEL_UIMAGE_LOADADDR}
PKG_KERNEL_UIMAGE_ENTRYADDR=${KERNEL_UIMAGE_ENTRYADDR}
fi

mkimage -A $TARGET_KERNEL_ARCH \
-O linux \
-T kernel \
-C $KERNEL_UIMAGE_COMP \
-a $KERNEL_UIMAGE_LOADADDR \
-e $KERNEL_UIMAGE_ENTRYADDR \
-a $PKG_KERNEL_UIMAGE_LOADADDR \
-e $PKG_KERNEL_UIMAGE_ENTRYADDR \
-d arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET \
arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_UIMAGE_TARGET
fi

0 comments on commit a87ec68

Please sign in to comment.