Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tizen] Add arm64 target - Docker part #37761

Merged
merged 12 commits into from
Mar 20, 2025
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
121 : [Telink] Update Docker image (Zephyr 3.3 & 3.7 support)
122 : [Tizen] Add arm64 target - Docker part
12 changes: 11 additions & 1 deletion integrations/docker/images/stage-2/chip-build-tizen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ENV TIZEN_SDK_ROOT=/opt/tizen-sdk
COPY tizen-sdk-installer $TIZEN_SDK_ROOT/files/installer
RUN set -x \
&& bash $TIZEN_SDK_ROOT/files/installer/install.sh \
--cpu arm,arm64 \
--tizen-sdk-path $TIZEN_SDK_ROOT \
--tizen-sdk-data-path /home/ubuntu/tizen-sdk-data \
--tizen-version $TIZEN_VERSION \
Expand All @@ -34,9 +35,18 @@ RUN set -x \

# ------------------------------------------------------------------------------
# Set environment
# Tools
ENV PATH="$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH"

# ARM
ENV TIZEN_SDK_TOOLCHAIN=$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2
ENV TIZEN_SDK_SYSROOT=$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core
ENV PATH="$TIZEN_SDK_TOOLCHAIN/bin:$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH"
ENV PATH="$TIZEN_SDK_TOOLCHAIN/bin:$PATH"

# ARM64
ENV TIZEN_SDK_TOOLCHAIN_ARM64=$TIZEN_SDK_ROOT/tools/aarch64-linux-gnu-gcc-9.2
ENV TIZEN_SDK_SYSROOT_ARM64=$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device64.core
ENV PATH="$TIZEN_SDK_TOOLCHAIN_ARM64/bin:$PATH"

# ------------------------------------------------------------------------------
# Switch to the non-root user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function show_help() {
echo
echo "Options:"
echo " -h, --help Display this information"
echo " --cpu Comma separated list of CPU architectures. Like arm or arm64"
echo " --tizen-sdk-path Set directory for Tizen SDK installation. Default is $TIZEN_SDK_ROOT"
echo " --tizen-sdk-data-path Set directory for Tizen SDK runtime data. Default is $TIZEN_SDK_DATA_PATH"
echo " --install-dependencies This option installs all required dependencies"
Expand Down Expand Up @@ -141,15 +142,12 @@ function cleanup() {
}

