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
74 changes: 74 additions & 0 deletions i
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2026 Comcast Cable Communications Management, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################

AUTOMAKE_OPTIONS = foreign subdir-objects

reboot_CFLAGS += -fPIC -pthread

AM_CPPFLAGS = -I$(top_srcdir)/reboot-helper/include -I$(top_srcdir)/reboot-reason-fetcher/include
AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -O2 -I./reboot-helper/include -DRDK_LOGGER_ENABLED -fPIC -pthread

# Library target
lib_LTLIBRARIES = librebootnow.la
librebootnow_la_LDFLAGS = -shared
librebootnow_la_SOURCES = \
system_cleanup.c \
cyclic_reboot.c \
utils.c

librebootnow_la_LIBADD = -lfwutils -lrdkloggers -lrfcapi -lsecure_wrapper #-lrebootreason

# CLI wrapper binary
bin_PROGRAMS = rebootnow
rebootnow_SOURCES = reboot_main.c
rebootnow_LDADD = librebootnow.la

AM_LDFLAGS = -lrdkloggers -lfwutils -lrfcapi -lsecure_wrapper #-lrebootreason

bin_PROGRAMS += update-prev-reboot-info
update_prev_reboot_info_SOURCES = \
$(top_srcdir)/reboot-reason-fetcher/src/rebootreason_main.c \
$(top_srcdir)/reboot-reason-fetcher/src/json.c \
$(top_srcdir)/reboot-reason-fetcher/src/parodus_log_update.c \
$(top_srcdir)/reboot-reason-fetcher/src/bootup_reason_checker.c

update_prev_reboot_info_la_LIBADD += -lrebootreason

if USE_CPC
update_prev_reboot_info_SOURCES += \
$(srcdir)/rebootmanager-cpc/src/reboot_reason_classify.c \
$(srcdir)/rebootmanager-cpc/src/platform_hal.c \
$(srcdir)/rebootmanager-cpc/src/log_parser.c
update_prev_reboot_info_CPPFLAGS = \
-I$(srcdir)/rebootmanager-cpc/include

update_prev_reboot_info_la_LIBADD = -lrebootreason
else
update_prev_reboot_info_SOURCES += \
$(top_srcdir)/reboot-reason-fetcher/src/reboot_reason_classify.c \
$(top_srcdir)/reboot-reason-fetcher/src/log_parser.c
update_prev_reboot_info_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/reboot-reason-fetcher/include
endif

if IS_TELEMETRY2_ENABLED
AM_CFLAGS += $(T2_EVENT_FLAG)
AM_LDFLAGS += -ltelemetry_msgsender -lt2utils
endif
Comment on lines +1 to +74
8 changes: 6 additions & 2 deletions reboot-helper/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ librebootnow_la_SOURCES = \
cyclic_reboot.c \
utils.c

librebootnow_la_LIBADD = -lfwutils -lrdkloggers -lrfcapi -lsecure_wrapper
librebootnow_la_LIBADD = -lfwutils -lrdkloggers -lrfcapi -lsecure_wrapper #-lrebootreason

# CLI wrapper binary
bin_PROGRAMS = rebootnow
rebootnow_SOURCES = reboot_main.c
rebootnow_LDADD = librebootnow.la

AM_LDFLAGS = -lrdkloggers -lfwutils -lrfcapi -lsecure_wrapper
AM_LDFLAGS = -lrdkloggers -lfwutils -lrfcapi -lsecure_wrapper #-lrebootreason

Comment on lines 34 to 43
bin_PROGRAMS += update-prev-reboot-info
update_prev_reboot_info_SOURCES = \
Expand All @@ -48,13 +48,17 @@ update_prev_reboot_info_SOURCES = \
$(top_srcdir)/reboot-reason-fetcher/src/parodus_log_update.c \
$(top_srcdir)/reboot-reason-fetcher/src/bootup_reason_checker.c

update_prev_reboot_info_la_LIBADD = -lrebootreason

Comment on lines 44 to +52
if USE_CPC
update_prev_reboot_info_SOURCES += \
$(srcdir)/rebootmanager-cpc/src/reboot_reason_classify.c \
$(srcdir)/rebootmanager-cpc/src/platform_hal.c \
$(srcdir)/rebootmanager-cpc/src/log_parser.c
update_prev_reboot_info_CPPFLAGS = \
-I$(srcdir)/rebootmanager-cpc/include

#update_prev_reboot_info_la_LIBADD = -lrebootreason
else
Comment on lines 53 to 62
update_prev_reboot_info_SOURCES += \
$(top_srcdir)/reboot-reason-fetcher/src/reboot_reason_classify.c \
Expand Down
2 changes: 1 addition & 1 deletion reboot-reason-fetcher/include/update-reboot-info.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int acquire_lock(const char *lockDir);
int release_lock(const char *lockDir);
int parse_device_properties(EnvContext *ctx);
void free_env_context(EnvContext *ctx);
int get_hardware_reason(const EnvContext *ctx, HardwareReason *hwReason, RebootInfo *info);
int get_hardware_reason(const EnvContext *ctx, HardwareReason *hwReason);
int read_brcm_previous_reboot_reason(HardwareReason *hw);
Comment on lines 118 to 122
int detect_kernel_panic(const EnvContext *ctx, PanicInfo *panicInfo);
int check_firmware_failure(const EnvContext *ctx, FirmwareFailure *fwFailure);
Expand Down
8 changes: 4 additions & 4 deletions reboot-reason-fetcher/src/log_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ int update_reboot_info(const EnvContext *ctx)
return 1;
}

