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
3 changes: 2 additions & 1 deletion meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/files/gwprovapp.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Unit]
After=network.target
After=network.target mount-nvram.service
Wants=network.target
Requires=mount-nvram.service

[Service]
ExecStart=/usr/bin/gw_prov_utopia
2 changes: 2 additions & 0 deletions meta-rdk-mtk-bpir4/recipes-ccsp/util/utopia.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ sed -i 's/^\(\$mgmt_wan_httpaccess=\)1/\10/' ${D}${sysconfdir}/utopia/system_def
sed -i 's/^\(\$mgmt_wan_httpsport=\)443/\18181/' ${D}${sysconfdir}/utopia/system_defaults
sed -i '/mgmt_wan_httpaccess/i \$mgmt_wan_httpaccess_ert=1' ${D}${sysconfdir}/utopia/system_defaults

#Mounting nvram
sed -i '/Before=CcspPandMSsp.service/a Requires=mount-nvram.service' ${D}/lib/systemd/system/ApplySystemDefaults.service
}

FILES_${PN} += " \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ RDEPENDS_packagegroup-ap-extender = "\
${@bb.utils.contains('DISTRO_FEATURES', 'with_alsap','ieee1905-em ','',d)} \
bpi-macaddress \
bpi-serialnumber \
mount-nvram \
"
DEPENDS += " ccsp-common-library"
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ GWPROVAPP = "${@bb.utils.contains('DISTRO_FEATURES','rdkb_wan_manager','ccsp-gwp

RDEPENDS_packagegroup-rdk-ccsp-broadband_append = "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_cellular_manager_mm', ' rdk-cellularmanager-mm', ' ', d)}"
RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " rdktelcovoicemanager"
RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " gw-lan-refresh"
RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " gw-lan-refresh"
RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " mount-nvram"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ do_install_append(){
sed -i '/brctl addif brlan0 lan0/d' ${D}${sbindir}/init-bridge.sh
fi
sed -i '/model/a \
while [ `mount | grep nvram | wc -l` -eq 0 ]; do usleep 500000 ; done; \
if [ ! -d /nvram/secure ]; then \
mkdir -p /nvram/secure \
fi \
Expand All @@ -22,6 +23,10 @@ if [ $? -eq 0 ];then \
BRLAN_MAC=`cat /nvram/mac_addresses.txt | grep -a brlan0 | cut -d " " -f 2` \
ifconfig brlan0 hw ether $BRLAN_MAC \
fi' ${D}${sbindir}/init-bridge.sh

#Mounting nvram
sed -i '/Before=CcspPandMSsp.service/a Requires=mount-nvram.service' ${D}/lib/systemd/system/init-Lanbridge.service
sed -i 's/utopia.service/mount-nvram.service &/' ${D}/lib/systemd/system/init-Lanbridge.service
}

#ESDK support - Avoid conflict file is installed by both systemd and init-filogic in kirkstone
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_EXT4_DEBUG=y
CONFIG_F2FS_FS=n
CONFIG_EXT4_ENCRYPTION=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Mount nvram partition
Before=gwprovapp.service

[Service]
ExecStart=/bin/sh /lib/rdk/mount-nvram.sh
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
45 changes: 45 additions & 0 deletions meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
#Copyright [2026] [RDK Management]
#
#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.

blkid_output=$(blkid /dev/mmcblk0p9 | grep 'TYPE="ext4"')

echo "blkid_output:$blkid_output" >>/tmp/mount-nvram.log
if [ -z "$blkid_output" ]; then
echo "First boot after flashing SD card -- nvram partition is not formatted." >>/tmp/mount-nvram.log
echo "Formatting nvram partition." >>/tmp/mount-nvram.log
mkfs.ext4 -F /dev/mmcblk0p9
else
echo "Nvram partition already formatted." >>/tmp/mount-nvram.log
fi

mkdir -p /nvram
mount /dev/mmcblk0p9 /nvram
if [ "$?" != "0" ]; then
echo "Mounting nvram partition failed." >>/tmp/mount-nvram.log
exit 1
fi
mkdir -p /nvram/secure
# OneWifi DB stored under /opt/secure/wifi
mkdir -p /opt/secure
mount --bind /nvram /opt/secure
# MariaDB stored under /var/lib/mysql
mkdir -p /var/lib/mysql
mount --bind /nvram /var/lib/mysql

exit 0
41 changes: 41 additions & 0 deletions meta-rdk-mtk-bpir4/recipes-nonvol/persistence/mount-nvram.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
DESCRIPTION = "Mounting nvram partition for storing customized data"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

COMPATIBLE_MACHINE = "^filogic$"

inherit deploy

PROVIDES = "mount-nvram"

do_patch[noexec] = "1"
do_configure[noexec] = "1"
do_compile[noexec] = "1"

# also get rid of the default dependency added in bitbake.conf
# since there is no 'main' package generated (empty)
RDEPENDS_${PN}-dev = ""

RDEPENDS:${PN} = "bash"
INSANE_SKIP:${PN} = "host-user-contaminated"

SRC_URI = " \
file://mount-nvram.sh \
file://mount-nvram.service \
"

do_install() {
echo "Installing service and script files."
mkdir -p ${D}${base_libdir}/rdk
install -m 0777 ${WORKDIR}/mount-nvram.sh ${D}${base_libdir}/rdk/
mkdir -p ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/mount-nvram.service ${D}${systemd_unitdir}/system/
}

FILES_${PN} = " \
${base_libdir}/rdk/mount-nvram.sh \
${systemd_unitdir}/system/mount-nvram.service \
"

SYSTEMD_SERVICE_${PN} = "mount-nvram.service"
Loading