# ------------------------------------------------------------------------------
# Function for installing Tizen SDK.
function install_tizen_sdk() {

# Function for installing common packages for Tizen SDK.
function install_tizen_sdk_common() {
mkdir -p "$TIZEN_SDK_ROOT" || return

info "Tizen SDK installation directory: $TIZEN_SDK_ROOT"

TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core"

cd "$TMP_DIR" || return

# Get Tizen Studio CLI
Expand All @@ -162,9 +160,24 @@ function install_tizen_sdk() {
'certificate-generator_0.1.4_ubuntu-64.zip'
'new-common-cli_2.5.64_ubuntu-64.zip'
'new-native-cli_2.5.64_ubuntu-64.zip'
'sdb_4.2.23_ubuntu-64.zip')
'sdb_4.2.23_ubuntu-64.zip'
"tizen-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"

# Tizen Developer Platform Certificate
URL="http://download.tizen.org/sdk/extensions/Tizen_IoT_Headless/binary/"
# Tizen site does not have this package available in version 8.0.
# Certificates are the same for 7.0 and 8.0, though.
PKG_ARR=(
"7.0-iot-things-add-ons_*_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"
}

# Function for installing Tizen SDK (arm).
function install_tizen_sdk_arm() {

TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core"

# Get toolchain
info "Downloading Tizen toolchain..."

Expand All @@ -182,7 +195,6 @@ function install_tizen_sdk() {
# Different versions of Tizen have different rootstrap versions
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
PKG_ARR=(
"tizen-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip"
"tizen-$TIZEN_VERSION-rs-device.core_*_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"

Expand Down Expand Up @@ -251,12 +263,113 @@ function install_tizen_sdk() {
PKG_ARR=()
download "$URL" "${PKG_ARR[@]}"

# Tizen Developer Platform Certificate
URL="http://download.tizen.org/sdk/extensions/Tizen_IoT_Headless/binary/"
# Tizen site does not have this package available in version 8.0.
# Certificates are the same for 7.0 and 8.0, though.
# Install all
info "Installing Tizen SDK..."

unzip -o '*.zip'
cp -rf data/* "$TIZEN_SDK_ROOT"

unrpm *.rpm
cp -rf lib usr "$TIZEN_SDK_SYSROOT"

# Make symbolic links relative
find "$TIZEN_SDK_SYSROOT/usr/lib" -maxdepth 1 -type l | while IFS= read -r LNK; do
ln -sf "$(basename "$(readlink "$LNK")")" "$LNK"
done

ln -sf ../../lib/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib/libcap.so"
ln -sf openssl3.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc"
}

# Function for installing Tizen SDK (arm64).
function install_tizen_sdk_arm64() {

TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device64.core"

# Get toolchain
info "Downloading Tizen toolchain..."

# Download
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
PKG_ARR=(
"7.0-iot-things-add-ons_*_ubuntu-64.zip")
"cross-aarch64-gcc-9.2_0.1.9_ubuntu-64.zip"
"sbi-toolchain-gcc-9.2.cpp.app_2.2.16_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"

# Get Tizen sysroot
info "Downloading Tizen sysroot..."

# Base sysroot
# Different versions of Tizen have different rootstrap versions
URL="http://download.tizen.org/sdk/tizenstudio/official/binary/"
PKG_ARR=(
"tizen-$TIZEN_VERSION-rs-device64.core_*_ubuntu-64.zip")
download "$URL" "${PKG_ARR[@]}"

# Base packages
URL="http://download.tizen.org/releases/milestone/TIZEN/Tizen-$TIZEN_VERSION/Tizen-$TIZEN_VERSION-Base/latest/repos/standard/packages/aarch64/"
PKG_ARR=(
'iniparser-*.aarch64.rpm'
'libblkid-devel-*.aarch64.rpm'
'libcap-*.aarch64.rpm'
'libffi-devel-*.aarch64.rpm'
'liblzma-*.aarch64.rpm'
'libmount-devel-*.aarch64.rpm'
'libncurses6-*.aarch64.rpm'
'libreadline-*.aarch64.rpm'
'libuuid-*.aarch64.rpm'
'pcre-devel-*.aarch64.rpm'
'readline-devel-*.aarch64.rpm'
'xdgmime-*.aarch64.rpm')
download "$URL" "${PKG_ARR[@]}"

# Unified packages
URL="http://download.tizen.org/releases/milestone/TIZEN/Tizen-$TIZEN_VERSION/Tizen-$TIZEN_VERSION-Unified/latest/repos/standard/packages/aarch64/"
PKG_ARR=(
'app-core-common-*.rpm'
'aul-0*.aarch64.rpm'
'aul-devel-*.aarch64.rpm'
'bluetooth-frwk-0*.aarch64.rpm'
'bundle-0*.aarch64.rpm'
'bundle-devel-*.aarch64.rpm'
'buxton2-*.aarch64.rpm'
'capi-network-bluetooth-0*.aarch64.rpm'
'capi-network-bluetooth-devel-*.aarch64.rpm'
'capi-network-nsd-*.aarch64.rpm'
'capi-network-thread-*.aarch64.rpm'
'capi-system-peripheral-io-*.aarch64.rpm'
'capi-system-peripheral-io-devel-*.aarch64.rpm'
'capi-system-resource-1*.aarch64.rpm'
'cynara-devel-*.aarch64.rpm'
'dbus-1*.aarch64.rpm'
'dbus-devel-*.aarch64.rpm'
'dbus-libs-1*.aarch64.rpm'
'glib2-devel-2*.aarch64.rpm'
'hal-api-common-*.aarch64.rpm'
'hal-api-sensor-*.aarch64.rpm'
'json-glib-devel-*.aarch64.rpm'
'libcynara-client-*.aarch64.rpm'
'libcynara-commons-*.aarch64.rpm'
'libdns_sd-*.aarch64.rpm'
'libjson-glib-*.aarch64.rpm'
'libnsd-dns-sd-*.aarch64.rpm'
'libsessiond-0*.aarch64.rpm'
'libsystemd-*.aarch64.rpm'
'libtzplatform-config-*.aarch64.rpm'
'parcel-0*.aarch64.rpm'
'parcel-devel-*.aarch64.rpm'
'pkgmgr-info-*.aarch64.rpm'
'sensord-*.aarch64.rpm'
'sensord-devel-*.aarch64.rpm'
'sensord-dummy-*.aarch64.rpm'
'vconf-compat-*.aarch64.rpm'
'vconf-internal-keys-devel-*.aarch64.rpm'
)
download "$URL" "${PKG_ARR[@]}"

# Unified packages (snapshots)
URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/latest/repos/standard/packages/aarch64/"
PKG_ARR=()
download "$URL" "${PKG_ARR[@]}"

# Install all
Expand All @@ -266,8 +379,18 @@ function install_tizen_sdk() {
cp -rf data/* "$TIZEN_SDK_ROOT"

unrpm *.rpm
cp -rf lib usr "$TIZEN_SDK_SYSROOT"
cp -rf lib64 usr "$TIZEN_SDK_SYSROOT"

# Make symbolic links relative
find "$TIZEN_SDK_SYSROOT/usr/lib64" -maxdepth 1 -type l | while IFS= read -r LNK; do
ln -sf "$(basename "$(readlink "$LNK")")" "$LNK"
done

ln -sf ../../lib64/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib64/libcap.so"
ln -sf openssl3.pc "$TIZEN_SDK_SYSROOT/usr/lib64/pkgconfig/openssl.pc"
}

function install_tizen_sdk_finalize() {
# Install secret tool or not
if ("$SECRET_TOOL"); then
info "Overriding secret tool..."
Expand All @@ -279,28 +402,30 @@ function install_tizen_sdk() {
echo "TIZEN_SDK_DATA_PATH=$TIZEN_SDK_DATA_PATH" >>"$TIZEN_SDK_ROOT/sdk.info"
ln -sf "$TIZEN_SDK_DATA_PATH/.tizen-cli-config" "$TIZEN_SDK_ROOT/tools/.tizen-cli-config"

# Use Tizen developer platform certificate as default
# Use Tizen developer platform certificate as defaults
cp "$TIZEN_SDK_ROOT"/tools/certificate-generator/certificates/distributor/sdk-platform/* \
"$TIZEN_SDK_ROOT"/tools/certificate-generator/certificates/distributor/

# Make symbolic links relative
find "$TIZEN_SDK_SYSROOT/usr/lib" -maxdepth 1 -type l | while IFS= read -r LNK; do
ln -sf "$(basename "$(readlink "$LNK")")" "$LNK"
done
ln -sf ../../lib/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib/libcap.so"
ln -sf openssl3.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc"

info "Done."
echo

# Information on necessary environment variables
warning "Before proceeding with Matter export environment variables as follows:"
echo -n "$COLOR_YELLOW"
echo "export TIZEN_VERSION=\"$TIZEN_VERSION\""
echo "export TIZEN_SDK_ROOT=\"$(realpath "$TIZEN_SDK_ROOT")\""
echo "export TIZEN_SDK_TOOLCHAIN=\"\$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2\""
echo "export TIZEN_SDK_SYSROOT=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core\""
echo "export PATH=\"\$TIZEN_SDK_TOOLCHAIN/bin:\$TIZEN_SDK_ROOT/tools/ide/bin:\$TIZEN_SDK_ROOT/tools:\$PATH\""

if [ "$INSTALL_ARM" = true ]; then
echo "export TIZEN_SDK_TOOLCHAIN=\"\$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2\""
echo "export TIZEN_SDK_SYSROOT=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core\""
echo "export PATH=\"\$TIZEN_SDK_TOOLCHAIN/bin:\$TIZEN_SDK_ROOT/tools/ide/bin:\$TIZEN_SDK_ROOT/tools:\$PATH\""
fi

if [ "$INSTALL_ARM64" = true ]; then
echo "export TIZEN_SDK_TOOLCHAIN_ARM64=\"\$TIZEN_SDK_ROOT/tools/aarch64-linux-gnu-gcc-9.2\""
echo "export TIZEN_SDK_SYSROOT_ARM64=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device64.core\""
echo "export PATH=\"\$TIZEN_SDK_TOOLCHAIN_ARM64/bin:\$TIZEN_SDK_ROOT/tools/ide/bin:\$TIZEN_SDK_ROOT/tools:\$PATH\""
fi

echo -n "$COLOR_NONE"
}

Expand All @@ -310,6 +435,20 @@ while (($#)); do
show_help
exit 0
;;
--cpu)
IFS=',' read -r -a array <<<"$2"
for CPU in "${array[@]}"; do
if [ "$CPU" == "arm" ]; then
INSTALL_ARM=true
elif [ "$CPU" == "arm64" ]; then
INSTALL_ARM64=true
else
error "Invalid CPU: $CPU. Use --help"
exit 1
fi
done
shift
;;
--tizen-sdk-path)
TIZEN_SDK_ROOT="$2"
shift
Expand All @@ -336,6 +475,13 @@ while (($#)); do
shift
done

# ------------------------------------------------------------------------------
# Verify passed arguments and flags
if [ -z "$INSTALL_ARM" ] && [ -z "$INSTALL_ARM64" ]; then
error "No CPU architecture provided. Use --help."
exit 1
fi

# ------------------------------------------------------------------------------
# Prepare a temporary directory and cleanup
trap cleanup EXIT
Expand Down Expand Up @@ -368,4 +514,14 @@ fi

# ------------------------------------------------------------------------------
# Installation Tizen SDK
install_tizen_sdk
install_tizen_sdk_common

if [ "$INSTALL_ARM" = true ]; then
install_tizen_sdk_arm
fi

if [ "$INSTALL_ARM64" = true ]; then
install_tizen_sdk_arm64
fi

install_tizen_sdk_finalize
Loading