Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ check_c_source_compiles(
# Add components
#

add_subdirectory(${ggl_sdk_SOURCE_DIR} ggl-sdk)
target_include_directories(ggl-sdk INTERFACE ${ggl_sdk_SOURCE_DIR}/priv_include)

# Common setup for a GGL module
function(ggl_init_module name)
cmake_parse_arguments(PARSE_ARGV 1 COMP_ARG "" "SRCDIR" "INCDIRS;LIBS")
Expand Down
5 changes: 5 additions & 0 deletions fc_deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
"url": "https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk.git",
"rev": "f0409ced6c2c9430f0e972019b7e8f20bbf58f4e",
"hash": "sha256-6is4ymM/Ct9JntgpFHF4Vlv5+GUwy0HZvEiEV+ALJkw="
},
"ggl_sdk": {
"url": "https://github.com/aws-greengrass/aws-greengrass-sdk-lite.git",
"rev": "f06f8e1e78e150172bbaa5386325e3918dfbc83e",
"hash": "sha256-+yu8ciEmVv2rmSTy4iQqDcH3+yrugwZCF7ZBkAgVDAo="
}
}
1 change: 1 addition & 0 deletions misc/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ PTRACE
Pypi
pyproject
respfd
rlimits
rodata
rootca
semp
Expand Down
2 changes: 1 addition & 1 deletion modules/core-bus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(core-bus LIBS ggl-sdk)
ggl_init_module(core-bus LIBS ggl-sdk ggl-socket-server)
10 changes: 8 additions & 2 deletions modules/fleet-provisioning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(
fleet-provision LIBS ggl-sdk core-bus ggl-exec core-bus-gg-config
core-bus-aws-iot-mqtt PkgConfig::openssl)
fleet-provision
LIBS ggl-sdk
ggl-common
core-bus
ggl-exec
core-bus-gg-config
core-bus-aws-iot-mqtt
PkgConfig::openssl)
target_compile_definitions(
fleet-provision
PRIVATE "GGL_SYSTEMD_SYSTEM_USER=\"${GGL_SYSTEMD_SYSTEM_USER}\"")
Expand Down
7 changes: 3 additions & 4 deletions modules/fleet-provisioning/bin/fleet-provisioning.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
#include <ggl/error.h>
#include <ggl/exec.h>
#include <ggl/log.h>
#include <ggl/nucleus/init.h>
#include <ggl/vector.h>
#include <ggl/version.h>
#include <sys/types.h>
#include <stdint.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;

