%attr(0554,system_fw,system_fw) %{_bindir}/device_board_set_partition_ab_cloned
%attr(0554,system_fw,system_fw) %{_bindir}/device_board_clear_partition_ab_cloned
%attr(0555,system_fw,system_fw) %{_bindir}/device_board_get_partition_ab_cloned
+%attr(0555,system_fw,system_fw) %{_bindir}/device_board_set_partition_status
+%attr(0555,system_fw,system_fw) %{_bindir}/device_board_get_partition_status
%attr(0554,system_fw,system_fw) %{_bindir}/device_board_set_upgrade_status
%attr(0555,system_fw,system_fw) %{_bindir}/device_board_get_upgrade_status
ADD_BOOT_EXECUTABLE(device_board_clear_partition_ab_cloned clear-partition-ab-cloned.c)
ADD_BOOT_EXECUTABLE(device_board_get_partition_ab_cloned get-partition-ab-cloned.c)
ADD_BOOT_EXECUTABLE(device_board_set_partition_ab_cloned set-partition-ab-cloned.c)
+ADD_BOOT_EXECUTABLE(device_board_get_partition_status get-partition-status.c)
+ADD_BOOT_EXECUTABLE(device_board_set_partition_status set-partition-status.c)
ADD_BOOT_EXECUTABLE(device_board_set_upgrade_status set-upgrade-status.c)
ADD_BOOT_EXECUTABLE(device_board_get_upgrade_status get-upgrade-status.c)
--- /dev/null
+/*
+ * device-board-get-partition-status
+ *
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <hal/device/hal-board.h>
+
+int main(int argc, char *argv[])
+{
+ char buffer[1024] = { 0, };
+ char partition_ab;
+ int ret;
+
+ if (argc < 2) {
+ partition_ab = '\0';
+ } else {
+ partition_ab = argv[1][0];
+
+ if (partition_ab != 'a' && partition_ab != 'b') {
+ goto err;
+ }
+ }
+
+ ret = hal_device_board_get_partition_status(partition_ab, buffer, sizeof(buffer));
+
+ if (ret < 0) {
+ goto err;
+ }
+
+ printf("%s\n", buffer);
+ return 0;
+
+err:
+ printf("FAILURE\n");
+ return 1;
+}
--- /dev/null
+/*
+ * device-board-set-partition-status
+ *
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <hal/device/hal-board.h>
+
+#define AVAILABLE_STATUS_NUM 3
+
+int main(int argc, char *argv[])
+{
+ const char *available_status[AVAILABLE_STATUS_NUM] = { "ok", "failed", "corrupted" };
+ const char *status;
+ int is_status_available;
+ char partition_ab;
+ int ret;
+
+ if (argc < 2) {
+ goto err;
+ } else if (argc == 2) {
+ partition_ab = '\0';
+ status = argv[1];
+ } else {
+ partition_ab = argv[1][0];
+ status = argv[2];
+
+ if (partition_ab != 'a' && partition_ab != 'b') {
+ goto err;
+ }
+ }
+
+ is_status_available = 0;
+ for (int i = 0; i < AVAILABLE_STATUS_NUM; ++i) {
+ if (!strncmp(status, available_status[i], strlen(available_status[i]))) {
+ is_status_available = 1;
+ break;
+ }
+ }
+
+ if (!is_status_available) {
+ goto err;
+ }
+
+ ret = hal_device_board_set_partition_status(partition_ab, status);
+
+ if(ret < 0) {
+ goto err;
+ }
+
+ printf("SUCCESS\n");
+ return 0;
+
+err:
+ printf("FAILURE\n");
+ return 1;
+}
*/
#include <stdio.h>
-#include <errno.h>
#include <hal/device/hal-board.h>
int main(int argc, char *argv[])