Re: buildroot-s6: s6 Supervision for Embedded Devices

2015-10-05 Thread Eric Le Bihan
Hi!

On Mon, Oct 05, 2015 at 02:09:41PM +0200, Laurent Bercot wrote:
> On 05/10/2015 11:52, Eric Le Bihan wrote:

> >- To cross-compile skalibs the documentation of skalibs recommends generating
> >   the sysdeps offline. This is a problem for Buildroot, as many 
> > architectures
> >   are supported and providing sysdeps for them is a no-go. I provide a 
> > patch for
> >   skalibs which replaces the run time tests for some type sizes and 
> > endianness
> >   with some compile time tests. This removes the need for offline sysdeps.
>
>  I don't understand: if you cross-compile, compile-time tests will always
> give the wrong results. How do other systems handle cross-compilation, for
> instance wrt endianness? There has to be a database of sysdeps somewhere,
> that lists the functionalities of various archs. How does Buildroot handle it?
> It's certainly possible to make skalibs tap into that database to extract its
> own sysdeps; please tell me if I can help.

Buildroot does not have a database of sysdeps. It relies on two things:

1. a description of the supported platforms: name and endianness (see
   buildroot/arch/Config.in*)
2. the tests provided by the packages themselves (via the autotools or cmake),
   most of them of the try-compile form.

The aforementionned patch is available in the buildroot/package/skalibs [1].
It patches the ./configure of skalibs as follow:

1. replace the src/sysdeps/trysize*.c with generated code to try all the
   possible sizes of each desired type. When the cross-compiler builds one
   code successfully then the size of the type has been found.
2. replace the src/sysdeps/tryendianness.c with one for testing little
   endian and the other for big endian, using the predefined macros from
   GCC and clang.

Hunk 1 does not rely on cross-compiler features, whereas hunk 2 does, so I
think I will modify the patch as follow:

- keep hunk 1
- remove the tryendianness part and dump the value of Buildroot BR2_ENDIAN
  variable in the generated sysdeps.h instead.

The parts where ./configure tries to link with a library are OK.

[1] 
buildroot/package/skalibs/skalibs-0001-No-runtime-tests-for-type-sizes-nor-endianness.patch

--
ELB


buildroot-s6: s6 Supervision for Embedded Devices

2015-10-05 Thread Eric Le Bihan
Hi all!

In order to use s6 and friends on embedded devices, I added support for them in
[Buildroot](http://buildroot.org), a set of Makefiles which make building Linux
embedded systems easy.

As these patches are not available upstream yet, I've created a playground:
[buildroot-s6](https://github.com/elebihan/buildroot-s6/).

In this playground, the user can build a firmware using s6-rc as init system for
the following platforms:

- QEMU/x86, dynamically linked against glibc.
- Raspberry Pi, statically linked against musl.

ATM, I only added the skarnet.org software stack as packages in Buildroot (see
"buildroot/package"), the skeleton for using s6-rc as init is available outside
(in the "custom" directory of the project). The objective is to add another
package for it and allow the user to select s6-rc as init from the configuration
menu (among Busybox, SysV and systemd).

Additional information:

- Buildroot allows the user to build a cross-compilation toolchain using glibc,
  musl or uclibc-ng. The build of skalibs fails with the later. More details
  soon.
- To cross-compile skalibs the documentation of skalibs recommends generating
  the sysdeps offline. This is a problem for Buildroot, as many architectures
  are supported and providing sysdeps for them is a no-go. I provide a patch for
  skalibs which replaces the run time tests for some type sizes and endianness
  with some compile time tests. This removes the need for offline sysdeps. This
  patch may be fine for Buildroot, but I have not verified its portability.
- The source files for the s6-rc service database are not stored in the
  firmware images. The database is built offline.

Comments welcomed.

Best regards,
ELB


Re: buildroot-s6: s6 Supervision for Embedded Devices

2015-10-05 Thread Laurent Bercot

On 05/10/2015 11:52, Eric Le Bihan wrote:

In order to use s6 and friends on embedded devices, I added support for them in
[Buildroot](http://buildroot.org), a set of Makefiles which make building Linux
embedded systems easy.

As these patches are not available upstream yet, I've created a playground:
[buildroot-s6](https://github.com/elebihan/buildroot-s6/).


 Yay! Thanks Eric!



- To cross-compile skalibs the documentation of skalibs recommends generating
   the sysdeps offline. This is a problem for Buildroot, as many architectures
   are supported and providing sysdeps for them is a no-go. I provide a patch 
for
   skalibs which replaces the run time tests for some type sizes and endianness
   with some compile time tests. This removes the need for offline sysdeps.


 I don't understand: if you cross-compile, compile-time tests will always
give the wrong results. How do other systems handle cross-compilation, for
instance wrt endianness? There has to be a database of sysdeps somewhere,
that lists the functionalities of various archs. How does Buildroot handle it?
It's certainly possible to make skalibs tap into that database to extract its
own sysdeps; please tell me if I can help.

--
 Laurent