trusty: build: de-dupe BUILTIN_USER_TASKS, print UUID on appload failure am: 1cbf76bc91
Original change: https://android-review.googlesource.com/c/trusty/lk/trusty/+/2774727
Change-Id: Ic0d3b2d24c81c7d106939d38744ea8f9154d1c5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/app/trusty/user-tasks.mk b/app/trusty/user-tasks.mk
index 36a30e4..719ae37 100644
--- a/app/trusty/user-tasks.mk
+++ b/app/trusty/user-tasks.mk
@@ -193,15 +193,20 @@
# the crate itself with the same path.
RUST_USER_TEST_MODULES := $(addsuffix -test,$(TRUSTY_RUST_USER_TESTS))
+
+ifneq (true,$(call TOBOOL,$(UNITTEST_COVERAGE_ENABLED)))
# Default to including all user tests in the image if the set of builtin tests
# is not selected.
-ifneq (true,$(call TOBOOL,$(UNITTEST_COVERAGE_ENABLED)))
TRUSTY_BUILTIN_USER_TESTS ?= $(TRUSTY_USER_TESTS) $(RUST_USER_TEST_MODULES)
TRUSTY_BUILTIN_USER_TASKS += $(TRUSTY_BUILTIN_USER_TESTS)
endif
+# remove duplicates
+TRUSTY_BUILTIN_USER_TASKS := $(sort $(TRUSTY_BUILTIN_USER_TASKS))
+
ALL_USER_TASKS := $(TRUSTY_BUILTIN_USER_TASKS) $(TRUSTY_LOADABLE_USER_TASKS) \
$(TRUSTY_USER_TESTS) $(TRUSTY_LOADABLE_USER_TESTS) $(TRUSTY_RUST_USER_TESTS)
+
# sort and remove duplicates
ALL_USER_TASKS := $(sort $(ALL_USER_TASKS))
@@ -387,20 +392,6 @@
ALLOW_FP_USE := $(TRUSTY_KERNEL_SAVED_ALLOW_FP_USE)
SCS_ENABLED := $(TRUSTY_KERNEL_SAVED_SCS_ENABLED)
-
-#
-# Check for duplicate tasks
-#
-$(foreach _task,$(TRUSTY_BUILTIN_USER_TASKS),\
- $(eval DUPLICATE_TASKS += $$(filter $$(TASKS_SEEN),$$(_task)))\
- $(eval TASKS_SEEN += $$(_task))\
-)
-
-ifneq ($(strip $(DUPLICATE_TASKS)),)
-$(error Duplicate TRUSTY_BUILTIN_USER_TASKS: $(DUPLICATE_TASKS))
-endif
-
-
#
# Generate combined user task obj/bin if necessary
#
@@ -429,8 +420,6 @@
# Reset app variables
BUILDDIR := $(TRUSTY_TOP_LEVEL_BUILDDIR)
-TASKS_SEEN :=
-DUPLICATE_TASKS :=
TRUSTY_APP :=
TRUSTY_APP_NAME :=
TRUSTY_APP_BASE_LDFLAGS :=
diff --git a/lib/trusty/trusty_app.c b/lib/trusty/trusty_app.c
index 54b2210..1ffa0c0 100644
--- a/lib/trusty/trusty_app.c
+++ b/lib/trusty/trusty_app.c
@@ -134,8 +134,8 @@
static struct list_node allowed_mmio_ranges_list =
LIST_INITIAL_VALUE(allowed_mmio_ranges_list);
-#define PRINT_TRUSTY_APP_UUID(tid, u) \
- dprintf(SPEW, \
+#define PRINT_TRUSTY_APP_UUID(level, tid, u) \
+ dprintf((level), \
"trusty_app %d uuid: 0x%08xx 0x%04xx 0x%04xx 0x%02x%02x 0x%02x%02x%02x%02x%02x%02x\n", \
tid, (u)->time_low, (u)->time_mid, (u)->time_hi_and_version, \
(u)->clock_seq_and_node[0], (u)->clock_seq_and_node[1], \
@@ -1079,13 +1079,14 @@
return ERR_NOT_VALID;
}
- PRINT_TRUSTY_APP_UUID(trusty_app->app_id, &trusty_app->props.uuid);
-
if (trusty_app_find_by_uuid_locked(&trusty_app->props.uuid)) {
+ PRINT_TRUSTY_APP_UUID(CRITICAL, trusty_app->app_id,
+ &trusty_app->props.uuid);
dprintf(CRITICAL, "app already registered\n");
return ERR_ALREADY_EXISTS;
}
+ PRINT_TRUSTY_APP_UUID(SPEW, trusty_app->app_id, &trusty_app->props.uuid);
dprintf(SPEW, "trusty_app %u name: %s priority: %u\n", trusty_app->app_id,
trusty_app->props.app_name, trusty_app->props.priority);