int get_hardware_reason(const EnvContext *ctx, HardwareReason *hwReason, RebootInfo *info)
int get_hardware_reason(const EnvContext *ctx, HardwareReason *hwReason)
{
if (ctx == NULL || hwReason == NULL || info == NULL) {
RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.REBOOTINFO", "get_hardware_reason: invalid argument(s): ctx=%p, hwReason=%p, info=%p",
(const void *)ctx, (void *)hwReason, (void *)info);
if (ctx == NULL || hwReason == NULL) {
RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.REBOOTINFO", "get_hardware_reason: invalid argument(s): ctx=%p, hwReason=%p",
(const void *)ctx, (void *)hwReason);
return ERROR_GENERAL;
}

Expand Down
2 changes: 1 addition & 1 deletion reboot-reason-fetcher/src/rebootreason_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main(void)
check_firmware_failure(&ctx, &fwFailure);

RDK_LOG(RDK_LOG_DEBUG,"LOG.RDK.REBOOTINFO","Getting hardware reboot reason for current boot \n");
get_hardware_reason(&ctx, &hwReason, &rebootInfo);
get_hardware_reason(&ctx, &hwReason);

RDK_LOG(RDK_LOG_INFO,"LOG.RDK.REBOOTINFO","Classifying reboot reason \n");
if (classify_reboot_reason(&rebootInfo, &ctx, &hwReason, &panicInfo, &fwFailure) != SUCCESS) {
Expand Down
20 changes: 10 additions & 10 deletions unittest/reboot_log_parser_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchBrcmPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Brcm);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_NE(hw.mappedReason[0], '\0');
}
Expand All @@ -525,7 +525,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchAmlogicPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Amlogic);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_STREQ(hw.mappedReason, "UNKNOWN");
}
Expand All @@ -539,7 +539,7 @@ TEST_F(LogParserTest, get_hardware_reason_UnknownSocFallsBackToUnknown) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Unknown);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_NE(hw.mappedReason[0], '\0');
}
Expand All @@ -565,7 +565,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchRtkAliasPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Realtek);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_STREQ(hw.mappedReason, "UNKNOWN");
}
Expand All @@ -579,7 +579,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchMtkPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Mtk);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_TRUE(rc == SUCCESS || rc == FAILURE || rc == ERROR_GENERAL);
}

Expand All @@ -592,7 +592,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchBroadcomAliasPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Broadcom);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_STREQ(hw.mappedReason, "UNKNOWN");
}
Expand All @@ -606,7 +606,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchMediatekAliasPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Mediatek);

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_TRUE(rc == SUCCESS || rc == FAILURE || rc == ERROR_GENERAL);
}

Expand All @@ -618,7 +618,7 @@ TEST_F(LogParserTest, get_hardware_reason_EmptySocFallbackPath) {
memset(&hw, 0, sizeof(hw));
memset(&info, 0, sizeof(info));

int rc = get_hardware_reason(&ctx, &hw, &info);
int rc = get_hardware_reason(&ctx, &hw);
EXPECT_EQ(rc, SUCCESS);
EXPECT_NE(hw.mappedReason[0], '\0');
}
Expand Down Expand Up @@ -650,7 +650,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchAmlogicUsesReadPath) {
memset(&info, 0, sizeof(info));
set_hal_test_soc(&ctx, HalTestSoc::Amlogic);

EXPECT_EQ(get_hardware_reason(&ctx, &hw, &info), SUCCESS);
EXPECT_EQ(get_hardware_reason(&ctx, &hw), SUCCESS);
EXPECT_STREQ(hw.mappedReason, "UNKNOWN");
EXPECT_EQ(info.reason[0], '\0');
}
Comment on lines +653 to 656
Expand All @@ -668,7 +668,7 @@ TEST_F(LogParserTest, get_hardware_reason_DispatchMtkUsesReadPath) {
set_hal_test_soc(&ctx, HalTestSoc::Mediatek);
strncpy(info.timestamp, "2026-03-10T11:22:33Z", sizeof(info.timestamp) - 1);

EXPECT_EQ(get_hardware_reason(&ctx, &hw, &info), SUCCESS);
EXPECT_EQ(get_hardware_reason(&ctx, &hw), SUCCESS);
EXPECT_STREQ(hw.mappedReason, "UNKNOWN");
EXPECT_EQ(info.reason[0], '\0');
EXPECT_STREQ(info.timestamp, "2026-03-10T11:22:33Z");
Comment on lines 669 to 674
Expand Down
Loading