Skip to content

Commit 88d112b

Browse files
authored
Merge pull request #310 from mahanteshchitt/new-bins
RDKBACCL-755 : Create SD Flash layout for BPI R4
2 parents bf2bcbc + 085e0f6 commit 88d112b

File tree

11 files changed

+182
-16
lines changed

11 files changed

+182
-16
lines changed

conf/machine/bananapi4-rdk-broadband.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ MACHINEOVERRIDES .="${@bb.utils.contains('DISTRO_FEATURES','sdmmc',':sd','',d)}"
1414
IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES','sdmmc',' wic.bz2 ext4','',d)}"
1515
KERNEL_DEVICETREE_mt7988_bpi4_sd = "${@bb.utils.contains('DISTRO_FEATURES','kernel6-6','mediatek/mt7988a-bananapi-bpi-r4.dtb','mediatek/mt7988a-bananapi-bpi-r4-sd.dtb', d)}"
1616

17-
WKS_FILE = " ${@bb.utils.contains('DISTRO_FEATURES','EasyMesh',' sdimage-EM-Bananapi.wks',' sdimage-Bananapi.wks',d)}"
17+
WKS_FILE = "${@bb.utils.contains('DISTRO_FEATURES', 'kernel6-6', \
18+
bb.utils.contains('DISTRO_FEATURES', 'EASYMESH', 'sdimage-EM-Bananapi_6-6.wks', 'sdimage-Bananapi_6-6.wks', d), \
19+
bb.utils.contains('DISTRO_FEATURES', 'EASYMESH', 'sdimage-EM-Bananapi.wks', 'sdimage-Bananapi.wks', d), d)}"
1820
IMAGE_BOOT_FILES = "${@bb.utils.contains('DISTRO_FEATURES','sdmmc', bb.utils.contains('DISTRO_FEATURES','kernel6-6','mt7988a-bananapi-bpi-r4.dtb ${KERNEL_IMAGETYPE}','mt7988a-bananapi-bpi-r4-sd.dtb ${KERNEL_IMAGETYPE}', d),'',d)}"
1921
do_image_wic[recrdeps] = "do_build"
2022
#SDCARD supported Pre build bootloader

meta-rdk-mtk-bpir4/recipes-bsp/trusted-firmware-a/bootloader_prebuild.bb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,30 @@ do_configure[noexec] = "1"
1717
# since there is no 'main' package generated (empty)
1818
RDEPENDS_${PN}-dev = ""
1919

20-
SRC_URI_append += " file://bpi-r4_sdmmc_bl2.img \
21-
file://bpi-r4_sdmmc_fip.bin"
20+
SRC_URI_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6-6', \
21+
' file://bpi-r4_sdmmc_bl2_6-6.img \
22+
file://bpi-r4_sdmmc_fip_6-6.bin \
23+
file://bpi-r4_sdmmc_bl2_B_6-6.img \
24+
file://bpi-r4_sdmmc_fip_B_6-6.bin', \
25+
' file://bpi-r4_sdmmc_bl2.img \
26+
file://bpi-r4_sdmmc_fip.bin \
27+
file://bpi-r4_sdmmc_bl2_B.img \
28+
file://bpi-r4_sdmmc_fip_B.bin', d)}"
2229

2330
do_deploy() {
2431
mkdir -p ${DEPLOYDIR}/atf/
32+
if ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6-6', 'true', 'false', d)}; then
33+
echo "Deploying kernel 6.6 BL2/FIP binaries..."
34+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_bl2_6-6.img ${DEPLOYDIR}/atf/
35+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_bl2_B_6-6.img ${DEPLOYDIR}/atf/
36+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_fip_6-6.bin ${DEPLOYDIR}/atf/
37+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_fip_B_6-6.bin ${DEPLOYDIR}/atf/
38+
else
39+
echo "Deploying default BL2/FIP binaries..."
2540
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_bl2.img ${DEPLOYDIR}/atf/
41+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_bl2_B.img ${DEPLOYDIR}/atf/
2642
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_fip.bin ${DEPLOYDIR}/atf/
43+
install -m 0644 ${WORKDIR}/bpi-r4_sdmmc_fip_B.bin ${DEPLOYDIR}/atf/
44+
fi
2745
}
2846
addtask do_deploy after do_install

meta-rdk-mtk-bpir4/recipes-ccsp/ccsp/ccsp-common-library.bbappend

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ do_install_append_class-target() {
7575
sed -i '$a [Install]\nWantedBy=multi-user.target' ${D}${systemd_unitdir}/system/onewifi.service
7676
fi
7777
sed -i '/IsErouterRunningStatus/,/fi/ s/^/#/' ${D}/usr/ccsp/ccspPAMCPCheck.sh
78+
sed -i '/ExecStart=/i ExecStartPre=/usr/bin/start_cron' ${D}/lib/systemd/system/RdkFwUpgradeManager.service
7879
}
7980

