Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ This meta layer contains recipes for Aos components such as:
* aos-communicationmanager - Aos communication manager;
* aos-iamanager - Aos identity and access manager;
* aos-servicemanager - Aos service manager;
* aos-updatemanager - Aos update manager;
* aos-vis - Aos vehicle information service;
* Aos CNI plugins;
* other tools and utility for AosEdge core part.
Expand Down
37 changes: 5 additions & 32 deletions doc/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ WKS_FILE = "custom.wks.in"
Aos main components should be added into the target image by appending `IMAGE_INSTALL` variable in `local.conf`:

```bash
IMAGE_INSTALL:append = " aos-iamanager aos-provfirewall aos-communicationmanager aos-servicemanager aos-updatemanager"
IMAGE_INSTALL:append = " aos-iamanager aos-provfirewall aos-communicationmanager aos-servicemanager"
```

`aos-iamanager`, `aos-communicationmanager`, `aos-servicemanager` are core Aos components. `aos-updatemanager` is
responsible for Aos OTA updates. If OTA system components update is not needed, `aos-updatemanager` may be removed from
the target image. It also required `umController` section to be removed from `aos-communicationmanager` config as
`aos-iamanager`, `aos-communicationmanager`, `aos-servicemanager` are core Aos components.
It also required `umController` section to be removed from `aos-communicationmanager` config as
well as `um` storage to be removed from `aos-iamanager` config. `aos-provfirewall` is helper service that closes
provisioning ports after provisioning for security reason.

Expand Down Expand Up @@ -177,33 +176,7 @@ by other layer recipes. See [aos-vm][aos-vm] layers as example.

## Integrate Aos FOTA update

`aos-updatemanager` performs Aos OTA update of different system components with dedicated plugins. `aos-updatemanager`
has an example implementation of updating disk partitions using dual partition (A/B) approach as well as using overlay
approach. Aos overlay OTA update supports incremental update (delta update) whereas dual partition update supports only
full partition update.

See reference Aos products as example of boot and roofs partitions update. At these products, rootfs is updated using
overlay approach, boot partition is updated using A/B approach. In [aos-vm][aos-vm] switching between A/B partition is
done by using `efi` boot manager at same time in [aos-rcar-gen3][aos-rcar-gen3] and [aos-rcar-gen4][aos-rcar-gen4]
switching A/B partition is done by using U-Boot environment variables.

For a custom component update, the appropriate `aos-updatemanager` shall be implemented and integrated.

Reference Aos FOTA implementation requires readonly rootfs. It can be enabled by setting the following variable in
`local.conf`:

```bash
IMAGE_FEATURES:append = " read-only-rootfs"
```

`meta-aos` provides base Aos image recipe with RO rootfs and generating required for FOTA versioning files. You can
simple use it as your image file or include it in your own image file:

```bash
require recipes-core/images/aos-image.inc
```

See [aos-vm][aos-vm] for reference.
*TBD*

## Integration using moulin meta build system

Expand Down Expand Up @@ -238,7 +211,7 @@ components:
- [DISTRO_FEATURES:append, " virtualization security"]
# selinux is optional
- [DISTRO_FEATURES:append, " acl xattr pam selinux"]
- [IMAGE_INSTALL:append, " aos-iamanager aos-provfirewall aos-communicationmanager aos-servicemanager aos-updatemanager"]
- [IMAGE_INSTALL:append, " aos-iamanager aos-provfirewall aos-communicationmanager aos-servicemanager"]
# AOS VIS is optional
- [IMAGE_INSTALL:append, " aos-vis"]
# AOS FOTA specific option
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
DESCRIPTION = "AOS Communication Manager"

GO_IMPORT = "github.com/aosedge/aos_communicationmanager"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"

BRANCH = "develop"
SRCREV = "${AUTOREV}"
BRANCH = "main"
SRCREV = "11a4ef530cf3a0357ffa0d9e45c342c9891b9222"

SRC_URI = "git://${GO_IMPORT}.git;branch=${BRANCH};protocol=https"
SRC_URI = "gitsm://github.com/aosedge/aos_core_cpp.git;protocol=https;branch=${BRANCH}"

