HOME
Shop
  • English
  • 简体中文
HOME
Shop
  • English
  • 简体中文
  • Product Series

    • FPGA+ARM

      • GM-3568JHF

        • 1. Introduction

          • About GM-3568JHF
        • 2. Quick Start

          • 00 Introduction
          • 01 Environment Setup
          • 02 Compilation Instructions
          • 03 Flashing Guide
          • 04 Debug Tools
          • 05 Software Update
          • 06 View Information
          • 07 Test Commands
          • 08 App Compilation
          • 09 Source Code Acquisition
        • 3. Peripherals and Interfaces

          • 01 USB
          • 02 Display and Touch
          • 03 Ethernet
          • 04 WIFI
          • 05 Bluetooth
          • 06 TF-Card
          • 07 Audio
          • 08 Serial Port
          • 09 CAN
          • 10 RTC
        • 4. Application Development

          • 01 UART read and write case
          • 02 Key detection case
          • 03 LED light flashing case
          • 04 MIPI screen detection case
          • 05 Read USB device information example
          • 06 FAN Detection Case
          • 07 FPGA FSPI Communication Case
          • 08 FPGA DMA read and write case
          • 09 GPS debugging case
          • 10 Ethernet Test Cases
          • 11 RS485 reading and writing examples
          • 12 FPGA IIC read and write examples
          • 13 PN532 NFC card reader case
          • 14 TF card reading and writing case
        • 5. QT Development

          • 01 ARM64 cross compiler environment construction
          • 02 QT program added automatic startup service
        • 6. RKNN_NPU Development

          • 01 RK3568 NPU Overview
          • 02 Development Environment Setup
          • Run Official YOLOv5 Example
          • Model Conversion Detailed Explanation
          • Run Custom Model on Board
        • 7. FPGA Development

          • ARM and FPGA Communication
          • /fpga-arm/GM-3568JHF/FPGA/ch02-FPGA-Development-Manual.html
        • 8. Others

          • 01 Modification of the root directory file system
          • 02 System auto-start service
        • 9. Download

          • Download Resources
    • ShimetaPi

      • M4-R1

        • 1. Introduction

          • 1.1 About M4-R1
        • 2. Quick Start

          • 2.1 OpenHarmony Overview
          • 2.2 Image Burning
          • 2.3 Development Environment Preparation
          • 2.4 Hello World Application
        • 3. Application Development

          • 3.1 Getting Started

            • 3.1.1 ArkTS Language Overview
            • 3.1.2 UI Components (Part 1)
            • 3.1.3 UI Components (Part 2)
            • 3.1.4 UI Components (Part 3)
          • 3.2 Advanced

            • 3.2.1 Getting Started Guide
            • 3.2.2 Usage of Third Party Libraries
            • 3.2.3 Deployment of the Application
            • 3.2.4 Factory Reset
            • 3.2.5 System Debug
            • 3.2.6 APP Stability Testing
            • 3.2.7 Application Testing
          • 3.3 Getting Docs

            • 3.3.1 Official Website Information
          • 3.4 Development Instructions

            • 3.4.1 Full SDK
            • 3.4.2 Introduction of Third Party Libraries
            • 3.4.3 Introduction of HDC Tool
            • 3.4.4 Restore Factory Mode
            • 3.4.5 Update System API
          • 3.5 First Application

            • 3.5.1 First ArkTS App
          • 3.6 Application Demo

            • 3.6.1 UART Tool
            • 3.6.2 Graphics Tablet
            • 3.6.3 Digital Clock
            • 3.6.4 WIFI Tool
        • 4. Device Development

          • 4.1 Ubuntu Environment Development

            • 4.1.1 Environment Setup
            • 4.1.2 Download Source Code
            • 4.1.3 Compile Source Code
          • 4.2 Using DevEco Device Tool

            • 4.2.1 Tool Introduction
            • 4.2.2 Environment Construction
            • 4.2.3 Import SDK
            • 4.2.4 Function Introduction
        • 5. Peripherals and Interfaces

          • 5.1 Raspberry Pi Interfaces
          • 5.2 GPIO Interface
          • 5.3 I2C Interface
          • 5.4 SPI Communication
          • 5.5 PWM Control
          • 5.6 Serial Port Communication
          • 5.7 TF Card Slot
          • 5.8 Display Screen
          • 5.9 Touch Screen
          • 5.10 Audio
          • 5.11 RTC
          • 5.12 Ethernet
          • 5.13 M.2
          • 5.14 MINI PCIE
          • 5.15 Camera
          • 5.16 WIFI BT
          • 5.17 HAT
        • 6. FAQ

          • 6.1 Download Link
      • M5-R1

        • 1. Introduction

          • M5-R1 Development Documentation
        • 2. Quick Start

          • OpenHarmony Overview
          • Image Burning
          • Development Environment Preparation
          • Hello World Application and Deployment
        • 3. Peripherals and Interfaces

          • 3.1 Raspberry Pi Interfaces
          • 3.2 GPIO Interface
          • 3.3 I2C Interface
          • 3.4 SPI Communication
          • 3.5 PWM Control
          • 3.6 Serial Port Communication
          • 3.7 TF Card Slot
          • 3.8 Display Screen
          • 3.9 Touch Screen
          • 3.10 Audio
          • 3.11 RTC
          • 3.12 Ethernet
          • 3.13 M.2
          • 3.14 MINI PCIE
          • 3.15 Camera
          • 3.16 WIFI BT
          • 3.17 HAT
        • 4. Application Development

          • 4.1 Getting Started

            • 4.1.1 ArkTS Language Overview
            • 4.1.2 UI Components (Part 1)
            • 4.1.3 UI Components (Part 2)
            • 4.1.4 UI Components (Part 3)
          • 4.2 Advanced

            • 4.2.1 Getting Started Guide
            • 4.2.2 Usage of Third Party Libraries
            • 4.2.3 Deployment of the Application
            • 4.2.4 Factory Reset
            • 4.2.5 System Debug
            • 4.2.6 APP Stability Testing
            • 4.2.7 Application Testing
        • 5. Device Development

          • 5.1 Environment Setup
          • 5.2 Download Source Code
          • 5.3 Compile Source Code
        • 6. Download

          • Data Download
    • OpenHarmony

      • SC-3568HA

        • 1. Introduction

          • 1.1 About SC-3568HA
        • 2. Quick Start

          • 2.1 OpenHarmony Overview
          • 2.2 Image Burning
          • 2.3 Development Environment Preparation
          • 2.4 Hello World Application
        • 3. Application Development

          • 3.1 ArkUI

            • 3.1.1 ArkTS Language Overview
            • 3.1.2 UI Components (Part 1)
            • 3.1.3 UI Components (Part 2)
            • 3.1.4 UI Components (Part 3)
          • 3.2 Advanced

            • 3.2.1 Getting Started Guide
            • 3.2.2 Usage of Third Party Libraries
            • 3.2.3 Deployment of the Application
            • 3.2.4 Factory Reset
            • 3.2.5 System Debug
            • 3.2.6 APP Stability Testing
            • 3.2.7 Application Testing
        • 4. Device Development

          • 4.1 Environment Setup
          • 4.2 Download Source Code
          • 4.3 Compile Source Code
        • 5. Peripherals and Interfaces

          • 5.1 Raspberry Pi Interfaces
          • 5.2 GPIO Interface
          • 5.3 I2C Interface
          • 5.4 SPI Communication
          • 5.5 PWM Control
          • 5.6 Serial Port Communication
          • 5.7 TF Card Slot
          • 5.8 Display Screen
          • 5.9 Touch Screen
          • 5.10 Audio
          • 5.11 RTC
          • 5.12 Ethernet
          • 5.13 M.2
          • 5.14 MINI PCIE
          • 5.15 Camera
          • 5.16 WIFI BT
          • 5.17 HAT
        • 6. FAQ

          • 6.1 Download Link
      • M-K1HSE

        • 1. Introduction

          • 1.1 Product Introduction
        • 2. Quick Start

          • 2.1 Debug Tool Installation
          • 2.2 Development Environment Setup
          • 2.3 Source Code Download
          • 2.4 Build Instructions
          • 2.5 Flashing Guide
          • 2.6 APT Update Sources
          • 2.7 View Board Info
          • 2.8 CLI LED and Key Test
          • 2.9 GCC Build Programs
        • 3. Application Development

          • 3.1 Basic Application Development

            • 3.1.1 Development Environment Preparation
            • 3.1.2 First Application HelloWorld
            • 3.1.3 Develop HAR Package
          • 3.2 Peripheral Application Cases

            • 3.2.1 UART Read/Write
            • 3.2.2 Key Demo
            • 3.2.3 LED Flash
        • 4. Peripherals and Interfaces

          • 4.1 Standard Peripherals

            • 4.1.1 USB
            • 4.1.2 Display and Touch
            • 4.1.3 Ethernet
            • 4.1.4 WIFI
            • 4.1.5 Bluetooth
            • 4.1.6 TF Card
            • 4.1.7 Audio
            • 4.1.8 Serial Port
            • 4.1.9 CAN
            • 4.1.10 RTC
          • 4.2 Interfaces

            • 4.2.1 Audio
            • 4.2.2 RS485
            • 4.2.3 Display
            • 4.2.4 Touch
        • 5. System Customization Development

          • 5.1 System Porting
          • 5.2 System Customization
          • 5.3 Driver Development
          • 5.4 System Debugging
          • 5.5 OTA Upgrade
        • 6. Download

          • 6.1 Download
    • EVS-Camera

      • CF-NRS1

        • 1. Introduction

          • 1.1 About CF-NRS1
          • 1.2 Event-Based Concepts
          • 1.3 Quick Start
          • 1.4 Resources
        • 2. Development

          • 2.1 Development Overview

            • 2.1.1 Shimetapi Hybrid Camera SDK Introduction
          • 2.2 Environment & API

            • 2.2.1 Environment Overview
            • 2.2.2 Development API Overview
          • 2.3 Linux Development

            • 2.3.1 Linux SDK Introduction
            • 2.3.2 Linux SDK API
            • 2.3.3 Linux Algorithm
            • 2.3.4 Linux Algorithm API
          • 2.4 Service & Web

            • 2.4.1 EVS Server
            • 2.4.2 Time Server
            • 2.4.3 EVS Web
        • 3. Download

          • 3.1 Download
        • 4. Common Problems

          • 4.1 Common Problems
      • CF-CRA2

        • 1. Introduction

          • 1.1 About CF-CRA2
        • 2. Download

          • 2.1 Download
      • EVS Module

        • 1. Related Concepts
        • 2. Hardware Preparation and Environment Configuration
        • 3. Example Program User Guide
        • Resources Download
    • AI-model

      • 1684XB-32T

        • 1. Introduction

          • AIBOX-1684XB-32 Introduction
        • 2. Quick Start

          • First time use
          • Network Configuration
          • Disk usage
          • Memory allocation
          • Fan Strategy
          • Firmware Upgrade
          • Cross-Compilation
          • Model Quantization
        • 3. Application Development

          • 3.1 Development Introduction

            • Sophgo SDK Development
            • SOPHON-DEMO Introduction
          • 3.2 Large Language Models

            • Deploying Llama3 Example
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/Sophon_LLM_api_server-Development-AIBOX-1684XB-32.html
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/MiniCPM-V-2_6-AIBOX-1684XB-32.html
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/Qwen-2-5-VL-demo-Development-AIBOX-1684XB-32.html
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/Qwen-3-chat-demo-Development-AIBOX-1684XB-32.html
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/Qwen3-Qwen Agent-MCP.html
            • /ai-model/AIBOX-1684XB-32/application-development/LLM/Qwen3-langchain-AI Agent.html
          • 3.3 Deep Learning

            • ResNet (Image Classification)
            • LPRNet (License Plate Recognition)
            • SAM (Universal Image Segmentation Foundation Model)
            • YOLOv5 (Object Detection)
            • OpenPose (Human Keypoint Detection)
            • PP-OCR (Optical Character Recognition)
        • 4. Download

          • Resource Download
      • 1684X-416T

        • 1. Introduction

          • AIBOX-1684X-416 Introduction
        • 2. Demo Simple Operation Guide

          • Simple instructions for using shimeta smart monitoring demo
      • RDK-X5

        • 1. Introduction

          • RDK-X5 Hardware Introduction
        • 2. Quick Start

          • RDK-X5 Quick Start
        • 3. Application Development

          • 3.1 AI Online Model Development

            • AI Online Development - Experiment01
            • AI Online Development - Experiment02
            • AI Online Development - Experiment03
            • AI Online Development - Experiment04
            • AI Online Development - Experiment05
            • AI Online Development - Experiment06
          • 3.2 Large Language Models (Voice)

            • Voice LLM Application - Experiment01
            • Voice LLM Application - Experiment02
            • Voice LLM Application - Experiment03
            • Voice LLM Application - Experiment04
            • Voice LLM Application - Experiment05
            • Voice LLM Application - Experiment06
          • 3.3 40pin-IO Development

            • 40pin IO Development - Experiment01
            • 40pin IO Development - Experiment02
            • 40pin IO Development - Experiment03
            • 40pin IO Development - Experiment04
            • 40pin IO Development - Experiment05
            • 40pin IO Development - Experiment06
            • 40pin IO Development - Experiment07
          • 3.4 USB Module Development

            • USB Module Usage - Experiment01
            • USB Module Usage - Experiment02
          • 3.5 Machine Vision

            • Machine Vision Technology Development - Experiment01
            • Machine Vision Technology Development - Experiment02
            • Machine Vision Technology Development - Experiment03
            • Machine Vision Technology Development - Experiment04
          • 3.6 ROS2 Base Development

            • ROS2 Basic Development - Experiment01
            • ROS2 Basic Development - Experiment02
            • ROS2 Basic Development - Experiment03
            • ROS2 Basic Development - Experiment04
      • RDK-S100

        • 1. Introduction

          • 1.1 About RDK-S100
        • 2. Quick Start

          • 2.1 First Use
        • 3. Application Development

          • 3.1 AI Online Model Development

            • 3.1.1 Volcano Engine Doubao AI
            • 3.1.2 Image Analysis
            • 3.1.3 Multimodal Visual Analysis
            • 3.1.4 Multimodal Image Comparison
            • 3.1.5 Multimodal Document Analysis
            • 3.1.6 Camera AI Vision Analysis
          • 3.2 Large Language Models

            • 3.2.1 Speech Recognition
            • 3.2.2 Voice Conversation
            • 3.2.3 Multimodal Image Analysis
            • 3.2.4 Multimodal Image Comparison
            • 3.2.5 Multimodal Document Analysis
            • 3.2.6 Multimodal Vision Application
          • 3.3 40pin-IO Development

            • 3.3.1 GPIO Output LED Blink
            • 3.3.2 GPIO Input
            • 3.3.3 Key Control LED
            • 3.3.4 PWM Output
            • 3.3.5 Serial Output
            • 3.3.6 I2C Experiment
          • 3.4 USB Module Development

            • 3.4.1 USB Voice Module
            • 3.4.2 Sound Source Localization
          • 3.5 Machine Vision

            • 3.5.1 USB Camera
            • 3.5.2 Image Processing Basics
            • 3.5.3 Object Detection
            • 3.5.4 Image Segmentation
          • 3.6 ROS2 Base Development

            • 3.6.1 Environment Setup
            • 3.6.2 Create and Build Workspace
            • 3.6.3 ROS2 Topic Communication
            • 3.6.4 ROS2 Camera Application
    • Core-Board

      • C-3568BQ

        • 1. Introduction

          • C-3568BQ Introduction
      • C-3588LQ

        • 1. Introduction

          • C-3588LQ Introduction
      • GC-3568JBAF

        • 1. Introduction

          • GC-3568JBAF Introduction
      • C-K1BA

        • 1. Introduction

          • C-K1BA Introduction

