Live data from Hacker News

Building Raspberry Pi Systems with Yocto

jumpnowtek.com

11–20 of 32 posts

Re: Building Raspberry Pi Systems with Yocto

#11

I looked into switching to yocto a while back for a rpi project I work on. However, one thing that put me off is the end user's inability to install regular debian (raspbian) packages as they will inevitably expect to. But I think that people have used yocto as a kind of docker hypervisor, the openhab project used to do something like that before moving to HassOS. Does anyone know if you can include a minimal raspbia…

Not tried this myself but this is probably what you are looking for http://layers.openembedded.org/layerindex/branch/master/laye... Even without meta-debian, you can configure yocto to use the apt package management tools, and then you can point this at the relevant repositories. Read the manual for more information.

Thanks for that. I'm not sure I understand yet if meta-raspberrypi and meta-debian can be used together, I'd have thought they are both at the same layer and so couldn't be. And it seems to be based on Jessie.

I did read about how to add APT by specifying: CORE_IMAGE_EXTRA_INSTALL += "apt" but how on earth does it know what you've 'baked' into your recipe? Otherwise surely it'd basically install the system again when handling the user's package's dependencies. Wouldn't it? Perhaps https://community.nxp.com/thread/325384#comment-486697 is the answer, which sounds like a bit of work.

I also found this which looks kind of interesting: https://elinux.org/images/c/c6/Smart_r002.pdf and https://community.nxp.com/docs/DOC-328199.

Re: Building Raspberry Pi Systems with Yocto

#12
post #9

I looked into switching to yocto a while back for a rpi project I work on. However, one thing that put me off is the end user's inability to install regular debian (raspbian) packages as they will inevitably expect to. But I think that people have used yocto as a kind of docker hypervisor, the openhab project used to do something like that before moving to HassOS. Does anyone know if you can include a minimal raspbia…

I recently ran into that issue - I have a nice fine-tuned yocto image and now a customer wants to "log in via ssh and install a custom raspbian package". I was thinking of the docker solution as well.

"We have small and fine-tuned ghetto, but customers don't want that. What to do?"

I have similar problem: we have consumer device on top of imx6. I used iMX6 SoloLite evaluation board kit (1GB of memory) with Fedora for arm as development prototype. For me, installing a package is not a problem at all: "dnf install package". I planed to use Raspbian or Fedberry on actual device, but our management blindly switched to Yocto, without comparing of alternatives. To install package on Yocto, we need to create our own recipe in our own layer,then rebuild Yocto, fix bugs and repeat, and then deliver update. We spent man-year to achieve same result as we already had with Fedora. We seriously lag behind schedule because two developers (and two consultants) are working on developing of our own custom OS instead of working on our application. Moreover, instead of single system for development/testing and production (Fedora or Debian on developer workstation, in Docker for CI, on actual device) we now have mix of two systems. I created configuration script with about fifty options to be able to compile for host and for Yocto at same time (including workaround for number of bugs in Yocto). Enormous development time was sink into ground because of this schizophrenia.

Re: Building Raspberry Pi Systems with Yocto

#13
The Yocto package format supports a mix of inheriting BitBake package files, Bash and Python. It's over-engineered and unpleasant. Values can easily be defined 3 or 4 layers away from the file you are looking at, either in one of the many configuration files (that can be overridden by other configuration files), or in one of the files the package is inheriting from.

Add clunky and unintuitive tools to the mix, and Yocto can easily be an unpleasant experience, at least for teams over a certain size.

It does make switching between architectures really easy and sweet, though, but that's about it.

Re: Building Raspberry Pi Systems with Yocto

#14
post #10

Just a quick tip, if you are interested in Yocto, and especially Yocto on the Raspberry Pi: there's a layer called meta-updater[1], originally developed for Automotive Grade Linux, that lets you add over-the-air updates to your Yocto-built systems, and it supports Raspberry Pi. It uses OSTree[2] to give you atomic updates and nice, small update sizes. (The whole filesystem is a content-addressed object store that's h…

With regards to image update management, personally what I wish to do for my Yocto image is to have it be:

- Small enough that it fits into RAM.

- Fetched over the network on boot, PXE-style.

