All of lore.kernel.org
 help / color / mirror / Atom feed
* Web frameworks on embedded linux
@ 2014-11-14  7:12 Edward Wingate
  2014-11-14  8:13 ` Maciek Borzecki
  0 siblings, 1 reply; 7+ messages in thread
From: Edward Wingate @ 2014-11-14  7:12 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 2598 bytes --]

I've been trying to get an existing python flask application running on an
embedded linux distro (Poky).  The web app was originally deployed on a
Debian distro.  I need to move the application to a less heftier board
and wanted to try a distro created by Yocto, rather than try to pare down
Debian.

I've been following the chain of dependencies for the web application and
adding them to Yocto to try and get the app to work (nginx, uwsgi, python,
pyserial, etc.), and hit a bump - Python's built-in logging and codecs
modules are not provided by Yocto.  Maybe I can add them myself, or maybe
I'll rip them out of the application, but I wanted to take a step back and
see if maybe Python/Flask is not the best app framework to use in an
embedded linux distro.

CPU is not a problem.  This board has ARM Cortex A9 processor running at
667MHz.  RAM should be OK as well at 512MB, but I am limited by the 32 MB
flash size on the board. I started with core-image-minimal on Poky (which
was ~3MB), and I'm up to almost 8MB now.  I guesstimate that I'm maybe 50%
of the way along the dependency chain. I haven't even gotten to flask yet,
just the webserver, uwsgi and plain python.  The size I'm referring to is
just the ramdisk image, not including FSBL nor u-boot (which are minimal
and shouldn't grow much, if at all, at this point).  I don't know what I'll
eventually end up at, but I do have to share the 32MB flash with other
data; it's not dedicated to the OS/Linux.  How much space the OS gets is
still up in the air.  I'd say at least 16 MB and maybe as much as 20-24 MB.

While it would be nice to reuse the already written web application, if the
Python/Flask stack turns out to be too heavy, a port/rewrite is not out of
the question.  This application just displays a web frontend to get/set
values on a device over a serial port.

So I wanted to get the list's thoughts and experience on:

1) Web application frameworks to use with an embedded linux constrained by
image size.  How well supported by Yocto recipes is the framework?  I've
been intrigued by the Lua language and the Kepler/Orbit web framework for
Lua, but except for Lua, there doesn't appear to be Yocto recipes for them.


2) Python modules that Yocto doesn't provide recipes for, like logging and
codecs modules.  How difficult is it to augment python-core?  Is it just a
matter of adding your own recipe in your own layer? Logging and codecs is
normally a part of a default Python install, so not sure yet how I would go
about adding this.

Thanks for your help.

Edward

[-- Attachment #2: Type: text/html, Size: 2749 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Web frameworks on embedded linux
@ 2014-11-14 20:43 Edward Wingate
  0 siblings, 0 replies; 7+ messages in thread
From: Edward Wingate @ 2014-11-14 20:43 UTC (permalink / raw)
  To: yocto

> From: Gary Thomas <gary@mlbassoc.com>
> To: yocto@yoctoproject.org
> Date: Fri, 14 Nov 2014 12:04:23 -0700
>
> On 2014-11-14 11:52, Edward Wingate wrote:
>>
>> On Fri, Nov 14, 2014 at 9:39 AM, <yocto-request@yoctoproject.org <mailto:yocto-request@yoctoproject.org>> wrote:
>>
>>     From: Gary Thomas <gary@mlbassoc.com <mailto:gary@mlbassoc.com>>
>>
>>     You can always just bring in the packages you need (python-modules is a
>>     pretty heavy hammer!)  Python is split into ~90 separate packages, each
>>     with a [small] set of modules/functionality.
>>
>> I would really like to try this. How do I find out what the various python packages are and what's in each package?  I tried
>> http://layers.openembedded.org/layerindex/branch/master/recipes/, but don't find what I'm looking for (right now, Python's built-in logging and codecs modules).
>
> Try looking in your build tree.  Depending on your target configuration,
> you'll have either RPM or IPK packages and the python modules end up in
> the architecture dependent collection.
>
> It can get a bit tricky to decide which package contains the module(s) you need
> as many of them are grouped together.  If you know the name of the module, you
> can typically find it via a quick search, e.g. to find the package that contains
> the htmllib module:
>   $ find tmp/work/cortexa7hf-vfp-neon-amltd-linux-gnueabi/python/2.7.3-r0.3/packages-split/ -name htmllib.py
>   tmp/work/cortexa7hf-vfp-neon-amltd-linux-gnueabi/python/2.7.3-r0.3/packages-split/python-html/usr/lib/python2.7/htmllib.py
> so, in this case I'm looking for the 'python-html' package.
>
> Once you determine the package name, just add that to your image (or if you
> have things set up for package updates, you can just add the packages directly
> on your board).

Thanks so much Gary!  I pulled in just logging and codecs modules and
my image went from 22 MB down to 9MB, and the app is still working.
I'm hopeful I can keep the ramdisk image under 16MB now.

Moving on to install and configure flask and uwsgi to serve the app
now.  Speaking of which, how do you assign static IP instead
defaulting to DHCP, and get ssh keys into the rootfs instead of
Drpbear generating them every bootup?  Can this be accomplished
through Yocto or do you have to mount and modify the rootfs manually?


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-14 20:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14  7:12 Web frameworks on embedded linux Edward Wingate
2014-11-14  8:13 ` Maciek Borzecki
2014-11-14 17:10   ` Edward Wingate
2014-11-14 17:18     ` Gary Thomas
2014-11-14 17:33     ` Nikolay Dimitrov
2014-11-14 18:39     ` Maciek Borzecki
  -- strict thread matches above, loose matches on Subject: below --
2014-11-14 20:43 Edward Wingate

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.