Compilation Notes

Installing the Compiler

Execute the script in the source code root directory to install the compiler and binary tools.

bash build/prebuilts_download.sh

By default, the downloaded files are stored in the same directory as OpenHarmony, under openharmony_prebuilts.

root@ubuntu:~/WorkSpace$ tree -L 1
.
|-- oh5
`-- openharmony_prebuilts

2 directories, 0 files

The contents of openharmony_prebuilts are as follows:

root@ubuntu:~/WorkSpace/openharmony_prebuilts$ ls -al
total 4970668
drwxr-xr-x 2 root dc-sw-users       4096 Oct 28 08:39 .
drwxr-xr-x 6 root dc-sw-users       4096 Oct 26 18:06 ..
-rw-r--r-- 1 root dc-sw-users   70959548 Sep 27 17:35 015654433b541c15ac605ecb2dd32f11.libcxx-ndk_ohos-arm64-5fbff2-20240727.tar.gz
-rw-r--r-- 1 root dc-sw-users    1151488 Sep 27 17:27 03a7b98353c5261f51bc2e5ec28dfed9.gn-linux-x86-20240510.tar.gz
-rw-r--r-- 1 root dc-sw-users  118696253 Sep 27 17:38 0c65e233a7c5b1ecf6585a38903cc52e.clang-mingw-20240510.tar.gz
-rw-r--r-- 1 root dc-sw-users   70970417 Oct 28 08:40 1822bea68b38ab77f1714d89e8453c34.libcxx-ndk_linux-x86_64-ef33c3-20240828.tar.gz
-rw-r--r-- 1 root dc-sw-users     298786 Sep 27 17:27 1ad55caffc571c067e7748967b86f477.ninja-windows-x86-1.12.0-20240523.tar.gz
-rw-r--r-- 1 root dc-sw-users     530721 Sep 27 17:28 20738011b324e100f6aab09353a7e7fa.bpftool_v5.10.93_20221114.tar.gz
-rw-r--r-- 1 root dc-sw-users   29078522 Sep 27 17:31 44e99f695a2058603263903a1198b79e.rust-std-nightly-x86_64-pc-windows-gnullvm_20240528.tar.gz
-rw-r--r-- 1 root dc-sw-users   35031005 Sep 27 17:32 44f2993d118ed3cefe4792a2fd62547f.node-v14.21.1-linux-x64.tar.gz
-rw-r--r-- 1 root dc-sw-users   31562008 Sep 27 17:32 46e8165e2cfa7799732c23615c5a3fa1.rust-std-nightly-x86_64-unknown-linux-ohos_20240528.tar.gz
-rw-r--r-- 1 root dc-sw-users  620135753 Sep 27 17:46 4fe01b604194d203f0371902cd6b4473.clang_windows-x86_64-5fbff2-20240727.tar.gz
-rw-r--r-- 1 root dc-sw-users 1446576155 Sep 27 17:51 5211242bf5608753c7488874c758dd0f.clang_ohos-arm64-5fbff2-20240727.tar.gz
-rw-r--r-- 1 root dc-sw-users  194623101 Sep 27 17:38 59325cdd5538f70910f66328acedea7d.prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi.tar.gz
-rw-r--r-- 1 root dc-sw-users  329772635 Sep 27 17:41 6a4909fc4262070aea24465c9a3aabc4.ark_js_prebuilts_20230713.tar.gz
-rw-r--r-- 1 root dc-sw-users   70953802 Sep 27 17:35 6be4fdb05760c8b2887f96c08ebff7b8.libcxx-ndk_windows-x86_64-5fbff2-20240727.tar.gz
-rw-r--r-- 1 root dc-sw-users    9048182 Oct 28 08:39 6c3294e4d1c73219c2bed617e6ab9676.python-linux-x86-Ubuntu_18.04-3.11.4_20240823.tar.gz
-rw-r--r-- 1 root dc-sw-users   30678419 Sep 27 17:31 6ea2077dceef4e1f0953819bc7c96e1f.rust-std-nightly-aarch64-unknown-linux-ohos_20240528.tar.gz
-rw-r--r-- 1 root dc-sw-users    9254059 Sep 27 17:29 741544d67d8d0281ba0d670b561b379b.python-linux-x86-Ubuntu_18.04-3.11.4_20240715.tar.gz
-rw-r--r-- 1 root dc-sw-users   27628068 Sep 27 17:32 76a4e507e09cb3693edaa91f5985ab8f.rust-std-nightly-armv7-unknown-linux-ohos_20240528.tar.gz
-rw-r--r-- 1 root dc-sw-users   17297524 Sep 27 17:29 7bcb19ee6150676833e5aa5d6a7bfe03.cmake-ohos-3.28.2.tar.gz
-rw-r--r-- 1 root dc-sw-users  106664705 Sep 27 17:36 8038bbe7160f809232e8df72e3980c92.rust-nightly-x86_64-unknown-linux-gnu_20240528.tar.gz
-rw-r--r-- 1 root dc-sw-users   52840113 Sep 27 17:33 9b1ca53ad98ebfaa0fbfa26d20d534df.cmake-linux-x86-3.28.2.tar.gz
-rw-r--r-- 1 root dc-sw-users   12397424 Sep 27 17:30 ae867132e2a2bdbbae5b58aa89eb883e.pahole_v1.21_20221124.tar.gz
-rw-r--r-- 1 root dc-sw-users   70969730 Oct 28 08:41 c9b9261adf5c264aa35312aeb8261419.libcxx-ndk_ohos-arm64-ef33c3-20240828.tar.gz
-rw-r--r-- 1 root dc-sw-users  117896452 Sep 27 17:36 cd98ff85e2af3869cf318497e6a1d559.gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
-rw-r--r-- 1 root dc-sw-users   15135801 Oct 28 08:39 d699eb29e0a9c9febb2b13bb779c1ebb.cmake-ohos-3.28.2-20240827.tar.gz
-rw-r--r-- 1 root dc-sw-users   70960099 Sep 27 17:35 d991cf9857b70074d0e7981807f280de.libcxx-ndk_linux-x86_64-5fbff2-20240727.tar.gz
-rw-r--r-- 1 root dc-sw-users     128365 Sep 27 17:27 dfcaa71177f12992d9542b6c8e60d363.ninja-linux-x86-1.12.0-20240523.tar.gz
-rw-r--r-- 1 root dc-sw-users     270405 Oct 28 08:39 e0c9e1b221277cd431bc9dcba432c3e1.ninja-ohos-1.12.0-20240827.tar.gz
-rw-r--r-- 1 root dc-sw-users   33784208 Sep 27 17:33 e778f29e95d22f8e3cb6e604936229dc.node-v16.20.2-linux-x64.tar.gz
-rw-r--r-- 1 root dc-sw-users   39492529 Sep 27 17:33 ebe7c49b8fdbb8cebc06adb7fef9cb4b.cmake-windows-x86-3.28.2.tar.gz
-rw-r--r-- 1 root dc-sw-users    2052940 Sep 27 17:28 ecc8770b5ab13932696406bf43a5401b.packing_tool_libs_20240730.zip
-rw-r--r-- 1 root dc-sw-users     462116 Sep 27 17:27 f8dea77cc089365ea9b35880dbc252b3.ninja-ohos-1.12.0-20240527.tar.gz
-rw-r--r-- 1 root dc-sw-users 1452493082 Oct 28 08:52 f997ab75c9658a9e47bb4db7b91b89a3.clang_ohos-arm64-ef33c3-20240828.tar.gz

Full compilation

Enter the source code root directory and execute

cd oh5
./build.sh --product-name smt001 --ccache --prebuilt-sdk

Common build parameter description

–fast-rebuild

./build.sh --product-name smt001 --ccache --no-prebuilt-sdk --fast-rebuild
## 编译流程主要分为:preloader->loader->gn->ninja这四个过程
## 在本地没有修改gn和产品配置相关文件的前提下,--fast-rebuild会直接从ninja编译开始
## 该参数可以减少编译总耗时

–prebuilt-sdk

Before executing the full compilation, compile the SDK first, and copy the SDK to prebuilts/ohos-sdk. build.sh supports specifying the SDK's operating platform through the parameter sdk_platform=xxx, supporting mac/win/linux/

ohos/default, default is {windows,linux,ohos} on a Linux host and {mac} on a Mac host

For example:

./build.sh --product-name smt001 --ccache --prebuilt-sdk sdk_platform=default

Generate burning img

./build/gen_zip.sh smt001

The generated burnable img is in

out/smt001/packages/phone/images/openharmony-spacemit-smt001.zip

Compile the kernel separately

./build.sh -product-name smt001 --ccache --prebuilt-sdk -T build_kernel

The build_kernel above is defined in device/board/spacemit/smt001/kernel/BUILD.gn:

action("build_kernel") {
  script = "build_kernel.sh"
  sources = [ kernel_source_dir ]
  outputs = [ "$root_build_dir/packages/phone/images/Image" ]
  args = [
      rebase_path(kernel_build_script_dir,root_build_dir),
      rebase_path("$root_build_dir/../.."),
      rebase_path("$root_build_dir/packages/phone/images"),
      rebase_path(kernel_source_dir),
      rebase_path(kernel_build_script_dir),
      kernel_ramdisk,
      product_company,
      product_name,
  ]
}

The kernel source code path is: kernel/linux/spacemit_kernel-6.6

The kernel source code path after patching generated in the out directory is: out/kernel/OBJ/smt001

The compiled kernel image path is: out/kernel/OBJ/smt001/arch/riscv/boot/Image.itb

The compiled dtb file path is: out/kernel/OBJ/smt001/arch/riscv/boot/dts/spacemit/k1-x_smt001.dtb

The generated kernel image and dtb file will be automatically copied to the out/smt001/packages/phone/images/bootfs directory, and the packaging script will package them into img.

Compile the HDF adaptation layer separately

Take display as an example:

./build.sh -product-name smt001 --ccache --prebuilt-sdk -T display_composer_vendor

The display adaptation code is in device/soc/spacemit/k1/hardware/display, and the definition of display_composer_vendor is in device/soc/spacemit/k1/hardware/display/BUILD.gn


ohos_shared_library("display_composer_vendor") {
  sources = [
    "src/display_device/drm_connector.cpp",
    "src/display_device/drm_crtc.cpp",
    "src/display_device/drm_device.cpp",
    ...
  ]
}

The compiled so is in:

-rwxr-x---+ 1 root root 181000 Jun  7 08:55 ./out/smt001/hdf/spacemit_products/libdisplay_composer_vendor.z.so

The so in the folder below has not been updated. You need to pay attention to the update time and md5 value

-rwxr-x---+ 1 root root 180968 Jun  6 16:02 ./out/smt001/packages/phone/vendor/lib64/libdisplay_composer_vendor.z.so

The generated dynamic library can be pushed to the machine through hdc to facilitate debugging and avoid re-burning the firmware. The command is as follows:

D:\>hdc shell
# mount -o remount,rw /                #system分区可读写
# mount -o remount,rw /vendor          #vendor分区可读写
# exit

D:\>hdc file send libdisplay_composer_vendor.z.so /vendor/lib64/
D:\>hdc shell
# reboot

Compile SDK separately

./build.py --product-name ohos-sdk --ccache=true --xcache=false --load-test-config=false --get-warning-list=false --stat-ccache=false --compute-overlap-rate=false --deps-guard=false --generate-ninja-trace=false --gn-args skip_generate_module_list_file=true use_cfi=false use_thin_lto=false enable_lto_O0=true sdk_check_flag=false enable_ndk_doxygen=false archive_ndk=false sdk_for_hap_build=true enable_archive_sdk=false enable_notice_collection=false enable_process_notice=false

By changing the sdk_platform and ndk_platform parameters, you can compile SDKs running on different OSes. The NDK output is located in out/sdk/sdk-native

Fast Compile

Compiling the target module is faster with the following command:

ninja -w dupbuild=warn -C out/xxx yyy -j8

xxx represents the solution name yyy represents the build target

For example, to compile the libomxvpu_dec target of the smt001 solution, the command is as follows:

ninja -w dupbuild=warn -C out/smt001 libomxvpu_dec -j8
Edit this page on GitHub
Last Updated:
Contributors: ZSL
Prev
2.3 Source Code Download
Next
2.5 Flashing Guide