Bug 12809

Summary: APPEND doesn't work with wic
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Anuj Mittal <anuj.mittal>
Component: Scripts and ToolsAssignee: Kevin Hao <kexin.hao>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: anon2313, ross.burton
Version: 5.99   
Target Milestone: 3.1 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Anuj Mittal 2018-06-22 07:41:26 UTC
Using APPEND at image level doesn't take effect when using the wks files with wic because none of the current kickstarter files use this value when passing parameters to bootloader's --append.

As an example, this won't take effect with wic:

http://cgit.openembedded.org/openembedded-core/commit/?id=cfc09de06ecc12bb42181004689e881c75072665

There's code present that can parse bitbake vars in a wks.in template file and that works as expected.

Is this an expected behavior or should it be changed to use APPEND var with a .wks.in file? Should the use of APPEND be discouraged and changed instead?
Comment 2 anon2313 2019-12-21 17:06:39 UTC
Thanks for the hint.  It's that easy.  This is the same change but for genericx86 targets that are part of Poky.  There's just too many other platforms that need changing (or at least there is a lot more wks files and I don't know which ones need to change).

diff --git a/meta-yocto-bsp/conf/machine/include/genericx86-common.inc b/meta-yocto-bsp/conf/machine/include/genericx86-common.inc
index f83ce5c594..5db91bee37 100644
--- a/meta-yocto-bsp/conf/machine/include/genericx86-common.inc
+++ b/meta-yocto-bsp/conf/machine/include/genericx86-common.inc
@@ -20,6 +20,6 @@ GLIBC_ADDONS = "nptl"
 EXTRA_OECONF_append_pn-matchbox-panel-2 = " --with-battery=acpi"
 
 IMAGE_FSTYPES += "wic wic.bmap"
-WKS_FILE ?= "genericx86.wks"
+WKS_FILE ?= "genericx86.wks.in"
 do_image_wic[depends] += "gptfdisk-native:do_populate_sysroot"
 do_image_wic[recrdeptask] += "do_bootimg"
diff --git a/meta-yocto-bsp/wic/genericx86.wks b/meta-yocto-bsp/wic/genericx86.wks.in
similarity index 80%
rename from meta-yocto-bsp/wic/genericx86.wks
rename to meta-yocto-bsp/wic/genericx86.wks.in
index dab719c584..7560035148 100644
--- a/meta-yocto-bsp/wic/genericx86.wks
+++ b/meta-yocto-bsp/wic/genericx86.wks.in
@@ -4,4 +4,4 @@ part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --
 part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid
 part swap --ondisk sda --size 44 --label swap1 --fstype=swap
 
-bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0"
+bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 ${APPEND}"
Comment 3 Kevin Hao 2020-03-17 01:11:37 UTC
commit dd372f09fc8a
Author: Kevin Hao <kexin.hao@windriver.com>
Date:   Thu Feb 13 10:31:41 2020 +0800

    wic: Honor APPEND
    
    APPEND is used to add additional parameters to kernel by features, such
    as read-only-rootfs. So we should honor this variable when we compose
    the kernel parameter in wic. I know we also can resolve this kind of
    issue by using the .wks.in template introduced by commit 42e870c5ed4b
    ("image_types.bbclass: support template .wks.in files for wic"), but the
    APPEND is needed by all the wks, it would seems pretty ridiculous to me
    to change all the .wks to .wks.in and then foist the APPEND into them.
    So the APPEND is definitely deserved to export to the wic directly.
    
    [Yocto #12809]
    
    (From OE-Core rev: 18981b8a457104391dfd94938c247eac04e4ed50)
    
    Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>