mgmt: updatehub: Add userspace syscalls
The current updatehub version forces user application to run in kernel mode. This add necessary api syscalls to isolate userspace from kernel. Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
parent
000257dad0
commit
647c48c574
5 changed files with 69 additions and 12 deletions
|
@ -14,6 +14,8 @@ zephyr_library_sources_ifdef(CONFIG_UPDATEHUB updatehub_integrity.c)
|
|||
zephyr_library_sources_ifdef(CONFIG_UPDATEHUB updatehub_storage.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_UPDATEHUB_SHELL shell.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE updatehub_handlers.c)
|
||||
|
||||
zephyr_include_directories(
|
||||
${ZEPHYR_BASE}/subsys/mgmt/updatehub/include
|
||||
)
|
||||
|
|
|
@ -743,19 +743,19 @@ static void probe_cb(char *metadata, size_t metadata_size)
|
|||
LOG_INF("Probe metadata received");
|
||||
}
|
||||
|
||||
int updatehub_confirm(void)
|
||||
int z_impl_updatehub_confirm(void)
|
||||
{
|
||||
return updatehub_storage_mark_partition_as_confirmed(UPDATEHUB_SLOT_PARTITION_0);
|
||||
}
|
||||
|
||||
int updatehub_reboot(void)
|
||||
int z_impl_updatehub_reboot(void)
|
||||
{
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum updatehub_response updatehub_probe(void)
|
||||
enum updatehub_response z_impl_updatehub_probe(void)
|
||||
{
|
||||
struct probe request;
|
||||
struct resp_probe_some_boards metadata_some_boards = { 0 };
|
||||
|
@ -919,7 +919,7 @@ error:
|
|||
return ctx.code_status;
|
||||
}
|
||||
|
||||
enum updatehub_response updatehub_update(void)
|
||||
enum updatehub_response z_impl_updatehub_update(void)
|
||||
{
|
||||
if (report(UPDATEHUB_STATE_DOWNLOADING) < 0) {
|
||||
LOG_ERR("Could not reporting downloading state");
|
||||
|
@ -1005,7 +1005,7 @@ static void autohandler(struct k_work *work)
|
|||
k_work_reschedule(&updatehub_work_handle, UPDATEHUB_POLL_INTERVAL);
|
||||
}
|
||||
|
||||
void updatehub_autohandler(void)
|
||||
void z_impl_updatehub_autohandler(void)
|
||||
{
|
||||
#if defined(CONFIG_UPDATEHUB_DOWNLOAD_SHA256_VERIFICATION)
|
||||
LOG_INF("SHA-256 verification on download only");
|
||||
|
|
39
subsys/mgmt/updatehub/updatehub_handlers.c
Normal file
39
subsys/mgmt/updatehub/updatehub_handlers.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2023 O.S.Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/syscall_handler.h>
|
||||
#include <zephyr/mgmt/updatehub.h>
|
||||
|
||||
|
||||
static inline void z_vrfy_updatehub_autohandler(void)
|
||||
{
|
||||
z_impl_updatehub_autohandler();
|
||||
}
|
||||
#include <syscalls/updatehub_autohandler_mrsh.c>
|
||||
|
||||
static inline enum updatehub_response z_vrfy_updatehub_probe(void)
|
||||
{
|
||||
return z_impl_updatehub_probe();
|
||||
}
|
||||
#include <syscalls/updatehub_probe_mrsh.c>
|
||||
|
||||
static inline enum updatehub_response z_vrfy_updatehub_update(void)
|
||||
{
|
||||
return z_impl_updatehub_update();
|
||||
}
|
||||
#include <syscalls/updatehub_update_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_updatehub_confirm(void)
|
||||
{
|
||||
return z_impl_updatehub_confirm();
|
||||
}
|
||||
#include <syscalls/updatehub_confirm_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_updatehub_reboot(void)
|
||||
{
|
||||
return z_impl_updatehub_reboot();
|
||||
}
|
||||
#include <syscalls/updatehub_reboot_mrsh.c>
|
Loading…
Add table
Add a link
Reference in a new issue