orangepi-xunlong / u-boot-orangepi

80 stars 92 forks source link

Invalid DRAM detection [pi zero 3] #19

Open Ripper346 opened 3 days ago

Ripper346 commented 3 days ago

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
tmoore22 commented 1 day ago

@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 commented 5 hours ago

@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 commented 2 hours ago

It seems you might be missing some make params: make CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) BL31=/path/to/trusted-firmware/build/sun50i-a64/debug/bl31.bin

From: Alessandro @.> Sent: 22 November 2024 23:27 To: orangepi-xunlong/u-boot-orangepi @.> Cc: Tim Moore @.>; Mention @.> Subject: Re: [orangepi-xunlong/u-boot-orangepi] Invalid DRAM detection [pi zero 3] (Issue #19)

@tmoore22https://github.com/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

- Reply to this email directly, view it on GitHubhttps://github.com/orangepi-xunlong/u-boot-orangepi/issues/19#issuecomment-2494975797, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAIPU5JIX75KYUUMLT2H3CT2B6VUPAVCNFSM6AAAAABSCXIVSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJUHE3TKNZZG4. You are receiving this because you were mentioned.Message ID: @.**@.>>