- Configured to not write any files to the greatest extent possible, and where writing files can not be avoided one would use tmpfs.

With the above three criteria satisfied, the following is achieved:

a) We never write to an SD card so we avoid SD card corruption issues.

b) Since the whole system image is sitting in RAM, we could do without NFS, Samba or similar either.

We do need to persist some data, but that data is coming from our application and is going to be stored in a database on a server on the local network.

I am currently working on developing the application that our image will run, but I have dug up some preliminary information relating to what I said above:

- Read-only Raspberry Pi [1]. Applies to Raspbian but certainly provides a starting point for doing the same thing with Yocto.

- Poky NFS Root [2]. Like I said, I don't need the NFS root part if the image can fit in RAM, but the portions that deal with gPXE might certainly be relevant.

- The State of Netbooting Raspberry Pis (December 2017) [3]. "Net-booting works well on the Raspberry Pi B Model 3 without an SD Card." So actually we won't be needing gPXE.

- Network Boot Your Raspberry Pi [4]. Referenced by [3] and provides the steps needed to configure Raspberry Pi 3 for network booting without an SD-card.

I am not completely decided upon whether or not to avoid NFS yet though. Because we never persist any files on the root file system anyway, serving said fs over NFS can be done in read-only mode, and we would put each revision of the corresponding root file system in a uniquely named top-level directory so that a client running the current version image has one place that it gets the files it expects from and the next version of the image which might expect other files or differing layout would get its files from another directory. Old root file system directories which are no longer in use would be removed so this scheme doesn't require much in terms of storage space.

It should be noted that NFS has some security issues [5], but our deployment is going to be running on an isolated network exclusive to the hardware that we are providing, so this concern is already resolved. Said isolated network will connect our embedded Raspberry Pis, a server (TFTP, database and NFS), and a tablet configured and provided by us. The tablet provides a graphical user interface that our customers will use to interact with the system.

[1]: https://learn.adafruit.com/read-only-raspberry-pi/

[2]: https://wiki.yoctoproject.org/wiki/Poky_NFS_Root

[3]: https://blog.alexellis.io/the-state-of-netbooting-raspberry-...

[4]: https://www.raspberrypi.org/documentation/hardware/raspberry...

[5]: https://www.tldp.org/HOWTO/NFS-HOWTO/security.html

Re: Building Raspberry Pi Systems with Yocto

#15

I looked into switching to yocto a while back for a rpi project I work on. However, one thing that put me off is the end user's inability to install regular debian (raspbian) packages as they will inevitably expect to. But I think that people have used yocto as a kind of docker hypervisor, the openhab project used to do something like that before moving to HassOS. Does anyone know if you can include a minimal raspbia…

I'd recommend using resinOS as the base. And then running your application inside a Raspbian container.

That will give you a read-only resinOS (based on Yocto. meta-resin layer). If you rpi is connected to the internet, you can use resin.io to remotely push application container updates and access the pi over a vpn.

https://docs.resin.io/learn/getting-started/raspberrypi3/nod...

Disclosure, I work at resin.io in the OS team on meta-resin.

The base resinOS is open source. And we are open-sourcing the rest of our stuff in due time as well.

Re: Building Raspberry Pi Systems with Yocto

#16
post #9

I looked into switching to yocto a while back for a rpi project I work on. However, one thing that put me off is the end user's inability to install regular debian (raspbian) packages as they will inevitably expect to. But I think that people have used yocto as a kind of docker hypervisor, the openhab project used to do something like that before moving to HassOS. Does anyone know if you can include a minimal raspbia…

I recently ran into that issue - I have a nice fine-tuned yocto image and now a customer wants to "log in via ssh and install a custom raspbian package". I was thinking of the docker solution as well.

[deleted]

Re: Building Raspberry Pi Systems with Yocto

#17
post #9

Earlier quoted context omitted.

I recently ran into that issue - I have a nice fine-tuned yocto image and now a customer wants to "log in via ssh and install a custom raspbian package". I was thinking of the docker solution as well.