static char doc[] = "fleet provisioner -- Executable to automatically "
"provision the device to AWS IOT core";
static GglBuffer component_name = GGL_STR("fleet-provisioning");
Expand Down Expand Up @@ -128,6 +125,8 @@ int main(int argc, char **argv) {
argp_parse(&argp, argc, argv, 0, 0, &args);
args.iotcored_path = (char *) iotcored_path;

ggl_nucleus_init();

pid_t pid = -1;
ret = run_fleet_prov(&args, &pid);
if (ret != GGL_ERR_OK) {
Expand Down
10 changes: 8 additions & 2 deletions modules/gg-fleet-statusd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(
gg-fleet-statusd LIBS ggl-sdk core-bus core-bus-gghealthd core-bus-gg-config
core-bus-aws-iot-mqtt ggl-constants)
gg-fleet-statusd
LIBS ggl-sdk
ggl-common
core-bus
core-bus-gghealthd
core-bus-gg-config
core-bus-aws-iot-mqtt
ggl-constants)
7 changes: 3 additions & 4 deletions modules/gg-fleet-statusd/bin/gg-fleet-statusd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

#include "gg_fleet_statusd.h"
#include <ggl/error.h>
#include <ggl/version.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;
#include <ggl/nucleus/init.h>

int main(int argc, char **argv) {
(void) argc;
(void) argv;

ggl_nucleus_init();

GglError ret = run_gg_fleet_statusd();
if (ret != GGL_ERR_OK) {
return 1;
Expand Down
1 change: 0 additions & 1 deletion modules/gg-fleet-statusd/src/fleet_status_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <ggl/nucleus/constants.h>
#include <ggl/object.h>
#include <ggl/vector.h>
#include <ggl/version.h>
#include <limits.h>
#include <pthread.h>
#include <string.h>
Expand Down
4 changes: 2 additions & 2 deletions modules/ggconfigd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(ggconfigd LIBS ggl-sdk core-bus core-bus-gg-config ggl-yaml
PkgConfig::sqlite3)
ggl_init_module(ggconfigd LIBS ggl-sdk ggl-common core-bus core-bus-gg-config
ggl-yaml PkgConfig::sqlite3)
target_compile_definitions(ggconfigd
PRIVATE "GGL_COMP_DIR=${CMAKE_CURRENT_LIST_DIR}")
target_compile_options(ggconfigd PRIVATE $<$<COMPILE_LANGUAGE:ASM>:-undef>)
7 changes: 3 additions & 4 deletions modules/ggconfigd/bin/ggconfigd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
#include "ggconfigd.h"
#include <argp.h>
#include <ggl/buffer.h>
#include <ggl/version.h>
#include <ggl/nucleus/init.h>
#include <stdlib.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;

static char doc[] = "ggconfigd -- Greengrass Nucleus Lite configuration daemon";

static struct argp_option opts[] = {
Expand Down Expand Up @@ -50,6 +47,8 @@ int main(int argc, char **argv) {
// NOLINTNEXTLINE(concurrency-mt-unsafe)
argp_parse(&argp, argc, argv, 0, 0, NULL);

ggl_nucleus_init();

atexit(exit_cleanup);

(void) ggconfig_open();
Expand Down
1 change: 1 addition & 0 deletions modules/ggdeploymentd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ggl_init_module(
ggdeploymentd
LIBS ggl-sdk
ggl-common
core-bus
ggl-backoff
ggl-http
Expand Down
7 changes: 3 additions & 4 deletions modules/ggdeploymentd/bin/ggdeploymentd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
#include <argp.h>
#include <ggl/buffer.h>
#include <ggl/error.h>
#include <ggl/nucleus/init.h>
#include <ggl/vector.h>
#include <ggl/version.h>
#include <limits.h>
#include <string.h>
#include <stdbool.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;

static char doc[]
= "ggdeploymentd -- Greengrass Nucleus Lite deployment daemon";

Expand Down Expand Up @@ -67,6 +64,8 @@ int main(int argc, char **argv) {
// NOLINTNEXTLINE(concurrency-mt-unsafe)
argp_parse(&argp, argc, argv, 0, 0, NULL);

ggl_nucleus_init();

ret = run_ggdeploymentd(bin_path);
if (ret != GGL_ERR_OK) {
return 1;
Expand Down
1 change: 0 additions & 1 deletion modules/ggdeploymentd/src/deployment_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <ggl/uri.h>
#include <ggl/utils.h>
#include <ggl/vector.h>
#include <ggl/version.h>
#include <ggl/zip.h>
#include <limits.h>
#include <string.h>
Expand Down
12 changes: 10 additions & 2 deletions modules/gghealthd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(gghealthd LIBS ggl-sdk ggl-exec ggl-constants core-bus
core-bus-gg-config PkgConfig::libsystemd)
ggl_init_module(
gghealthd
LIBS ggl-sdk
ggl-common
ggl-exec
ggl-constants
core-bus
ggl-socket-server
core-bus-gg-config
PkgConfig::libsystemd)
6 changes: 2 additions & 4 deletions modules/gghealthd/bin/gghealthd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

#include "bus_server.h"
#include <ggl/error.h>
#include <ggl/version.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;
#include <ggl/nucleus/init.h>

int main(void) {
ggl_nucleus_init();
GglError ret = run_gghealthd();
if (ret != GGL_ERR_OK) {
return 1;
Expand Down
4 changes: 3 additions & 1 deletion modules/ggipcd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
ggl_init_module(
ggipcd
LIBS ggl-sdk
ggl-common
ggl-constants
core-bus
core-bus-gg-config
core-bus-aws-iot-mqtt
ggipc-auth
ggl-rand)
ggl-rand
ggl-socket-server)
7 changes: 3 additions & 4 deletions modules/ggipcd/bin/ggipcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
#include "ggipcd.h"
#include <argp.h>
#include <ggl/error.h>
#include <ggl/version.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;
#include <ggl/nucleus/init.h>

static char doc[] = "ggipcd -- Greengrass IPC server for Nucleus Lite";

Expand Down Expand Up @@ -39,6 +36,8 @@ int main(int argc, char **argv) {
// NOLINTNEXTLINE(concurrency-mt-unsafe)
argp_parse(&argp, argc, argv, 0, 0, &args);

ggl_nucleus_init();

GglError ret = run_ggipcd(&args);
if (ret != GGL_ERR_OK) {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion modules/ggl-cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(ggl-cli LIBS ggl-sdk core-bus)
ggl_init_module(ggl-cli LIBS ggl-sdk ggl-common core-bus)
7 changes: 3 additions & 4 deletions modules/ggl-cli/bin/ggl-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@
#include <ggl/error.h>
#include <ggl/log.h>
#include <ggl/map.h>
#include <ggl/nucleus/init.h>
#include <ggl/object.h>
#include <ggl/vector.h>
#include <ggl/version.h>
#include <limits.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;

char *command = NULL;
char *recipe_dir = NULL;
char *artifacts_dir = NULL;
Expand Down Expand Up @@ -88,6 +85,8 @@ int main(int argc, char **argv) {
// NOLINTNEXTLINE(concurrency-mt-unsafe)
argp_parse(&argp, argc, argv, 0, 0, NULL);

ggl_nucleus_init();

GglKVVec args = GGL_KV_VEC((GglKV[3]) { 0 });

if (recipe_dir != NULL) {
Expand Down
5 changes: 5 additions & 0 deletions modules/ggl-common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# aws-greengrass-lite - AWS IoT Greengrass runtime for constrained devices
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

ggl_init_module(ggl-common LIBS ggl-sdk)
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#ifndef GGL_IPC_LIMITS_H
#define GGL_IPC_LIMITS_H
#ifndef GGL_NUCLEUS_INIT_H
#define GGL_NUCLEUS_INIT_H

#define GGL_IPC_PAYLOAD_MAX_SUBOBJECTS (50)
#define GGL_IPC_SVCUID_STR_LEN (16)
/// Initial setup for nucleus executables
void ggl_nucleus_init(void);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// IWYU removes this since GGL_VERSION is provided on the command line
// IWYU pragma: always_keep

#ifndef GGL_VERSION_H
#define GGL_VERSION_H

//! Greengrass Lite version number
#include <argp.h>
#include <ggl/nucleus/init.h>
#include <ggl/sdk.h>

#ifndef GGL_VERSION
#define GGL_VERSION "0.0.0"
#endif

#endif
__attribute__((visibility("default"))) const char *argp_program_version
= GGL_VERSION;

void ggl_nucleus_init(void) {
// TODO: Raise rlimits
ggl_sdk_init();
}
10 changes: 0 additions & 10 deletions modules/ggl-sdk/CMakeLists.txt

This file was deleted.

Loading