SRC_URI += " \
file://aos_communicationmanager.cfg \
file://aos-communicationmanager.service \
file://aos_cm.cfg \
file://aos-cm.service \
file://aos-target.conf \
file://aos-dirs-service.conf \
"

inherit go goarch systemd
S = "${WORKDIR}/git"

inherit cmake pkgconfig systemd

SYSTEMD_SERVICE:${PN} = "aos-communicationmanager.service"
SYSTEMD_SERVICE:${PN} = "aos-cm.service"

MIGRATION_SCRIPTS_PATH = "${base_prefix}/usr/share/aos/cm/migration"

Expand All @@ -29,24 +29,28 @@ FILES:${PN} += " \
${MIGRATION_SCRIPTS_PATH} \
"

DEPENDS = "systemd"

RDEPENDS:${PN} += " \
aos-rootca \
nfs-exports \
"
DEPENDS = "grpc grpc-native poco protobuf-native systemd curl libnl"

RDEPENDS:${PN}-dev += " bash make"
RDEPENDS:${PN}-staticdev += " bash make"
do_configure[network] = "1"

INSANE_SKIP:${PN} = "textrel"
EXTRA_OECMAKE += " \
-DFETCHCONTENT_FULLY_DISCONNECTED=OFF \
-DWITH_CM=ON \
-DWITH_IAM=OFF \
-DWITH_MP=OFF \
-DWITH_SM=OFF \
"
OECMAKE_GENERATOR = "Unix Makefiles"

# embed version
GO_LDFLAGS += '-ldflags="-X main.GitSummary=`git --git-dir=${S}/src/${GO_IMPORT}/.git describe --tags --always`"'
PACKAGECONFIG ??= "openssl"

# WA to support go install for v 1.18
PACKAGECONFIG[openssl] = "-DWITH_OPENSSL=ON,-DWITH_OPENSSL=OFF,openssl,"
PACKAGECONFIG[mbedtls] = "-DWITH_MBEDTLS=ON,-DWITH_MBEDTLS=OFF,,"

GO_LINKSHARED = ""
RDEPENDS:${PN} += " \
aos-rootca \
nfs-exports \
"

