Skip to content

Commit

Permalink
Refactor samples and NDK setup guide:
Browse files Browse the repository at this point in the history
- Change output path and delete unused flags in samples
- Improve readability of NDK setup guide
  • Loading branch information
Heeam-Shin committed Dec 30, 2024
1 parent 5b69d70 commit a080deb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
43 changes: 27 additions & 16 deletions content/en/docs/guides/setup/setting-up-native-development-kit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Native Development Kit Setup
date: 2024-11-29
date: 2024-12-27
weight: 90
toc: true
---
Expand All @@ -18,19 +18,28 @@ Building NDK needs a high-performance build system computer. See [Build System R
To build the NDK, enter the following commands:

``` bash
# Download source codes
$ git clone https://github.com/webosose/build-webos
$ cd build-webos
$ git checkout -t origin/<BRANCH_OF_THE_LATEST_WEBOS_OSE_VERSION>

# (Optional) If a patch version exists
# See http://webosose.org/docs/guides/setup/building-webos-ose/#
$ git checkout -t origin/<branch of the latest webos ose version>

# Install and configure the build
$ sudo scripts/prerequisites.sh
$ ./mcf -p <NUM_OF_CPUS> -b <NUM_OF_CPUS> raspberrypi4-64
$ ./mcf -p <half the num of CPUs> -b <half the num of CPUs> <image type>

# Start to build
$ source oe-init-build-env
$ bitbake -c populate_sdk webos-image
```

| Parameter | Description |
|-----------|-------------|
| `<BRANCH_OF_THE_LATEST_WEBOS_OSE_VERSION>` | This parameter varies depending on the current the webOS OSE version. Use the latest version. See also [Cloning the Repository]({{< relref "building-webos-ose#cloning-the-repository" >}}). |
| `<NUM_OF_CPUS>` | Number of CPU cores to allocate to the building process. For the specific value, refer to [Appendix A. Setting Values for mcf]({{< relref "building-webos-ose#appendix-a-setting-values-for-mcf" >}}). |
| `<branch of the latest webos ose version>` | This parameter varies depending on the current the webOS OSE version. Use the latest version. See also [(Optional) How to Handle Patch Versions]({{< relref "building-webos-ose#optional-how-to-handle-patch-versions" >}}). |
| `<half the num of CPUs>` | Number of CPU cores to allocate to the building process. For the specific value, refer to [Appendix A. Setting Values for mcf]({{< relref "building-webos-ose#appendix-a-setting-values-for-mcf" >}}). |
| `<image type>` | A type of the webOS OSE image to build. See [Configuring the Build]({{< relref "building-webos-ose#configuring-the-build" >}}). |

{{< note >}}
OpenEmbedded commands (e.g., `bitbake`) are used to build the NDK installer. For more details about the commands and OpenEmbedded, see [Yocto Project SDK Manual](https://www.yoctoproject.org/docs/2.6/sdk-manual/sdk-manual.html#sdk-building-an-sdk-installer).
Expand All @@ -40,11 +49,11 @@ If the building process succeeds, a script file (`.sh`) is generated in `build-w

``` bash
$ ls BUILD/deploy/sdk
# Example results for webOS OSE v2.20.1
webos-sdk-x86_64-cortexa72-toolchain-2.20.1.g.host.manifest
webos-sdk-x86_64-cortexa72-toolchain-2.20.1.g.sh
webos-sdk-x86_64-cortexa72-toolchain-2.20.1.g.target.manifest
webos-sdk-x86_64-cortexa72-toolchain-2.20.1.g.testdata.json
# Example results for webOS OSE v2.27.0
webos-sdk-x86_64-cortexa72-toolchain-2.27.0.g.host.manifest
webos-sdk-x86_64-cortexa72-toolchain-2.27.0.g.sh
webos-sdk-x86_64-cortexa72-toolchain-2.27.0.g.target.manifest
webos-sdk-x86_64-cortexa72-toolchain-2.27.0.g.testdata.json
```

## Install the NDK
Expand All @@ -60,12 +69,12 @@ To run the generated script file, enter the following commands:

``` bash
$ cd BUILD/deploy/sdk
$ ./webos-sdk-x86_64-cortexa72-toolchain-2.20.1.g.sh
# Example results for webOS OSE v2.20.1
webOS OSE SDK installer version 2.20.1.g
$ ./webos-sdk-x86_64-cortexa72-toolchain-2.27.0.g.sh
webOS OSE SDK installer version 2.27.0.g
========================================
Enter target directory for SDK (default: /usr/local/webos-sdk-x86_64):
You are about to install the SDK to "/usr/local/webos-sdk-x86_64". Proceed [Y/n]? Y
The directory "/usr/local/webos-sdk-x86_64" already contains a SDK for this architecture.
If you continue, existing files will be overwritten! Proceed [y/N]? y
```

{{< note >}}
Expand All @@ -76,8 +85,10 @@ If the process succeeds, an environment setup file (`environment-setup-cortexa72

``` bash
$ ls /usr/local/webos-sdk-x86_64/
environment-setup-cortexa72-webos-linux sysroots
site-config-cortexa72-webos-linux version-cortexa72-webos-linux
environment-setup-cortexa72-webos-linux
site-config-cortexa72-webos-linux
sysroots
version-cortexa72-webos-linux
```

### Set Up an Environment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Downloadable Native Apps
display_title: Developing Downloadable Native Apps
date: 2024-10-02
date: 2024-12-23
weight: 10
toc: true
---
Expand Down Expand Up @@ -132,12 +132,10 @@ Follow the guides in [Native Development Kit Setup]({{< relref "setting-up-nativ
$ make
```

If the commands succeed, a `pkg_<YOUR_ARCHITECTURE>` directory will be generated in your app directory. `<YOUR_ARCHITECTURE>` depends on your build machine’s architecture.

In the following example, the `pkg_aarch64` directory is generated.
If the commands succeed, a `output` directory will be generated.

```
pkg_aarch64/
BUILD/output/
├── appinfo.json
├── icon.png
└── wayland_egl
Expand All @@ -151,8 +149,8 @@ Enter the following command:

``` bash
# Command format
# ares-package <APP DIRECTORY>
ares-package pkg_aarch64
# ares-package <OUTPUT DIRECTORY>
ares-package output
```

If the command succeeds, an `.ipk` file will be generated under the current directory.
Expand Down Expand Up @@ -275,7 +273,7 @@ set(SRC_LIST
${CMAKE_SOURCE_DIR}/src/wayland_egl.c
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/pkg_$ENV{OECORE_TARGET_ARCH}/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
add_executable(${BIN_NAME} ${SRC_LIST})
set_target_properties(${BIN_NAME} PROPERTIES LINKER_LANGUAGE C)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Downloadable Native Services
display_title: Developing Downloadable Native Services
date: 2024-10-02
date: 2024-12-23
weight: 10
toc: true
---
Expand Down Expand Up @@ -140,12 +140,10 @@ Follow the guides in [Native Development Kit Setup]({{< relref "setting-up-nativ
$ make
```

If the commands succeed, a `pkg_<YOUR_ARCHITECTURE>` directory will be generated in your app directory. `<YOUR_ARCHITECTURE>` depends on your build machine’s architecture.

In the following example, the `pkg_aarch64` directory is generated.
If the commands succeed, a `output` directory will be generated.

```
pkg_aarch64/
BUILD/output/
├── echo_service
└── services.json
```
Expand All @@ -159,7 +157,7 @@ Enter the following command:
``` bash
# Command format
# ares-package <APP DIRECTORY> <SERVICE DIRECTORY>
ares-package ./com.sample.echo ./com.sample.echo.service/pkg_aarch64
ares-package ./com.sample.echo ./com.sample.echo.service/BUILD/output
```

If the command succeeds, an `.ipk` file will be generated under the current directory.
Expand Down Expand Up @@ -287,9 +285,6 @@ See also [services.json]({{< relref "services-json" >}}).
cmake_minimum_required(VERSION 2.8.7)
project(nativeService C)
# set link directory
#link_directories(${CMAKE_SOURCE_DIR}/pkg_$ENV{ARCH}/lib)
# ---
# add include files
include_directories(${CMAKE_SOURCE_DIR})
Expand Down Expand Up @@ -324,11 +319,9 @@ set(SRC_LIST
${CMAKE_SOURCE_DIR}/src/main.c
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/pkg_$ENV{OECORE_TARGET_ARCH}/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output)
add_executable(${BIN_NAME} ${SRC_LIST})
# ignore shared library
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--allow-shlib-undefined")
set_target_properties(${BIN_NAME} PROPERTIES LINKER_LANGUAGE C)
target_link_libraries (${BIN_NAME}
Expand Down

0 comments on commit a080deb

Please sign in to comment.