* [PATCH 1/7] wic: Move isar plugins out of example layer to core
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
@ 2018-11-26 9:38 ` Jan Kiszka
2018-11-26 9:38 ` [PATCH 2/7] wic: Remove obsolete reference to msger logger Jan Kiszka
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:38 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
They should be available without having to include meta-isar.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
{meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 0
{meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename {meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-efi-isar.py (100%)
rename {meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py (100%)
diff --git a/meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
similarity index 100%
rename from meta-isar/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
rename to meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
diff --git a/meta-isar/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
similarity index 100%
rename from meta-isar/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
rename to meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/7] wic: Remove obsolete reference to msger logger
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
2018-11-26 9:38 ` [PATCH 1/7] wic: Move isar plugins out of example layer to core Jan Kiszka
@ 2018-11-26 9:38 ` Jan Kiszka
2018-11-26 9:45 ` Henning Schild
2018-11-26 9:38 ` [PATCH 3/7] meta-isar: Factor out bananapi machine config Jan Kiszka
` (5 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:38 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
OE core commit b561292c4e7b.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
scripts/lib/wic/plugins/source/rootfs.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index f2e2ca8..944ec5f 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -28,6 +28,7 @@
import logging
import os
import shutil
+import sys
from oe.path import copyhardlinktree
@@ -98,7 +99,8 @@ class RootfsPlugin(SourcePlugin):
for orig_path in part.exclude_path:
path = orig_path
if os.path.isabs(path):
- msger.error("Must be relative: --exclude-path=%s" % orig_path)
+ logger.error("Must be relative: --exclude-path=%s" % orig_path)
+ sys.exit(1)
full_path = os.path.realpath(os.path.join(new_rootfs, path))
@@ -106,7 +108,8 @@ class RootfsPlugin(SourcePlugin):
# because doing so could be quite disastrous (we will delete the
# directory).
if not full_path.startswith(new_rootfs):
- msger.error("'%s' points to a path outside the rootfs" % orig_path)
+ logger.error("'%s' points to a path outside the rootfs" % orig_path)
+ sys.exit(1)
if path.endswith(os.sep):
# Delete content only.
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] wic: Remove obsolete reference to msger logger
2018-11-26 9:38 ` [PATCH 2/7] wic: Remove obsolete reference to msger logger Jan Kiszka
@ 2018-11-26 9:45 ` Henning Schild
2018-11-26 9:50 ` Jan Kiszka
0 siblings, 1 reply; 13+ messages in thread
From: Henning Schild @ 2018-11-26 9:45 UTC (permalink / raw)
To: Jan Kiszka; +Cc: isar-users
Is this a cherry pick of a single commit on wic? If so i am stronly
against that. Bump the whole thing but do not fork it.
Henning
Am Mon, 26 Nov 2018 10:38:57 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> OE core commit b561292c4e7b.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> scripts/lib/wic/plugins/source/rootfs.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/rootfs.py
> b/scripts/lib/wic/plugins/source/rootfs.py index f2e2ca8..944ec5f
> 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py
> +++ b/scripts/lib/wic/plugins/source/rootfs.py
> @@ -28,6 +28,7 @@
> import logging
> import os
> import shutil
> +import sys
>
> from oe.path import copyhardlinktree
>
> @@ -98,7 +99,8 @@ class RootfsPlugin(SourcePlugin):
> for orig_path in part.exclude_path:
> path = orig_path
> if os.path.isabs(path):
> - msger.error("Must be relative:
> --exclude-path=%s" % orig_path)
> + logger.error("Must be relative:
> --exclude-path=%s" % orig_path)
> + sys.exit(1)
>
> full_path =
> os.path.realpath(os.path.join(new_rootfs, path))
> @@ -106,7 +108,8 @@ class RootfsPlugin(SourcePlugin):
> # because doing so could be quite disastrous (we
> will delete the # directory).
> if not full_path.startswith(new_rootfs):
> - msger.error("'%s' points to a path outside the
> rootfs" % orig_path)
> + logger.error("'%s' points to a path outside the
> rootfs" % orig_path)
> + sys.exit(1)
>
> if path.endswith(os.sep):
> # Delete content only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] wic: Remove obsolete reference to msger logger
2018-11-26 9:45 ` Henning Schild
@ 2018-11-26 9:50 ` Jan Kiszka
2018-11-26 10:07 ` Henning Schild
0 siblings, 1 reply; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:50 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users
On 26.11.18 10:45, Henning Schild wrote:
> Is this a cherry pick of a single commit on wic? If so i am stronly
> against that. Bump the whole thing but do not fork it.
>
What is the baseline then? Where can we move to, i.e. what were you selection
criteria back then?
Jan
> Henning
>
> Am Mon, 26 Nov 2018 10:38:57 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> OE core commit b561292c4e7b.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> scripts/lib/wic/plugins/source/rootfs.py | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/lib/wic/plugins/source/rootfs.py
>> b/scripts/lib/wic/plugins/source/rootfs.py index f2e2ca8..944ec5f
>> 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py
>> +++ b/scripts/lib/wic/plugins/source/rootfs.py
>> @@ -28,6 +28,7 @@
>> import logging
>> import os
>> import shutil
>> +import sys
>>
>> from oe.path import copyhardlinktree
>>
>> @@ -98,7 +99,8 @@ class RootfsPlugin(SourcePlugin):
>> for orig_path in part.exclude_path:
>> path = orig_path
>> if os.path.isabs(path):
>> - msger.error("Must be relative:
>> --exclude-path=%s" % orig_path)
>> + logger.error("Must be relative:
>> --exclude-path=%s" % orig_path)
>> + sys.exit(1)
>>
>> full_path =
>> os.path.realpath(os.path.join(new_rootfs, path))
>> @@ -106,7 +108,8 @@ class RootfsPlugin(SourcePlugin):
>> # because doing so could be quite disastrous (we
>> will delete the # directory).
>> if not full_path.startswith(new_rootfs):
>> - msger.error("'%s' points to a path outside the
>> rootfs" % orig_path)
>> + logger.error("'%s' points to a path outside the
>> rootfs" % orig_path)
>> + sys.exit(1)
>>
>> if path.endswith(os.sep):
>> # Delete content only.
>
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] wic: Remove obsolete reference to msger logger
2018-11-26 9:50 ` Jan Kiszka
@ 2018-11-26 10:07 ` Henning Schild
2018-11-26 11:02 ` Jan Kiszka
0 siblings, 1 reply; 13+ messages in thread
From: Henning Schild @ 2018-11-26 10:07 UTC (permalink / raw)
To: Jan Kiszka; +Cc: isar-users, Frank Lenormand
Am Mon, 26 Nov 2018 10:50:57 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> On 26.11.18 10:45, Henning Schild wrote:
> > Is this a cherry pick of a single commit on wic? If so i am stronly
> > against that. Bump the whole thing but do not fork it.
> >
>
> What is the baseline then? Where can we move to, i.e. what were you
> selection criteria back then?
We are currently at "131629ca6238ea05", without modification. The pick
was made by Frank Lenormand in "2b164b18fd639c9c". I guess without a
special reason.
For a bump i would suggest whatever the latest OE release uses, just
like bitbake. I already tried it once and it broke the build in a weird
way ...
Henning
> Jan
>
> > Henning
> >
> > Am Mon, 26 Nov 2018 10:38:57 +0100
> > schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> >
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> OE core commit b561292c4e7b.
> >>
> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >> ---
> >> scripts/lib/wic/plugins/source/rootfs.py | 7 +++++--
> >> 1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/scripts/lib/wic/plugins/source/rootfs.py
> >> b/scripts/lib/wic/plugins/source/rootfs.py index f2e2ca8..944ec5f
> >> 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py
> >> +++ b/scripts/lib/wic/plugins/source/rootfs.py
> >> @@ -28,6 +28,7 @@
> >> import logging
> >> import os
> >> import shutil
> >> +import sys
> >>
> >> from oe.path import copyhardlinktree
> >>
> >> @@ -98,7 +99,8 @@ class RootfsPlugin(SourcePlugin):
> >> for orig_path in part.exclude_path:
> >> path = orig_path
> >> if os.path.isabs(path):
> >> - msger.error("Must be relative:
> >> --exclude-path=%s" % orig_path)
> >> + logger.error("Must be relative:
> >> --exclude-path=%s" % orig_path)
> >> + sys.exit(1)
> >>
> >> full_path =
> >> os.path.realpath(os.path.join(new_rootfs, path))
> >> @@ -106,7 +108,8 @@ class RootfsPlugin(SourcePlugin):
> >> # because doing so could be quite disastrous (we
> >> will delete the # directory).
> >> if not full_path.startswith(new_rootfs):
> >> - msger.error("'%s' points to a path outside the
> >> rootfs" % orig_path)
> >> + logger.error("'%s' points to a path outside
> >> the rootfs" % orig_path)
> >> + sys.exit(1)
> >>
> >> if path.endswith(os.sep):
> >> # Delete content only.
> >
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] wic: Remove obsolete reference to msger logger
2018-11-26 10:07 ` Henning Schild
@ 2018-11-26 11:02 ` Jan Kiszka
0 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 11:02 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users, Frank Lenormand
On 26.11.18 11:07, Henning Schild wrote:
> Am Mon, 26 Nov 2018 10:50:57 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>
>> On 26.11.18 10:45, Henning Schild wrote:
>>> Is this a cherry pick of a single commit on wic? If so i am stronly
>>> against that. Bump the whole thing but do not fork it.
>>>
>>
>> What is the baseline then? Where can we move to, i.e. what were you
>> selection criteria back then?
>
> We are currently at "131629ca6238ea05", without modification. The pick
> was made by Frank Lenormand in "2b164b18fd639c9c". I guess without a
> special reason.
> For a bump i would suggest whatever the latest OE release uses, just
> like bitbake. I already tried it once and it broke the build in a weird
> way ...
OK, bigger effort. Then just skip this patch for now.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/7] meta-isar: Factor out bananapi machine config
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
2018-11-26 9:38 ` [PATCH 1/7] wic: Move isar plugins out of example layer to core Jan Kiszka
2018-11-26 9:38 ` [PATCH 2/7] wic: Remove obsolete reference to msger logger Jan Kiszka
@ 2018-11-26 9:38 ` Jan Kiszka
2018-11-26 9:38 ` [PATCH 4/7] wic: Add rootfs-u-boot Jan Kiszka
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:38 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
The multiconfig file should only select the machine, not define it.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../bananapi-stretch.conf => machine/bananapi.conf} | 3 ---
meta-isar/conf/multiconfig/bananapi-stretch.conf | 17 ++---------------
2 files changed, 2 insertions(+), 18 deletions(-)
copy meta-isar/conf/{multiconfig/bananapi-stretch.conf => machine/bananapi.conf} (89%)
diff --git a/meta-isar/conf/multiconfig/bananapi-stretch.conf b/meta-isar/conf/machine/bananapi.conf
similarity index 89%
copy from meta-isar/conf/multiconfig/bananapi-stretch.conf
copy to meta-isar/conf/machine/bananapi.conf
index bf89652..95876f1 100644
--- a/meta-isar/conf/multiconfig/bananapi-stretch.conf
+++ b/meta-isar/conf/machine/bananapi.conf
@@ -3,9 +3,6 @@
#
# SPDX-License-Identifier: MIT
-MACHINE ?= "bananapi"
-
-DISTRO ?= "debian-stretch"
DISTRO_ARCH ?= "armhf"
KERNEL_NAME ?= "armmp"
diff --git a/meta-isar/conf/multiconfig/bananapi-stretch.conf b/meta-isar/conf/multiconfig/bananapi-stretch.conf
index bf89652..6c80020 100644
--- a/meta-isar/conf/multiconfig/bananapi-stretch.conf
+++ b/meta-isar/conf/multiconfig/bananapi-stretch.conf
@@ -3,18 +3,5 @@
#
# SPDX-License-Identifier: MIT
-MACHINE ?= "bananapi"
-
-DISTRO ?= "debian-stretch"
-DISTRO_ARCH ?= "armhf"
-
-KERNEL_NAME ?= "armmp"
-
-DISTRO_APT_SOURCES_append = " conf/distro/debian-stretch-backports.list"
-DISTRO_APT_PREFERENCES += "conf/multiconfig/preferences.bananapi.conf"
-
-IMAGE_INSTALL += "u-boot-script-${KERNEL_NAME}"
-
-IMAGE_TYPE ?= "wic-img"
-WKS_FILE ?= "bananapi"
-IMAGER_INSTALL += "u-boot-sunxi"
+MACHINE = "bananapi"
+DISTRO = "debian-stretch"
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/7] wic: Add rootfs-u-boot
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
` (2 preceding siblings ...)
2018-11-26 9:38 ` [PATCH 3/7] meta-isar: Factor out bananapi machine config Jan Kiszka
@ 2018-11-26 9:38 ` Jan Kiszka
2018-11-26 9:39 ` [PATCH 5/7] meta-isar: Switch bananapi and de0-nano-soc to rootfs-u-boot Jan Kiszka
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:38 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
This implements the translation of the target wks into an U-Boot script
file as wic plugin. It allows to remove any image or kernel specifics
from the u-boot-script package. And then, in turn, permits to make wks
files image-specific again, just like in OE.
As u-boot-script is already installed on the target, we chroot into that
rootfs in order to run update-u-boot-script in-place. In cross-arch
scenarios, we just need to restore qemu-*-static temporarily for this
because do_rootfs already cleaned it up.
The plugin allows to inject the SCRIPT_PREPEND and NO_INITRD parameters
via --sourceparams, which also obsoletes the need to carry /etc/default/
u-boot-script in customization packages.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../lib/wic/plugins/source/rootfs-u-boot.py | 91 ++++++++++++++++++++++
1 file changed, 91 insertions(+)
create mode 100644 meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
new file mode 100644
index 0000000..0c7710e
--- /dev/null
+++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
@@ -0,0 +1,91 @@
+#
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+#
+# DESCRIPTION
+# This implements the 'rootfs-u-boot' source plugin class for 'wic'.
+# It performs the same tasks as the 'rootfs' plugin and additionally configures
+# u-boot-script to boot this rootfs.
+# Recognized sourceparams:
+# - no_initrd=yes (disables initrd loading)
+# - script_prepend=cmd;... (prepends U-Boot command)
+
+import glob
+import logging
+import os
+
+from wic import WicError
+from wic.plugins.source.rootfs import RootfsPlugin
+from wic.utils.misc import exec_cmd
+
+logger = logging.getLogger('wic')
+
+class RootfsUBootPlugin(RootfsPlugin):
+ """
+ Populate partition content from a rootfs directory and set up
+ /etc/default/u-boot-script.
+ """
+
+ name = 'rootfs-u-boot'
+
+ @classmethod
+ def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ krootfs_dir, native_sysroot):
+ # Prologue from RootfsPlugin.do_prepare_partition, retrieves the
+ # rootfs directory
+ if part.rootfs_dir is None:
+ if not 'ROOTFS_DIR' in krootfs_dir:
+ raise WicError("Couldn't find --rootfs-dir, exiting")
+
+ rootfs_dir = krootfs_dir['ROOTFS_DIR']
+ else:
+ if part.rootfs_dir in krootfs_dir:
+ rootfs_dir = krootfs_dir[part.rootfs_dir]
+ elif part.rootfs_dir:
+ rootfs_dir = part.rootfs_dir
+ else:
+ raise WicError("Couldn't find --rootfs-dir=%s connection or "
+ "it is not a valid path, exiting" % part.rootfs_dir)
+ if os.path.isdir(rootfs_dir):
+ real_rootfs_dir = rootfs_dir
+ else:
+ image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
+ if not os.path.isdir(image_rootfs_dir):
+ raise WicError("No valid artifact IMAGE_ROOTFS from image "
+ "named %s has been found at %s, exiting." %
+ (rootfs_dir, image_rootfs_dir))
+ real_rootfs_dir = image_rootfs_dir
+
+ u_boot_script = os.path.join(real_rootfs_dir,
+ "etc/default/u-boot-script")
+ if not os.path.exists(u_boot_script):
+ raise WicError("u-boot-scripts package not installed")
+
+ # Write new /etc/default/u-boot-script
+ with open(u_boot_script, 'w') as cfg:
+ cfg.write('# Generated by wic, rootfs-u-boot plugin\n')
+ cfg.write('ROOT_PARTITION="%d"\n' % part.realnum)
+ cfg.write('KERNEL_ARGS="root=%s %s"\n' % \
+ (cr.rootdev, cr.ks.bootloader.append))
+ no_initrd = source_params.get('no_initrd') or ''
+ cfg.write('NO_INITRD="%s"\n' % no_initrd)
+ script_prepend = source_params.get('script_prepend') or ''
+ cfg.write('SCRIPT_PREPEND="%s"\n' % script_prepend)
+
+ # Run update-u-boot-script in the target rootfs
+ results = glob.glob(os.path.join("/usr/bin/qemu-*-static"))
+ qemu_static = results[0] if len(results) > 0 else None
+ if qemu_static:
+ cp_cmd = "cp -L %s %s/usr/bin" % (qemu_static, real_rootfs_dir)
+ exec_cmd(cp_cmd)
+ update_cmd = "chroot %s sh -c update-u-boot-script" % real_rootfs_dir
+ exec_cmd(update_cmd)
+ if qemu_static:
+ rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static)
+ exec_cmd(rm_cmd)
+
+ RootfsPlugin.do_prepare_partition(part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ krootfs_dir, native_sysroot)
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/7] meta-isar: Switch bananapi and de0-nano-soc to rootfs-u-boot
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
` (3 preceding siblings ...)
2018-11-26 9:38 ` [PATCH 4/7] wic: Add rootfs-u-boot Jan Kiszka
@ 2018-11-26 9:39 ` Jan Kiszka
2018-11-26 9:39 ` [PATCH 6/7] u-boot-script: Make truly generic Jan Kiszka
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:39 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
Switch the two u-boot-script users to the new wic plugin.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/scripts/lib/wic/canned-wks/bananapi.wks | 2 +-
meta-isar/scripts/lib/wic/canned-wks/de0-nano-soc.wks | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-isar/scripts/lib/wic/canned-wks/bananapi.wks b/meta-isar/scripts/lib/wic/canned-wks/bananapi.wks
index e8fcdbe..dbec48e 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/bananapi.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/bananapi.wks
@@ -1,5 +1,5 @@
part u-boot --source rawcopy --sourceparams "file=/usr/lib/u-boot/Bananapi/u-boot-sunxi-with-spl.bin" --no-table --align 8
-part / --source rootfs --ondisk mmcblk0 --fstype ext4 --label platform --align 1024
+part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --label platform --align 1024
bootloader --append "rootwait"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/de0-nano-soc.wks b/meta-isar/scripts/lib/wic/canned-wks/de0-nano-soc.wks
index 993a4ca..184474d 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/de0-nano-soc.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/de0-nano-soc.wks
@@ -5,6 +5,6 @@
part --source rawcopy --sourceparams "file=/usr/lib/u-boot/de0-nano-soc/u-boot-with-spl.sfp" --system-id 0xa2 --align 1
-part / --source rootfs --ondisk mmcblk0 --fstype ext4 --label platform --align 1024 --active
+part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --label platform --align 1024 --active
bootloader --append "rw rootwait"
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/7] u-boot-script: Make truly generic
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
` (4 preceding siblings ...)
2018-11-26 9:39 ` [PATCH 5/7] meta-isar: Switch bananapi and de0-nano-soc to rootfs-u-boot Jan Kiszka
@ 2018-11-26 9:39 ` Jan Kiszka
2018-11-26 9:39 ` [PATCH 7/7] meta: Fold wks-file class into wic-img Jan Kiszka
2018-11-29 12:15 ` [PATCH 0/7] u-boot-script rework, the Final One (tm) Maxim Yu. Osipov
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:39 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
Now that rootfs-u-boot can generate the required config, we can remove
any config generation from this package. Makes things much simpler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/machine/bananapi.conf | 2 +-
meta-isar/conf/machine/de0-nano-soc.conf | 2 +-
.../recipes-bsp/u-boot-script/u-boot-script_1.0.bb | 81 ----------------------
.../recipes-bsp/u-boot-script/u-boot-script_1.1.bb | 28 ++++++++
4 files changed, 30 insertions(+), 83 deletions(-)
delete mode 100644 meta/recipes-bsp/u-boot-script/u-boot-script_1.0.bb
create mode 100644 meta/recipes-bsp/u-boot-script/u-boot-script_1.1.bb
diff --git a/meta-isar/conf/machine/bananapi.conf b/meta-isar/conf/machine/bananapi.conf
index 95876f1..7b380c1 100644
--- a/meta-isar/conf/machine/bananapi.conf
+++ b/meta-isar/conf/machine/bananapi.conf
@@ -10,7 +10,7 @@ KERNEL_NAME ?= "armmp"
DISTRO_APT_SOURCES_append = " conf/distro/debian-stretch-backports.list"
DISTRO_APT_PREFERENCES += "conf/multiconfig/preferences.bananapi.conf"
-IMAGE_INSTALL += "u-boot-script-${KERNEL_NAME}"
+IMAGE_INSTALL += "u-boot-script"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "bananapi"
diff --git a/meta-isar/conf/machine/de0-nano-soc.conf b/meta-isar/conf/machine/de0-nano-soc.conf
index 184da4a..63b2cfb 100644
--- a/meta-isar/conf/machine/de0-nano-soc.conf
+++ b/meta-isar/conf/machine/de0-nano-soc.conf
@@ -15,4 +15,4 @@ WKS_FILE ?= "de0-nano-soc"
IMAGER_INSTALL += "u-boot-de0-nano-soc"
IMAGER_BUILD_DEPS += "u-boot-de0-nano-soc"
-IMAGE_INSTALL += "u-boot-tools u-boot-script-${KERNEL_NAME}"
+IMAGE_INSTALL += "u-boot-tools u-boot-script"
diff --git a/meta/recipes-bsp/u-boot-script/u-boot-script_1.0.bb b/meta/recipes-bsp/u-boot-script/u-boot-script_1.0.bb
deleted file mode 100644
index a827c35..0000000
--- a/meta/recipes-bsp/u-boot-script/u-boot-script_1.0.bb
+++ /dev/null
@@ -1,81 +0,0 @@
-# Boot script generator for U-Boot
-#
-# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
-#
-# SPDX-License-Identifier: MIT
-
-inherit dpkg-raw
-inherit wks-file
-
-WKS_FULL_PATH = "${@get_wks_full_path(d)}"
-
-DESCRIPTION = "Boot script generator for U-Boot"
-
-PN .= "-${KERNEL_NAME}"
-
-SRC_URI = " \
- file://update-u-boot-script \
- file://u-boot-script \
- file://zz-u-boot-script"
-
-DEBIAN_DEPENDS = "u-boot-tools, linux-image-${KERNEL_NAME}"
-
-# Extract the following information from the wks file and add it to the
-# packaged /etc/default/u-boot-script:
-# - --append parameters from a bootloader entry
-# - root partition number
-# - disk name the root partition is located on
-
-init_config_from_wks() {
- # Filter out the bootloader line, then grap the argument of --append.
- # The argument may be quoted, respect that but remove the quotes prior
- # to assigning the target variable. Will be re-added later.
- KERNEL_ARGS=$(grep "^bootloader " $1 | \
- sed -e 's/.* --append[= ]\(".*"\|[^ $]*\).*/\1/' \
- -e 's/\"\(.*\)\"/\1/')
-
- COUNT=0
- while read COMMAND MNT OPTIONS; do
- if [ "${COMMAND}" != part ] ||
- echo "${OPTIONS}" | grep -q "\--no-table"; then
- continue
- fi
- COUNT=$(expr ${COUNT} + 1)
- if [ "${MNT}" = "/" ]; then
- ROOT_PARTITION=${COUNT}
- break
- fi
- done < $1
- if [ -n "${ROOT_PARTITION}" ]; then
- # filter out parameter of --ondisk or --ondrive
- ROOT=$(echo ${OPTIONS} | \
- sed 's/.*--on\(disk\|drive\)[ ]\+\([^ ]\+\) .*/\2/')
- # anything found?
- if [ "${ROOT}" != "${OPTIONS}" ]; then
- # special case: append 'p' to mmcblkN
- ROOT=$(echo ${ROOT} | sed 's/^\(mmcblk[0-9]\+\)/\1p/')
-
- KERNEL_ARGS="\"root=/dev/${ROOT}${ROOT_PARTITION} ${KERNEL_ARGS}\""
- fi
- fi
-
- sed -i -e 's|\(^ROOT_PARTITION=\).*|\1\"'"${ROOT_PARTITION}"'\"|' \
- -e 's|\(^KERNEL_ARGS=\).*|\1'"${KERNEL_ARGS}"'|' \
- ${WORKDIR}/u-boot-script
-}
-
-do_install() {
- [ -n ${WKS_FULL_PATH} ] && init_config_from_wks "${WKS_FULL_PATH}"
-
- sudo rm -rf ${D}/etc ${D}/usr
-
- install -v -d ${D}/usr/sbin
- install -v -m 755 ${WORKDIR}/update-u-boot-script ${D}/usr/sbin/
-
- install -v -d ${D}/etc/default
- install -v -m 644 ${WORKDIR}/u-boot-script ${D}/etc/default/
-
- install -v -d ${D}/etc/kernel/postinst.d
- install -v -m 755 ${WORKDIR}/zz-u-boot-script ${D}/etc/kernel/postinst.d
-}
diff --git a/meta/recipes-bsp/u-boot-script/u-boot-script_1.1.bb b/meta/recipes-bsp/u-boot-script/u-boot-script_1.1.bb
new file mode 100644
index 0000000..e07deee
--- /dev/null
+++ b/meta/recipes-bsp/u-boot-script/u-boot-script_1.1.bb
@@ -0,0 +1,28 @@
+# Boot script generator for U-Boot
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+DESCRIPTION = "Boot script generator for U-Boot"
+
+SRC_URI = " \
+ file://update-u-boot-script \
+ file://u-boot-script \
+ file://zz-u-boot-script"
+
+DEBIAN_DEPENDS = "u-boot-tools, linux-image-${KERNEL_NAME}"
+
+do_install() {
+ install -v -d ${D}/usr/sbin
+ install -v -m 755 ${WORKDIR}/update-u-boot-script ${D}/usr/sbin/
+
+ install -v -d ${D}/etc/default
+ install -v -m 644 ${WORKDIR}/u-boot-script ${D}/etc/default/
+
+ install -v -d ${D}/etc/kernel/postinst.d
+ install -v -m 755 ${WORKDIR}/zz-u-boot-script ${D}/etc/kernel/postinst.d
+}
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 7/7] meta: Fold wks-file class into wic-img
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
` (5 preceding siblings ...)
2018-11-26 9:39 ` [PATCH 6/7] u-boot-script: Make truly generic Jan Kiszka
@ 2018-11-26 9:39 ` Jan Kiszka
2018-11-29 12:15 ` [PATCH 0/7] u-boot-script rework, the Final One (tm) Maxim Yu. Osipov
7 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2018-11-26 9:39 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
There is no longer a valid use case for obtaining a wks file outside of
the wic-img class.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/wic-img.bbclass | 26 ++++++++++++++++++++++----
meta/classes/wks-file.bbclass | 30 ------------------------------
2 files changed, 22 insertions(+), 34 deletions(-)
delete mode 100644 meta/classes/wks-file.bbclass
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index e7527c8..225463e 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -5,14 +5,32 @@
#
python () {
- if not d.getVar('WKS_FILE', True):
+ wks_full_path = None
+
+ wks_file = d.getVar('WKS_FILE', True)
+ if not wks_file:
bb.fatal("WKS_FILE must be set")
+ if not wks_file.endswith('.wks'):
+ wks_file += '.wks'
+
+ if os.path.isabs(wks_file):
+ if os.path.exists(wks_file):
+ wks_full_path = wks_file
+ else:
+ bbpaths = d.getVar('BBPATH', True).split(':')
+ corebase = d.getVar('COREBASE', True)
+ search_path = ':'.join('%s/wic' % p for p in bbpaths) + ':' + \
+ ':'.join('%s/scripts/lib/wic/canned-wks' % l \
+ for l in (bbpaths + [corebase]))
+ wks_full_path = bb.utils.which(search_path, wks_file)
+
+ if not wks_full_path:
+ bb.fatal("WKS_FILE '%s' not found" % wks_file)
+
+ d.setVar('WKS_FULL_PATH', wks_full_path)
}
inherit buildchroot
-inherit wks-file
-
-WKS_FULL_PATH = "${@get_wks_full_path(d)}"
# wic comes with reasonable defaults, and the proper interface is the wks file
ROOTFS_EXTRA ?= "0"
diff --git a/meta/classes/wks-file.bbclass b/meta/classes/wks-file.bbclass
deleted file mode 100644
index 493fea7..0000000
--- a/meta/classes/wks-file.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2018 Siemens AG
-#
-# SPDX-License-Identifier: MIT
-
-def get_wks_full_path(d):
- if (d.getVar('IMAGE_TYPE', True) or '') != 'wic-img':
- return ""
-
- wks_full_path = None
-
- wks_file = d.getVar('WKS_FILE', True)
- if not wks_file.endswith('.wks'):
- wks_file += '.wks'
-
- if os.path.isabs(wks_file):
- if os.path.exists(wks_file):
- wks_full_path = wks_file
- else:
- bbpaths = d.getVar('BBPATH', True).split(':')
- corebase = d.getVar('COREBASE', True)
- search_path = ':'.join('%s/wic' % p for p in bbpaths) + ':' + \
- ':'.join('%s/scripts/lib/wic/canned-wks' % l \
- for l in (bbpaths + [corebase]))
- wks_full_path = bb.utils.which(search_path, wks_file)
-
- if not wks_full_path:
- bb.fatal("WKS_FILE '%s' not found" % wks_file)
-
- return wks_full_path
--
2.16.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] u-boot-script rework, the Final One (tm)
2018-11-26 9:38 [PATCH 0/7] u-boot-script rework, the Final One (tm) Jan Kiszka
` (6 preceding siblings ...)
2018-11-26 9:39 ` [PATCH 7/7] meta: Fold wks-file class into wic-img Jan Kiszka
@ 2018-11-29 12:15 ` Maxim Yu. Osipov
7 siblings, 0 replies; 13+ messages in thread
From: Maxim Yu. Osipov @ 2018-11-29 12:15 UTC (permalink / raw)
To: Jan Kiszka, isar-users; +Cc: Henning Schild
On 11/26/18 12:38 PM, Jan Kiszka wrote:
> Yes, another rework of the u-boo-script interface. I finally realized
> that the current approach of packaging the machine- or even image-
> specific configuration along with the script generator is broken: It
> cannot easily account for different targets requesting different
> configurations. This breakes in multiconfig scenarios with different
> targets of the same architecture.
>
> Rather than hacking further on the recipe and package, this now pushes
> the /etc/default/u-boot-script generation to wic. For that, a new plugin
> is introduced, rootfs-u-boot, which is inheriting the rootfs plugin. The
> reason to choose rootfs as hook, rather than some bootimg plugin, is
> that there are systems that do not have U-Boot in a regular partition
> but still want to use u-boot-script.
>
> Along this change come a few directly or indirectly related cleanups.
>
> Jan
Applied to the 'next' (except dropped patch #2 "wic: Remove obsolete
reference to msger logger").
Thanks,
Maxim.
> Jan Kiszka (7):
> wic: Move isar plugins out of example layer to core
> wic: Remove obsolete reference to msger logger
> meta-isar: Factor out bananapi machine config
> wic: Add rootfs-u-boot
> meta-isar: Switch bananapi and de0-nano-soc to rootfs-u-boot
> u-boot-script: Make truly generic
> meta: Fold wks-file class into wic-img
>
> .../bananapi.conf} | 5 +-
> meta-isar/conf/machine/de0-nano-soc.conf | 2 +-
> meta-isar/conf/multiconfig/bananapi-stretch.conf | 17 +---
> meta-isar/scripts/lib/wic/canned-wks/bananapi.wks | 2 +-
> .../scripts/lib/wic/canned-wks/de0-nano-soc.wks | 2 +-
> meta/classes/wic-img.bbclass | 26 ++++++-
> meta/classes/wks-file.bbclass | 30 -------
> .../recipes-bsp/u-boot-script/u-boot-script_1.0.bb | 81 -------------------
> .../recipes-bsp/u-boot-script/u-boot-script_1.1.bb | 28 +++++++
> .../lib/wic/plugins/source/bootimg-efi-isar.py | 0
> .../lib/wic/plugins/source/bootimg-pcbios-isar.py | 0
> .../lib/wic/plugins/source/rootfs-u-boot.py | 91 ++++++++++++++++++++++
> scripts/lib/wic/plugins/source/rootfs.py | 7 +-
> 13 files changed, 152 insertions(+), 139 deletions(-)
> copy meta-isar/conf/{multiconfig/bananapi-stretch.conf => machine/bananapi.conf} (79%)
> delete mode 100644 meta/classes/wks-file.bbclass
> delete mode 100644 meta/recipes-bsp/u-boot-script/u-boot-script_1.0.bb
> create mode 100644 meta/recipes-bsp/u-boot-script/u-boot-script_1.1.bb
> rename {meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-efi-isar.py (100%)
> rename {meta-isar => meta}/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py (100%)
> create mode 100644 meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 13+ messages in thread