Skip to contentSkip to conversation

How to provide one default skeleton per init system?

Buildroot Eric Le Bihan 5 participants 7 messages Jun 9, 2014 – Jun 10, 2014

lore
Share & tools
lore
#0 lore raw

Hi!

To properly use systemd as init system, some modifications should be performed on the default skeleton. This can be done via an overlay and a post-build script, as done in [1]. However, it would be best for Buildroot users to have it done automatically, as noted per ThomasP and MaximeH [2]. This brings forth the idea of having one target skeleton per init system.

IHMO, there are two solutions for implementing it:

a) Move system/skeleton to system/skeleton/busybox, then add system/skeleton/systemd, and maybe system/skeleton/sysv. The menu in system/Config.in will be updated to select BR2_ROOTFS_SKELETON_BUSYBOX, or BR2_ROOTFS_SKELETON_CUSTOM.
b) Add a new virtual package: target-skeleton, with some providers:
target-skeleton-busybox, target-skeleton-systemd and target-skeleton-custom (path to the custom skeleton would be handled in the configuration menu).

Solution A is the quickest and less intrusive to implement, but it can only copy the files of the skeleton, not perform the additional operations from the post-build script. So solution B seems the best.

But if a new package target-skeleton is added, what would be the dependency chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

Comments and ideas welcomed!

Best regards,
ELB

[1] https://github.com/elebihan/buildroot-ext-elb/tree/master/overlays/base-systemd
[2] http://lists.busybox.net/pipermail/buildroot/2014-June/098738.html

#1 lore raw

Hi Eric, all

Quoted 7 lines · Eric Le Bihan

Hi!

To properly use systemd as init system, some modifications should be performed on the default skeleton. This can be done via an overlay and a post-build script, as done in [1]. However, it would be best for Buildroot users to have it done automatically, as noted per ThomasP and MaximeH [2]. This brings forth the idea of having one target skeleton per init system.

Exactly, and I have started a few patches to do so. I shall send them pretty soon and break my series in too so that this part is at least done.

Quoted 12 lines

IHMO, there are two solutions for implementing it:

a) Move system/skeleton to system/skeleton/busybox, then add system/skeleton/systemd, and maybe system/skeleton/sysv. The menu in system/Config.in will be updated to select BR2_ROOTFS_SKELETON_BUSYBOX, or BR2_ROOTFS_SKELETON_CUSTOM.
b) Add a new virtual package: target-skeleton, with some providers:
target-skeleton-busybox, target-skeleton-systemd and target-skeleton-custom (path to the custom skeleton would be handled in the configuration menu).

Quoted 7 lines

Solution A is the quickest and less intrusive to implement, but it can only copy the files of the skeleton, not perform the additional operations from the post-build script. So solution B seems the best.

But if a new package target-skeleton is added, what would be the dependency chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

Actually the package that I have introduced after discussing it with Thomas Petazzoni was a package called initscripts and busybox/systemv only depends on it. This way, when you chose an init system, it will copy the files to the target directory.

This seems to be less intrusive as the end users would not even notice (except the disappearance of the init.d folder when systemd is chosen).

If you have any comments regarding this idea, they are welcomed. I'll try and send this patch tonight so we can discuss on the idea with some code.

Quoted 11 lines

Comments and ideas welcomed!

Best regards,
ELB

[1] https://github.com/elebihan/buildroot-ext-elb/tree/master/overlays/base-systemd
[2] http://lists.busybox.net/pipermail/buildroot/2014-June/098738.html
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw
In reply to Eric Le Bihan

Dear Eric Le Bihan,

Quoted 5 lines · Eric Le Bihan

To properly use systemd as init system, some modifications should be performed on the default skeleton. This can be done via an overlay and a post-build script, as done in [1]. However, it would be best for Buildroot users to have it done automatically, as noted per ThomasP and MaximeH [2]. This brings forth the idea of having one target skeleton per init system.

Right. This looks a necessary cleanup to me.

Quoted 11 lines

IHMO, there are two solutions for implementing it:

a) Move system/skeleton to system/skeleton/busybox, then add system/skeleton/systemd, and maybe system/skeleton/sysv. The menu in system/Config.in will be updated to select BR2_ROOTFS_SKELETON_BUSYBOX, or BR2_ROOTFS_SKELETON_CUSTOM.
b) Add a new virtual package: target-skeleton, with some providers:
target-skeleton-busybox, target-skeleton-systemd and target-skeleton-custom (path to the custom skeleton would be handled in the configuration menu).

Quoted 6 lines

Solution A is the quickest and less intrusive to implement, but it can only copy the files of the skeleton, not perform the additional operations from the post-build script. So solution B seems the best.

But if a new package target-skeleton is added, what would be the dependency chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

Clearly, some sort of solution (b), i.e something based on packages.

Regarding the names, I'd use just skeleton-*, not target-skeleton-*. And I believe I would make skeleton a virtual package provided by skeleton-systemd and skeleton-busybox, but instead have the 'skeleton' package be a real package that provides all the files common to both the Busybox and Systemd cases, and then have skeleton-systemd and skeleton-busybox depend on skeleton, and adding the additional stuff needed by systemd or busybox.