8081

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
4+
CRON_JOB="*/15 * * * * /usr/bin/fwupgrade >> /var/log/fwupgrade_cron.log 2>&1"
5+
6+
7+
crontab -l 2>/dev/null | grep -qF "/usr/bin/fwupgrade" || (
8+
crontab -l 2>/dev/null; echo "$CRON_JOB"
9+
) | crontab -
10+
partitions=(9 10 11 12 13)
11+
12+
for part_num in "${partitions[@]}"; do
13+
part="/dev/mmcblk0p${part_num}"
14+
blkid_output=$(blkid "$part")
15+
if echo "$blkid_output" | grep -q 'TYPE="'; then
16+
echo "Partition $part is already formatted. Skipping."
17+
else
18+
mkfs.ext4 -F "$part"
19+
fi
20+
done
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1+
DESCRIPTION = "HAL Firmware Upgrade for BPI"
2+
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
3+
SRC_URI_remove = "git://git01.mediatek.com/filogic/rdk-b/rdkb_hal;branch=master;protocol=https;name=fwupgradehal \
4+
file://LICENSE;subdir=git \
5+
"
6+
SRC_URI_append = "git://github.com/rdkcentral/rdkb-hal-bpi;branch=develop;protocol=https;name=fwupgradehal \
7+
file://start_cron.sh \
8+
"
9+
LIC_FILES_CHKSUM = "file://../../LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
10+
#LIC_FILES_CHKSUM = "file://${THISDIR}/files/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
11+
12+
13+
SRCREV = "0c1948d6fd6598b0290a54c21265642faa8124da"
14+
do_install_append () {
15+
install -d ${D}${bindir}
16+
install -v -m 0755 ${WORKDIR}/start_cron.sh ${D}${bindir}/start_cron
17+
}
18+
FILES:${PN} += "${bindir}/start_cron"
19+
DEPENDS_append += " cjson "
20+
RDEPENDS_${PN}_append = " cjson "
21+
CFLAGS_append = "-I${STAGING_INCDIR}/cjson "
22+
LDFLAGS += "-lcjson"
23+
S = "${WORKDIR}/git/source/fwupgrade"
124
DEPENDS += " rdkb-halif-fwupgrade"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONFIG_ARP=y
22
CONFIG_CRONTAB=y
3+
CONFIG_CROND=y

meta-rdk-mtk-bpir4/recipes-core/images/rdk-generic-broadband-image.bbappend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ IMAGE_INSTALL_append = " bpi-macaddress"
99

1010
IMAGE_INSTALL_append = " rdk-speedtest-cli"
1111
#Enable required linux utils for Fwupgrade
12-
IMAGE_INSTALL_append = " gptfdisk e2fsprogs-mke2fs"
12+
IMAGE_INSTALL_append = " gptfdisk e2fsprogs-mke2fs util-linux util-linux-losetup coreutils"
1313

1414
ROOTFS_POSTPROCESS_COMMAND_append = "add_busybox_fixes; "
1515

setup-environment-refboard-rdkb

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,26 @@ if [ "X$BPI_IMG_TYPE" == "Xnand" ]; then
120120
sed -i '/sdmmc/s/^/#/' ${_TOPDIR}/meta-cmf-bananapi/conf/distro/include/rdk-bpi.inc
121121
else # SD card image is default
122122
mkdir -p ${_TOPDIR}/downloads
123-
if [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_bl2.img ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_fip.bin ]; then
124-
echo "Both bl2 and fip binaries are present in local workspace."
123+
if [ "X$KERNEL_TYPE" == "Xkernel6-6" ]; then
124+
if [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_bl2_6-6.img ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_fip_6-6.bin ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_bl2_B_6-6.img ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_fip_B_6-6.bin ]; then
125+
echo "Both bl2 and fip binaries are present in local workspace for 6.6 kernel."
126+
else
127+
echo "**********************************************************************"
128+
echo "> Missing files are preventing the build from starting:"
129+
echo "> The BL2 and FIP binaries for kernel-6.6 aren't in the downloads directory. Copy these binaries into the directory and then restart the build. You can find instructions for creating the necessary binaries on the RDK-B Code Releases page: (https://wiki.rdkcentral.com/display/CMF/RDK-B+Code+Releases)"
130+
echo "**********************************************************************"
131+
return 1
132+
fi
125133
else
126-
echo "**********************************************************************"
127-
echo "> Missing files are preventing the build from starting:"
128-
echo "> The BL2 and FIP binaries aren't in the downloads directory. Copy these binaries into the directory and then restart the build. You can find instructions for creating the necessary binaries on the RDK-B Code Releases page: (https://wiki.rdkcentral.com/display/CMF/RDK-B+Code+Releases)"
129-
echo "**********************************************************************"
130-
return 1
134+
if [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_bl2.img ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_fip.bin ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_bl2_B.img ] && [ -f ${_TOPDIR}/downloads/bpi-r4_sdmmc_fip_B.bin ]; then
135+
echo "Both bl2 and fip binaries are present in local workspace for 5.4 kernel."
136+
else
137+
echo "**********************************************************************"
138+
echo "> Missing files are preventing the build from starting:"
139+
echo "> The BL2 and FIP binaries for kernel-5.4 aren't in the downloads directory. Copy these binaries into the directory and then restart the build. You can find instructions for creating the necessary binaries on the RDK-B Code Releases page: (https://wiki.rdkcentral.com/display/CMF/RDK-B+Code+Releases)"
140+
echo "**********************************************************************"
141+
return 1
142+
fi
143+
131144
fi
132145
fi

