[BPI-R4] Successfully upgraded 8GB RAM on BPI-R4

Hello, could someone here do the upgrade to 8GB Ram and the exchange of the SSD to a larger model for me? Soldering the BGA is the end of my possibilities. Preferably someone from Germany. I would have the RAM and the SSD here. It was only about the pure conversion.

I can but I am from Poland :wink:

with the new model with the 8gb ootb…any chance to have this push to main openwrt? will this still required manual operation ?

Booting Openwrt 24.10 from SDcard shows that I’m only getting 4G of ram, even though I bought an 8G model (and the stickers on the board packaging shows 8G as well). What should I be checking?

You have to use an 8gb image (if there is one) or replace bl2 (needs code patch and build parameter).

Guessing (cmiiw) that the relevant bl2 in my case is bpi-r4_spim-nand_ubi_8GB_bl2.img for booting off NAND/SD.

So I’d need to overwrite the bl2 partition in the Openwrt image which starts at 44MiB from the beginning of the image and boot from SD; alternatively, for nand on the R4:

mtd write bpi-r4_spim-nand_ubi_8GB_bl2.img bl2

Is that right?

P/s I’d be happy to help upstream this into OpenWrt if you can point me in the right direction. It does not seem like u-boot is directly in the OpenWrt main branch (possibly fetched from elsewhere)

I’m not sure if this works with openwrt…maybe they made more adjustments to atf. But bl2 is nearly at beginning of the image,on nand it should be offset 0x0

Did a bit of digging, feels like I need to patch the uboot-mediatek package with your 8gb patch and apply the same build flag changes.

That would be the right way for openwrt…but not use extraflags as var as this is in my repo only.

I reconstructed the Openwrt sdcard image using your patched bl2. Did a power cycle (seems like bl2 is only used for cold boot), and while I do get to userspace I’m still seeing 4gb memory. Any way to debug this without UART (I have not got one yet)?

I checked Openwrt main branch and it seems they have upgraded to uboot 2025.01, which contains mediatek-openwrt/arm-trusted-firmware@e0907706 where DDR4_4BG_MODE defaults to 1. Your other commit to add AVAIL_DRAM_SIZE := 1024 2048 4096 however doesn’t yet exist.

I’ll hold onto the patch until we figure out why the bl2 I got from your repo still doesn’t detect 8gb RAM.

I only applied the known changes for 8gb…possibly i missed something as i could not test it (will get a 8gb and 2g5 phy board next week).

But defaulting to 4bg-mode will break the 4g versions of r4.so i don’t think it will be the case.

But everyone can see changes and the ci pipeline to follow whats done to build the files…maybe someone having 8gb working sees the missing part

Debugging this without uart is imho impossible.

1 Like

got my r4 with 8GB ram today

  • tested image with default ram-setting: 4GB shown but working so far
  • flashed 8gb variant from my repo, still 4GB
  • noticed that i had 2 dram-settings set (DRAM_USE_COMB=1 DDR4_4BG_MODE=1) and dropped the USE_COMB=1, but then i see this:
NOTICE:  EMI: DDR4 4BG mode                                                                                                                       
NOTICE:  EMI: Using DDR3 settings                                                                                                                 
NOTICE:  EMI: Detected DRAM size: 0 MB

@tombpi @drozdi70 @wwwing any idea? possibly my mtk-atf version is too old, i see some changes in mtk-original atf, tried using latest atf but failed due to missing files

make: *** No rule to make target 'plat/mediatek/common/drivers/efuse/mtk_efuse.c', needed by '/media/data_ext/git/uboot/u-boot/build/mt7988/release/bl2/mtk_efuse.o'.  Stop.

same for plat/mediatek/common/drivers/mmc/mtk-sd.c, plat/mediatek/common/drivers/spi/mtk_spi.c, plat/mediatek/mt7988/drivers/wdt/mtk_wdt.c

last one has multiple conflicts when i try to cherry-pick from my old tree

1 Like

Unfortunately, I also wasn’t able to get my BPi-R4 to recognize the full 8GB of RAM using the 8GB variant from your repo.

Now, I must say I have far less experience than you when it comes to using OpenWrt with BPi, so what I’m going to share below might be obvious to you, but I’m posting it anyway in case it helps someone who just received their new board.

