Skip to content

Invalid DRAM detection [pi zero 3] #19

Open
@Ripper346

Description

@Ripper346

Hi, I have a problem with the u-boot shipped with Ubuntu and Debian images. I have a stock of Orange Pi Zero 3 with 2GB of RAM and this is happening on the batch 24-01 (I don't know if it is important but I would like to specify it). The problem is that u-boot is detecting 4GB of RAM almost at every boot and this then breaks the system. From the serial output I get the log below. Do you think there is a way to fix the issue or even to hardcode the size? I had this problem with also the previous version of u-boot since the ubuntu image was updated last October. Also, the u-boot in SPI, version 2018.05, always detects the correct amount.

U-Boot SPL 2024.01-orangepi (Sep 12 2024 - 11:08:27 +0800)
DRAM base address is defined as 0x40000000
DRAM has 16 b/raw, 10 b/col, 4 B/width, 2 #rank and 8 #bank
DRAM top address must be less than 0x100000000
DRAM: 4096 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.11.0(debug):0631d68d8
NOTICE:  BL31: Built : 13:56:00, Sep 10 2024
NOTICE:  BL31: Detected Allwinner H616 SoC (1823)
NOTICE:  BL31: Found U-Boot DTB at 0x4a0b2aa8, model: OrangePi Zero3
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    Probing for PMIC on I2C:
INFO:    PMIC: found AXP313
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for erratum 855873 was applied
INFO:    BL31: cortex_a53: CPU workaround for erratum 1530924 was applied
INFO:    PSCI: Suspend is unavailable
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x4a000000
INFO:    SPSR = 0x3c9
INFO:    Changed devicetree.


U-Boot 2024.01-orangepi (Sep 12 2024 - 11:08:27 +0800) Allwinner Technology

CPU:   Allwinner H616 (SUN50I)
Model: OrangePi Zero3
DRAM:  4 GiB
Core:  57 devices, 25 uclasses, devicetree: separate
WDT:   Not starting watchdog@30090a0
MMC:   mmc@4020000: 0
Loading Environment from FAT... Unable to use mmc 0:1...
In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Allwinner mUSB OTG (Peripheral)
Net:   eth0: ethernet@5020000using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC de:ad:be:ef:00:01
HOST MAC de:ad:be:ef:00:00
RNDIS ready
, eth1: usb_ether
starting USB...
Bus usb@5200000: USB EHCI 1.00
Bus usb@5200400: USB OHCI 1.0
scanning bus usb@5200000 for devices... 1 USB Device(s) found
scanning bus usb@5200400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
3636 bytes read in 3 ms (1.2 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
173 bytes read in 2 ms (84 KiB/s)
39931 bytes read in 5 ms (7.6 MiB/s)
Working FDT set to 4fa00000
452 bytes read in 3 ms (146.5 KiB/s)
Applying kernel provided DT overlay sun50i-h616-ph-i2c3.dtbo
4203 bytes read in 4 ms (1 MiB/s)
Applying kernel provided DT fixup script (sun50i-h616-fixup.scr)
## Executing script at 45000000
18428387 bytes read in 763 ms (23 MiB/s)
9368071 bytes read in 389 ms (23 MiB/s)
   Uncompressing Kernel Image
Moving Image from 0x40080000 to 0x40200000, end=41800000
## Loading init Ramdisk from Legacy Image at 4ff00000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    18428323 Bytes = 17.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
   Booting using the fdt blob at 0x4fa00000
Working FDT set to 4fa00000
   Loading Ramdisk to 48e6c000, end 49fff1a3 ... OK
   Loading Device Tree to 0000000048df9000, end 0000000048e6bfff ... OK
Working FDT set to 48df9000

Activity

tmoore22

tmoore22 commented on Nov 21, 2024

@tmoore22

@Ripper346 thanks for the hint ;)
reverse this patch in u-boot: https://github.com/armbian/build/blob/cc4513958fb01d0fcdafe96144d2da76bcd51427/patch/u-boot/u-boot-sunxi/opizero3-1.5GB-trim-from-u-boot-v2024.01.patch#L64

just restore the "return" instead of "size =" and the code flow works without 1.5G detection... more stable for me!

Ripper346

Ripper346 commented on Nov 22, 2024

@Ripper346
Author

@tmoore22 after doing the patch, how do you build the new u-boot? I tried with make orangepi_zero3_defconfig; make all but I don't know then what to do with all the files it makes. I tried also with the orangepi-build tool but it fails

[ o.k. ] Using config file [ /home/pi/orangepi-build/userpatches/config-example.conf ]
[ .... ] Extension being added [ sunxi-tools :: added by ./build.sh:305 -> scripts/main.sh:374 -> scripts/configuration.sh:151 -> external/config/sources/families/sun50iw9.conf:1 -> external/config/sources/families/include/sunxi64_common.inc:1 -> scripts/extensions.sh:0 ]
[ o.k. ] Extension manager [ processed 3 Extension Methods calls and 3 Extension Method implementations ]
[ o.k. ] Preparing [ host ]
[ o.k. ] Build host OS release [ noble ]
[ .... ] Installing build dependencies
[ o.k. ] Syncing clock [ cn.pool.ntp.org ]
[ o.k. ] Downloading sources
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/u-boot v2024.01 ]
[ .... ] Up to date
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/external/cache/sources/arm-trusted-firmware-sunxi-mainline master ]
[ .... ] Up to date
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/external/cache/sources/sunxi-tools master ]
[ .... ] Up to date
[ o.k. ] Cleaning /home/pi/orangepi-build/output/debs for [ orangepizero3 next ]
[ o.k. ] Compiling ATF
[ o.k. ] Compiler version [ aarch64-linux-gnu-gcc 13 ]
[ o.k. ] Started patching process for [ atf sun50iw9-orangepizero3-next ]
[ o.k. ] Looking for user patches in [ userpatches/atf/atf-sun50iw9 ]
  CC      bl31/bl31_context_mgmt.c
  CC      bl31/bl31_main.c
  CC      bl31/interrupt_mgmt.c
  CC      bl31/bl31_traps.c
  CC      common/bl_common.c
