memtool footprint improvements

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

memtool footprint improvements

698 Views
mattmart
Contributor II

Hello everyone,

I find memtool to be a very useful utility but it produces a quite large binary and its packaged together with many other test utilities which could consume too much filesystem memory on some constrained systems.

Therefore, I would like to propose a few minor improvements:

  1. reduce footprint adding an option to compile only for the specified SOCs modules
  2. reduce footprint adding an option to avoid compile descriptions for registers and bit fields
  3. extract memtool code base from imx-tests and move it into a new repository. The imx-tests recipe could then depend on a new self-contained memtool recipe (e.g. imx-memtool). This would allow users to only include memtool instead of including all the imx-tests suite.

You can find such modifications in the repository https://github.com/matteomartelli/imx-memtool which is based on the memtool code base extracted from imx-tests at the latest current tag (imx-test_lf-6.1.22-2.0.0). The repository preserves the original git history of the memtool subfolder. I then tagged the last commit before my modifications with version 1.0.0 (I don't think memtool itself was respecting any versioning), and tagged again my last commit with version 1.0.1.

I am using this repository for a self contained imx-memtool_1.0.1.bb recipe which looks like the following:

 

 

 

SUMMARY = "IMX Memtool"

LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING-GPL-2;md5=59530bdf33659b29e73d4adb9f9f6552"

SRC_URI = "git://scm.sadel.it/git/MIRROR/imx-memtool;branch=master;protocol=http"
SRCREV = "fdb0a999dcfa0002de2bc8aeae20eeed7202f589"

S = "${WORKDIR}/git"

TARGET_CC_ARCH += "${LDFLAGS}"

do_compile() {
    oe_runmake
}

do_install() {
   install -d ${D}${bindir}
   install -m 0755 memtool ${D}${bindir}
}

FILES_${PN} = "${bindir}"

 

 

 

 

This recipe produces a imx-memtool package built with the same options as the current memtool packaged together with imx-tests, but it also allows me to create a bbappend extension, like the following imx-memtool_1.0.1.bbappend, to reduce the binary footprint:

 

 

 

# Reduce imx-memtool footprint

IMX_MEMTOOL_SOC:mx6q-nxp-bsp = "mx6q"
IMX_MEMTOOL_SOC:mx6dl-nxp-bsp = "mx6dl"
IMX_MEMTOOL_SOC:mx6sl-nxp-bsp = "mx6sl"
IMX_MEMTOOL_SOC:mx6sx-nxp-bsp = "mx6sx"
IMX_MEMTOOL_SOC:mx6ull-nxp-bsp = "mx6ull"
IMX_MEMTOOL_SOC:mx6ul-nxp-bsp = "mx6ul"
IMX_MEMTOOL_SOC:mx7d-nxp-bsp = "mx7d"
IMX_MEMTOOL_SOC:mx8mq-nxp-bsp = "mx8mq"

export SOCS="${IMX_MEMTOOL_SOC}"
export ENABLE_DESCRIPTIONS="no"

 

 

 

In addition to the modifications listed above I also fixed a register address for the mx6ull module and added a very small README.md.

I hope you find this this proposal useful and I am open to adapt it further.

Thanks,
Matteo

 

P.S.
In the Android.mk I added the LOCAL_CFLAGS that should build memtool with all SOCs and descriptions enabled, however I was not able to test it since I am not very familiar with the Android SDK for iMX. I could try to test it if anyone could provide some indications to build it for Android.

Labels (2)
Tags (1)
0 Kudos
Reply
0 Replies