Skip to content

Commit 0c198fe

Browse files
committed
eib_image: Enable charging RTC battery on RPi 500(+) with PAYG image
EOS will have PAYG image with RPi 500(+) using platform ID "rpi_payg". To keep the RTC working on RPi 500(+) for PAYG, there will be an RPi certified rechargeable RTC battery [1]. So, enable RPi 500(+)'s PMIC charging the RTC battery with the configuration within RPi PAYG image's config.txt by following RPi's document [2]. [1]: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#add-a-backup-battery [2]: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#enable-battery-charging https://app.asana.com/1/1203676861188277/task/1212515211230014
1 parent 69c8db4 commit 0c198fe

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

stages/eib_image

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ create_image() {
205205

206206
# Raspberry Pi's GPU starts the boot process by loading bootloader blobs
207207
# from the first partition which must be VFAT.
208-
if [ "${EIB_PLATFORM}" == "rpi" ]; then
208+
if [ "${EIB_PLATFORM:0:3}" == "rpi" ]; then
209209
# BOOT Partition using EFI System type for RPi firmware
210210
echo "size=512MiB, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
211211
fi
@@ -240,7 +240,7 @@ create_image() {
240240
rootfs_attrs+=("GUID:55")
241241
fi
242242

243-
if [[ "${EIB_PLATFORM}" == "rpi" ]]; then
243+
if [[ "${EIB_PLATFORM:0:3}" == "rpi" ]]; then
244244
# Make u-boot find the bootable partition which is rootfs for Raspberry Pi
245245
rootfs_attrs+=("LegacyBIOSBootable")
246246
fi
@@ -283,7 +283,7 @@ create_image() {
283283
*)
284284
# On ARM disable 64bit ext4 option
285285
ext4_opts="dir_index,^huge_file,^64bit"
286-
if [ "${EIB_PLATFORM}" == "rpi" ]; then
286+
if [ "${EIB_PLATFORM:0:3}" == "rpi" ]; then
287287
boot_loop=${img_loop}p1
288288
root_loop=${img_loop}p2
289289
else
@@ -337,7 +337,7 @@ EOF
337337
"${ROOT}"/boot/boot.scr
338338

339339
case "${EIB_PLATFORM}" in
340-
rpi)
340+
rpi|rpi_payg)
341341
mkfs.vfat ${boot_loop}
342342

343343
# Copy Raspberry Pi's bootloader & device tree blobs
@@ -356,6 +356,14 @@ EOF
356356
# Copy Raspberry Pi's u-boot
357357
local UBOOT_PATH="${DEPLOY}"/usr/lib/u-boot/rpi_arm64
358358
cp ${UBOOT_PATH}/u-boot.bin ${EIB_TMPDIR}/rpiboot/kernel8.img
359+
360+
if [ "${EIB_PLATFORM}" == "rpi_payg" ]; then
361+
CHRG_BAT="\[pi500\]\n"
362+
CHRG_BAT+="# Enable charging RTC battery with PAYG image\n"
363+
CHRG_BAT+="dtparam=rtc_bbat_vchg=3000000\n"
364+
sed -i "/^\[all\]/i ${CHRG_BAT}" ${EIB_TMPDIR}/rpiboot/config.txt
365+
fi
366+
359367
eib_umount ${EIB_TMPDIR}/rpiboot
360368
;;
361369
pinebookpro)

0 commit comments

Comments
 (0)