From 4e69c9df4be645f44e7266fa70d1e8fe9c3eadc5 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 24 May 2022 12:54:25 +0200 Subject: [PATCH 1/7] Fix environment variables order --- integrations/docker/images/chip-build-vscode/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 5feb2ed7bae54c..565705298152f5 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -75,8 +75,9 @@ ENV SYSROOT_AARCH64=/opt/ubuntu-21.04-aarch64-sysroot ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.13.2 ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.11.0 -ENV TIZEN_SDK_ROOT /opt/tizen-sdk -ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core -ENV TIZEN_VERSION 6.0 ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb + +ENV TIZEN_VERSION 6.0 +ENV TIZEN_SDK_ROOT /opt/tizen-sdk +ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core From b7246a3e7cba90a30f3e64409d0e5bc45e733898 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 24 May 2022 12:56:45 +0200 Subject: [PATCH 2/7] Add missing dependencies for tizen-sdk. --- integrations/docker/images/chip-build-vscode/Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 565705298152f5..429d21be3df9ae 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -57,6 +57,14 @@ RUN set -x \ && chmod -R a+w /opt/android/sdk/licenses \ && : # last line +RUN set -x \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ + zip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && : # last line + ENV AMEBA_PATH=/opt/ameba/ambd_sdk_with_chip_non_NDA ENV ANDROID_HOME=/opt/android/sdk ENV ANDROID_NDK_HOME=/opt/android/android-ndk-r21b From 79cd1483ba81318da480dd49ab697442d13af883 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 24 May 2022 13:00:36 +0200 Subject: [PATCH 3/7] Configure tizen-sdk in vscode container --- .devcontainer/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f74c217aac322c..9a9a04dfa17eb4 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -77,3 +77,18 @@ RUN chown -R $USERNAME:$USERNAME /opt/fsl-imx-xwayland/5.10-hardknott/ # Add access to openocd for VSCode debugging RUN chown -R $USERNAME:$USERNAME /opt/openocd +RUN sed -i '/^TIZEN_SDK_DATA_PATH/d' $TIZEN_SDK_ROOT/sdk.info \ + && echo TIZEN_SDK_DATA_PATH=/home/$USERNAME/tizen-sdk-data >> $TIZEN_SDK_ROOT/sdk.info \ + && ln -sf /home/$USERNAME/.tizen-cli-config $TIZEN_SDK_ROOT/tools/.tizen-cli-config \ + && : # last line + +USER $USERNAME +WORKDIR /home/$USERNAME + +RUN set -x \ + # Generate authr certificate + && $TIZEN_SDK_ROOT/tools/ide/bin/tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen \ + # Add new security profile + && $TIZEN_SDK_ROOT/tools/ide/bin/tizen security-profiles add --active --name=CHIP --author=$HOME/tizen-sdk-data/keystore/author/author.p12 --password=chiptizen \ + # Cleanup + && : # last line From 1330f1d7a1f1dbcc33cb162a530515bcc87a81f8 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Mon, 30 May 2022 11:14:59 +0000 Subject: [PATCH 4/7] Update image version --- integrations/docker/images/chip-build/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 65c817be30ca46..0e06a183605c22 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.5.77 Version bump reason: Update nRF Connect SDK version. +0.5.78 Version bump reason: [Tizen] Fix environment variable order, add missing tizen dependencies From 5d28fe111c1900a61de3ab006a65f253aa90eb2e Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Mon, 30 May 2022 13:29:19 +0000 Subject: [PATCH 5/7] Add comments --- .devcontainer/Dockerfile | 3 +++ integrations/docker/images/chip-build-vscode/Dockerfile | 1 + 2 files changed, 4 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9a9a04dfa17eb4..0c37f5ac0e45a1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -77,6 +77,8 @@ RUN chown -R $USERNAME:$USERNAME /opt/fsl-imx-xwayland/5.10-hardknott/ # Add access to openocd for VSCode debugging RUN chown -R $USERNAME:$USERNAME /opt/openocd + +# Fix Tizen SDK paths for new user RUN sed -i '/^TIZEN_SDK_DATA_PATH/d' $TIZEN_SDK_ROOT/sdk.info \ && echo TIZEN_SDK_DATA_PATH=/home/$USERNAME/tizen-sdk-data >> $TIZEN_SDK_ROOT/sdk.info \ && ln -sf /home/$USERNAME/.tizen-cli-config $TIZEN_SDK_ROOT/tools/.tizen-cli-config \ @@ -85,6 +87,7 @@ RUN sed -i '/^TIZEN_SDK_DATA_PATH/d' $TIZEN_SDK_ROOT/sdk.info \ USER $USERNAME WORKDIR /home/$USERNAME +# Setup tizen studio CLI RUN set -x \ # Generate authr certificate && $TIZEN_SDK_ROOT/tools/ide/bin/tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen \ diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 429d21be3df9ae..5bbad09fa8a521 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -57,6 +57,7 @@ RUN set -x \ && chmod -R a+w /opt/android/sdk/licenses \ && : # last line +# Required for the Tizen SDK RUN set -x \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ From 5244626b238744a8e8e9ed2d0b384dffaf3303d0 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 31 May 2022 10:08:20 +0000 Subject: [PATCH 6/7] Generate author certificate and security profile manually. * Remove automatic certificate generation and security profiles with hardcoded passwords from docker images. * Describe building the Tizen lighting-app app with the author certificate and security profile generation process. --- .devcontainer/Dockerfile | 12 ------ examples/lighting-app/tizen/README.md | 43 +++++++++++++++++++ .../docker/images/chip-build-tizen/Dockerfile | 10 ----- 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0c37f5ac0e45a1..0a5684b2d9eb3d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -83,15 +83,3 @@ RUN sed -i '/^TIZEN_SDK_DATA_PATH/d' $TIZEN_SDK_ROOT/sdk.info \ && echo TIZEN_SDK_DATA_PATH=/home/$USERNAME/tizen-sdk-data >> $TIZEN_SDK_ROOT/sdk.info \ && ln -sf /home/$USERNAME/.tizen-cli-config $TIZEN_SDK_ROOT/tools/.tizen-cli-config \ && : # last line - -USER $USERNAME -WORKDIR /home/$USERNAME - -# Setup tizen studio CLI -RUN set -x \ - # Generate authr certificate - && $TIZEN_SDK_ROOT/tools/ide/bin/tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen \ - # Add new security profile - && $TIZEN_SDK_ROOT/tools/ide/bin/tizen security-profiles add --active --name=CHIP --author=$HOME/tizen-sdk-data/keystore/author/author.p12 --password=chiptizen \ - # Cleanup - && : # last line diff --git a/examples/lighting-app/tizen/README.md b/examples/lighting-app/tizen/README.md index 29ac1c818da311..cc713360f5f593 100644 --- a/examples/lighting-app/tizen/README.md +++ b/examples/lighting-app/tizen/README.md @@ -1,5 +1,48 @@ # CHIP Tizen Lighting Example +## Building binary + +Activating environment + +```sh +source ./scripts/activate.sh +``` + +Generating tizen-arm-light + +```sh +gn gen --check \ + --fail-on-unused-args \ + --export-compile-commands \ + --root=$PW_PROJECT_ROOT/examples/lighting-app/tizen \ + "--args=target_os=\"tizen\" target_cpu=\"arm\" tizen_sdk_root=\"$TIZEN_SDK_ROOT\" sysroot=\"$TIZEN_SDK_SYSROOT\"" \ + $PW_PROJECT_ROOT/out/tizen-arm-light +``` + +Building tizen-arm-light + +```sh +ninja -C $PW_PROJECT_ROOT/out/tizen-arm-light +``` + +## Preparing Tizen SDK certificate + +For packaging the Tizen APP, there is a need to generate an author certificate +and security profile using the commands described below. Change password and +author data as needed. + +```sh +tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen + +tizen security-profiles add --active --name=CHIP --author=$HOME/tizen-sdk-data/keystore/author/author.p12 --password=chiptizen +``` + +## Packaging APP + +```sh +ninja -C $PW_PROJECT_ROOT/out/tizen-arm-light chip-lighting-app:tpk +``` + ## Installing TPK Upload TPK package to device under test (DUT). Install it with `pkgcmd` as diff --git a/integrations/docker/images/chip-build-tizen/Dockerfile b/integrations/docker/images/chip-build-tizen/Dockerfile index ba2452b675412c..cd3915b3b0e5d3 100644 --- a/integrations/docker/images/chip-build-tizen/Dockerfile +++ b/integrations/docker/images/chip-build-tizen/Dockerfile @@ -147,13 +147,3 @@ RUN set -x \ # Switch to the non-root user USER $USER_NAME WORKDIR $USER_HOME - -# ------------------------------------------------------------------------------ -# Setup tizen studio CLI -RUN set -x \ - # Generate author certificate - && tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen \ - # Add new security profile - && tizen security-profiles add --active --name=CHIP --author=$HOME/tizen-sdk-data/keystore/author/author.p12 --password=chiptizen \ - # Cleanup - && : # last line From 5ab4c86b1187ba7b2edeb05b4e5f61cd23f3ff40 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 31 May 2022 12:08:48 +0000 Subject: [PATCH 7/7] Update the Tizen lighting app description * update tizen app call to use the full path * describe regeneration of author certificates --- examples/lighting-app/tizen/README.md | 36 +++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/examples/lighting-app/tizen/README.md b/examples/lighting-app/tizen/README.md index cc713360f5f593..d2063a7a55977c 100644 --- a/examples/lighting-app/tizen/README.md +++ b/examples/lighting-app/tizen/README.md @@ -32,9 +32,41 @@ and security profile using the commands described below. Change password and author data as needed. ```sh -tizen certificate --alias=CHIP --name=CHIP --email=chip@tizen.org --password=chiptizen +$TIZEN_SDK_ROOT/tools/ide/bin/tizen certificate \ + --alias=CHIP \ + --name=CHIP \ + --email=chip@tizen.org \ + --password=chiptizen + +$TIZEN_SDK_ROOT/tools/ide/bin/tizen security-profiles add \ + --active \ + --name=CHIP \ + --author=$HOME/tizen-sdk-data/keystore/author/author.p12 \ + --password=chiptizen +``` + +This is only _one-time action_. To regenerate the author certificate and +security profile, you have to remove files from the `$HOME` directory using +specified commands: + +```sh +rm -r \ + $HOME/tizen-sdk-data \ + $HOME/.tizen-cli-config \ + $HOME/.secretsdb +``` -tizen security-profiles add --active --name=CHIP --author=$HOME/tizen-sdk-data/keystore/author/author.p12 --password=chiptizen +After that, normally call scripts to generate the author certificate and +security profile mentioned previously. + +### Important + +Regenerating the author certificate and security profile makes it necessary to +remove the previously installed Tizen app. You can't reinstall an application on +the Tizen device with a different certificate. + +```sh +pkgcmd -u -n org.tizen.matter.example.lighting ``` ## Packaging APP