Quantcast
Viewing all articles
Browse latest Browse all 5240

Compute Module • Re: Maximizing CMA memory size problem

finally success! I will now describe what i did so others would not have to struggle.

1. Had a long sleep, got up, had good meal, jerked off.
2. Flashed a USB stick with 32-bit lite bookworm OS. the reason i put 32-bit is that vcdbg didnt work on fresh lite installation for some reason. got segmentation fault
3. sudo cat /proc/meminfo | grep cma
CmaTotal: 327680 kB
CmaFree: 311248 kB
!!! This is very importnant as CMA is initally smaller in size then there is lots of space to move device_tree and initramfs into right after the kernel data
4. added these lines to /boot/config.txt
device_tree_address=0x2000000
device_tree_end=0x20FFFFF
5. then observed that indeed the device tree had been moved to these addresses. How did i do that? i just ran the sudo cat /proc/iomem before and after these parameters. and used calculator app -> menu -> programmer to see how much memory has been allocated at these initial and moved ranges and it was the same number.
pi@pi:~ $ sudo cat /proc/iomem
00000000-0007ffff : reserved
00080000-3fbfffff : System RAM
00210000-0122ffff : Kernel code
01230000-0165ffff : reserved
01660000-0199ffff : Kernel data
02000000-02012fff : reserved <-- device tree has been moved here now
1a400000-2e3fffff : reserved <-- this is 327680 CMA
2e5e6000-2effffff : reserved <-- this is initramfs ~10.6MB. not yet relocated

6. Added this line to the end of the /boot/config.txt
initramfs initramfs8 0x02400000

7.
pi@pi:~ $ sudo cat /proc/iomem
00000000-0007ffff : reserved
00080000-3fbfffff : System RAM
00210000-0122ffff : Kernel code
01230000-0165ffff : reserved
01660000-0199ffff : Kernel data
02000000-02012fff : reserved
02400000-02e19fff : reserved <--- initramfs has been moved here now
2bc00000-3fbfffff : reserved <-- this is CMA+ peripherals

This is what my /boot/config.txt looks like

Code:

pi@pi:~ $ sudo cat /boot/config.txt# For more options and information see# http://rptl.io/configtxt# Some settings may impact device functionality. See link above for details# Uncomment some or all of these to enable the optional hardware interfaces#dtparam=i2c_arm=on#dtparam=i2s=on#dtparam=spi=on# Enable audio (loads snd_bcm2835)dtparam=audio=on# Additional overlays and parameters are documented# /boot/firmware/overlays/README# Automatically load overlays for detected camerascamera_auto_detect=1# Automatically load overlays for detected DSI displaysdisplay_auto_detect=1# Automatically load initramfs files, if foundauto_initramfs=1# Enable DRM VC4 V3D driverdtoverlay=vc4-kms-v3dmax_framebuffers=2# Don't have the firmware create an initial video= setting in cmdline.txt.# Use the kernel's default instead.disable_fw_kms_setup=1# Disable compensation for displays with overscandisable_overscan=1# Run as fast as firmware / board allowsarm_boost=1[cm4]# Enable host mode on the 2711 built-in XHCI USB controller.# This line should be removed if the legacy DWC2 controller is required# (e.g. for USB device mode) or if USB support is not required.otg_mode=1[all]device_tree_address=0x2000000device_tree_end=0x20FFFFFinitramfs initramfs8 0x02400000
I will Now try to increase CMA to 848M and beyond!

Added cma=848M@48M to the end of /boot/cmdline.txt. I put @48M because the end address for initramfs now is rougly at 46M and the starting addresses for some reason have to be divisible by 4M. OS booted properly into console.
sudo cat /proc/meminfo
CmaTotal: 868352 kB
CmaFree: 851920 kB

Setting it cma=900M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 921600 kB
CmaFree: 905168 kB

Setting it cma=960M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 983040 kB
CmaFree: 966608 kB

Probably 1024M-48M is maximum it can be set. Lets try

Setting it cma=976M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 999424 kB
CmaFree: 982992 kB

Setting it cma=980M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 1003520 kB
CmaFree: 987088 kB

Setting it cma=1024M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 1048576 kB
CmaFree: 1032144 kB

escaping the matrix...

Setting it cma=3072M@48M booted properly
pi@pi:~ $ sudo cat /proc/meminfo | grep Cma
CmaTotal: 3145728 kB
CmaFree: 3129296 kB

https://youtu.be/M5Uo_-UoKeE?t=147

Statistics: Posted by henri2134234 — Wed Dec 27, 2023 10:48 pm



Viewing all articles
Browse latest Browse all 5240

Trending Articles