# Reduce Yocto image size

**URL:** <https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138>\
**Category:** WP Series\
**Created:** [October 8, 2021, 8:16am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138 "2021-10-08T08:16:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![georges.torval91](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@georges.torval91](https://forum.sierrawireless.com/u/georges.torval91)\
**Post date:** [October 8, 2021, 8:16am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/1 "2021-10-08T08:16:47Z")

</div>

Hello,  
I followed the below steps to add python3 in my Yocto image, i can build it succufuly but i cannot flash it in the module because the size of yocto\_wp77xx.4k.cwe is too big.

- In ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc = IMAGE\_INSTALL\_append = " python3"
- In ./meta-swi/meta-swi-mdm9x28/conf/machine/swi-mdm9x28.conf = UBI\_ROOTFS\_SIZE ?= **“48MiB”**

What can i do in this situation? what can i remove from yocto to make my image fills the module?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [October 8, 2021, 9:06am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/2 "2021-10-08T09:06:35Z")

</div>

here is a document showing how to run additional python library in RAM, maybe it can help you:

> **[Example on running additional python library in RAM](https://forum.legato.io/t/example-on-running-additional-python-library-in-ram/4946)**
>
> As there are plenty of python libraries which are large to be integrated in yocto image, this document will show you how to run additional library to RAM so that python can run more library in the py script. Enjoy!

Also you might need to see if you can use AT!PARTITION to enlarge the rootFS partition.

> [@Repartition wp7702](https://forum.sierrawireless.com/t/repartition-wp7702/22662/3):
>
> Thanks for your response! When I try the command you suggested, I see the below. at!partition=? To print partition table: AT!PARTITION? To modify partition sizes: AT!PARTITION=\<name\>,\<size0\>[,\<size1\>,...] \<name\> - name of the first partition to modify its size, can be blank \<size0\> - new size in KB of the first partition \<size1\>,..…

---

<div class="post-metadata">

**Author:** ![georges.torval91](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@georges.torval91](https://forum.sierrawireless.com/u/georges.torval91)\
**Post date:** [October 8, 2021, 9:45am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/3 "2021-10-08T09:45:36Z")

</div>

Hi @jyijyi sorry but the RAM is not an option for us.

For AT!PARTITION, i have as information that on FX30 you do not support resize image partition, it doesn’t work for us.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [October 8, 2021, 9:48am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/4 "2021-10-08T09:48:35Z")

</div>

may I know why RAM is not option for you?

You can write a init script to automatically extract it to RAM during each boot up.

---

<div class="post-metadata">

**Author:** ![georges.torval91](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@georges.torval91](https://forum.sierrawireless.com/u/georges.torval91)\
**Post date:** [October 8, 2021, 7:27pm UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/5 "2021-10-08T19:27:33Z")

</div>

this solution may work for a development environment but is not suitable for a distribution, as it would have to be reloaded in RAM each time the device is restarted.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [October 9, 2021, 12:50am UTC](https://forum.sierrawireless.com/t/reduce-yocto-image-size/25138/6 "2021-10-09T00:50:52Z")

</div>

Another solution is to put all additional libraries in /home/root, each time boot up, create some dynamic link (ln -s ) in /usr/lib to link to these libraries

In this case, you don’t need to extract the zipped file of python3 each power cycle.

FYI, proof of concept on using python3 here:

> **[Building Custom Yocto Image for Mangoh Red WP76](https://forum.mangoh.io/t/building-custom-yocto-image-for-mangoh-red-wp76/5374/31)**
>
> You can follow the steps below to run python3: download the yocto source and go to ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc add the following line: IMAGE\_INSTALL\_append = " python3" go to...