My goal was to run OpenWrt from the eMMC. From my testing, the only way I managed to get all 8GB recognized was:


  1. The fastest and most straightforward method is using the official image from the BPi documentation specifically made for the R4-8GB:

The advantage is that you can be up and running with full RAM support within minutes. The downside is that the image is based on a relatively old version of OpenWrt (I believe it’s 21.02) and it’s a snapshot, which makes updating packages via opkg a bit tricky.


  1. The second option works with any OpenWrt version and allows to use the full 8GB:
    I used the official OpenWrt Firmware Selector and picked the latest stable release, 24.10. After selecting the packages I needed, I wrote the image to an SD card and used it to install OpenWrt to the NAND using U-Boot, and from NAND to eMMC.

This results in OpenWrt 24.10 being installed to eMMC (also on SD and Nand) but initially, only 4GB of RAM is detected.

To fix that, I booted OpenWrt again from NAND and re-flashed the BL2 partition of the eMMC using the bl2_emmc_8g.img file (same one included in the snapshot 21.02 files I mentioned above).

Here’s the process I used while booted into NAND:

echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=bl2_emmc_8g.img of=/dev/mmcblk0boot0
mmc bootpart enable 1 1 /dev/mmcblk0

After rebooting from eMMC, the system properly detected the full 8GB while still running the stable OpenWrt 24.10.


That’s how I got it working using prebuilt images. It would definitely be ideal to learn how to build them properly and update your repo to support the R4-8GB variant out of the box.

Besides @tombpi @drozdi70 @wwwing I believe @meehien might also be able to help, since they mentioned in the thread below that they managed to build the BL2 image themselves:

1 Like

Maybe check the RDA, RDB, RDC resistors on the PCB. There is a small chance that the wrong components were installed at the factory.

Liujie suggested to close DRAM_USE_COMB=1 He builded a BL2 for Openwrt 21 version, for 8GB RAM, you can refer it: bl2 8g.rar - Google Drive

You mean drop this?

I got it working with new atf code after some hassle (incomplete make clean) and poweroff issue.

for SD card write this (starting from SD card)

dd if=bl2sd.img of=/dev/mmcblk0p1

for eMMC write this (starting from NAND)

dd if=bl2emmc.img of=/dev/mmcblk0boot0
dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-sdcard.img of=/dev/mmcblk0 (or antoher image)
mmc bootpart enable 1 1 /dev/mmcblk0

old versions but still working for my board. I noticed that recently arm-trusted-firmware-mediatek package has some issues and not compiling well bl2 files. Now my board is in pieces and Im focused on some other projects. I will check out that later :slight_smile:

Files can be taked from here

1 Like

General idea is folllowing in arm-trusted-firmware-mediatek package:

  1. openwrt/package/boot/arm-trusted-firmware-mediatek/Makefile add support DDR4_4BG_MODE:=1 (in sections Trusted-Firmware-A/mt7988-*comb)

it should be also enabled DRAM_USE_COMB:=1

  1. dram-configs.mk files for mt7988 add 4096 to AVAIL_DRAM_SIZE
./arm-trusted-firmware-mediatek-mt7988-sdmmc-comb/arm-trusted-firmware-mediatek-2024.01.17~bacca82a/plat/mediatek/mt7988/drivers/dram/dram-configs.mk
./arm-trusted-firmware-mediatek-mt7988-spim-nand-ubi-comb/arm-trusted-firmware-mediatek-2024.01.17~bacca82a/plat/mediatek/mt7988/drivers/dram/dram-configs.mk
./arm-trusted-firmware-mediatek-mt7988-emmc-comb/arm-trusted-firmware-mediatek-2024.01.17~bacca82a/plat/mediatek/mt7988/drivers/dram/dram-configs.mk
./arm-trusted-firmware-mediatek-mt7988-ram-comb/arm-trusted-firmware-mediatek-2024.01.17~bacca82a/plat/mediatek/mt7988/drivers/dram/dram-configs.mk

more or less :wink:

!!! Just one thing… I heard that changes in arm-trusted-firmware-mediatek package as above could impact that image you compile could not work for users with 4GB board. Please validate it…

1 Like

updated pipeline+release

1 Like