Also, there is the case of sysvinit, which is another init system that we support.

Regarding the dependency chain, I believe all target packages will have to depend on 'skeleton-<init>', just like they all depend on the 'toolchain' package. Since 'skeleton-<init>' are also going to be target packages, it will require a little trick to avoid the circular dependency, but nothing really terrible here.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw
In reply to Eric Le Bihan

Hi,

Quoted 10 lines · Eric Le Bihan

Hi!

To properly use systemd as init system, some modifications should be performed on the default skeleton. This can be done via an overlay and a post-build script, as done in [1]. However, it would be best for Buildroot users to have it done automatically, as noted per ThomasP and MaximeH [2]. This brings forth the idea of having one target skeleton per init system.

IHMO, there are two solutions for implementing it:

Quoted 8 lines

a) Move system/skeleton to system/skeleton/busybox, then add system/skeleton/systemd, and maybe system/skeleton/sysv. The menu in system/Config.in will be updated to select BR2_ROOTFS_SKELETON_BUSYBOX, or BR2_ROOTFS_SKELETON_CUSTOM.
b) Add a new virtual package: target-skeleton, with some providers:
target-skeleton-busybox, target-skeleton-systemd and target-skeleton-custom (path to the custom skeleton would be handled in the configuration menu).

And you also have:

c) Move the files in the skeleton at the package level. Each package would be providing whatever file it needs and is not shared by all the init systems.

Quoted 3 lines

Solution A is the quickest and less intrusive to implement, but it can only copy the files of the skeleton, not perform the additional operations from the post-build script. So solution B seems the best.

And solution C would be taking the advantages of both. It's not very intrusive, since everything is already in place, and you can do pretty much anything you want.

Quoted 2 lines

But if a new package target-skeleton is added, what would be the dependency chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

And you don't have to worry about the dependencies either.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140610/15468d61/attachment.asc>
#2 lore raw
In reply to Maxime Hadjinlian

Dear Maxime Hadjinlian,

Quoted 8 lines · Maxime Hadjinlian
Quoted 3 lines

But if a new package target-skeleton is added, what would be the dependency chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

Actually the package that I have introduced after discussing it with Thomas Petazzoni was a package called initscripts and busybox/systemv only depends on it. This way, when you chose an init system, it will copy the files to the target directory.

Quoted 7 lines

This seems to be less intrusive as the end users would not even notice (except the disappearance of the init.d folder when systemd is chosen).

If you have any comments regarding this idea, they are welcomed. I'll try and send this patch tonight so we can discuss on the idea with some code.

After thinking more about it, I believe it would be even better to have the whole skeleton as a package. This way, everything installed to $(TARGET_DIR) comes from a package, and things like my "graph-size" script do not need to special case the skeleton.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw
In reply to Maxime Ripard

Dear Maxime Ripard,

Quoted 9 lines · Maxime Ripard
Quoted 8 lines

a) Move system/skeleton to system/skeleton/busybox, then add system/skeleton/systemd, and maybe system/skeleton/sysv. The menu in system/Config.in will be updated to select BR2_ROOTFS_SKELETON_BUSYBOX, or BR2_ROOTFS_SKELETON_CUSTOM.
b) Add a new virtual package: target-skeleton, with some providers:
target-skeleton-busybox, target-skeleton-systemd and target-skeleton-custom (path to the custom skeleton would be handled in the configuration menu).

Quoted 5 lines

And you also have:

c) Move the files in the skeleton at the package level. Each package would be providing whatever file it needs and is not shared by all the init systems.

I don't think (b) and (c) are mutually exclusive actually. We can have a "skeleton" package that installs all the files that are common to all situations, and then have busybox, systemd and sysvinit install the files that they need.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw
In reply to Thomas Petazzoni

Hello,

Quoted 16 lines · On Tuesday 10 June 2014 11:50:04 Thomas Petazzoni wrote:

Dear Maxime Hadjinlian,

Quoted 13 lines · Maxime Hadjinlian
Quoted 3 lines

But if a new package target-skeleton is added, what would be the dependency
chain? Would make target-skeleton-rebuild rebuild... the whole rootfs?

Actually the package that I have introduced after discussing it with Thomas Petazzoni was a package called initscripts and busybox/systemv only depends on it. This way, when you chose an init system, it will copy the files to the target directory.

This seems to be less intrusive as the end users would not even notice (except the disappearance of the init.d folder when systemd is chosen).

Quoted 8 lines
Quoted 3 lines

If you have any comments regarding this idea, they are welcomed. I'll try and send this patch tonight so we can discuss on the idea with some code.

After thinking more about it, I believe it would be even better to have the whole skeleton as a package. This way, everything installed to $(TARGET_DIR) comes from a package, and things like my "graph-size" script do not need to special case the skeleton.

Hmm... This patch seems to be something close to that:
http://patchwork.ozlabs.org/patch/335963/

I may rework it, if needed.

Signature · 3 lines
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr