# Contiguous memory

**URL:** <https://discuss.pynq.io/t/contiguous-memory/8924>\
**Category:** Support\
**Created:** [December 13, 2025, 2:02am UTC](https://discuss.pynq.io/t/contiguous-memory/8924 "2025-12-13T02:02:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewphysics](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@drewphysics](https://discuss.pynq.io/u/drewphysics)\
**Post date:** [December 13, 2025, 2:02am UTC](https://discuss.pynq.io/t/contiguous-memory/8924/1 "2025-12-13T02:02:29Z")

</div>

I’m running 3.0.1 on a 4x2 board. I issue the linux command

```auto
!cat /proc/meminfo | grep -I cms

```

from the jupyter notebook and it comes back with

```auto
CmaTotal: 131072 kB
CmaFree: 69596 kB

```

I read a previous post on this in this forum ([Pynq & maximum allocatable memory (CMA)](https://discuss.pynq.io/t/pynq-maximum-allocatable-memory-cma/1593)) which has to do with how to rebuild linux for more contiguous space. But I couldn’t resist asking claude.ai what it thinks, and here’s what it returned (see below). Seems quite a bit easier than rebuilding linux! Has anyone tried this, could it work? I can easily try it but thought I would ask if there’s any experience out there first. Thanks in advance!

## Method 1: Edit the boot arguments directly

1. **Mount the boot partition** (if not already mounted):

bash

```auto
   sudo mount /dev/mmcblk0p1 /mnt

```

1. **Edit the boot.py or uEnv.txt file** (depending on your PYNQ setup):

bash

```auto
   sudo nano /mnt/uEnv.txt

```

Or look for boot configuration files in `/boot/`

1. **Add or modify the CMA parameter** in the kernel command line:

```auto
   cma=256M

```

You can set this to whatever size you need (e.g., 256M, 512M, etc.). Common values are powers of 2.

## Method 2: Modify extlinux.conf (more common on PYNQ)

1. **Edit the extlinux configuration** :

bash

```auto
   sudo nano /boot/extlinux/extlinux.conf

```

1. **Add `cma=XXXm` to the APPEND line** :

```auto
   APPEND root=/dev/mmcblk0p2 rw rootwait cma=256M

```

## Method 3: Device Tree modification

For PYNQ systems, you might need to modify the device tree:

1. **Check your current device tree** :

bash

```auto
   ls /boot/devicetree/

```

1. You can either modify the bootargs in the device tree source or use the methods above.

## Important Considerations:

- **Total RAM** : Make sure you don’t allocate too much to CMA, as this reduces available system memory
- **Backup** : Always backup your boot configuration before modifying
- **Reboot required** : Changes take effect after rebooting
- **Verification** : After reboot, check with `cat /proc/meminfo | grep Cma` to verify the change

The exact location and method depends on your specific PYNQ image, but the `cma=` kernel parameter is the standard way to control CMA size across all these approaches.

---

<div class="post-metadata">

**Author:** ![joshgoldsmith](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/joshgoldsmith/32/5347_2.png) [@joshgoldsmith](https://discuss.pynq.io/u/joshgoldsmith)\
**Post date:** [December 15, 2025, 6:26am UTC](https://discuss.pynq.io/t/contiguous-memory/8924/2 "2025-12-15T06:26:21Z")

</div>

Hi @drewphysics

I remember trying this a while back, but couldn’t get it to work by changing the boot arguments in u-boot.

I didn’t try any other methods mentioned in your post though, so if you do find one that works, then please report back.

---

<div class="post-metadata">

**Author:** ![drewphysics](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@drewphysics](https://discuss.pynq.io/u/drewphysics)\
**Post date:** [January 25, 2026, 3:06am UTC](https://discuss.pynq.io/t/contiguous-memory/8924/3 "2026-01-25T03:06:07Z")

</div>

The Trixie release boots via a U-boot script for the implementation of Ubuntu Linux. You can know this by looking at the directory /boot/ via

```auto
ls -la /boot

```

you should see:

```auto
drwxr-xr-x 3 root root 16384 Jan 1 1970 .
drwxr-xr-x 19 root root 4096 Nov 21 17:57 ../
-rwxr-xr-x 1 root root 1683736 Oct 23 2022 BOOT.BIN*
-rwxr-xr-x 1 root root 1726 Oct 23 2022 boot.py*
-rwxr-xr-x 1 root root 2779 Oct 23 2022 boot.scr*
-rwxr-xr-x 1 root root 23123516 May 25 2024 image.ub*
-rwxr-xr-x 1 root root 89 Oct 23 2022 REVISION*
drwxr-xr-x 2 root root 4096 May 26 2024 &quot;System Volume Information&quot;

```

That you see BOOT.BIN and boot.scr is telling you that the system uses the U-Boot facility.

All you need to do to increase contiguous memory is to create a file in /boot that gets read at boot time, and put the modifications there. So it’s quite easy:

```auto
cd /boot
sudo nano uEnv.txt

```

and add this single line:

```auto
bootargs=root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=1 uio_pdrv_genirq.of_id=&quot;generic-uio&quot; clk_ignore_unused cma=512M

```

save and exit (control x) and reboot. This increases the contiguous memory to 512M, but you can go higher (e.g. change 512M to 2G)

When you reboot check with

```auto
cat /proc/meminfo | grep -i cma

```

And it should return the right number. At least, it did for me!

```auto

```
