date: move device specific partition under /hal directory 05/256105/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 29 Mar 2021 05:07:52 +0000 (14:07 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 29 Mar 2021 06:10:32 +0000 (15:10 +0900)
The pratition information is device specific data, and it should
be under /hal directory.

Change-Id: I543fd5d5d1fe4c0c688ef3fcb76adca8e5b2f510
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
CMakeLists.txt
packaging/initrd-flash.spec
scripts/41-flash.list.in
src/main.c

index 6b4f625..79dd33a 100644 (file)
@@ -4,6 +4,8 @@ PROJECT(flash-manager C)
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -O2")
 SET(CMAKE_EXE_LINKER_FLAGS "-pie")
 
+ADD_DEFINITIONS("-DTFM_PARTITION_DIR=\"${INITRD_FLASH_PARTITION_DATA_DIR}\"")
+
 FIND_PACKAGE(Threads REQUIRED)
 
 ADD_EXECUTABLE(${PROJECT_NAME} src/main.c src/thor.c src/dfu.c src/interface.c src/net.c src/usb.c)
index 96b4e34..2a00fd3 100644 (file)
@@ -39,6 +39,7 @@ Provide flash-manager with partition table for flashing image and files of Raspb
 
 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
         -DINITRD_FLASH_LIBEXEC_DIR=%{init_script_dir} \
+        -DINITRD_FLASH_PARTITION_DATA_DIR=%{_hal_datadir} \
         -DINITRD_RECOVERY_INSTALL_DROPIN_DIR=%{initrd_recovery_install_dropin_dir}
 
 make %{?jobs:-j%jobs}
@@ -47,14 +48,16 @@ make %{?jobs:-j%jobs}
 
 %make_install
 
-cp ./data/partition_* %{buildroot}%{_datadir}/
+mkdir -p %{buildroot}%{_hal_datadir}
+cp ./data/partition_* %{buildroot}%{_hal_datadir}/
 
 %post
 
 %post -n fm-data-rpi3
-mv %{_datadir}/partition_rpi3.info %{_datadir}/partition.info
+mv %{_hal_datadir}/partition_rpi3.info %{_hal_datadir}/partition.info
 
 %postun
+rm -f %{_hal_datadir}/partition.info
 
 %files
 %manifest initrd-flash.manifest
@@ -64,4 +67,4 @@ mv %{_datadir}/partition_rpi3.info %{_datadir}/partition.info
 %{initrd_recovery_install_dropin_dir}/*.list
 
 %files -n fm-data-rpi3
-%{_datadir}/partition_rpi3.info
+%{_hal_datadir}/partition_rpi3.info
index 247ec0c..80e7c27 100755 (executable)
@@ -29,5 +29,5 @@ SYMLINKS="
 "
 
 VERBATIMS="
-/usr/share/partition.info
+@INITRD_FLASH_PARTITION_DATA_DIR@/partition.info
 "
index e7d276d..9a81a06 100644 (file)
 #include "dfu.h"
 #include "interface.h"
 
+#if defined(TFM_PARTITION_DIR)
+       #define TFM_PART_INFO TFM_PARTITION_DIR"/partition.info"
+#else
+       #define TFM_PART_INFO "/hal/share/partition.info"
+#endif
+
 int _main(int argc, char *argv[])
 {
        struct tfm_interface_context *supported_interfaces;
        struct dfu_context *dfu;
        struct tfm_interface *intf;
-       const char *part_table = "/usr/share/partition.info";
+       const char *part_table = TFM_PART_INFO;
        char *opt_table = NULL;
        char *opt_serial = NULL;
        int ret, opt;