Add packages to the nerves firmware

Hello,

I have a project with a Phoenix based UI, and one of the requirements is to get a PDF report.

I’m using Raspberry Pi 3, and I’ve read https://hexdocs.pm/nerves/systems.html#customizing-your-own-nerves-system

when running make menuconfig I see some packages that can be installed.

In the case I need wkhtmltopdf (required for many elixir libraries), which is not in the list, do I have to create it somehow for buildroot?

using ssh nerves.local I can get into Elixir session, but is it possible to ssh into a shell?

I’m very confused with this part of Nerves System, buildroot, busybox…

Thanks!

I’ve never looked for this package, but you may have to add it manually. Nerves supports this and there is a great talk from last year’s ElixirConf about it. I’ll try to find it if you would like.

We had a sort of shell a while back. You can add the dep from here but it isn’t your normal shell. It is usually easier to do cmd("echo hello world") but sometimes you need a bit more control in which case i do usually: _ = Nerves.Runtime.cmd("echo", ["hello", "world"], :return). The only issue with those two approaches is when you need something that does fancy stuff to the terminal such as top. (which is disabled in the default systems iirc). What are you trying to do in a regular shell? maybe i can recommend an approach.

1 Like

I just had a look at the wkhtmltopdf repo
It looks like it require QT + webkit for some reason. While you can enable both of those thing in buildroot, it seems a little strange to me…

This is one of those things that is surprisingly hard and a reason to seriously thank package maintainers. There are several issues: Qt and Webkit have a lot of dependencies, Qt switched to Chromium for their web engine a while back so there’s more effort to get their Webkit integration, and the main one is that wkhtmltopdf hasn’t already been ported to Buildroot. If the last one weren’t the case, then this would be soooo much easier.

Here’s what I’d try:

  1. See if someone has built a static linked binary of wkhtmltopdf for ARM. If yes, then try including that in a priv directory or a rootfs_overlay. If you can run it and it doesn’t crash immediately, you’re probably good.
  2. See if you can upload the data to a server for pdf conversion.
  3. Port wkhtmltopdf to plain-vanilla Buildroot (no Nerves). Try setting the “all static libraries” option and see if you can generate a static wkhtmltopdf binary. I.e. make option #1.
  4. If there are issues making a static version of wkhtmltopdf, then try making one that uses dynamic libraries in plain-vanilla Buildroot. I’m certain this will work. Once you do this, the path to integrating it with Nerves will make a lot more sense.

I’m not going to lie, there’s some work here if #1 or #2 don’t pan out. I recently had to deal with this and ended up using a Qt PDF report generator (NCReport). That solution has some different challenges, but is much faster than wkhtmltopdf if you are running on a slow processor.

Good luck, and please let us know how you end up.

4 Likes

Thanks a lot for your answer @fhunleth!