M cmake/modules/DiskImage.cmake => cmake/modules/DiskImage.cmake +3 -0
@@ 24,6 24,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()
@@ 50,6 52,7 @@ function(add_image)
${SCRIPT_PATH}
${DISK_IMAGE_NAME}
${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 +17 -8
@@ 4,15 4,16 @@
usage() {
cat << ==usage
-Usage: $(basename $0) image_path build_dir [boot.bin_file] [updater.bin_file]
- image_path - Destination image path name e.g., PurePhone.img
- sysroot - product's system root e.g., build-rt1051-RelWithDebInfo/sysroot
- 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: $(basename $0) image_path build_dir version.json_file [boot.bin_file] [updater.bin_file]
+ image_path - Destination image path name e.g., PurePhone.img
+ 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
}
-if [[ ( $# -ne 2 ) && ( $# -ne 4 ) ]]; then
+if [[ ( $# -ne 3 ) && ( $# -ne 5 ) ]]; then
echo "Error! Invalid argument count"
usage
exit -1
@@ 20,8 21,9 @@ fi
IMAGE_NAME=$(realpath $1)
SYSROOT=$(realpath $2)
-BIN_FILE=$3
-UPDATER_FILE=$4
+VERSION_FILE=$3
+BIN_FILE=$4
+UPDATER_FILE=$5
if [ ! -d "$SYSROOT" ]; then
echo "Error! ${SYSROOT} is not a directory"
@@ 110,6 112,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