wic/sdimage-Bananapi.wks

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
1-
# short-description: Create Bananapi Pi SD card image
2-
# long-description: Creates a partitioned SD card image for use with Bananapi R4.
3-
1+
# short-description: Custom Bananapi R4 SD card image
2+
# long-description: Creates a partitioned SD card image with dual-bank layout and additional RDK-B partitions.
3+
#
44
bootloader --ptable gpt --timeout=0
55

6+
# 1. BL2 (aligned at 17 sectors, 4079KB)
67
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_bl2.img" --part-name bl2 --align 17 --fixed-size 4079K --active --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
78

9+
10+
# 2. FIP (aligned at 6656 sectors, 2048KB)
811
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_fip.bin" --part-name fip --align 6656 --fixed-size 2M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
912

10-
part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 8704 --fixed-size 100M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
13+
# 3. Boot A
14+
part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot_a --active --align 8704 --fixed-size 16M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
15+
16+
# 4. rootfs A
17+
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label rootfs_a --fixed-size 1024M
18+
19+
# 5. BL2 B (copy of BL2)
20+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_bl2_B.img" --part-name bl2_b --fixed-size 4079K --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
21+
22+
# 6. FIP B (copy of FIP)
23+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_fip_B.bin" --part-name fip_b --fixed-size 2M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
24+
25+
# 7. Boot B
26+
part --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot_b --active --fixed-size 16M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
27+
28+
# 8. rootfs B
29+
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label rootfs_b --fixed-size 1024M
30+
31+
# 9. NVRAM (2MB)
32+
part --source=empty --fstype=ext4 --label=nvram --fixed-size=2M
33+
34+
# 10. Crash_a Debug (8MB)
35+
part --source=empty --fstype=ext4 --label=crash_a --fixed-size=8M
36+
37+
# 11. Crash_b Debug (8MB)
38+
part --source=empty --fstype=ext4 --label=crash_b --fixed-size=8M
39+
40+
# 12. Reserved (16MB)
41+
part --source=empty --fstype=ext4 --label=reserved --fixed-size=16M
1142

12-
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 111104
43+
# 13. DAC
44+
part --source=empty --fstype=ext4 --label=dac --fixed-size=32M

wic/sdimage-Bananapi_6-6.wks

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# short-description: Custom Bananapi R4 SD card image
2+
# long-description: Creates a partitioned SD card image with dual-bank layout and additional RDK-B partitions.
3+
#
4+
bootloader --ptable gpt --timeout=0
5+
6+
# 1. BL2 (aligned at 17 sectors, 4079KB)
7+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_bl2_6-6.img" --part-name bl2 --align 17 --fixed-size 4079K --active --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
8+
9+
10+
# 2. FIP (aligned at 6656 sectors, 2048KB)
11+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_fip_6-6.bin" --part-name fip --align 6656 --fixed-size 2M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
12+
13+
# 3. Boot A
14+
part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot_a --active --align 8704 --fixed-size 16M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
15+
16+
# 4. rootfs A
17+
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label rootfs_a --fixed-size 1024M
18+
19+
# 5. BL2 B (copy of BL2)
20+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_bl2_B_6-6.img" --part-name bl2_b --fixed-size 4079K --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
21+
22+
# 6. FIP B (copy of FIP)
23+
part --source rawcopy --sourceparams="file=atf/bpi-r4_sdmmc_fip_B_6-6.bin" --part-name fip_b --fixed-size 2M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
24+
25+
# 7. Boot B
26+
part --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot_b --active --fixed-size 16M --part-type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
27+
28+
# 8. rootfs B
29+
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label rootfs_b --fixed-size 1024M
30+
31+
# 9. NVRAM (2MB)
32+
part --source=empty --fstype=ext4 --label=nvram --fixed-size=2M
33+
34+
# 10. Crash_a Debug (8MB)
35+
part --source=empty --fstype=ext4 --label=crash_a --fixed-size=8M
36+
37+
# 11. Crash_b Debug (8MB)
38+
part --source=empty --fstype=ext4 --label=crash_b --fixed-size=8M
39+
40+
# 12. Reserved (16MB)
41+
part --source=empty --fstype=ext4 --label=reserved --fixed-size=16M
42+
43+
# 13. DAC
44+
part --source=empty --fstype=ext4 --label=dac --fixed-size=32M

0 commit comments

Comments
 (0)