diff --git a/meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/files/gwprovapp.conf b/meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/files/gwprovapp.conf index dde640b3..d639aff5 100644 --- a/meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/files/gwprovapp.conf +++ b/meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/files/gwprovapp.conf @@ -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 diff --git a/meta-rdk-mtk-bpir4/recipes-ccsp/util/utopia.bbappend b/meta-rdk-mtk-bpir4/recipes-ccsp/util/utopia.bbappend index 05262242..d9532d81 100644 --- a/meta-rdk-mtk-bpir4/recipes-ccsp/util/utopia.bbappend +++ b/meta-rdk-mtk-bpir4/recipes-ccsp/util/utopia.bbappend @@ -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} += " \ diff --git a/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-ap-extender.bbappend b/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-ap-extender.bbappend index 1d4fcd40..f00cec0c 100644 --- a/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-ap-extender.bbappend +++ b/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-ap-extender.bbappend @@ -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" diff --git a/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend b/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend index e7baa3f1..5f3a0daf 100644 --- a/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend +++ b/meta-rdk-mtk-bpir4/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend @@ -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" \ No newline at end of file +RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " gw-lan-refresh" +RDEPENDS_packagegroup-rdk-ccsp-broadband_append = " mount-nvram" diff --git a/meta-rdk-mtk-bpir4/recipes-devtools/init-filogic/init-filogic.bbappend b/meta-rdk-mtk-bpir4/recipes-devtools/init-filogic/init-filogic.bbappend index a7772832..3d41decc 100644 --- a/meta-rdk-mtk-bpir4/recipes-devtools/init-filogic/init-filogic.bbappend +++ b/meta-rdk-mtk-bpir4/recipes-devtools/init-filogic/init-filogic.bbappend @@ -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 \ @@ -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 diff --git a/meta-rdk-mtk-bpir4/recipes-kernel/linux/files/rdkb_cfg/sdmmc.cfg b/meta-rdk-mtk-bpir4/recipes-kernel/linux/files/rdkb_cfg/sdmmc.cfg index 58641a3e..5fb119a7 100644 --- a/meta-rdk-mtk-bpir4/recipes-kernel/linux/files/rdkb_cfg/sdmmc.cfg +++ b/meta-rdk-mtk-bpir4/recipes-kernel/linux/files/rdkb_cfg/sdmmc.cfg @@ -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 diff --git a/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.service b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.service new file mode 100644 index 00000000..e94dc9f6 --- /dev/null +++ b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.service @@ -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 diff --git a/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.sh b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.sh new file mode 100644 index 00000000..f945bda3 --- /dev/null +++ b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/files/mount-nvram.sh @@ -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 diff --git a/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/mount-nvram.bb b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/mount-nvram.bb new file mode 100644 index 00000000..e64e24fb --- /dev/null +++ b/meta-rdk-mtk-bpir4/recipes-nonvol/persistence/mount-nvram.bb @@ -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"