Can PYNQ be lighter ? Which packages can be removed?

Hi, before presentating my question, here is the context :

  • PYNQ version : 2.6

  • Board name : Microzed 7020 / Picozed 7020

  • Tool Version : Ubuntu 18.04.06 ; Vivado 2020.1 ; Petalinux 2020.1

  • I have built my PYNQ image (for the picozed_7020_fmc2) thanks to these 2 githubs :
    GitHub - siesse/PYNQ at pz7030-fmc
    GitHub - FredKellerman/Microzed-PYNQ
    I don’t have yet the picozed, the image is running on a microzed. It doesn’t bother me because I just want to analyse the architecture of PYNQ, and if I want to code with python I can still generate a microzed image.

  • My project: to command a drilling unit, by substituting a sbRIO-9607 card with a picozed7020 as the control card. The microzed can’t boot PYNQ without a SD card, so it can’t be use at a larger scale of production (vibrations etc.). However the picozed7020-revE has 8Gb of eMMC, so it can do the job.

Here is my assesment: PYNQ is heavy, my image weights 6Gb ! I would like to have an OS that can do as the NI Linux RT (which weights roughly 500Mb) : in a few words, control steppers motors, but this time with Python.

So here is my question: is it possible to reduce the weight of PYNQ ?

As an exemple, there are 3 versions of Python (3.7 ; 3.6 ; 2.7), but I need only the 3.6 to run my scripts. Also, Jupyter is usefull to test and produce code, but at the end it will be useless once the drilling unit will be used in a factory.
Moreover it won’t be required to add some packages afterwards, or to connect to internet.
=> I just want to control motors.
Such weight also asks the question of security, due to the huge numbers of packages in the linux.

What I have done : I have looked up in the files of the linux, and I have seen that the vast majority of the weight can be found in the /usr and /local directories (3.2 Gb and 1.4Gb).
Once here, I don’t know what to remove. Where do I begin, what can’t be deleted ?

Thanks for your answers.

@guillaume_lamotte

I dont think you can bought 3.xx GB SD Card so 4GB as baseline =]

change the wks:
–extra-space 512
reduce it
remove swap space

I don’t think 4GB size below (1,2, 512M or below) SD Card is cheaper, so not really reasonable to make such size shrink. Unless SD NAND or EMMC BGA.

=]

ENJOY~

1 Like

My first plan was to build the image on a SD card, then swap it on the eMMC of the picozed.

However, I just realized that one could download the pynq python package with a linux who has python3.6 and pip installed ; With an alpine linux I could have the functionnalities desired, unless it needs the whole PYNQ image to work.

I’ll give it a try.

@guillaume_lamotte

I think usually the only major control (ignore modprob etc) the boot files aka uImage BIN src is all you need to enable the kernel support. So software side you can use any linux u want with installing the PYNQ SW package.

Never tried in such way as Ubuntu is good enough and the overall image is less than 4GB if you really reduce the empty space needed.

ENJOY~ =]

1 Like