Please replace myapp/MYAPP with your application name:
1. cd your TZ root.
2. mkdir -p trustzone_images/core/bsp/trustzone/qsapps/myapp/build
3. cp trustzone_images/core/bsp/trustzone/qsapps/sampleapp/build/SConscript trustzone_images/core/bsp/trustzone/qsapps/myapp/build/SConscript
4. Edit trustzone_images/core/bsp/trustzone/qsapps/myapp/build/SConscript
Replace all occurrences of smapleapp and SAMPLEAPP with myapp and MYAPP, respectively.
Remove all aliases except 'myapp' and 'all'.
and (also for 8996, replace smplap32 as myapp)
5. Edit trustzone_images/core/securemsm/trustzone/qsapps/libs/applib/proxy/build/SConscript:
Add 'MYAPP_IMAGE' to env.AddBinaryLibrary(
copy
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\proxy\build\sampleapp
to
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\proxy\build\myapp
6. Edit trustzone_images/core/securemsm/trustzone/qsapps/libs/applib/qsee/build/SConscript:
Add the following lines:
env.AddBinaryObject('MYAPP_IMAGE', IMG_ENTRY_SOURCES)
env.AddBinaryLibrary('MYAPP_IMAGE', '${BUILDPATH}/tzapp_entrylib', LIB_ENTRY_SOURCES)
if for GP apps:
env.AddBinaryObject('MYAPP_IMAGE', IMG_ENTRY_SOURCES)
env.AddBinaryLibrary('MYAPP_IMAGE', '${BUILDPATH}/gpapp_lib', LIB_ENTRY_SOURCES_FOR_GP_APPS)
Add the following to the if-else block:
elif env.has_key('MYAPP_IMAGE'):
LIB_ENTRY_SOURCES += [ '${BUILDPATH}/src/tzapp_lib_main.c',]
copy
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\qsee\build\sampleapp
to
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\qsee\build\myapp
7. do same edit with step6 in Edit trustzone_images/core/securemsm/trustzone/qsapps/libs/applib/qsee64
(only for 8996 now, and need to use MYAPP64 like SAMPLEAPP64 in SConscript)
8. If you wish to use libstd (which includes string functions) in your application, edit trustzone_images/core/kernel/libstd/build/SConscript:
Add 'MYAPP_IMAGE' to env.AddBinaryLibrary()
And copy
trustzone_images/core/kernel/libstd/build/sampleapp
to
trustzone_images/core/kernel/libstd/build/myapp
9. If you wish to use secrsa in your application, edit trustzone_images/core/securemsm/secrsa/build/SConscript:
Add the following lines:
if env.has_key('MYAPP_IMAGE'):
env.Append(CPPPATH = "${COREBSP_ROOT}/securemsm/secrsa/env/sampleapp/inc")
env.Append(CPPPATH = "${COREBSP_ROOT}/securemsm/secmath/env/sampleapp/inc")
env.Append(CPPPATH = "${COREBSP_ROOT}/api/securemsm/trustzone/qsee")
env.Append(CPPPATH = "${COREBSP_ROOT}/api/securemsm/crypto")
Add the following to the if-else block:
elif env.has_key('MYAPP_IMAGE'):
env.Append(CCFLAGS = "-O3 -OTime ")
10. For TZ.BF.3.0 and beyond:
trustzone_images\core\securemsm\trustzone\qsee\mink\libstd\build\SConscript (follow the example of sampleapp)
And copy
trustzone_images\core\securemsm\trustzone\qsee\mink\libstd\build\sampleapp
to
trustzone_images\core\securemsm\trustzone\qsee\mink\libstd\build\myapp
11. trustzone_images/core/bsp/trustzone/qsapps/build/secimage.xml
Follow the example of sampleapp and remember to have the same app_id as you put in
trustzone_images/core/bsp/trustzone/qsapps/build/signingattr_qpsa.cfg.template
12. for 8996 only
Edit trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\common_applib\build\SConscript:
(follow the example of sampleapp)
And copy
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\common_applib\build\sampleapp
to
trustzone_images\core\securemsm\trustzone\qsapps\libs\applib\common_applib\build\myapp
13. mkdir trustzone_images/core/securemsm/trustzone/qsapps/myapp
cd trustzone_images/core/securemsm/trustzone/qsapps/myapp
mkdir build src
cp ../sampleapp/build/sampleapp.scl build/myapp.scl
(for 8996) cp ../sampleapp/build/sampleapp.ld build/myapp.ld
cp ../sampleapp/build/SConscript build/
Edit build/SConscript
Replace smapleapp with myapp.
Update the sources and env.PublishPrivateApi according to your needs.
Create your c files (e.g. main_app.c) at src directory.
14. build your app:
for 8996:
trustzone_images\build\ms\build.cmd CHIPSET=msm8996 devcfg myapp
for 8939/52/56/76/92/94:
trustzone_images\build\ms\build_qsapps.cmd CHIPSET=<chipset> myapp