~aleteoryx/muditaos

ac7a9420457aa0456d25cbce2752d5b3000ec1d0 — Piotr Tański 4 years ago 72f7d7f
[CP-583] Update failure due to version.json on the phone

Added version.json to the image

(cherry picked from commit 395e99e16239630263d5892e2462f1333236ae99)
2 files changed, 14 insertions(+), 2 deletions(-)

M cmake/modules/DiskImage.cmake
M tools/generate_image.sh
M cmake/modules/DiskImage.cmake => cmake/modules/DiskImage.cmake +3 -0
@@ 29,6 29,8 @@ function(add_image)
        set(BIN_FILE_PATH "")
    endif()

    set(VERSION_FILE_PATH ${CMAKE_BINARY_DIR}/${_ARG_PRODUCT}-version.json)

    if(HAS_UPDATER)
        set(UPDATER_FILE_PATH ${CMAKE_BINARY_DIR}/updater.bin)
    else()


@@ 56,6 58,7 @@ function(add_image)
            ${DISK_IMAGE_NAME}
            ${IMAGE_PARTITIONS}
            ${CMAKE_BINARY_DIR}/${_ARG_SYSROOT}
            "${VERSION_FILE_PATH}"
            "${BIN_FILE_PATH}"
            "${UPDATER_FILE_PATH}"
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}

M tools/generate_image.sh => tools/generate_image.sh +11 -2
@@ 8,6 8,7 @@ Usage: $(basename $0) image_path image_partitions build_dir [boot.bin_file] [upd
    image_path       - Destination image path name e.g., PurePhone.img
    image_partitions - Path to image_partitions.map product-specific file
    sysroot          - product's system root e.g., build-rt1051-RelWithDebInfo/sysroot
    version.json_file - version file
    boot.bin_file    - optional for linux image - name of the boot.bin file (for different targets)
    updater.bin_file - optional for linux image - name of the updater.bin file
==usage


@@ 24,8 25,9 @@ PRODUCT_NAME=$(basename -s .img $1)
IMAGE_PARTITIONS=$(realpath $2)

SYSROOT=$(realpath $3)
BIN_FILE=$4
UPDATER_FILE=$5
VERSION_FILE=$4
BIN_FILE=$5
UPDATER_FILE=$6

if [ ! -d "$SYSROOT" ]; then
	echo "Error! ${SYSROOT} is not a directory"


@@ 116,6 118,13 @@ for i in $CURRENT_DATA; do
	fi
done

if [[ -n "${VERSION_FILE}" && -f "${VERSION_FILE}" ]]; then
	mcopy -v -s -i "$PART1" ${VERSION_FILE} ::/current/version.json
else
	echo "Warning! Missing version.json"
	echo "(it's fine for a Linux build)"
fi

if [[ -n "${BIN_FILE}" && -f "${BIN_FILE}" ]]; then
	mcopy -v -s -i "$PART1" ${BIN_FILE} ::/current/boot.bin
else