[ error ] ERROR in function compile_atf [ ./build.sh:305 -> scripts/main.sh:632 -> scripts/main.sh:516 -> scripts/compilation.sh:86 -> scripts/general.sh:0 ]
[ error ] ATF compilation failed
[ o.k. ] Process terminated
tmoore22

tmoore22 commented on Nov 23, 2024

@tmoore22
Ripper346

Ripper346 commented on Nov 23, 2024

@Ripper346
Author

Thanks @tmoore22, I already set the BL31 and I don't need the cross-compilation since I was directly compiling in the oPi zero 3 to be sure (and prior I tried also on a oPi 5B). Via make I am able to finish the compilation but I don't know what to do with all the files that it generates. My objective is to substitute the u-boot in the ubuntu image/TF and after the make I thought that I had the new boot folder to replace but it seems this isn't the case.

ColumKam

ColumKam commented on Feb 17, 2025

@ColumKam

@tmoore22 after doing the patch, how do you build the new u-boot? I tried with make orangepi_zero3_defconfig; make all but I don't know then what to do with all the files it makes. I tried also with the orangepi-build tool but it fails

[ o.k. ] Using config file [ /home/pi/orangepi-build/userpatches/config-example.conf ]
[ .... ] Extension being added [ sunxi-tools :: added by ./build.sh:305 -> scripts/main.sh:374 -> scripts/configuration.sh:151 -> external/config/sources/families/sun50iw9.conf:1 -> external/config/sources/families/include/sunxi64_common.inc:1 -> scripts/extensions.sh:0 ]
[ o.k. ] Extension manager [ processed 3 Extension Methods calls and 3 Extension Method implementations ]
[ o.k. ] Preparing [ host ]
[ o.k. ] Build host OS release [ noble ]
[ .... ] Installing build dependencies
[ o.k. ] Syncing clock [ cn.pool.ntp.org ]
[ o.k. ] Downloading sources
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/u-boot v2024.01 ]
[ .... ] Up to date
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/external/cache/sources/arm-trusted-firmware-sunxi-mainline master ]
[ .... ] Up to date
[ o.k. ] Checking git sources [ /home/pi/orangepi-build/external/cache/sources/sunxi-tools master ]
[ .... ] Up to date
[ o.k. ] Cleaning /home/pi/orangepi-build/output/debs for [ orangepizero3 next ]
[ o.k. ] Compiling ATF
[ o.k. ] Compiler version [ aarch64-linux-gnu-gcc 13 ]
[ o.k. ] Started patching process for [ atf sun50iw9-orangepizero3-next ]
[ o.k. ] Looking for user patches in [ userpatches/atf/atf-sun50iw9 ]
  CC      bl31/bl31_context_mgmt.c
  CC      bl31/bl31_main.c
  CC      bl31/interrupt_mgmt.c
  CC      bl31/bl31_traps.c
  CC      common/bl_common.c
[ error ] ERROR in function compile_atf [ ./build.sh:305 -> scripts/main.sh:632 -> scripts/main.sh:516 -> scripts/compilation.sh:86 -> scripts/general.sh:0 ]
[ error ] ATF compilation failed
[ o.k. ] Process terminated

有一个可行方法,在 scripts/compilation.sh 中做如下修改:
git diff :

diff --git a/scripts/compilation.sh b/scripts/compilation.sh
index b1420a7..5a74520 100755
--- a/scripts/compilation.sh
+++ b/scripts/compilation.sh
@@ -76,9 +76,9 @@ compile_atf()
        echo -e "\n\t==  atf  ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log
        # ENABLE_BACKTRACE="0" has been added to workaround a regression in ATF.
        # Check: https://github.com/armbian/build/issues/1157
-       eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \
+       eval env PATH="${toolchain}:${toolchain2}:${PATH}" \
                'make ENABLE_BACKTRACE="0" $target_make $CTHREADS \
-               CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \
+               CROSS_COMPILE="$ATF_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \
                ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \
                ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling ATF..." $TTY_Y $TTY_X'} \
                ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}

观察报错是与 ccahe 的使用相关,直接移除掉能编译成功的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Invalid DRAM detection [pi zero 3] · Issue #19 · orangepi-xunlong/u-boot-orangepi