* [Buildroot] [PATCH 2/2] system: support br2-external init systems
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
@ 2020-10-13 19:41 ` Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 1/5] system: support br2-external skeleton packages Brandon Maier
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 19:41 UTC (permalink / raw)
To: buildroot
Some externals may wish to provide custom init systems for tightly
integrated boot. This has been supported through the BR2_INIT_NONE,
however a downside to the BR2_INIT_NONE is it forces the custom init
system to use either skeleton-custom and roll a custom skeleton for
each target, or skeleton-init-none which isn't a complete skeleton.
Allowing br2-external to define custom BR2_INIT_* means they can now
safely 'select' the BR2_PACKAGE_SKELETON_INIT_* and use a sysv style
skeleton if they want.
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
support/scripts/br2-external | 17 +++++++++++++++++
system/Config.in | 3 +++
2 files changed, 20 insertions(+)
diff --git a/support/scripts/br2-external b/support/scripts/br2-external
index ededd2d900..f6ad722f72 100755
--- a/support/scripts/br2-external
+++ b/support/scripts/br2-external
@@ -161,6 +161,7 @@ do_kconfig() {
toolchains
jpeg
openssl
+ init
)
for br2 in "${items[@]}"; do
@@ -224,7 +225,23 @@ do_kconfig() {
else
printf '# No openssl from: %s\n\n' "${br2_desc}"
fi >>"${outputdir}/.br2-external.in.openssl"
+
+ if [ -f "${br2_ext}/provides/init.in" ]; then
+ printf 'comment "init from: %s"\n' "${br2_desc}"
+ printf 'source "%s/provides/init.in"\n' "${br2_ext}"
+ printf '\n'
+ else
+ printf '# No init from: %s\n\n' "${br2_desc}"
+ fi >>"${outputdir}/.br2-external.in.init"
done
+ if [ -f "${br2_ext}/provides/toolchains.in" ]; then
+ printf 'comment "Toolchains from: %s"\n' "${br2_desc}"
+ printf 'source "%s/provides/toolchains.in"\n' "${br2_ext}"
+ printf '\n'
+ else
+ printf '# No toolchain from: %s\n\n' "${br2_desc}"
+ fi >>"${outputdir}/.br2-external.in.toolchains"
+
printf 'endmenu\n' >>"${outputdir}/.br2-external.in.menus"
}
diff --git a/system/Config.in b/system/Config.in
index ec61fac781..ff7a470561 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -144,6 +144,9 @@ config BR2_INIT_NONE
have to provide your own, either with a new package
or with a rootfs-overlay.
+# Init systems from br2-external trees, if any
+source "$BR2_BASE_DIR/.br2-external.in.init"
+
endchoice
choice
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 1/5] system: support br2-external skeleton packages
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
2020-10-13 19:41 ` [Buildroot] [PATCH 2/2] system: support br2-external init systems Brandon Maier
@ 2020-10-13 22:36 ` Brandon Maier
2020-10-14 21:17 ` Yann E. MORIN
2020-10-13 22:36 ` [Buildroot] [PATCH v2 2/5] docs/manual: add section about br2-external skeleton Brandon Maier
` (3 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 22:36 UTC (permalink / raw)
To: buildroot
Today, the BR2_ROOTFS_SKELETON_CUSTOM is the only way to build a custom
skeleton. But it's limiting as users must provide a pre-built skeleton
for each target. Supporting a br2-external package allows users to build
up a skeleton and customize it with their own KConfig options.
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
support/scripts/br2-external | 9 +++++++++
system/Config.in | 3 +++
2 files changed, 12 insertions(+)
diff --git a/support/scripts/br2-external b/support/scripts/br2-external
index ededd2d900..01804e1220 100755
--- a/support/scripts/br2-external
+++ b/support/scripts/br2-external
@@ -161,6 +161,7 @@ do_kconfig() {
toolchains
jpeg
openssl
+ skeleton
)
for br2 in "${items[@]}"; do
@@ -224,6 +225,14 @@ do_kconfig() {
else
printf '# No openssl from: %s\n\n' "${br2_desc}"
fi >>"${outputdir}/.br2-external.in.openssl"
+
+ if [ -f "${br2_ext}/provides/skeleton.in" ]; then
+ printf 'comment "skeleton from: %s"\n' "${br2_desc}"
+ printf 'source "%s/provides/skeleton.in"\n' "${br2_ext}"
+ printf '\n'
+ else
+ printf '# No skeleton from: %s\n\n' "${br2_desc}"
+ fi >>"${outputdir}/.br2-external.in.skeleton"
done
printf 'endmenu\n' >>"${outputdir}/.br2-external.in.menus"
diff --git a/system/Config.in b/system/Config.in
index b8b7c16529..a363e099e5 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -23,6 +23,9 @@ config BR2_ROOTFS_SKELETON_CUSTOM
help
Use custom target skeleton.
+# skeleton from br2-external trees, if any
+source "$BR2_BASE_DIR/.br2-external.in.skeleton"
+
endchoice
if BR2_ROOTFS_SKELETON_CUSTOM
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 1/5] system: support br2-external skeleton packages
2020-10-13 22:36 ` [Buildroot] [PATCH v2 1/5] system: support br2-external skeleton packages Brandon Maier
@ 2020-10-14 21:17 ` Yann E. MORIN
0 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2020-10-14 21:17 UTC (permalink / raw)
To: buildroot
Brandon, All,
On 2020-10-13 17:36 -0500, Brandon Maier spake thusly:
> Today, the BR2_ROOTFS_SKELETON_CUSTOM is the only way to build a custom
> skeleton. But it's limiting as users must provide a pre-built skeleton
> for each target. Supporting a br2-external package allows users to build
> up a skeleton and customize it with their own KConfig options.
>
> Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Series applied to master, thanks!
I only did very minor tweaks; please see the ammended commit logs.
Regards,
Yann E. MORIN.
> ---
> support/scripts/br2-external | 9 +++++++++
> system/Config.in | 3 +++
> 2 files changed, 12 insertions(+)
>
> diff --git a/support/scripts/br2-external b/support/scripts/br2-external
> index ededd2d900..01804e1220 100755
> --- a/support/scripts/br2-external
> +++ b/support/scripts/br2-external
> @@ -161,6 +161,7 @@ do_kconfig() {
> toolchains
> jpeg
> openssl
> + skeleton
> )
>
> for br2 in "${items[@]}"; do
> @@ -224,6 +225,14 @@ do_kconfig() {
> else
> printf '# No openssl from: %s\n\n' "${br2_desc}"
> fi >>"${outputdir}/.br2-external.in.openssl"
> +
> + if [ -f "${br2_ext}/provides/skeleton.in" ]; then
> + printf 'comment "skeleton from: %s"\n' "${br2_desc}"
> + printf 'source "%s/provides/skeleton.in"\n' "${br2_ext}"
> + printf '\n'
> + else
> + printf '# No skeleton from: %s\n\n' "${br2_desc}"
> + fi >>"${outputdir}/.br2-external.in.skeleton"
> done
>
> printf 'endmenu\n' >>"${outputdir}/.br2-external.in.menus"
> diff --git a/system/Config.in b/system/Config.in
> index b8b7c16529..a363e099e5 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -23,6 +23,9 @@ config BR2_ROOTFS_SKELETON_CUSTOM
> help
> Use custom target skeleton.
>
> +# skeleton from br2-external trees, if any
> +source "$BR2_BASE_DIR/.br2-external.in.skeleton"
> +
> endchoice
>
> if BR2_ROOTFS_SKELETON_CUSTOM
> --
> 2.28.0
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 2/5] docs/manual: add section about br2-external skeleton
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
2020-10-13 19:41 ` [Buildroot] [PATCH 2/2] system: support br2-external init systems Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 1/5] system: support br2-external skeleton packages Brandon Maier
@ 2020-10-13 22:36 ` Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 3/5] system: Move skeleton-init-* selection to init Brandon Maier
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 22:36 UTC (permalink / raw)
To: buildroot
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
docs/manual/customize-outside-br.txt | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/docs/manual/customize-outside-br.txt b/docs/manual/customize-outside-br.txt
index 5f7d623aea..c24516680c 100644
--- a/docs/manual/customize-outside-br.txt
+++ b/docs/manual/customize-outside-br.txt
@@ -202,6 +202,7 @@ a set of files that define those alternatives:
will then be listed in the toolchain selection;
* +provides/jpeg.in+ defines the alternative libjpeg implementations;
* +provides/openssl.in+ defines the alternative openssl implementations.
+* +provides/skeleton.in+ defines the alternative skeleton implementations.
===== Free-form content
@@ -321,6 +322,27 @@ illustration, of course):
| |$(eval $(toolchain-external-package))
| `----
|
+ |- provides/skeleton.in
+ | |config BR2_ROOTFS_SKELETON_MINE
+ | | bool "my custom skeleton"
+ | | select BR2_PACKAGE_SKELETON_MINE
+ | `----
+ |- package/skeleton-mine/Config.in
+ | |config BR2_PACKAGE_SKELETON_MINE
+ | | bool
+ | | select BR2_PACKAGE_HAS_SKELETON
+ | |
+ | |config BR2_PACKAGE_PROVIDES_SKELETON
+ | | default "skeleton-mine" if BR2_PACKAGE_SKELETON_MINE
+ | `----
+ |- package/skeleton-mine/skeleton-mine.mk
+ | |SKELETON_MINE_ADD_TOOLCHAIN_DEPENDENCY = NO
+ | |SKELETON_MINE_ADD_SKELETON_DEPENDENCY = NO
+ | |SKELETON_MINE_PROVIDES = skeleton
+ | |SKELETON_MINE_INSTALL_STAGING = YES
+ | |$(eval $(generic-package))
+ | `----
+ |
|- linux/Config.ext.in
| |config BR2_LINUX_KERNEL_EXT_EXAMPLE_DRIVER
| | bool "example-external-driver"
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 3/5] system: Move skeleton-init-* selection to init
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
` (2 preceding siblings ...)
2020-10-13 22:36 ` [Buildroot] [PATCH v2 2/5] docs/manual: add section about br2-external skeleton Brandon Maier
@ 2020-10-13 22:36 ` Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 4/5] system: support br2-external init systems Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 5/5] docs/manual: add section about br2-external init Brandon Maier
5 siblings, 0 replies; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 22:36 UTC (permalink / raw)
To: buildroot
In preparation for supporting br2-external inits, move the 'select' for
the BR2_PACKAGE_SKELETON_INIT_* to their respective init systems. This
will allow a br2-external init to 'select' which skeleton it needs.
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
system/Config.in | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/system/Config.in b/system/Config.in
index a363e099e5..f062e5be93 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -1,21 +1,17 @@
menu "System configuration"
-# Note: usually, it is not possible to select a provider of a virtual
-# package. But here we have an exception: there are only four providers
-# and they only get selected by separate entries in this choice and
-# under different, exclusive conditions. So this is a safe situation.
+# Note on package/skeleton: usually, it is not safe to 'select' a
+# provider of a virtual package. But below we have an exception: each
+# init system may select one of the virtual skeleton-init-* packages. As
+# only one init system may be enabled, only one skeleton-init-* may be
+# selected. So this is a safe situation.
choice
prompt "Root FS skeleton"
config BR2_ROOTFS_SKELETON_DEFAULT
bool "default target skeleton"
- select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_INIT_SYSV
- select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_INIT_BUSYBOX
- select BR2_PACKAGE_SKELETON_INIT_OPENRC if BR2_INIT_OPENRC
- select BR2_PACKAGE_SKELETON_INIT_SYSTEMD if BR2_INIT_SYSTEMD
- select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_INIT_NONE
help
- Use default target skeleton
+ Use default target skeleton for selected init system.
config BR2_ROOTFS_SKELETON_CUSTOM
bool "custom target skeleton"
@@ -94,6 +90,7 @@ config BR2_INIT_BUSYBOX
bool "BusyBox"
select BR2_PACKAGE_BUSYBOX
select BR2_PACKAGE_INITSCRIPTS
+ select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
config BR2_INIT_SYSV
bool "systemV"
@@ -101,12 +98,14 @@ config BR2_INIT_SYSV
select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # sysvinit
select BR2_PACKAGE_INITSCRIPTS
select BR2_PACKAGE_SYSVINIT
+ select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
config BR2_INIT_OPENRC
bool "OpenRC"
depends on BR2_USE_MMU
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_OPENRC
+ select BR2_PACKAGE_SKELETON_INIT_OPENRC if BR2_ROOTFS_SKELETON_DEFAULT
comment "openrc needs a toolchain w/ dynamic library"
depends on BR2_USE_MMU
@@ -129,6 +128,7 @@ config BR2_INIT_SYSTEMD
depends on BR2_HOST_GCC_AT_LEAST_5
select BR2_ROOTFS_MERGED_USR
select BR2_PACKAGE_SYSTEMD
+ select BR2_PACKAGE_SKELETON_INIT_SYSTEMD if BR2_ROOTFS_SKELETON_DEFAULT
comment "systemd needs a glibc toolchain w/ SSP, headers >= 3.10, host and target gcc >= 5"
depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
@@ -141,6 +141,7 @@ comment "systemd needs a glibc toolchain w/ SSP, headers >= 3.10, host and targe
config BR2_INIT_NONE
bool "None"
+ select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
help
Buildroot will not install any init system. You will
have to provide your own, either with a new package
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 4/5] system: support br2-external init systems
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
` (3 preceding siblings ...)
2020-10-13 22:36 ` [Buildroot] [PATCH v2 3/5] system: Move skeleton-init-* selection to init Brandon Maier
@ 2020-10-13 22:36 ` Brandon Maier
2020-10-13 22:36 ` [Buildroot] [PATCH v2 5/5] docs/manual: add section about br2-external init Brandon Maier
5 siblings, 0 replies; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 22:36 UTC (permalink / raw)
To: buildroot
Some externals may wish to provide custom init systems for tightly
integrated boot. This has been supported through the BR2_INIT_NONE,
however a downside to the BR2_INIT_NONE is it forces the custom init
system to use either skeleton-custom and roll a custom skeleton for
each target, or skeleton-init-none which isn't a complete skeleton.
Allowing br2-external to define custom BR2_INIT_* means they can now
safely 'select' the BR2_PACKAGE_SKELETON_INIT_* and use a sysv style
skeleton if they want.
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
v2
- Remove bad code from a rebase
---
support/scripts/br2-external | 9 +++++++++
system/Config.in | 3 +++
2 files changed, 12 insertions(+)
diff --git a/support/scripts/br2-external b/support/scripts/br2-external
index 01804e1220..56dc6f53ca 100755
--- a/support/scripts/br2-external
+++ b/support/scripts/br2-external
@@ -162,6 +162,7 @@ do_kconfig() {
jpeg
openssl
skeleton
+ init
)
for br2 in "${items[@]}"; do
@@ -233,6 +234,14 @@ do_kconfig() {
else
printf '# No skeleton from: %s\n\n' "${br2_desc}"
fi >>"${outputdir}/.br2-external.in.skeleton"
+
+ if [ -f "${br2_ext}/provides/init.in" ]; then
+ printf 'comment "init from: %s"\n' "${br2_desc}"
+ printf 'source "%s/provides/init.in"\n' "${br2_ext}"
+ printf '\n'
+ else
+ printf '# No init from: %s\n\n' "${br2_desc}"
+ fi >>"${outputdir}/.br2-external.in.init"
done
printf 'endmenu\n' >>"${outputdir}/.br2-external.in.menus"
diff --git a/system/Config.in b/system/Config.in
index f062e5be93..33abb9beb1 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -147,6 +147,9 @@ config BR2_INIT_NONE
have to provide your own, either with a new package
or with a rootfs-overlay.
+# Init systems from br2-external trees, if any
+source "$BR2_BASE_DIR/.br2-external.in.init"
+
endchoice
choice
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH v2 5/5] docs/manual: add section about br2-external init
2020-10-13 19:41 [Buildroot] [PATCH 1/2] system: Move skeleton-init-* selection to init Brandon Maier
` (4 preceding siblings ...)
2020-10-13 22:36 ` [Buildroot] [PATCH v2 4/5] system: support br2-external init systems Brandon Maier
@ 2020-10-13 22:36 ` Brandon Maier
5 siblings, 0 replies; 8+ messages in thread
From: Brandon Maier @ 2020-10-13 22:36 UTC (permalink / raw)
To: buildroot
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
docs/manual/customize-outside-br.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/manual/customize-outside-br.txt b/docs/manual/customize-outside-br.txt
index c24516680c..59a01f278d 100644
--- a/docs/manual/customize-outside-br.txt
+++ b/docs/manual/customize-outside-br.txt
@@ -203,6 +203,8 @@ a set of files that define those alternatives:
* +provides/jpeg.in+ defines the alternative libjpeg implementations;
* +provides/openssl.in+ defines the alternative openssl implementations.
* +provides/skeleton.in+ defines the alternative skeleton implementations.
+* +provides/init.in+ defines the alternative init system implementations, this
+ can be used to select a default skeleton for your init.
===== Free-form content
@@ -343,6 +345,13 @@ illustration, of course):
| |$(eval $(generic-package))
| `----
|
+ |- provides/init.in
+ | |config BR2_INIT_MINE
+ | | bool "my custom init"
+ | | select BR2_PACKAGE_MY_INIT
+ | | select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
+ | `----
+ |
|- linux/Config.ext.in
| |config BR2_LINUX_KERNEL_EXT_EXAMPLE_DRIVER
| | bool "example-external-driver"
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread