[v2] wic/plugins: Fix boot plugin

Message ID 20201126091750.28048-1-Vijaikumar_Kanagarajan@mentor.com
State Accepted, archived
Headers show
Series [v2] wic/plugins: Fix boot plugin | expand

Commit Message

Vijai Kumar K Nov. 25, 2020, 11:17 p.m. UTC
When we use --use-uuid along with bootimg plugin, it is observed
that the uuid updated in /etc/fstab is not same as the one the
disk created by bootimg has.

The latest wic[1] creates a UUID for use for these plugins, our ISAR
version of these plugins were not consuming the uuid generated by
wic while generating the partition. Instead a default volume id is
generated which is different from what is written by wic in fstab;
resulting in boot failure.

Fix the ISAR bootimg plugins to use the uuid from wic.

[1] https://github.com/openembedded/openembedded-core/commit/9256b8799495634ee8aee5d16ff71bd6e6e25ed4

Reported-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
Changes in v2:

Address review comment from Henning.
 - Dropped --use-uuid from common-isar.wks.inc

 meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py    | 3 ++-
 meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Henning Schild Nov. 26, 2020, 4:35 a.m. UTC | #1
Am Thu, 26 Nov 2020 14:47:50 +0530
schrieb Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>:

> When we use --use-uuid along with bootimg plugin, it is observed
> that the uuid updated in /etc/fstab is not same as the one the
> disk created by bootimg has.
> 
> The latest wic[1] creates a UUID for use for these plugins, our ISAR
> version of these plugins were not consuming the uuid generated by
> wic while generating the partition. Instead a default volume id is
> generated which is different from what is written by wic in fstab;
> resulting in boot failure.
> 
> Fix the ISAR bootimg plugins to use the uuid from wic.
> 
> [1]
> https://github.com/openembedded/openembedded-core/commit/9256b8799495634ee8aee5d16ff71bd6e6e25ed4
> 
> Reported-by: Henning Schild <henning.schild@siemens.com>

Tested-by: Henning Schild <henning.schild@siemens.com>

> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> ---
> Changes in v2:
> 
> Address review comment from Henning.
>  - Dropped --use-uuid from common-isar.wks.inc

I think this can be merged. But i am still not clear if that is all
that we missed to update in the forked plugins. If it is all, good to
go!

If it is not i rather wait for all the bits instead of merging such a
hotfix, which in itself might have unexpected outcome.

Henning

>  meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py    | 3 ++-
>  meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index
> 2285d2e..6b2fbc2 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -276,7
> +276,8 @@ class BootimgEFIPlugin(SourcePlugin): # dosfs image,
> created by mkdosfs bootimg = "%s/boot.img" % cr_workdir
>  
> -        dosfs_cmd = "mkdosfs -n efi -C %s %d" % (bootimg, blocks)
> +        dosfs_cmd = "mkdosfs -n efi -i %s -C %s %d" % \
> +                    (part.fsuuid, bootimg, blocks)
>          exec_cmd(dosfs_cmd)
>  
>          mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
> diff --git
> a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py index
> 493615b..b3d71c5 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@
> -209,7 +209,8 @@ class BootimgPcbiosIsarPlugin(SourcePlugin): # dosfs
> image, created by mkdosfs bootimg = "%s/boot.img" % cr_workdir 
> -        dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (bootimg,
> blocks)
> +        dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \
> +                    (part.fsuuid, bootimg, blocks)
>          exec_native_cmd(dosfs_cmd, native_sysroot)
>  
>          mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
Anton Mikanovich Feb. 9, 2021, 11:13 p.m. UTC | #2
26.11.2020 12:17, Vijai Kumar K wrote:
> When we use --use-uuid along with bootimg plugin, it is observed
> that the uuid updated in /etc/fstab is not same as the one the
> disk created by bootimg has.
>
> The latest wic[1] creates a UUID for use for these plugins, our ISAR
> version of these plugins were not consuming the uuid generated by
> wic while generating the partition. Instead a default volume id is
> generated which is different from what is written by wic in fstab;
> resulting in boot failure.
>
> Fix the ISAR bootimg plugins to use the uuid from wic.
>
> [1] https://github.com/openembedded/openembedded-core/commit/9256b8799495634ee8aee5d16ff71bd6e6e25ed4
>
> Reported-by: Henning Schild <henning.schild@siemens.com>
> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>

Applied to next, thanks.

Patch

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 2285d2e..6b2fbc2 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -276,7 +276,8 @@  class BootimgEFIPlugin(SourcePlugin):
         # dosfs image, created by mkdosfs
         bootimg = "%s/boot.img" % cr_workdir
 
-        dosfs_cmd = "mkdosfs -n efi -C %s %d" % (bootimg, blocks)
+        dosfs_cmd = "mkdosfs -n efi -i %s -C %s %d" % \
+                    (part.fsuuid, bootimg, blocks)
         exec_cmd(dosfs_cmd)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
index 493615b..b3d71c5 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -209,7 +209,8 @@  class BootimgPcbiosIsarPlugin(SourcePlugin):
         # dosfs image, created by mkdosfs
         bootimg = "%s/boot.img" % cr_workdir
 
-        dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (bootimg, blocks)
+        dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \
+                    (part.fsuuid, bootimg, blocks)
         exec_native_cmd(dosfs_cmd, native_sysroot)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)