RRECOMMENDS:${PN} += " \
kernel-module-quota-v1 \
Expand All @@ -57,7 +61,7 @@ RRECOMMENDS:${PN} += " \
python do_update_config() {
import json

file_name = oe.path.join(d.getVar("D"), d.getVar("sysconfdir"), "aos", "aos_communicationmanager.cfg")
file_name = oe.path.join(d.getVar("D"), d.getVar("sysconfdir"), "aos", "aos_cm.cfg")

with open(file_name) as f:
data = json.load(f)
Expand Down Expand Up @@ -89,25 +93,21 @@ python do_update_config() {
json.dump(data, f, indent=4)
}

do_compile:prepend() {
cd ${GOPATH}/src/${GO_IMPORT}/
}

do_install:append() {
install -d ${D}${sysconfdir}/aos
install -m 0644 ${WORKDIR}/aos_communicationmanager.cfg ${D}${sysconfdir}/aos
install -m 0644 ${WORKDIR}/aos_cm.cfg ${D}${sysconfdir}/aos

install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-communicationmanager.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-cm.service ${D}${systemd_system_unitdir}

install -d ${D}${sysconfdir}/systemd/system/aos.target.d
install -m 0644 ${WORKDIR}/aos-target.conf ${D}${sysconfdir}/systemd/system/aos.target.d/${PN}.conf

install -d ${D}${sysconfdir}/systemd/system/aos-communicationmanager.service.d
install -m 0644 ${WORKDIR}/aos-dirs-service.conf ${D}${sysconfdir}/systemd/system/aos-communicationmanager.service.d/10-aos-dirs-service.conf
install -d ${D}${sysconfdir}/systemd/system/aos-cm.service.d
install -m 0644 ${WORKDIR}/aos-dirs-service.conf ${D}${sysconfdir}/systemd/system/aos-cm.service.d/10-aos-dirs-service.conf

install -d ${D}${MIGRATION_SCRIPTS_PATH}
source_migration_path="/src/${GO_IMPORT}/database/migration"
source_migration_path="/src/cm/database/migration"
if [ -d ${S}${source_migration_path} ]; then
install -m 0644 ${S}${source_migration_path}/* ${D}${MIGRATION_SCRIPTS_PATH}
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=AOS Communication Manager
Wants=network-online.target aos-iamanager.service
After=network-online.target aos-iamanager.service
Wants=network-online.target aos-iam.service
After=network-online.target aos-iam.service
ConditionPathExists=/var/aos/.provisionstate
PartOf=aos.target

[Service]
Type=notify
ExecStart=/usr/bin/aos_communicationmanager -c /etc/aos/aos_communicationmanager.cfg -v debug -j
ExecStart=/usr/bin/aos_cm_app -c /etc/aos/aos_cm.cfg -v debug -j
Restart=always
RestartSec=10

Expand Down
4 changes: 2 additions & 2 deletions recipes-aos/aos-communicationmanager/files/aos-target.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[Unit]
Wants=aos-communicationmanager.service
After=aos-communicationmanager.service
Wants=aos-cm.service
After=aos-cm.service
4 changes: 2 additions & 2 deletions recipes-aos/aos-dnsname/aos-dnsname.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ GO_IMPORT = "github.com/aosedge/aos_cni_dns"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

BRANCH = "develop"
SRCREV = "${AUTOREV}"
BRANCH = "main"
SRCREV = "2b445820a9b011703cc86bca98f6a419c14c92fb"

SRC_URI = "git://${GO_IMPORT}.git;branch=${BRANCH};protocol=https"

Expand Down
4 changes: 2 additions & 2 deletions recipes-aos/aos-firewall/aos-firewall.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ GO_IMPORT = "github.com/aosedge/aos_cni_firewall"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

BRANCH = "develop"
SRCREV = "${AUTOREV}"
BRANCH = "main"
SRCREV = "e1f1c51bb069ed8f0150973669cd2d8d62d37516"

SRC_URI = "git://${GO_IMPORT}.git;branch=${BRANCH};protocol=https"

Expand Down
49 changes: 27 additions & 22 deletions recipes-aos/aos-iamanager/aos-iamanager_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,40 @@ FILESEXTRAPATHS:prepend:aos-secondary-node := "${THISDIR}/files/secondary:"
DESCRIPTION = "AOS Identity and Access Manager CPP"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"

BRANCH = "develop"
SRCREV = "${AUTOREV}"
BRANCH = "main"
SRCREV = "491b0dfb347568ab584c84a6e2c49a0d66d792a8"

SRC_URI = "gitsm://github.com/aosedge/aos_core_iam_cpp.git;protocol=https;branch=${BRANCH}"
SRC_URI = "gitsm://github.com/aosedge/aos_core_cpp.git;protocol=https;branch=${BRANCH}"

SRC_URI += " \
file://aos_iamanager.cfg \
file://aos-iamanager.service \
file://aos-iamanager-provisioning.service \
file://aos_iam.cfg \
file://aos-iam.service \
file://aos-iam-provisioning.service \
file://aos-target.conf \
file://aos-dirs-service.conf \
"

DEPENDS += "poco systemd grpc grpc-native protobuf-native protobuf openssl curl libnl"

EXTRA_OECMAKE += " \
-DFETCHCONTENT_FULLY_DISCONNECTED=OFF \
-DWITH_CM=OFF \
-DWITH_IAM=ON \
-DWITH_MP=OFF \
-DWITH_SM=OFF \
"
OECMAKE_GENERATOR = "Unix Makefiles"
EXTRA_OECMAKE += "-DFETCHCONTENT_FULLY_DISCONNECTED=OFF -DWITH_MBEDTLS=OFF -DWITH_OPENSSL=ON"

PACKAGECONFIG ??= "openssl"

PACKAGECONFIG[openssl] = "-DWITH_OPENSSL=ON,-DWITH_OPENSSL=OFF,openssl,"
PACKAGECONFIG[mbedtls] = "-DWITH_MBEDTLS=ON,-DWITH_MBEDTLS=OFF,,"

inherit autotools pkgconfig cmake systemd

SYSTEMD_SERVICE:${PN} = "aos-iamanager.service aos-iamanager-provisioning.service"
SYSTEMD_SERVICE:${PN} = "aos-iam.service aos-iam-provisioning.service"

MIGRATION_SCRIPTS_PATH = "${base_prefix}/usr/share/aos/iam/migration"

Expand All @@ -50,7 +61,7 @@ do_fetch[vardeps] += "AOS_MAIN_NODE AOS_MAIN_NODE_HOSTNAME AOS_NODE_HOSTNAME AOS
python do_update_config() {
import json

file_name = oe.path.join(d.getVar("D"), d.getVar("sysconfdir"), "aos", "aos_iamanager.cfg")
file_name = oe.path.join(d.getVar("D"), d.getVar("sysconfdir"), "aos", "aos_iam.cfg")

with open(file_name) as f:
data = json.load(f)
Expand Down Expand Up @@ -86,29 +97,23 @@ python do_update_config() {

do_install:append() {
install -d ${D}${sysconfdir}/aos
install -m 0644 ${WORKDIR}/aos_iamanager.cfg ${D}${sysconfdir}/aos
install -m 0644 ${WORKDIR}/aos_iam.cfg ${D}${sysconfdir}/aos

install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-iamanager.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-iamanager-provisioning.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-iam.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/aos-iam-provisioning.service ${D}${systemd_system_unitdir}

install -d ${D}${sysconfdir}/systemd/system/aos-iamanager-provisioning.service.d
install -m 0644 ${WORKDIR}/aos-dirs-service.conf ${D}${sysconfdir}/systemd/system/aos-iamanager-provisioning.service.d/20-aos-dirs-service.conf
install -d ${D}${sysconfdir}/systemd/system/aos-iam-provisioning.service.d
install -m 0644 ${WORKDIR}/aos-dirs-service.conf ${D}${sysconfdir}/systemd/system/aos-iam-provisioning.service.d/20-aos-dirs-service.conf

install -d ${D}${sysconfdir}/systemd/system/aos.target.d
install -m 0644 ${WORKDIR}/aos-target.conf ${D}${sysconfdir}/systemd/system/aos.target.d/${PN}.conf

install -d ${D}${MIGRATION_SCRIPTS_PATH}
source_migration_path="/src/database/migration"
source_migration_path="/src/iam/database/migration"
if [ -d ${S}${source_migration_path} ]; then
install -m 0644 ${S}${source_migration_path}/* ${D}${MIGRATION_SCRIPTS_PATH}
fi
}

# Do not install headers files
# This is temporary solution and should be removed when switching to new repo approach
do_install:append() {
rm -rf ${D}${includedir}
}

addtask update_config after do_install before do_package
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PartOf=aos.target
[Service]
Type=notify
ExecStartPre=-/opt/aos/deprovision.sh
ExecStart=/usr/bin/aos_iamanager -c /etc/aos/aos_iamanager.cfg -provisioning -v debug -j
ExecStart=/usr/bin/aos_iam_app -c /etc/aos/aos_iam.cfg -provisioning -v debug -j
Restart=always
RestartSec=10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PartOf=aos.target

[Service]
Type=notify
ExecStart=/usr/bin/aos_iamanager -c /etc/aos/aos_iamanager.cfg -v debug -j
ExecStart=/usr/bin/aos_iam_app -c /etc/aos/aos_iam.cfg -v debug -j
Restart=always
RestartSec=10
KillMode=process
Expand Down
8 changes: 4 additions & 4 deletions recipes-aos/aos-iamanager/files/aos-target.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Wants=aos-iamanager.service
After=aos-iamanager.service
Wants=aos-iamanager-provisioning.service
After=aos-iamanager-provisioning.service
Wants=aos-iam.service
After=aos-iam.service
Wants=aos-iam-provisioning.service
After=aos-iam-provisioning.service
Loading