"We have small and fine-tuned ghetto, but customers don't want that. What to do?" I have similar problem: we have consumer device on top of imx6. I used iMX6 SoloLite evaluation board kit (1GB of memory) with Fedora for arm as development prototype. For me, installing a package is not a problem at all: "dnf install package". I planed to use Raspbian or Fedberry on actual device, but our management blindly switched to…

ouch. That sucks.

You could run Fedora in a container on your Yocto base using resinOS.

I wrote more about this in another comment. https://news.ycombinator.com/item?id=18093336

Re: Building Raspberry Pi Systems with Yocto

#18
post #10

Just a quick tip, if you are interested in Yocto, and especially Yocto on the Raspberry Pi: there's a layer called meta-updater[1], originally developed for Automotive Grade Linux, that lets you add over-the-air updates to your Yocto-built systems, and it supports Raspberry Pi. It uses OSTree[2] to give you atomic updates and nice, small update sizes. (The whole filesystem is a content-addressed object store that's h…

With regards to image update management, personally what I wish to do for my Yocto image is to have it be: - Small enough that it fits into RAM. - Fetched over the network on boot, PXE-style. - Configured to not write any files to the greatest extent possible, and where writing files can not be avoided one would use tmpfs. With the above three criteria satisfied, the following is achieved: a) We never write to an SD…

Running an OS + application entirely from memory is an interesting approach indeed.

I guess the fundamental big problem you are facing is SD card corruption. In our experience, we've found the SanDisk Extreme Pro cards to be most reliable. (coupled with a good power supply).

Read-only rootfs is almost a must have for any production environment.

resinOS does not satisfy all your requirements (nfs boot, state in memory etc).. But we do have stuff in place to reduce the problems you are facing.

- There is an initramfs in the kernel. When the kernel loads in memory, it runs fsck on the root/data partitions before mounting the rootfs. - The rootfs is read-only with only a few configuration files in the state partition. - Applications run inside a container so you can basically run rasbian on top of resinOS.

I wrote more about resinOS in another comment highlighting remote application container updates/vpn access etc.

https://news.ycombinator.com/item?id=18093336

Disclaimer: I work at resin in the OS team. I've noted down your feedback about running purely in memory.

Re: Building Raspberry Pi Systems with Yocto

#19
post #10

Just a quick tip, if you are interested in Yocto, and especially Yocto on the Raspberry Pi: there's a layer called meta-updater[1], originally developed for Automotive Grade Linux, that lets you add over-the-air updates to your Yocto-built systems, and it supports Raspberry Pi. It uses OSTree[2] to give you atomic updates and nice, small update sizes. (The whole filesystem is a content-addressed object store that's h…

With regards to image update management, personally what I wish to do for my Yocto image is to have it be: - Small enough that it fits into RAM. - Fetched over the network on boot, PXE-style. - Configured to not write any files to the greatest extent possible, and where writing files can not be avoided one would use tmpfs. With the above three criteria satisfied, the following is achieved: a) We never write to an SD…

Be wary of some packages that expect their log folder to exist at /var/log/some_package else they won't start, I can't remember which of nginix or apache has that issue. That adafruit script is very simple and there are more robust setups out there, albeit not as well documented.

Netbooting isn't 100% reliable and last time I checked there were certain network switches/hubs that caused issues. Maybe that's a non-issue if you are also providing the network infrastructure.

Lastly, remember that the more RAM you consume for your filesystem/logs etc, the less available for our actual application. That becomes more of a problem when you start also assigning a large chunk of that RAM to the GPU.

Re: Building Raspberry Pi Systems with Yocto

#20
post #13

The Yocto package format supports a mix of inheriting BitBake package files, Bash and Python. It's over-engineered and unpleasant. Values can easily be defined 3 or 4 layers away from the file you are looking at, either in one of the many configuration files (that can be overridden by other configuration files), or in one of the files the package is inheriting from. Add clunky and unintuitive tools to the mix, and Yo…

I'm currently using Yocto for an embedded Linux project, and agree that it just feels so overly complicated for what we're using it for. I've written packages for Arch Linux in the past, and that's a breeze compared to writing bitbake recipes.

The ability to modify existing recipes through append files is nice, but that seems like it could be handled in a normal distro just by forking a package and making changes.

Post reply on HN