--- /dev/null
+#
+# upgrade-engine
+#
+# Copyright (c) 2022 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+ADD_DEFINITIONS("-DFEATURE_SUPPORT_CAPABILITY")
+ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
+ADD_DEFINITIONS("-DHOST_BUILD")
+
+SET(SRCS
+ src/upgrade-apply-deltafs/fota_util.c
+ src/upgrade-apply-deltafs/ua.c
+ src/upgrade-apply-deltafs/engine/SS_Common.c
+ src/upgrade-apply-deltafs/engine/SS_UPI.c
+ src/upgrade-apply-deltafs/engine/SS_FSUpdate.c
+ src/upgrade-apply-deltafs/engine/SS_ApplyPatch.c
+ src/upgrade-apply-deltafs/engine/SS_PatchDelta.c
+ src/upgrade-apply-deltafs/engine/fota_log.c
+ src/upgrade-apply-deltafs/engine/fota_tar.c
+ src/upgrade-apply-deltafs/engine/ss_bspatch_common.c
+ src/upgrade-apply/sha1/sha1.c
+)
+
+INCLUDE_DIRECTORIES(src/upgrade-apply/sha1)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${PROJECT_NAME}_pkgs REQUIRED liblzma-tool libbrotlienc zlib)
+
+FOREACH(flag ${${PROJECT_NAME}_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -I./include")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(EXECNAME "upgrade-apply-deltafs")
+SET(BINDIR "/usr/bin")
+ADD_EXECUTABLE(${EXECNAME} ${SRCS})
+
+TARGET_LINK_LIBRARIES(${EXECNAME} PRIVATE ${${PROJECT_NAME}_pkgs_LDFLAGS} "-g" "-pthread")
+TARGET_LINK_LIBRARIES(${EXECNAME} PRIVATE libtar.a)
+INSTALL(TARGETS ${EXECNAME} DESTINATION ${BINDIR})
\ No newline at end of file
--- /dev/null
+#
+# upgrade-engine
+#
+# Copyright (c) 2022 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+ADD_SUBDIRECTORY(src/dmverity)
+ADD_SUBDIRECTORY(src/img-verifier)
+ADD_SUBDIRECTORY(src/upgrade-apply)
+ADD_SUBDIRECTORY(src/upgrade-apply-deltafs)
+ADD_SUBDIRECTORY(src/blkid-print)
+ADD_SUBDIRECTORY(data)
+ADD_SUBDIRECTORY(scripts/rw-upgrade)
#
# upgrade-engine
#
-# Copyright (c) 2021 Samsung Electronics Co., Ltd.
+# Copyright (c) 2022 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
CMAKE_MINIMUM_REQUIRED(VERSION 2.82)
PROJECT(upgrade C)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
-ADD_SUBDIRECTORY(src/dmverity)
-ADD_SUBDIRECTORY(src/img-verifier)
-ADD_SUBDIRECTORY(src/upgrade-apply)
-ADD_SUBDIRECTORY(src/upgrade-apply-deltafs)
-ADD_SUBDIRECTORY(src/blkid-print)
-ADD_SUBDIRECTORY(data)
-ADD_SUBDIRECTORY(scripts/rw-upgrade)
+# set this to ON if you want to build on host
+OPTION(DEFINE_HOST_BUILD OFF)
+IF(DEFINE_HOST_BUILD)
+ INCLUDE(CMakeLists.host-build)
+ELSE()
+ INCLUDE(CMakeLists.target-build)
+ENDIF()
\ No newline at end of file
#include <string.h>
#include <getopt.h>
+#ifndef HOST_BUILD
#include <hal/device/hal-board.h>
+#endif
#include "ua.h"
#include "fota_util.h"
static void set_upgrade_progress(int percent)
{
int relative_precent = HAL_PROGRESS_MIN + ((HAL_PROGRESS_MAX - HAL_PROGRESS_MIN) * percent)/100;
+
+#ifndef HOST_BUILD
if (hal_device_board_set_upgrade_status(relative_precent) < 0) {
LOG("set_upgrade_status failed: %d\n", relative_precent);
return;
}
+#endif
LOG("set_upgrade_status success: %d\n", relative_precent);
}