diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-02-26 06:55:05 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-03-15 17:22:49 +0300 |
commit | d7bf8c17eca8f8c89898a7794462c773c449e983 (patch) | |
tree | d18618fca85ca5f0c077032cc7b009344b60f663 /import-layers/yocto-poky/scripts/lib | |
parent | e2b5abdc9f28cdf8578e5b9be803c8e697443c20 (diff) | |
download | openbmc-d7bf8c17eca8f8c89898a7794462c773c449e983.tar.xz |
Yocto 2.4
Move OpenBMC to Yocto 2.4(rocko)
Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'import-layers/yocto-poky/scripts/lib')
129 files changed, 2651 insertions, 1442 deletions
diff --git a/import-layers/yocto-poky/scripts/lib/argparse_oe.py b/import-layers/yocto-poky/scripts/lib/argparse_oe.py index bf6eb1719..9bdfc1cec 100644 --- a/import-layers/yocto-poky/scripts/lib/argparse_oe.py +++ b/import-layers/yocto-poky/scripts/lib/argparse_oe.py @@ -167,3 +167,10 @@ class OeHelpFormatter(argparse.HelpFormatter): return '\n'.join(lines) else: return super(OeHelpFormatter, self)._format_action(action) + +def int_positive(value): + ivalue = int(value) + if ivalue <= 0: + raise argparse.ArgumentTypeError( + "%s is not a positive int value" % value) + return ivalue diff --git a/import-layers/yocto-poky/scripts/lib/bsp/help.py b/import-layers/yocto-poky/scripts/lib/bsp/help.py index 4f0d7721f..85d446b86 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/help.py +++ b/import-layers/yocto-poky/scripts/lib/bsp/help.py @@ -818,6 +818,10 @@ yocto_layer_help_usage = """ yocto_layer_create_usage = """ + WARNING: this plugin will be removed starting 2.5 development in favour + of using 'bitbake-layers create-layer' script/plugin, offering a single + script to manage layers. + Create a new generic Yocto layer usage: yocto-layer create <layer-name> [layer_priority] @@ -845,6 +849,10 @@ yocto_layer_create_usage = """ yocto_layer_create_help = """ +WARNING: this plugin will be removed starting 2.5 development in favour +of using 'bitbake-layers create-layer' script/plugin, offering a single +script to manage layers. + NAME yocto-layer create - Create a new generic Yocto layer diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc index 828400df4..fb3866f11 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc @@ -4,5 +4,3 @@ kconf non-hardware {{machine}}-non_hardware.cfg include features/usb-net/usb-net.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend index d15a178e1..6f3e104c6 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ @@ -30,6 +32,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.10.bbappend index eaf436759..dfbecb533 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.12.bbappend index 4e7d7cbed..e874c9e45 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.4.bbappend index 56e8ad3a1..a809c7600 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb index fda955b5e..3ba4226aa 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb @@ -42,6 +42,7 @@ SRC_URI += "file://{{=machine}}.scc \ file://{{=machine}}.cfg \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ " {{ if kernel_choice == "custom" and custom_kernel_need_kbranch == "y" and custom_kernel_kbranch and custom_kernel_kbranch != "master": }} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc new file mode 100644 index 000000000..582759e61 --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc index 0b6b41337..64d3ed181 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc @@ -14,5 +14,3 @@ kconf hardware {{=machine}}.cfg # These are used by yocto-kernel to add config fragments and features. # Don't remove if you plan on using yocto-kernel with this BSP. -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc index 3d32f111b..3e4c54fcf 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc @@ -17,5 +17,3 @@ include cfg/usb-mass-storage.scc include cfg/boot-live.scc include features/power/intel.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend index c391322e3..6f3e104c6 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ @@ -30,6 +32,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.10.bbappend index 02059207d..f8616ed87 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.12.bbappend index 5ed144b0e..20d57f673 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.4.bbappend index ab644bdad..0a9d47595 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index a535aeab8..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard:standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard:standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc index f39dc3edf..792fdc94a 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc @@ -4,5 +4,3 @@ kconf hardware {{=machine}}.cfg include cfg/usb-mass-storage.scc include cfg/fs/vfat.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend deleted file mode 100644 index d15a178e1..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend index d15a178e1..6f3e104c6 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ @@ -30,6 +32,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend deleted file mode 100644 index c391322e3..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.10.bbappend index eaf436759..dfbecb533 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.12.bbappend index 59752a9ed..e874c9e45 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.4.bbappend index 56e8ad3a1..a809c7600 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc index f39dc3edf..792fdc94a 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc @@ -4,5 +4,3 @@ kconf hardware {{=machine}}.cfg include cfg/usb-mass-storage.scc include cfg/fs/vfat.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend deleted file mode 100644 index d15a178e1..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend index c391322e3..6f3e104c6 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ @@ -30,6 +32,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend deleted file mode 100644 index c391322e3..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.10.bbappend index 512b59758..336a95631 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.12.bbappend index 802e5f465..5333c30b8 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.4.bbappend index dbb0fd55a..7d18566b2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index c2eb40d49..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc index 7aac8b080..89bb97efd 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc @@ -6,5 +6,3 @@ include cfg/fs/vfat.scc include cfg/dmaengine.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend deleted file mode 100644 index d15a178e1..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend new file mode 100644 index 000000000..6f3e104c6 --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -0,0 +1,37 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" +SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" +#LINUX_VERSION = "4.10" +#Remove the following line once AUTOREV is locked to a certain SRCREV +KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend deleted file mode 100644 index c391322e3..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.1.bbappend deleted file mode 100644 index 4e7d7cbed..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.10.bbappend index eaf436759..dfbecb533 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.12.bbappend index 4e7d7cbed..e874c9e45 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.4.bbappend index 56e8ad3a1..a809c7600 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index 59752a9ed..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc index 8301e05f7..d25d0a037 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc @@ -1,5 +1,3 @@ # yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend index 7e3ce5ba1..d7b9cef98 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -45,11 +45,15 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 29ad17b20..8c0fd1577 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -45,11 +45,14 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend index 81392ce38..83eb216dc 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -45,11 +45,14 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ @@ -59,6 +62,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index a73b1aa13..22abc230b 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -45,11 +45,14 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend deleted file mode 100644 index 7d40671fd..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ /dev/null @@ -1,64 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y" and qemuarch == "arm": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"arm" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "arm": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"arm" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "powerpc": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "powerpc": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/common-pc" }} - -{{ if need_new_kbranch == "y" and qemuarch == "x86_64": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "x86_64": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "mips": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "mips": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.10.bbappend index 5873da424..851d96c37 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -45,13 +45,17 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.12.bbappend index a9fd9ecff..d7ce37e23 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -45,19 +45,23 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.4.bbappend index cdee77379..71be913bb 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -45,13 +45,17 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" +{{ if qemuarch != "arm": }} {{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index 24c28803e..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,63 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y" and qemuarch == "arm": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base your new BSP branch on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "arm": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose an existing machine branch to use for this BSP:" default:"standard/arm-versatile-926ejs" }} - -{{ if need_new_kbranch == "y" and qemuarch == "powerpc": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "powerpc": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/qemuppc" }} - -{{ if need_new_kbranch == "y" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "x86_64": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "x86_64": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n" and qemuarch == "mips": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta32" }} - -{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta64" }} - -{{ if need_new_kbranch == "y" and qemuarch == "mips": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc index 9b7c291a8..9d20d199b 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc @@ -10,5 +10,3 @@ include features/i915/i915.scc include cfg/usb-mass-storage.scc include features/power/intel.scc -kconf hardware {{=machine}}-user-config.cfg -include {{=machine}}-user-patches.scc diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall index 20f2059ce..917f0e220 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.10) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (4.12) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.10"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_4.12"}} diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend index c336007eb..22ed27381 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -19,7 +19,10 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend deleted file mode 100644 index d15a178e1..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.1.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend index 5cc82e82a..bae943ea1 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend new file mode 100644 index 000000000..6f3e104c6 --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -0,0 +1,37 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.12": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" +SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" +#LINUX_VERSION = "4.10" +#Remove the following line once AUTOREV is locked to a certain SRCREV +KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend index 070bd876a..62d1817f2 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -20,7 +20,9 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-tiny.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-tiny.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend deleted file mode 100644 index c391322e3..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_4.8.bbappend +++ /dev/null @@ -1,35 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.1.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.1.bbappend deleted file mode 100644 index 4e7d7cbed..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.1.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.1": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.1" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.10.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.10.bbappend index eaf436759..dfbecb533 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.10.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.12.bbappend index 59752a9ed..e874c9e45 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -1,4 +1,4 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.12": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -20,15 +20,18 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" +#LINUX_VERSION = "4.10" #Remove the following line once AUTOREV is locked to a certain SRCREV KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.4.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.4.bbappend index 56e8ad3a1..a809c7600 100644 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -20,9 +20,12 @@ KBRANCH_{{=machine}} = "{{=existing_kbranch}}" {{ if smp == "y": }} KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" -SRC_URI += "file://{{=machine}}-standard.scc \ +SRC_URI += "file://{{=machine}}.scc \ + file://{{=machine}}.cfg \ + file://{{=machine}}-standard.scc \ file://{{=machine}}-user-config.cfg \ file://{{=machine}}-user-features.scc \ + file://{{=machine}}-user-patches.scc \ " # replace these SRCREVs with the real commit ids once you've had diff --git a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.8.bbappend b/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index 59752a9ed..000000000 --- a/import-layers/yocto-poky/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_4.8": }} this -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-features.scc \ - " - -# replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "${AUTOREV}" -#LINUX_VERSION = "4.8" -#Remove the following line once AUTOREV is locked to a certain SRCREV -KERNEL_VERSION_SANITY_SKIP = "1" diff --git a/import-layers/yocto-poky/scripts/lib/build_perf/html/report.html b/import-layers/yocto-poky/scripts/lib/build_perf/html/report.html index 165cbb811..291ad9d72 100644 --- a/import-layers/yocto-poky/scripts/lib/build_perf/html/report.html +++ b/import-layers/yocto-poky/scripts/lib/build_perf/html/report.html @@ -53,9 +53,11 @@ summary th, .meta-table td { border-collapse: collapse; } .details th { - font-weight: normal; padding-right: 8px; } +.details.plain th { + font-weight: normal; +} .preformatted { font-family: monospace; white-space: pre-wrap; @@ -118,29 +120,32 @@ h3 { {% else %} {% set row_style = 'style="background-color: #ffffff"' %} {% endif %} - <tr {{ row_style }}><td>{{ test.name }}: {{ test.description }}</td> {% if test.status == 'SUCCESS' %} {% for measurement in test.measurements %} - {# add empty cell in place of the test name#} - {% if loop.index > 1 %}<td></td>{% endif %} - {% if measurement.absdiff > 0 %} - {% set result_style = "color: red" %} - {% elif measurement.absdiff == measurement.absdiff %} - {% set result_style = "color: green" %} - {% else %} - {% set result_style = "color: orange" %} - {%endif %} - <td>{{ measurement.description }}</td> - <td style="font-weight: bold">{{ measurement.value.mean }}</td> - <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td> - <td style="{{ result_style }}">{{ measurement.reldiff }}</td> - </tr><tr {{ row_style }}> + <tr {{ row_style }}> + {% if loop.index == 1 %} + <td>{{ test.name }}: {{ test.description }}</td> + {% else %} + {# add empty cell in place of the test name#} + <td></td> + {% endif %} + {% if measurement.absdiff > 0 %} + {% set result_style = "color: red" %} + {% elif measurement.absdiff == measurement.absdiff %} + {% set result_style = "color: green" %} + {% else %} + {% set result_style = "color: orange" %} + {%endif %} + <td>{{ measurement.description }}</td> + <td style="font-weight: bold">{{ measurement.value.mean }}</td> + <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td> + <td style="{{ result_style }}">{{ measurement.reldiff }}</td> + </tr> {% endfor %} {% else %} <td style="font-weight: bold; color: red;">{{test.status }}</td> <td></td> <td></td> <td></td> <td></td> {% endif %} - </tr> {% endfor %} </table> @@ -165,6 +170,7 @@ h3 { {{ measurement.absdiff_str }} ({{measurement.reldiff}}) </span></span> </div> + {# Table for trendchart and the statistics #} <table style="width: 100%"> <tr> <td style="width: 75%"> @@ -173,7 +179,7 @@ h3 { </td> <td> {# Measurement statistics #} - <table class="details"> + <table class="details plain"> <tr> <th>Test runs</th><td>{{ measurement.value.sample_cnt }}</td> </tr><tr> @@ -186,11 +192,85 @@ h3 { <th>Stdev</th><td>{{ measurement.value.stdev }}</td> </tr><tr> <th><div id="{{ test.name }}_{{ measurement.name }}_chart_png"></div></th> + <td></td> </tr> </table> </td> </tr> </table> + + {# Task and recipe summary from buildstats #} + {% if 'buildstats' in measurement %} + Task resource usage + <table class="details" style="width:100%"> + <tr> + <th>Number of tasks</th> + <th>Top consumers of cputime</th> + </tr> + <tr> + <td style="vertical-align: top">{{ measurement.buildstats.tasks.count }} ({{ measurement.buildstats.tasks.change }})</td> + {# Table of most resource-hungry tasks #} + <td> + <table class="details plain"> + {% for diff in measurement.buildstats.top_consumer|reverse %} + <tr> + <th>{{ diff.pkg }}.{{ diff.task }}</th> + <td>{{ '%0.0f' % diff.value2 }} s</td> + </tr> + {% endfor %} + </table> + </td> + </tr> + <tr> + <th>Biggest increase in cputime</th> + <th>Biggest decrease in cputime</th> + </tr> + <tr> + {# Table biggest increase in resource usage #} + <td> + <table class="details plain"> + {% for diff in measurement.buildstats.top_increase|reverse %} + <tr> + <th>{{ diff.pkg }}.{{ diff.task }}</th> + <td>{{ '%+0.0f' % diff.absdiff }} s</td> + </tr> + {% endfor %} + </table> + </td> + {# Table biggest decrease in resource usage #} + <td> + <table class="details plain"> + {% for diff in measurement.buildstats.top_decrease %} + <tr> + <th>{{ diff.pkg }}.{{ diff.task }}</th> + <td>{{ '%+0.0f' % diff.absdiff }} s</td> + </tr> + {% endfor %} + </table> + </td> + </tr> + </table> + + {# Recipe version differences #} + {% if measurement.buildstats.ver_diff %} + <div style="margin-top: 16px">Recipe version changes</div> + <table class="details"> + {% for head, recipes in measurement.buildstats.ver_diff.items() %} + <tr> + <th colspan="2">{{ head }}</th> + </tr> + {% for name, info in recipes|sort %} + <tr> + <td>{{ name }}</td> + <td>{{ info }}</td> + </tr> + {% endfor %} + {% endfor %} + </table> + {% else %} + <div style="margin-top: 16px">No recipe version changes detected</div> + {% endif %} + {% endif %} </div> {% endfor %} {# Unsuccessful test #} diff --git a/import-layers/yocto-poky/scripts/lib/build_perf/report.py b/import-layers/yocto-poky/scripts/lib/build_perf/report.py index eb00ccca2..d99a36797 100644 --- a/import-layers/yocto-poky/scripts/lib/build_perf/report.py +++ b/import-layers/yocto-poky/scripts/lib/build_perf/report.py @@ -11,12 +11,15 @@ # more details. # """Handling of build perf test reports""" -from collections import OrderedDict, Mapping +from collections import OrderedDict, Mapping, namedtuple from datetime import datetime, timezone from numbers import Number from statistics import mean, stdev, variance +AggregateTestData = namedtuple('AggregateTestData', ['metadata', 'results']) + + def isofmt_to_timestamp(string): """Convert timestamp string in ISO 8601 format into unix timestamp""" if '.' in string: diff --git a/import-layers/yocto-poky/scripts/lib/buildstats.py b/import-layers/yocto-poky/scripts/lib/buildstats.py new file mode 100644 index 000000000..d9aadf3cb --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/buildstats.py @@ -0,0 +1,349 @@ +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +"""Functionality for analyzing buildstats""" +import json +import logging +import os +import re +from collections import namedtuple,OrderedDict +from statistics import mean + + +log = logging.getLogger() + + +taskdiff_fields = ('pkg', 'pkg_op', 'task', 'task_op', 'value1', 'value2', + 'absdiff', 'reldiff') +TaskDiff = namedtuple('TaskDiff', ' '.join(taskdiff_fields)) + + +class BSError(Exception): + """Error handling of buildstats""" + pass + + +class BSTask(dict): + def __init__(self, *args, **kwargs): + self['start_time'] = None + self['elapsed_time'] = None + self['status'] = None + self['iostat'] = {} + self['rusage'] = {} + self['child_rusage'] = {} + super(BSTask, self).__init__(*args, **kwargs) + + @property + def cputime(self): + """Sum of user and system time taken by the task""" + rusage = self['rusage']['ru_stime'] + self['rusage']['ru_utime'] + if self['child_rusage']: + # Child rusage may have been optimized out + return rusage + self['child_rusage']['ru_stime'] + self['child_rusage']['ru_utime'] + else: + return rusage + + @property + def walltime(self): + """Elapsed wall clock time""" + return self['elapsed_time'] + + @property + def read_bytes(self): + """Bytes read from the block layer""" + return self['iostat']['read_bytes'] + + @property + def write_bytes(self): + """Bytes written to the block layer""" + return self['iostat']['write_bytes'] + + @property + def read_ops(self): + """Number of read operations on the block layer""" + if self['child_rusage']: + # Child rusage may have been optimized out + return self['rusage']['ru_inblock'] + self['child_rusage']['ru_inblock'] + else: + return self['rusage']['ru_inblock'] + + @property + def write_ops(self): + """Number of write operations on the block layer""" + if self['child_rusage']: + # Child rusage may have been optimized out + return self['rusage']['ru_oublock'] + self['child_rusage']['ru_oublock'] + else: + return self['rusage']['ru_oublock'] + + @classmethod + def from_file(cls, buildstat_file): + """Read buildstat text file""" + bs_task = cls() + log.debug("Reading task buildstats from %s", buildstat_file) + end_time = None + with open(buildstat_file) as fobj: + for line in fobj.readlines(): + key, val = line.split(':', 1) + val = val.strip() + if key == 'Started': + start_time = float(val) + bs_task['start_time'] = start_time + elif key == 'Ended': + end_time = float(val) + elif key.startswith('IO '): + split = key.split() + bs_task['iostat'][split[1]] = int(val) + elif key.find('rusage') >= 0: + split = key.split() + ru_key = split[-1] + if ru_key in ('ru_stime', 'ru_utime'): + val = float(val) + else: + val = int(val) + ru_type = 'rusage' if split[0] == 'rusage' else \ + 'child_rusage' + bs_task[ru_type][ru_key] = val + elif key == 'Status': + bs_task['status'] = val + if end_time is not None and start_time is not None: + bs_task['elapsed_time'] = end_time - start_time + else: + raise BSError("{} looks like a invalid buildstats file".format(buildstat_file)) + return bs_task + + +class BSTaskAggregate(object): + """Class representing multiple runs of the same task""" + properties = ('cputime', 'walltime', 'read_bytes', 'write_bytes', + 'read_ops', 'write_ops') + + def __init__(self, tasks=None): + self._tasks = tasks or [] + self._properties = {} + + def __getattr__(self, name): + if name in self.properties: + if name not in self._properties: + # Calculate properties on demand only. We only provide mean + # value, so far + self._properties[name] = mean([getattr(t, name) for t in self._tasks]) + return self._properties[name] + else: + raise AttributeError("'BSTaskAggregate' has no attribute '{}'".format(name)) + + def append(self, task): + """Append new task""" + # Reset pre-calculated properties + assert isinstance(task, BSTask), "Type is '{}' instead of 'BSTask'".format(type(task)) + self._properties = {} + self._tasks.append(task) + + +class BSRecipe(object): + """Class representing buildstats of one recipe""" + def __init__(self, name, epoch, version, revision): + self.name = name + self.epoch = epoch + self.version = version + self.revision = revision + if epoch is None: + self.evr = "{}-{}".format(version, revision) + else: + self.evr = "{}_{}-{}".format(epoch, version, revision) + self.tasks = {} + + def aggregate(self, bsrecipe): + """Aggregate data of another recipe buildstats""" + if self.nevr != bsrecipe.nevr: + raise ValueError("Refusing to aggregate buildstats, recipe version " + "differs: {} vs. {}".format(self.nevr, bsrecipe.nevr)) + if set(self.tasks.keys()) != set(bsrecipe.tasks.keys()): + raise ValueError("Refusing to aggregate buildstats, set of tasks " + "in {} differ".format(self.name)) + + for taskname, taskdata in bsrecipe.tasks.items(): + if not isinstance(self.tasks[taskname], BSTaskAggregate): + self.tasks[taskname] = BSTaskAggregate([self.tasks[taskname]]) + self.tasks[taskname].append(taskdata) + + @property + def nevr(self): + return self.name + '-' + self.evr + + +class BuildStats(dict): + """Class representing buildstats of one build""" + + @property + def num_tasks(self): + """Get number of tasks""" + num = 0 + for recipe in self.values(): + num += len(recipe.tasks) + return num + + @classmethod + def from_json(cls, bs_json): + """Create new BuildStats object from JSON object""" + buildstats = cls() + for recipe in bs_json: + if recipe['name'] in buildstats: + raise BSError("Cannot handle multiple versions of the same " + "package ({})".format(recipe['name'])) + bsrecipe = BSRecipe(recipe['name'], recipe['epoch'], + recipe['version'], recipe['revision']) + for task, data in recipe['tasks'].items(): + bsrecipe.tasks[task] = BSTask(data) + + buildstats[recipe['name']] = bsrecipe + + return buildstats + + @staticmethod + def from_file_json(path): + """Load buildstats from a JSON file""" + with open(path) as fobj: + bs_json = json.load(fobj) + return BuildStats.from_json(bs_json) + + + @staticmethod + def split_nevr(nevr): + """Split name and version information from recipe "nevr" string""" + n_e_v, revision = nevr.rsplit('-', 1) + match = re.match(r'^(?P<name>\S+)-((?P<epoch>[0-9]{1,5})_)?(?P<version>[0-9]\S*)$', + n_e_v) + if not match: + # If we're not able to parse a version starting with a number, just + # take the part after last dash + match = re.match(r'^(?P<name>\S+)-((?P<epoch>[0-9]{1,5})_)?(?P<version>[^-]+)$', + n_e_v) + name = match.group('name') + version = match.group('version') + epoch = match.group('epoch') + return name, epoch, version, revision + + @classmethod + def from_dir(cls, path): + """Load buildstats from a buildstats directory""" + if not os.path.isfile(os.path.join(path, 'build_stats')): + raise BSError("{} does not look like a buildstats directory".format(path)) + + log.debug("Reading buildstats directory %s", path) + + buildstats = cls() + subdirs = os.listdir(path) + for dirname in subdirs: + recipe_dir = os.path.join(path, dirname) + if not os.path.isdir(recipe_dir): + continue + name, epoch, version, revision = cls.split_nevr(dirname) + bsrecipe = BSRecipe(name, epoch, version, revision) + for task in os.listdir(recipe_dir): + bsrecipe.tasks[task] = BSTask.from_file( + os.path.join(recipe_dir, task)) + if name in buildstats: + raise BSError("Cannot handle multiple versions of the same " + "package ({})".format(name)) + buildstats[name] = bsrecipe + + return buildstats + + def aggregate(self, buildstats): + """Aggregate other buildstats into this""" + if set(self.keys()) != set(buildstats.keys()): + raise ValueError("Refusing to aggregate buildstats, set of " + "recipes is different") + for pkg, data in buildstats.items(): + self[pkg].aggregate(data) + + +def diff_buildstats(bs1, bs2, stat_attr, min_val=None, min_absdiff=None): + """Compare the tasks of two buildstats""" + tasks_diff = [] + pkgs = set(bs1.keys()).union(set(bs2.keys())) + for pkg in pkgs: + tasks1 = bs1[pkg].tasks if pkg in bs1 else {} + tasks2 = bs2[pkg].tasks if pkg in bs2 else {} + if not tasks1: + pkg_op = '+' + elif not tasks2: + pkg_op = '-' + else: + pkg_op = ' ' + + for task in set(tasks1.keys()).union(set(tasks2.keys())): + task_op = ' ' + if task in tasks1: + val1 = getattr(bs1[pkg].tasks[task], stat_attr) + else: + task_op = '+' + val1 = 0 + if task in tasks2: + val2 = getattr(bs2[pkg].tasks[task], stat_attr) + else: + val2 = 0 + task_op = '-' + + if val1 == 0: + reldiff = float('inf') + else: + reldiff = 100 * (val2 - val1) / val1 + + if min_val and max(val1, val2) < min_val: + log.debug("Filtering out %s:%s (%s)", pkg, task, + max(val1, val2)) + continue + if min_absdiff and abs(val2 - val1) < min_absdiff: + log.debug("Filtering out %s:%s (difference of %s)", pkg, task, + val2-val1) + continue + tasks_diff.append(TaskDiff(pkg, pkg_op, task, task_op, val1, val2, + val2-val1, reldiff)) + return tasks_diff + + +class BSVerDiff(object): + """Class representing recipe version differences between two buildstats""" + def __init__(self, bs1, bs2): + RecipeVerDiff = namedtuple('RecipeVerDiff', 'left right') + + recipes1 = set(bs1.keys()) + recipes2 = set(bs2.keys()) + + self.new = dict([(r, bs2[r]) for r in sorted(recipes2 - recipes1)]) + self.dropped = dict([(r, bs1[r]) for r in sorted(recipes1 - recipes2)]) + self.echanged = {} + self.vchanged = {} + self.rchanged = {} + self.unchanged = {} + self.empty_diff = False + + common = recipes2.intersection(recipes1) + if common: + for recipe in common: + rdiff = RecipeVerDiff(bs1[recipe], bs2[recipe]) + if bs1[recipe].epoch != bs2[recipe].epoch: + self.echanged[recipe] = rdiff + elif bs1[recipe].version != bs2[recipe].version: + self.vchanged[recipe] = rdiff + elif bs1[recipe].revision != bs2[recipe].revision: + self.rchanged[recipe] = rdiff + else: + self.unchanged[recipe] = rdiff + + if len(recipes1) == len(recipes2) == len(self.unchanged): + self.empty_diff = True + + def __bool__(self): + return not self.empty_diff diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/__init__.py b/import-layers/yocto-poky/scripts/lib/checklayer/__init__.py index 7197e850e..63952616b 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/__init__.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/__init__.py @@ -1,4 +1,4 @@ -# Yocto Project compatibility layer tool +# Yocto Project layer check tool # # Copyright (C) 2017 Intel Corporation # Released under the MIT license (see COPYING.MIT) @@ -46,16 +46,16 @@ def _get_layer_collections(layer_path, lconf=None, data=None): raise LayerError(exc) ldata.expandVarref('LAYERDIR') - collections = (ldata.getVar('BBFILE_COLLECTIONS', True) or '').split() + collections = (ldata.getVar('BBFILE_COLLECTIONS') or '').split() if not collections: name = os.path.basename(layer_path) collections = [name] collections = {c: {} for c in collections} for name in collections: - priority = ldata.getVar('BBFILE_PRIORITY_%s' % name, True) - pattern = ldata.getVar('BBFILE_PATTERN_%s' % name, True) - depends = ldata.getVar('LAYERDEPENDS_%s' % name, True) + priority = ldata.getVar('BBFILE_PRIORITY_%s' % name) + pattern = ldata.getVar('BBFILE_PATTERN_%s' % name) + depends = ldata.getVar('LAYERDEPENDS_%s' % name) collections[name]['priority'] = priority collections[name]['pattern'] = pattern collections[name]['depends'] = depends diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/case.py b/import-layers/yocto-poky/scripts/lib/checklayer/case.py index 54ce78aa6..9dd00412e 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/case.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/case.py @@ -3,5 +3,5 @@ from oeqa.core.case import OETestCase -class OECompatLayerTestCase(OETestCase): +class OECheckLayerTestCase(OETestCase): pass diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/__init__.py b/import-layers/yocto-poky/scripts/lib/checklayer/cases/__init__.py index e69de29bb..e69de29bb 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/__init__.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/cases/__init__.py diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/bsp.py b/import-layers/yocto-poky/scripts/lib/checklayer/cases/bsp.py index 43efae406..b6b611be7 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/bsp.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/cases/bsp.py @@ -3,14 +3,14 @@ import unittest -from compatlayer import LayerType, get_signatures, check_command, get_depgraph -from compatlayer.case import OECompatLayerTestCase +from checklayer import LayerType, get_signatures, check_command, get_depgraph +from checklayer.case import OECheckLayerTestCase -class BSPCompatLayer(OECompatLayerTestCase): +class BSPCheckLayer(OECheckLayerTestCase): @classmethod def setUpClass(self): if self.tc.layer['type'] != LayerType.BSP: - raise unittest.SkipTest("BSPCompatLayer: Layer %s isn't BSP one." %\ + raise unittest.SkipTest("BSPCheckLayer: Layer %s isn't BSP one." %\ self.tc.layer['name']) def test_bsp_defines_machines(self): @@ -62,7 +62,7 @@ class BSPCompatLayer(OECompatLayerTestCase): This criteria can only be tested by testing different machines in combination, i.e. one main layer, potentially several additional BSP layers and an explicit choice of machines: - yocto-compat-layer --additional-layers .../meta-intel --machines intel-corei7-64 imx6slevk -- .../meta-freescale + yocto-check-layer --additional-layers .../meta-intel --machines intel-corei7-64 imx6slevk -- .../meta-freescale ''' if not self.td['machines']: diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/common.py b/import-layers/yocto-poky/scripts/lib/checklayer/cases/common.py index 55e8ba4c5..a13c1088f 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/common.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/cases/common.py @@ -4,10 +4,10 @@ import glob import os import unittest -from compatlayer import get_signatures, LayerType, check_command, get_depgraph, compare_signatures -from compatlayer.case import OECompatLayerTestCase +from checklayer import get_signatures, LayerType, check_command, get_depgraph, compare_signatures +from checklayer.case import OECheckLayerTestCase -class CommonCompatLayer(OECompatLayerTestCase): +class CommonCheckLayer(OECheckLayerTestCase): def test_readme(self): # The top-level README file may have a suffix (like README.rst or README.txt). readme_files = glob.glob(os.path.join(self.tc.layer['path'], 'README*')) diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/distro.py b/import-layers/yocto-poky/scripts/lib/checklayer/cases/distro.py index 523acc1e7..df1b3035e 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/cases/distro.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/cases/distro.py @@ -3,14 +3,14 @@ import unittest -from compatlayer import LayerType -from compatlayer.case import OECompatLayerTestCase +from checklayer import LayerType +from checklayer.case import OECheckLayerTestCase -class DistroCompatLayer(OECompatLayerTestCase): +class DistroCheckLayer(OECheckLayerTestCase): @classmethod def setUpClass(self): if self.tc.layer['type'] != LayerType.DISTRO: - raise unittest.SkipTest("DistroCompatLayer: Layer %s isn't Distro one." %\ + raise unittest.SkipTest("DistroCheckLayer: Layer %s isn't Distro one." %\ self.tc.layer['name']) def test_distro_defines_distros(self): diff --git a/import-layers/yocto-poky/scripts/lib/compatlayer/context.py b/import-layers/yocto-poky/scripts/lib/checklayer/context.py index 7811d4ac2..1bec2c410 100644 --- a/import-layers/yocto-poky/scripts/lib/compatlayer/context.py +++ b/import-layers/yocto-poky/scripts/lib/checklayer/context.py @@ -8,8 +8,8 @@ import re from oeqa.core.context import OETestContext -class CompatLayerTestContext(OETestContext): +class CheckLayerTestContext(OETestContext): def __init__(self, td=None, logger=None, layer=None, test_software_layer_signatures=True): - super(CompatLayerTestContext, self).__init__(td, logger) + super(CheckLayerTestContext, self).__init__(td, logger) self.layer = layer self.test_software_layer_signatures = test_software_layer_signatures diff --git a/import-layers/yocto-poky/scripts/lib/devtool/__init__.py b/import-layers/yocto-poky/scripts/lib/devtool/__init__.py index d646b0cf6..94e3d7d4b 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/__init__.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/__init__.py @@ -115,8 +115,8 @@ def setup_tinfoil(config_only=False, basepath=None, tracking=False): import bb.tinfoil tinfoil = bb.tinfoil.Tinfoil(tracking=tracking) try: - tinfoil.prepare(config_only) tinfoil.logger.setLevel(logger.getEffectiveLevel()) + tinfoil.prepare(config_only) except bb.tinfoil.TinfoilUIException: tinfoil.shutdown() raise DevtoolError('Failed to start bitbake environment') @@ -191,7 +191,7 @@ def use_external_build(same_dir, no_same_dir, d): logger.info('Using source tree as build directory since --same-dir specified') elif bb.data.inherits_class('autotools-brokensep', d): logger.info('Using source tree as build directory since recipe inherits autotools-brokensep') - elif d.getVar('B') == os.path.abspath(d.getVar('S')): + elif os.path.abspath(d.getVar('B')) == os.path.abspath(d.getVar('S')): logger.info('Using source tree as build directory since that would be the default for this recipe') else: b_is_s = False @@ -261,34 +261,79 @@ def get_bbclassextend_targets(recipefile, pn): targets.append('%s-%s' % (pn, variant)) return targets -def ensure_npm(config, basepath, fixed_setup=False, check_exists=True): - """ - Ensure that npm is available and either build it or show a - reasonable error message - """ - if check_exists: - tinfoil = setup_tinfoil(config_only=False, basepath=basepath) - try: - rd = tinfoil.parse_recipe('nodejs-native') - nativepath = rd.getVar('STAGING_BINDIR_NATIVE') - finally: - tinfoil.shutdown() - npmpath = os.path.join(nativepath, 'npm') - build_npm = not os.path.exists(npmpath) - else: - build_npm = True +def replace_from_file(path, old, new): + """Replace strings on a file""" + + def read_file(path): + data = None + with open(path) as f: + data = f.read() + return data + + def write_file(path, data): + if data is None: + return + wdata = data.rstrip() + "\n" + with open(path, "w") as f: + f.write(wdata) + + # In case old is None, return immediately + if old is None: + return + try: + rdata = read_file(path) + except IOError as e: + # if file does not exit, just quit, otherwise raise an exception + if e.errno == errno.ENOENT: + return + else: + raise - if build_npm: - logger.info('Building nodejs-native') + old_contents = rdata.splitlines() + new_contents = [] + for old_content in old_contents: try: - exec_build_env_command(config.init_path, basepath, - 'bitbake -q nodejs-native -c addto_recipe_sysroot', watch=True) - except bb.process.ExecutionError as e: - if "Nothing PROVIDES 'nodejs-native'" in e.stdout: - if fixed_setup: - msg = 'nodejs-native is required for npm but is not available within this SDK' - else: - msg = 'nodejs-native is required for npm but is not available - you will likely need to add a layer that provides nodejs' - raise DevtoolError(msg) - else: - raise + new_contents.append(old_content.replace(old, new)) + except ValueError: + pass + write_file(path, "\n".join(new_contents)) + + +def update_unlockedsigs(basepath, workspace, fixed_setup, extra=None): + """ This function will make unlocked-sigs.inc match the recipes in the + workspace plus any extras we want unlocked. """ + + if not fixed_setup: + # Only need to write this out within the eSDK + return + + if not extra: + extra = [] + + confdir = os.path.join(basepath, 'conf') + unlockedsigs = os.path.join(confdir, 'unlocked-sigs.inc') + + # Get current unlocked list if any + values = {} + def get_unlockedsigs_varfunc(varname, origvalue, op, newlines): + values[varname] = origvalue + return origvalue, None, 0, True + if os.path.exists(unlockedsigs): + with open(unlockedsigs, 'r') as f: + bb.utils.edit_metadata(f, ['SIGGEN_UNLOCKED_RECIPES'], get_unlockedsigs_varfunc) + unlocked = sorted(values.get('SIGGEN_UNLOCKED_RECIPES', [])) + + # If the new list is different to the current list, write it out + newunlocked = sorted(list(workspace.keys()) + extra) + if unlocked != newunlocked: + bb.utils.mkdirhier(confdir) + with open(unlockedsigs, 'w') as f: + f.write("# DO NOT MODIFY! YOUR CHANGES WILL BE LOST.\n" + + "# This layer was created by the OpenEmbedded devtool" + + " utility in order to\n" + + "# contain recipes that are unlocked.\n") + + f.write('SIGGEN_UNLOCKED_RECIPES += "\\\n') + for pn in newunlocked: + f.write(' ' + pn) + f.write('"') diff --git a/import-layers/yocto-poky/scripts/lib/devtool/deploy.py b/import-layers/yocto-poky/scripts/lib/devtool/deploy.py index b3730ae83..9cc492788 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/deploy.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/deploy.py @@ -16,12 +16,16 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """Devtool plugin containing the deploy subcommands""" +import logging import os +import shutil import subprocess -import logging import tempfile -import shutil + +import bb.utils import argparse_oe +import oe.types + from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError logger = logging.getLogger('devtool') @@ -64,7 +68,7 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals lines.append(' rmdir $file > /dev/null 2>&1 || true') lines.append(' fi') lines.append(' else') - lines.append(' rm $file') + lines.append(' rm -f $file') lines.append(' fi') lines.append(' done') if not dryrun: @@ -119,7 +123,11 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals # Put any preserved files back lines.append('if [ -d $preservedir ] ; then') lines.append(' cd $preservedir') - lines.append(' find . -type f -exec mv {} /{} \;') + # find from busybox might not have -exec, so we don't use that + lines.append(' find . -type f | while read file') + lines.append(' do') + lines.append(' mv $file /$file') + lines.append(' done') lines.append(' cd /') lines.append(' rm -rf $preservedir') lines.append('fi') @@ -136,11 +144,12 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals return '\n'.join(lines) + def deploy(args, config, basepath, workspace): """Entry point for the devtool 'deploy' subcommand""" - import re import math import oe.recipeutils + import oe.package check_workspace_recipe(workspace, args.recipename, checksrc=False) @@ -166,6 +175,17 @@ def deploy(args, config, basepath, workspace): 'recipe? If so, the install step has not installed ' 'any files.' % args.recipename) + if args.strip and not args.dry_run: + # Fakeroot copy to new destination + srcdir = recipe_outdir + recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'deploy-target-stripped') + if os.path.isdir(recipe_outdir): + bb.utils.remove(recipe_outdir, True) + exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True) + os.environ['PATH'] = ':'.join([os.environ['PATH'], rd.getVar('PATH') or '']) + oe.package.strip_execs(args.recipename, recipe_outdir, rd.getVar('STRIP'), rd.getVar('libdir'), + rd.getVar('base_libdir')) + filelist = [] ftotalsize = 0 for root, _, files in os.walk(recipe_outdir): @@ -185,7 +205,6 @@ def deploy(args, config, basepath, workspace): print(' %s' % item) return 0 - extraoptions = '' if args.no_host_check: extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' @@ -297,6 +316,7 @@ def undeploy(args, config, basepath, workspace): def register_commands(subparsers, context): """Register devtool subcommands from the deploy plugin""" + parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine', description='Deploys a recipe\'s build output (i.e. the output of the do_install task) to a live target machine over ssh. By default, any existing files will be preserved instead of being overwritten and will be restored if you run devtool undeploy-target. Note: this only deploys the recipe itself and not any runtime dependencies, so it is assumed that those have been installed on the target beforehand.', @@ -309,6 +329,15 @@ def register_commands(subparsers, context): parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve existing files', action='store_true') parser_deploy.add_argument('--no-check-space', help='Do not check for available space before deploying', action='store_true') parser_deploy.add_argument('-P', '--port', default='22', help='Port to use for connection to the target') + + strip_opts = parser_deploy.add_mutually_exclusive_group(required=False) + strip_opts.add_argument('-S', '--strip', + help='Strip executables prior to deploying (default: %(default)s). ' + 'The default value of this option can be controlled by setting the strip option in the [Deploy] section to True or False.', + default=oe.types.boolean(context.config.get('Deploy', 'strip', default='0')), + action='store_true') + strip_opts.add_argument('--no-strip', help='Do not strip executables prior to deploy', dest='strip', action='store_false') + parser_deploy.set_defaults(func=deploy) parser_undeploy = subparsers.add_parser('undeploy-target', diff --git a/import-layers/yocto-poky/scripts/lib/devtool/export.py b/import-layers/yocto-poky/scripts/lib/devtool/export.py new file mode 100644 index 000000000..13ee258e7 --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/devtool/export.py @@ -0,0 +1,119 @@ +# Development tool - export command plugin +# +# Copyright (C) 2014-2017 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool export plugin""" + +import os +import argparse +import tarfile +import logging +import datetime +import json + +logger = logging.getLogger('devtool') + +# output files +default_arcname_prefix = "workspace-export" +metadata = '.export_metadata' + +def export(args, config, basepath, workspace): + """Entry point for the devtool 'export' subcommand""" + + def add_metadata(tar): + """Archive the workspace object""" + # finally store the workspace metadata + with open(metadata, 'w') as fd: + fd.write(json.dumps((config.workspace_path, workspace))) + tar.add(metadata) + os.unlink(metadata) + + def add_recipe(tar, recipe, data): + """Archive recipe with proper arcname""" + # Create a map of name/arcnames + arcnames = [] + for key, name in data.items(): + if name: + if key == 'srctree': + # all sources, no matter where are located, goes into the sources directory + arcname = 'sources/%s' % recipe + else: + arcname = name.replace(config.workspace_path, '') + arcnames.append((name, arcname)) + + for name, arcname in arcnames: + tar.add(name, arcname=arcname) + + + # Make sure workspace is non-empty and possible listed include/excluded recipes are in workspace + if not workspace: + logger.info('Workspace contains no recipes, nothing to export') + return 0 + else: + for param, recipes in {'include':args.include,'exclude':args.exclude}.items(): + for recipe in recipes: + if recipe not in workspace: + logger.error('Recipe (%s) on %s argument not in the current workspace' % (recipe, param)) + return 1 + + name = args.file + + default_name = "%s-%s.tar.gz" % (default_arcname_prefix, datetime.datetime.now().strftime('%Y%m%d%H%M%S')) + if not name: + name = default_name + else: + # if name is a directory, append the default name + if os.path.isdir(name): + name = os.path.join(name, default_name) + + if os.path.exists(name) and not args.overwrite: + logger.error('Tar archive %s exists. Use --overwrite/-o to overwrite it') + return 1 + + # if all workspace is excluded, quit + if not len(set(workspace.keys()).difference(set(args.exclude))): + logger.warn('All recipes in workspace excluded, nothing to export') + return 0 + + exported = [] + with tarfile.open(name, 'w:gz') as tar: + if args.include: + for recipe in args.include: + add_recipe(tar, recipe, workspace[recipe]) + exported.append(recipe) + else: + for recipe, data in workspace.items(): + if recipe not in args.exclude: + add_recipe(tar, recipe, data) + exported.append(recipe) + + add_metadata(tar) + + logger.info('Tar archive created at %s with the following recipes: %s' % (name, ', '.join(exported))) + return 0 + +def register_commands(subparsers, context): + """Register devtool export subcommands""" + parser = subparsers.add_parser('export', + help='Export workspace into a tar archive', + description='Export one or more recipes from current workspace into a tar archive', + group='advanced') + + parser.add_argument('--file', '-f', help='Output archive file name') + parser.add_argument('--overwrite', '-o', action="store_true", help='Overwrite previous export tar archive') + group = parser.add_mutually_exclusive_group() + group.add_argument('--include', '-i', nargs='+', default=[], help='Include recipes into the tar archive') + group.add_argument('--exclude', '-e', nargs='+', default=[], help='Exclude recipes into the tar archive') + parser.set_defaults(func=export) diff --git a/import-layers/yocto-poky/scripts/lib/devtool/import.py b/import-layers/yocto-poky/scripts/lib/devtool/import.py new file mode 100644 index 000000000..c13a180d1 --- /dev/null +++ b/import-layers/yocto-poky/scripts/lib/devtool/import.py @@ -0,0 +1,144 @@ +# Development tool - import command plugin +# +# Copyright (C) 2014-2017 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool import plugin""" + +import os +import tarfile +import logging +import collections +import json +import fnmatch + +from devtool import standard, setup_tinfoil, replace_from_file, DevtoolError +from devtool import export + +logger = logging.getLogger('devtool') + +def devimport(args, config, basepath, workspace): + """Entry point for the devtool 'import' subcommand""" + + def get_pn(name): + """ Returns the filename of a workspace recipe/append""" + metadata = name.split('/')[-1] + fn, _ = os.path.splitext(metadata) + return fn + + if not os.path.exists(args.file): + raise DevtoolError('Tar archive %s does not exist. Export your workspace using "devtool export"' % args.file) + + with tarfile.open(args.file) as tar: + # Get exported metadata + export_workspace_path = export_workspace = None + try: + metadata = tar.getmember(export.metadata) + except KeyError as ke: + raise DevtoolError('The export metadata file created by "devtool export" was not found. "devtool import" can only be used to import tar archives created by "devtool export".') + + tar.extract(metadata) + with open(metadata.name) as fdm: + export_workspace_path, export_workspace = json.load(fdm) + os.unlink(metadata.name) + + members = tar.getmembers() + + # Get appends and recipes from the exported archive, these + # will be needed to find out those appends without corresponding + # recipe pair + append_fns, recipe_fns = set(), set() + for member in members: + if member.name.startswith('appends'): + append_fns.add(get_pn(member.name)) + elif member.name.startswith('recipes'): + recipe_fns.add(get_pn(member.name)) + + # Setup tinfoil, get required data and shutdown + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + current_fns = [os.path.basename(recipe[0]) for recipe in tinfoil.cooker.recipecaches[''].pkg_fn.items()] + finally: + tinfoil.shutdown() + + # Find those appends that do not have recipes in current metadata + non_importables = [] + for fn in append_fns - recipe_fns: + # Check on current metadata (covering those layers indicated in bblayers.conf) + for current_fn in current_fns: + if fnmatch.fnmatch(current_fn, '*' + fn.replace('%', '') + '*'): + break + else: + non_importables.append(fn) + logger.warn('No recipe to append %s.bbapppend, skipping' % fn) + + # Extract + imported = [] + for member in members: + if member.name == export.metadata: + continue + + for nonimp in non_importables: + pn = nonimp.split('_')[0] + # do not extract data from non-importable recipes or metadata + if member.name.startswith('appends/%s' % nonimp) or \ + member.name.startswith('recipes/%s' % nonimp) or \ + member.name.startswith('sources/%s' % pn): + break + else: + path = os.path.join(config.workspace_path, member.name) + if os.path.exists(path): + # by default, no file overwrite is done unless -o is given by the user + if args.overwrite: + try: + tar.extract(member, path=config.workspace_path) + except PermissionError as pe: + logger.warn(pe) + else: + logger.warn('File already present. Use --overwrite/-o to overwrite it: %s' % member.name) + continue + else: + tar.extract(member, path=config.workspace_path) + + # Update EXTERNALSRC and the devtool md5 file + if member.name.startswith('appends'): + if export_workspace_path: + # appends created by 'devtool modify' just need to update the workspace + replace_from_file(path, export_workspace_path, config.workspace_path) + + # appends created by 'devtool add' need replacement of exported source tree + pn = get_pn(member.name).split('_')[0] + exported_srctree = export_workspace[pn]['srctree'] + if exported_srctree: + replace_from_file(path, exported_srctree, os.path.join(config.workspace_path, 'sources', pn)) + + standard._add_md5(config, pn, path) + imported.append(pn) + + if imported: + logger.info('Imported recipes into workspace %s: %s' % (config.workspace_path, ', '.join(imported))) + else: + logger.warn('No recipes imported into the workspace') + + return 0 + +def register_commands(subparsers, context): + """Register devtool import subcommands""" + parser = subparsers.add_parser('import', + help='Import exported tar archive into workspace', + description='Import tar archive previously created by "devtool export" into workspace', + group='advanced') + parser.add_argument('file', metavar='FILE', help='Name of the tar archive to import') + parser.add_argument('--overwrite', '-o', action="store_true", help='Overwrite files when extracting') + parser.set_defaults(func=devimport) diff --git a/import-layers/yocto-poky/scripts/lib/devtool/sdk.py b/import-layers/yocto-poky/scripts/lib/devtool/sdk.py index e8bf0ad98..f46577c2a 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/sdk.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/sdk.py @@ -155,7 +155,7 @@ def sdk_update(args, config, basepath, workspace): if os.path.exists(os.path.join(basepath, 'layers/.git')): out = subprocess.check_output("git status --porcelain", shell=True, cwd=layers_dir) if not out: - ret = subprocess.call("git fetch --all; git reset --hard", shell=True, cwd=layers_dir) + ret = subprocess.call("git fetch --all; git reset --hard @{u}", shell=True, cwd=layers_dir) else: logger.error("Failed to update metadata as there have been changes made to it. Aborting."); logger.error("Changed files:\n%s" % out); diff --git a/import-layers/yocto-poky/scripts/lib/devtool/standard.py b/import-layers/yocto-poky/scripts/lib/devtool/standard.py index 5ff1e230f..beea0d4c2 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/standard.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/standard.py @@ -1,6 +1,6 @@ # Development tool - standard commands plugin # -# Copyright (C) 2014-2016 Intel Corporation +# Copyright (C) 2014-2017 Intel Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -30,7 +30,7 @@ import errno import glob import filecmp from collections import OrderedDict -from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, ensure_npm, DevtoolError +from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, DevtoolError from devtool import parse_recipe logger = logging.getLogger('devtool') @@ -66,6 +66,12 @@ def add(args, config, basepath, workspace): elif os.path.isdir(args.recipename): logger.warn('Ambiguous argument "%s" - assuming you mean it to be the recipe name' % args.recipename) + if not args.fetchuri: + if args.srcrev: + raise DevtoolError('The -S/--srcrev option is only valid when fetching from an SCM repository') + if args.srcbranch: + raise DevtoolError('The -B/--srcbranch option is only valid when fetching from an SCM repository') + if args.srctree and os.path.isfile(args.srctree): args.fetchuri = 'file://' + os.path.abspath(args.srctree) args.srctree = '' @@ -128,9 +134,6 @@ def add(args, config, basepath, workspace): color = args.color extracmdopts = '' if args.fetchuri: - if args.fetchuri.startswith('npm://'): - ensure_npm(config, basepath, args.fixed_setup) - source = args.fetchuri if srctree: extracmdopts += ' -x %s' % srctree @@ -152,31 +155,24 @@ def add(args, config, basepath, workspace): extracmdopts += ' -a' if args.fetch_dev: extracmdopts += ' --fetch-dev' + if args.mirrors: + extracmdopts += ' --mirrors' + if args.srcrev: + extracmdopts += ' --srcrev %s' % args.srcrev + if args.srcbranch: + extracmdopts += ' --srcbranch %s' % args.srcbranch + if args.provides: + extracmdopts += ' --provides %s' % args.provides tempdir = tempfile.mkdtemp(prefix='devtool') try: - builtnpm = False - while True: - try: - stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create --devtool -o %s \'%s\' %s' % (color, tempdir, source, extracmdopts), watch=True) - except bb.process.ExecutionError as e: - if e.exitcode == 14: - if builtnpm: - raise DevtoolError('Re-running recipetool still failed to find npm') - # FIXME this is a horrible hack that is unfortunately - # necessary due to the fact that we can't run bitbake from - # inside recipetool since recipetool keeps tinfoil active - # with references to it throughout the code, so we have - # to exit out and come back here to do it. - ensure_npm(config, basepath, args.fixed_setup, check_exists=False) - logger.info('Re-running recipe creation process after building nodejs') - builtnpm = True - continue - elif e.exitcode == 15: - raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line') - else: - raise DevtoolError('Command \'%s\' failed' % e.command) - break + try: + stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create --devtool -o %s \'%s\' %s' % (color, tempdir, source, extracmdopts), watch=True) + except bb.process.ExecutionError as e: + if e.exitcode == 15: + raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line') + else: + raise DevtoolError('Command \'%s\' failed' % e.command) recipes = glob.glob(os.path.join(tempdir, '*.bb')) if recipes: @@ -282,6 +278,24 @@ def add(args, config, basepath, workspace): f.write(' done\n') f.write('}\n') + # Check if the new layer provides recipes whose priorities have been + # overriden by PREFERRED_PROVIDER. + recipe_name = rd.getVar('PN') + provides = rd.getVar('PROVIDES') + # Search every item defined in PROVIDES + for recipe_provided in provides.split(): + preferred_provider = 'PREFERRED_PROVIDER_' + recipe_provided + current_pprovider = rd.getVar(preferred_provider) + if current_pprovider and current_pprovider != recipe_name: + if args.fixed_setup: + #if we are inside the eSDK add the new PREFERRED_PROVIDER in the workspace layer.conf + layerconf_file = os.path.join(config.workspace_path, "conf", "layer.conf") + with open(layerconf_file, 'a') as f: + f.write('%s = "%s"\n' % (preferred_provider, recipe_name)) + else: + logger.warn('Set \'%s\' in order to use the recipe' % preferred_provider) + break + _add_md5(config, recipename, appendfile) logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) @@ -383,7 +397,7 @@ def extract(args, config, basepath, workspace): """Entry point for the devtool 'extract' subcommand""" import bb - tinfoil = _prep_extract_operation(config, basepath, args.recipename) + tinfoil = setup_tinfoil(basepath=basepath) if not tinfoil: # Error already shown return 1 @@ -393,7 +407,7 @@ def extract(args, config, basepath, workspace): return 1 srctree = os.path.abspath(args.srctree) - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, rd, tinfoil) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) logger.info('Source tree extracted to %s' % srctree) if initial_rev: @@ -407,7 +421,7 @@ def sync(args, config, basepath, workspace): """Entry point for the devtool 'sync' subcommand""" import bb - tinfoil = _prep_extract_operation(config, basepath, args.recipename) + tinfoil = setup_tinfoil(basepath=basepath) if not tinfoil: # Error already shown return 1 @@ -417,7 +431,7 @@ def sync(args, config, basepath, workspace): return 1 srctree = os.path.abspath(args.srctree) - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, rd, tinfoil) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, config, basepath, workspace, args.fixed_setup, rd, tinfoil) logger.info('Source tree %s synchronized' % srctree) if initial_rev: @@ -428,31 +442,10 @@ def sync(args, config, basepath, workspace): tinfoil.shutdown() -def _prep_extract_operation(config, basepath, recipename, tinfoil=None): - """HACK: Ugly workaround for making sure that requirements are met when - trying to extract a package. Returns the tinfoil instance to be used.""" - if not tinfoil: - tinfoil = setup_tinfoil(basepath=basepath) - - rd = parse_recipe(config, tinfoil, recipename, True) - if not rd: - return None - - if bb.data.inherits_class('kernel-yocto', rd): - tinfoil.shutdown() - try: - stdout, _ = exec_build_env_command(config.init_path, basepath, - 'bitbake kern-tools-native') - tinfoil = setup_tinfoil(basepath=basepath) - except bb.process.ExecutionError as err: - raise DevtoolError("Failed to build kern-tools-native:\n%s" % - err.stdout) - return tinfoil - - -def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): +def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil): """Extract sources of a recipe""" import oe.recipeutils + import oe.patch pn = d.getVar('PN') @@ -480,6 +473,12 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): os.rmdir(srctree) initial_rev = None + + appendexisted = False + recipefile = d.getVar('FILE') + appendfile = recipe_to_append(recipefile, config) + is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d) + # We need to redirect WORKDIR, STAMPS_DIR etc. under a temporary # directory so that: # (a) we pick up all files that get unpacked to the WORKDIR, and @@ -498,137 +497,56 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): try: tinfoil.logger.setLevel(logging.WARNING) - crd = d.createCopy() - # Make a subdir so we guard against WORKDIR==S - workdir = os.path.join(tempdir, 'workdir') - crd.setVar('WORKDIR', workdir) - if not crd.getVar('S').startswith(workdir): - # Usually a shared workdir recipe (kernel, gcc) - # Try to set a reasonable default - if bb.data.inherits_class('kernel', d): - crd.setVar('S', '${WORKDIR}/source') - else: - crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S'))) - if bb.data.inherits_class('kernel', d): - # We don't want to move the source to STAGING_KERNEL_DIR here - crd.setVar('STAGING_KERNEL_DIR', '${S}') - - is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d) - if not is_kernel_yocto: - crd.setVar('PATCHTOOL', 'git') - crd.setVar('PATCH_COMMIT_FUNCTIONS', '1') - - # Apply our changes to the datastore to the server's datastore - for key in crd.localkeys(): - tinfoil.config_data.setVar('%s_pn-%s' % (key, pn), crd.getVar(key, False)) - - tinfoil.config_data.setVar('STAMPS_DIR', os.path.join(tempdir, 'stamps')) - tinfoil.config_data.setVar('T', os.path.join(tempdir, 'temp')) - tinfoil.config_data.setVar('BUILDCFG_FUNCS', '') - tinfoil.config_data.setVar('BUILDCFG_HEADER', '') - tinfoil.config_data.setVar('BB_HASH_IGNORE_MISMATCH', '1') - - tinfoil.set_event_mask(['bb.event.BuildStarted', - 'bb.event.BuildCompleted', - 'logging.LogRecord', - 'bb.command.CommandCompleted', - 'bb.command.CommandFailed', - 'bb.build.TaskStarted', - 'bb.build.TaskSucceeded', - 'bb.build.TaskFailed', - 'bb.build.TaskFailedSilent']) - - def runtask(target, task): - if tinfoil.build_file(target, task): - while True: - event = tinfoil.wait_event(0.25) - if event: - if isinstance(event, bb.command.CommandCompleted): - break - elif isinstance(event, bb.command.CommandFailed): - raise DevtoolError('Task do_%s failed: %s' % (task, event.error)) - elif isinstance(event, bb.build.TaskFailed): - raise DevtoolError('Task do_%s failed' % task) - elif isinstance(event, bb.build.TaskStarted): - logger.info('Executing %s...' % event._task) - elif isinstance(event, logging.LogRecord): - if event.levelno <= logging.INFO: - continue - logger.handle(event) - - # we need virtual:native:/path/to/recipe if it's a BBCLASSEXTEND - fn = tinfoil.get_recipe_file(pn) - runtask(fn, 'unpack') - - if bb.data.inherits_class('kernel-yocto', d): - # Extra step for kernel to populate the source directory - runtask(fn, 'kernel_checkout') - - srcsubdir = crd.getVar('S') - - # Move local source files into separate subdir - recipe_patches = [os.path.basename(patch) for patch in - oe.recipeutils.get_recipe_patches(crd)] - local_files = oe.recipeutils.get_recipe_local_files(crd) - - # Ignore local files with subdir={BP} - srcabspath = os.path.abspath(srcsubdir) - local_files = [fname for fname in local_files if - os.path.exists(os.path.join(workdir, fname)) and - (srcabspath == workdir or not - os.path.join(workdir, fname).startswith(srcabspath + - os.sep))] - if local_files: - for fname in local_files: - _move_file(os.path.join(workdir, fname), - os.path.join(tempdir, 'oe-local-files', fname)) - with open(os.path.join(tempdir, 'oe-local-files', '.gitignore'), - 'w') as f: - f.write('# Ignore local files, by default. Remove this file ' - 'if you want to commit the directory to Git\n*\n') - - if srcsubdir == workdir: - # Find non-patch non-local sources that were "unpacked" to srctree - # directory - src_files = [fname for fname in _ls_tree(workdir) if - os.path.basename(fname) not in recipe_patches] - # Force separate S so that patch files can be left out from srctree - srcsubdir = tempfile.mkdtemp(dir=workdir) - tinfoil.config_data.setVar('S_task-patch', srcsubdir) - # Move source files to S - for path in src_files: - _move_file(os.path.join(workdir, path), - os.path.join(srcsubdir, path)) - elif os.path.dirname(srcsubdir) != workdir: - # Handle if S is set to a subdirectory of the source - srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) - - scriptutils.git_convert_standalone_clone(srcsubdir) - - # Make sure that srcsubdir exists - bb.utils.mkdirhier(srcsubdir) - if not os.path.exists(srcsubdir) or not os.listdir(srcsubdir): - logger.warning("no source unpacked to S, either the %s recipe " - "doesn't use any source or the correct source " - "directory could not be determined" % pn) - - setup_git_repo(srcsubdir, crd.getVar('PV'), devbranch, d=d) + # FIXME this results in a cache reload under control of tinfoil, which is fine + # except we don't get the knotty progress bar - (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) - initial_rev = stdout.rstrip() + if os.path.exists(appendfile): + appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak') + shutil.copyfile(appendfile, appendbackup) + else: + appendbackup = None + bb.utils.mkdirhier(os.path.dirname(appendfile)) + logger.debug('writing append file %s' % appendfile) + with open(appendfile, 'a') as f: + f.write('###--- _extract_source\n') + f.write('DEVTOOL_TEMPDIR = "%s"\n' % tempdir) + f.write('DEVTOOL_DEVBRANCH = "%s"\n' % devbranch) + if not is_kernel_yocto: + f.write('PATCHTOOL = "git"\n') + f.write('PATCH_COMMIT_FUNCTIONS = "1"\n') + f.write('inherit devtool-source\n') + f.write('###--- _extract_source\n') + + update_unlockedsigs(basepath, workspace, fixed_setup, [pn]) + + sstate_manifests = d.getVar('SSTATE_MANIFESTS') + bb.utils.mkdirhier(sstate_manifests) + preservestampfile = os.path.join(sstate_manifests, 'preserve-stamps') + with open(preservestampfile, 'w') as f: + f.write(d.getVar('STAMP')) + try: + if bb.data.inherits_class('kernel-yocto', d): + # We need to generate the kernel config + task = 'do_configure' + else: + task = 'do_patch' - logger.info('Patching...') - runtask(fn, 'patch') + # Run the fetch + unpack tasks + res = tinfoil.build_targets(pn, + task, + handle_events=True) + finally: + if os.path.exists(preservestampfile): + os.remove(preservestampfile) - bb.process.run('git tag -f devtool-patched', cwd=srcsubdir) + if not res: + raise DevtoolError('Extracting source for %s failed' % pn) - kconfig = None - if bb.data.inherits_class('kernel-yocto', d): - # Store generate and store kernel config - logger.info('Generating kernel config') - runtask(fn, 'configure') - kconfig = os.path.join(crd.getVar('B'), '.config') + with open(os.path.join(tempdir, 'initial_rev'), 'r') as f: + initial_rev = f.read() + with open(os.path.join(tempdir, 'srcsubdir'), 'r') as f: + srcsubdir = f.read() tempdir_localdir = os.path.join(tempdir, 'oe-local-files') srctree_localdir = os.path.join(srctree, 'oe-local-files') @@ -682,11 +600,15 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d) bb.process.run('git %s commit -a -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree) - if kconfig: + if is_kernel_yocto: logger.info('Copying kernel config to srctree') - shutil.copy2(kconfig, srctree) + shutil.copy2(os.path.join(tempdir, '.config'), srctree) finally: + if appendbackup: + shutil.copyfile(appendbackup, appendfile) + elif os.path.exists(appendfile): + os.remove(appendfile) if keep_temp: logger.info('Preserving temporary directory %s' % tempdir) else: @@ -699,8 +621,11 @@ def _add_md5(config, recipename, filename): def addfile(fn): md5 = bb.utils.md5_file(fn) - with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: - f.write('%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5)) + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a+') as f: + md5_str = '%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5) + f.seek(0, os.SEEK_SET) + if not md5_str in f.read(): + f.write(md5_str) if os.path.isdir(filename): for root, _, files in os.walk(filename): @@ -772,13 +697,6 @@ def modify(args, config, basepath, workspace): raise DevtoolError("--no-extract specified and source path %s does " "not exist or is not a directory" % srctree) - if not args.no_extract: - tinfoil = _prep_extract_operation(config, basepath, pn, tinfoil) - if not tinfoil: - # Error already shown - return 1 - # We need to re-parse because tinfoil may have been re-initialised - rd = parse_recipe(config, tinfoil, args.recipename, True) recipefile = rd.getVar('FILE') appendfile = recipe_to_append(recipefile, config, args.wildcard) @@ -793,7 +711,7 @@ def modify(args, config, basepath, workspace): initial_rev = None commits = [] if not args.no_extract: - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, rd, tinfoil) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) if not initial_rev: return 1 logger.info('Source tree extracted to %s' % srctree) @@ -842,7 +760,10 @@ def modify(args, config, basepath, workspace): if bb.data.inherits_class('kernel', rd): f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout ' - 'do_fetch do_unpack do_patch do_kernel_configme do_kernel_configcheck"\n') + 'do_fetch do_unpack do_kernel_configme do_kernel_configcheck"\n') + f.write('\ndo_patch() {\n' + ' :\n' + '}\n') f.write('\ndo_configure_append() {\n' ' cp ${B}/.config ${S}/.config.baseline\n' ' ln -sfT ${B}/.config ${S}/.config.new\n' @@ -852,6 +773,8 @@ def modify(args, config, basepath, workspace): for commit in commits: f.write('# commit: %s\n' % commit) + update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn]) + _add_md5(config, pn, appendfile) logger.info('Recipe %s now set up to build from %s' % (pn, srctree)) @@ -1375,12 +1298,13 @@ def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remo if not no_remove: # Find list of existing patches in recipe file patches_dir = tempfile.mkdtemp(dir=tempdir) - old_srcrev = (rd.getVar('SRCREV', False) or '') + old_srcrev = rd.getVar('SRCREV') or '' upd_p, new_p, del_p = _export_patches(srctree, rd, old_srcrev, patches_dir) + logger.debug('Patches: update %s, new %s, delete %s' % (dict(upd_p), dict(new_p), dict(del_p))) # Remove deleted local files and "overlapping" patches - remove_files = list(del_f.values()) + list(upd_p.values()) + remove_files = list(del_f.values()) + list(upd_p.values()) + list(del_p.values()) if remove_files: removedentries = _remove_file_entries(srcuri, remove_files)[0] update_srcuri = True @@ -1612,7 +1536,7 @@ def update_recipe(args, config, basepath, workspace): def status(args, config, basepath, workspace): """Entry point for the devtool 'status' subcommand""" if workspace: - for recipe, value in workspace.items(): + for recipe, value in sorted(workspace.items()): recipefile = value['recipefile'] if recipefile: recipestr = ' (%s)' % recipefile @@ -1627,6 +1551,26 @@ def status(args, config, basepath, workspace): def _reset(recipes, no_clean, config, basepath, workspace): """Reset one or more recipes""" + def clean_preferred_provider(pn, layerconf_path): + """Remove PREFERRED_PROVIDER from layer.conf'""" + import re + layerconf_file = os.path.join(layerconf_path, 'conf', 'layer.conf') + new_layerconf_file = os.path.join(layerconf_path, 'conf', '.layer.conf') + pprovider_found = False + with open(layerconf_file, 'r') as f: + lines = f.readlines() + with open(new_layerconf_file, 'a') as nf: + for line in lines: + pprovider_exp = r'^PREFERRED_PROVIDER_.*? = "' + pn + r'"$' + if not re.match(pprovider_exp, line): + nf.write(line) + else: + pprovider_found = True + if pprovider_found: + shutil.move(new_layerconf_file, layerconf_file) + else: + os.remove(new_layerconf_file) + if recipes and not no_clean: if len(recipes) == 1: logger.info('Cleaning sysroot for recipe %s...' % recipes[0]) @@ -1679,6 +1623,7 @@ def _reset(recipes, no_clean, config, basepath, workspace): # This is unlikely, but if it's empty we can just remove it os.rmdir(srctree) + clean_preferred_provider(pn, config.workspace_path) def reset(args, config, basepath, workspace): """Entry point for the devtool 'reset' subcommand""" @@ -1834,10 +1779,15 @@ def register_commands(subparsers, context): parser_add.add_argument('--fetch-dev', help='For npm, also fetch devDependencies', action="store_true") parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") - parser_add.add_argument('--autorev', '-a', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + group = parser_add.add_mutually_exclusive_group() + group.add_argument('--srcrev', '-S', help='Source revision to fetch if fetching from an SCM such as git (default latest)') + group.add_argument('--autorev', '-a', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + parser_add.add_argument('--srcbranch', '-B', help='Branch in source repository if fetching from an SCM such as git (default master)') parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true') parser_add.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') parser_add.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') + parser_add.add_argument('--mirrors', help='Enable PREMIRRORS and MIRRORS for source tree fetching (disable by default).', action="store_true") + parser_add.add_argument('--provides', '-p', help='Specify an alias for the item provided by the recipe. E.g. virtual/libgl') parser_add.set_defaults(func=add, fixed_setup=context.fixed_setup) parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', @@ -1854,7 +1804,7 @@ def register_commands(subparsers, context): group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")') parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true") - parser_modify.set_defaults(func=modify) + parser_modify.set_defaults(func=modify, fixed_setup=context.fixed_setup) parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', description='Extracts the source for an existing recipe', @@ -1863,7 +1813,7 @@ def register_commands(subparsers, context): parser_extract.add_argument('srctree', help='Path to where to extract the source tree') parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (default "%(default)s")') parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') - parser_extract.set_defaults(func=extract, no_workspace=True) + parser_extract.set_defaults(func=extract, fixed_setup=context.fixed_setup) parser_sync = subparsers.add_parser('sync', help='Synchronize the source tree for an existing recipe', description='Synchronize the previously extracted source tree for an existing recipe', @@ -1873,7 +1823,7 @@ def register_commands(subparsers, context): parser_sync.add_argument('srctree', help='Path to the source tree') parser_sync.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout') parser_sync.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') - parser_sync.set_defaults(func=sync) + parser_sync.set_defaults(func=sync, fixed_setup=context.fixed_setup) parser_rename = subparsers.add_parser('rename', help='Rename a recipe file in the workspace', description='Renames the recipe file for a recipe in the workspace, changing the name or version part or both, ensuring that all references within the workspace are updated at the same time. Only works when the recipe file itself is in the workspace, e.g. after devtool add. Particularly useful when devtool add did not automatically determine the correct name.', diff --git a/import-layers/yocto-poky/scripts/lib/devtool/upgrade.py b/import-layers/yocto-poky/scripts/lib/devtool/upgrade.py index 05fb9e5ed..f1b3ff0a9 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/upgrade.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/upgrade.py @@ -1,6 +1,6 @@ # Development tool - upgrade command plugin # -# Copyright (C) 2014-2015 Intel Corporation +# Copyright (C) 2014-2017 Intel Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -33,7 +33,7 @@ sys.path = sys.path + [devtool_path] import oe.recipeutils from devtool import standard -from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build +from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs logger = logging.getLogger('devtool') @@ -180,7 +180,7 @@ def _get_uri(rd): srcuri = rev_re.sub('', srcuri) return srcuri, srcrev -def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tinfoil, rd): +def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, keep_temp, tinfoil, rd): """Extract sources of a recipe with a new version""" def __run(cmd): @@ -202,15 +202,38 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin __run('git tag -f devtool-base-new') md5 = None sha256 = None + if not srcbranch: + check_branch, check_branch_err = __run('git branch -r --contains %s' % srcrev) + get_branch = [x.strip() for x in check_branch.splitlines()] + # Remove HEAD reference point and drop remote prefix + get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] + if 'master' in get_branch: + # If it is master, we do not need to append 'branch=master' as this is default. + # Even with the case where get_branch has multiple objects, if 'master' is one + # of them, we should default take from 'master' + srcbranch = '' + elif len(get_branch) == 1: + # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' + srcbranch = get_branch[0] + else: + # If get_branch contains more than one objects, then display error and exit. + mbrch = '\n ' + '\n '.join(get_branch) + raise DevtoolError('Revision %s was found on multiple branches: %s\nPlease provide the correct branch in the devtool command with "--srcbranch" or "-B" option.' % (srcrev, mbrch)) else: __run('git checkout devtool-base -b devtool-%s' % newpv) tmpdir = tempfile.mkdtemp(prefix='devtool') try: - md5, sha256 = scriptutils.fetch_uri(tinfoil.config_data, uri, tmpdir, rev) - except bb.fetch2.FetchError as e: + checksums, ftmpdir = scriptutils.fetch_url(tinfoil, uri, rev, tmpdir, logger, preserve_tmp=keep_temp) + except scriptutils.FetchUrlFailure as e: raise DevtoolError(e) + if ftmpdir and keep_temp: + logger.info('Fetch temp directory is %s' % ftmpdir) + + md5 = checksums['md5sum'] + sha256 = checksums['sha256sum'] + tmpsrctree = _get_srctree(tmpdir) srctree = os.path.abspath(srctree) @@ -269,7 +292,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin else: shutil.rmtree(tmpsrctree) - return (rev, md5, sha256) + return (rev, md5, sha256, srcbranch) def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil, rd): """Creates the new recipe under workspace""" @@ -277,7 +300,10 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil bpn = rd.getVar('BPN') path = os.path.join(workspace, 'recipes', bpn) bb.utils.mkdirhier(path) - copied, _ = oe.recipeutils.copy_recipe_files(rd, path) + copied, _ = oe.recipeutils.copy_recipe_files(rd, path, all_variants=True) + if not copied: + raise DevtoolError('Internal error - no files were copied for recipe %s' % bpn) + logger.debug('Copied %s to %s' % (copied, path)) oldpv = rd.getVar('PV') if not newpv: @@ -329,6 +355,29 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil return fullpath, copied + +def _check_git_config(): + def getconfig(name): + try: + value = bb.process.run('git config --global %s' % name)[0].strip() + except bb.process.ExecutionError as e: + if e.exitcode == 1: + value = None + else: + raise + return value + + username = getconfig('user.name') + useremail = getconfig('user.email') + configerr = [] + if not username: + configerr.append('Please set your name using:\n git config --global user.name') + if not useremail: + configerr.append('Please set your email using:\n git config --global user.email') + if configerr: + raise DevtoolError('Your git configuration is incomplete which will prevent rebases from working:\n' + '\n'.join(configerr)) + + def upgrade(args, config, basepath, workspace): """Entry point for the devtool 'upgrade' subcommand""" @@ -339,6 +388,8 @@ def upgrade(args, config, basepath, workspace): if args.srcbranch and not args.srcrev: raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename) + _check_git_config() + tinfoil = setup_tinfoil(basepath=basepath, tracking=True) try: rd = parse_recipe(config, tinfoil, args.recipename, True) @@ -367,11 +418,11 @@ def upgrade(args, config, basepath, workspace): rf = None try: - rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd, tinfoil) - rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch, - args.srcrev, args.branch, args.keep_temp, + rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) + rev2, md5, sha256, srcbranch = _extract_new_source(args.version, srctree, args.no_patch, + args.srcrev, args.srcbranch, args.branch, args.keep_temp, tinfoil, rd) - rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) + rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, config.workspace_path, tinfoil, rd) except bb.process.CmdError as e: _upgrade_error(e, rf, srctree) except DevtoolError as e: @@ -381,6 +432,9 @@ def upgrade(args, config, basepath, workspace): af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, copied, config.workspace_path, rd) standard._add_md5(config, pn, af) + + update_unlockedsigs(basepath, workspace, [pn], args.fixed_setup) + logger.info('Upgraded source extracted to %s' % srctree) logger.info('New recipe is %s' % rf) finally: @@ -406,4 +460,4 @@ def register_commands(subparsers, context): group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') - parser_upgrade.set_defaults(func=upgrade) + parser_upgrade.set_defaults(func=upgrade, fixed_setup=context.fixed_setup) diff --git a/import-layers/yocto-poky/scripts/lib/devtool/utilcmds.py b/import-layers/yocto-poky/scripts/lib/devtool/utilcmds.py index 0437e6417..b74511643 100644 --- a/import-layers/yocto-poky/scripts/lib/devtool/utilcmds.py +++ b/import-layers/yocto-poky/scripts/lib/devtool/utilcmds.py @@ -30,15 +30,13 @@ from devtool import parse_recipe logger = logging.getLogger('devtool') - -def edit_recipe(args, config, basepath, workspace): - """Entry point for the devtool 'edit-recipe' subcommand""" +def _find_recipe_path(args, config, basepath, workspace): if args.any_recipe: tinfoil = setup_tinfoil(config_only=False, basepath=basepath) try: rd = parse_recipe(config, tinfoil, args.recipename, True) if not rd: - return 1 + raise DevtoolError("Failed to find specified recipe") recipefile = rd.getVar('FILE') finally: tinfoil.shutdown() @@ -48,8 +46,19 @@ def edit_recipe(args, config, basepath, workspace): if not recipefile: raise DevtoolError("Recipe file for %s is not under the workspace" % args.recipename) + return recipefile + + +def find_recipe(args, config, basepath, workspace): + """Entry point for the devtool 'find-recipe' subcommand""" + recipefile = _find_recipe_path(args, config, basepath, workspace) + print(recipefile) + return 0 - return scriptutils.run_editor(recipefile) + +def edit_recipe(args, config, basepath, workspace): + """Entry point for the devtool 'edit-recipe' subcommand""" + return scriptutils.run_editor(_find_recipe_path(args, config, basepath, workspace), logger) def configure_help(args, config, basepath, workspace): @@ -220,6 +229,14 @@ def register_commands(subparsers, context): parser_edit_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Edit any recipe, not just where the recipe file itself is in the workspace') parser_edit_recipe.set_defaults(func=edit_recipe) + # Find-recipe + parser_find_recipe = subparsers.add_parser('find-recipe', help='Find a recipe file in your workspace', + description='By default, this will find a recipe file in your workspace; you can override this with the -a/--any-recipe option.', + group='working') + parser_find_recipe.add_argument('recipename', help='Recipe to find') + parser_find_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Find any recipe, not just where the recipe file itself is in the workspace') + parser_find_recipe.set_defaults(func=find_recipe) + # NOTE: Needed to override the usage string here since the default # gets the order wrong - recipename must come before --arg parser_configure_help = subparsers.add_parser('configure-help', help='Get help on configure script options', diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/create.py b/import-layers/yocto-poky/scripts/lib/recipetool/create.py index 4de52fc30..5bf939efc 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/create.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/create.py @@ -1,6 +1,6 @@ # Recipe creation tool - create command plugin # -# Copyright (C) 2014-2016 Intel Corporation +# Copyright (C) 2014-2017 Intel Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -156,10 +156,12 @@ class RecipeHandler(object): RecipeHandler.recipebinmap[prog] = pn @staticmethod - def checkfiles(path, speclist, recursive=False): + def checkfiles(path, speclist, recursive=False, excludedirs=None): results = [] if recursive: - for root, _, files in os.walk(path): + for root, dirs, files in os.walk(path, topdown=True): + if excludedirs: + dirs[:] = [d for d in dirs if d not in excludedirs] for fn in files: for spec in speclist: if fnmatch.fnmatch(fn, spec): @@ -339,9 +341,14 @@ def determine_from_url(srcuri): pn = res.group(1).strip().replace('_', '-') pv = res.group(2).strip().replace('_', '.') - if not pn and not pv and parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']: - srcfile = os.path.basename(parseres.path.rstrip('/')) - pn, pv = determine_from_filename(srcfile) + if not pn and not pv: + if parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']: + srcfile = os.path.basename(parseres.path.rstrip('/')) + pn, pv = determine_from_filename(srcfile) + elif parseres.scheme in ['git', 'gitsm']: + pn = os.path.basename(parseres.path.rstrip('/')).lower().replace('_', '-') + if pn.endswith('.git'): + pn = pn[:-4] logger.debug('Determined from source URL: name = "%s", version = "%s"' % (pn, pv)) return (pn, pv) @@ -412,11 +419,15 @@ def create_recipe(args): pkgarch = "${MACHINE_ARCH}" extravalues = {} - checksums = (None, None) + checksums = {} tempsrc = '' source = args.source srcsubdir = '' srcrev = '${AUTOREV}' + srcbranch = '' + scheme = '' + storeTagName = '' + pv_srcpv = False if os.path.isfile(source): source = 'file://%s' % os.path.abspath(source) @@ -432,24 +443,65 @@ def create_recipe(args): rev_re = re.compile(';rev=([^;]+)') res = rev_re.search(srcuri) if res: + if args.srcrev: + logger.error('rev= parameter and -S/--srcrev option cannot both be specified - use one or the other') + sys.exit(1) + if args.autorev: + logger.error('rev= parameter and -a/--autorev option cannot both be specified - use one or the other') + sys.exit(1) srcrev = res.group(1) srcuri = rev_re.sub('', srcuri) - tempsrc = tempfile.mkdtemp(prefix='recipetool-') - srctree = tempsrc - d = bb.data.createCopy(tinfoil.config_data) - if fetchuri.startswith('npm://'): - # Check if npm is available - npm_bindir = check_npm(tinfoil, args.devtool) - d.prependVar('PATH', '%s:' % npm_bindir) - logger.info('Fetching %s...' % srcuri) + elif args.srcrev: + srcrev = args.srcrev + + # Check whether users provides any branch info in fetchuri. + # If true, we will skip all branch checking process to honor all user's input. + scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri) + srcbranch = params.get('branch') + if args.srcbranch: + if srcbranch: + logger.error('branch= parameter and -B/--srcbranch option cannot both be specified - use one or the other') + sys.exit(1) + srcbranch = args.srcbranch + nobranch = params.get('nobranch') + if nobranch and srcbranch: + logger.error('nobranch= cannot be used if you specify a branch') + sys.exit(1) + tag = params.get('tag') + if not srcbranch and not nobranch and srcrev != '${AUTOREV}': + # Append nobranch=1 in the following conditions: + # 1. User did not set 'branch=' in srcuri, and + # 2. User did not set 'nobranch=1' in srcuri, and + # 3. Source revision is not '${AUTOREV}' + params['nobranch'] = '1' + if tag: + # Keep a copy of tag and append nobranch=1 then remove tag from URL. + # Bitbake fetcher unable to fetch when {AUTOREV} and tag is set at the same time. + storeTagName = params['tag'] + params['nobranch'] = '1' + del params['tag'] + if scheme == 'npm': + params['noverify'] = '1' + fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) + + tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR') + bb.utils.mkdirhier(tmpparent) + tempsrc = tempfile.mkdtemp(prefix='recipetool-', dir=tmpparent) + srctree = os.path.join(tempsrc, 'source') + try: - checksums = scriptutils.fetch_uri(d, fetchuri, srctree, srcrev) - except bb.fetch2.BBFetchException as e: - logger.error(str(e).rstrip()) + checksums, ftmpdir = scriptutils.fetch_url(tinfoil, fetchuri, srcrev, srctree, logger, preserve_tmp=args.keep_temp) + except scriptutils.FetchUrlFailure as e: + logger.error(str(e)) sys.exit(1) + + if ftmpdir and args.keep_temp: + logger.info('Fetch temp directory is %s' % ftmpdir) + dirlist = os.listdir(srctree) - if 'git.indirectionsymlink' in dirlist: - dirlist.remove('git.indirectionsymlink') + filterout = ['git.indirectionsymlink'] + dirlist = [x for x in dirlist if x not in filterout] + logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) if len(dirlist) == 1: singleitem = os.path.join(srctree, dirlist[0]) if os.path.isdir(singleitem): @@ -457,30 +509,74 @@ def create_recipe(args): srcsubdir = dirlist[0] srctree = os.path.join(srctree, srcsubdir) else: - with open(singleitem, 'r', errors='surrogateescape') as f: - if '<html' in f.read(100).lower(): - logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri) - sys.exit(1) + check_single_file(dirlist[0], fetchuri) + elif len(dirlist) == 0: + if '/' in fetchuri: + fn = os.path.join(tinfoil.config_data.getVar('DL_DIR'), fetchuri.split('/')[-1]) + if os.path.isfile(fn): + check_single_file(fn, fetchuri) + # If we've got to here then there's no source so we might as well give up + logger.error('URL %s resulted in an empty source tree' % fetchuri) + sys.exit(1) + + # We need this checking mechanism to improve the recipe created by recipetool and devtool + # is able to parse and build by bitbake. + # If there is no input for branch name, then check for branch name with SRCREV provided. + if not srcbranch and not nobranch and srcrev and (srcrev != '${AUTOREV}') and scheme in ['git', 'gitsm']: + try: + cmd = 'git branch -r --contains' + check_branch, check_branch_err = bb.process.run('%s %s' % (cmd, srcrev), cwd=srctree) + except bb.process.ExecutionError as err: + logger.error(str(err)) + sys.exit(1) + get_branch = [x.strip() for x in check_branch.splitlines()] + # Remove HEAD reference point and drop remote prefix + get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] + if 'master' in get_branch: + # If it is master, we do not need to append 'branch=master' as this is default. + # Even with the case where get_branch has multiple objects, if 'master' is one + # of them, we should default take from 'master' + srcbranch = '' + elif len(get_branch) == 1: + # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' + srcbranch = get_branch[0] + else: + # If get_branch contains more than one objects, then display error and exit. + mbrch = '\n ' + '\n '.join(get_branch) + logger.error('Revision %s was found on multiple branches: %s\nPlease provide the correct branch with -B/--srcbranch' % (srcrev, mbrch)) + sys.exit(1) + + # Since we might have a value in srcbranch, we need to + # recontruct the srcuri to include 'branch' in params. + scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(srcuri) + if srcbranch: + params['branch'] = srcbranch + + if storeTagName and scheme in ['git', 'gitsm']: + # Check srcrev using tag and check validity of the tag + cmd = ('git rev-parse --verify %s' % (storeTagName)) + try: + check_tag, check_tag_err = bb.process.run('%s' % cmd, cwd=srctree) + srcrev = check_tag.split()[0] + except bb.process.ExecutionError as err: + logger.error(str(err)) + logger.error("Possibly wrong tag name is provided") + sys.exit(1) + # Drop tag from srcuri as it will have conflicts with SRCREV during recipe parse. + del params['tag'] + srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) + if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'): srcuri = 'gitsm://' + srcuri[6:] logger.info('Fetching submodules...') bb.process.run('git submodule update --init --recursive', cwd=srctree) if is_package(fetchuri): - tmpfdir = tempfile.mkdtemp(prefix='recipetool-') - try: - pkgfile = None + localdata = bb.data.createCopy(tinfoil.config_data) + pkgfile = bb.fetch2.localpath(fetchuri, localdata) + if pkgfile: + tmpfdir = tempfile.mkdtemp(prefix='recipetool-') try: - fileuri = fetchuri + ';unpack=0' - scriptutils.fetch_uri(tinfoil.config_data, fileuri, tmpfdir, srcrev) - for root, _, files in os.walk(tmpfdir): - for f in files: - pkgfile = os.path.join(root, f) - break - except bb.fetch2.BBFetchException as e: - logger.warn('Second fetch to get metadata failed: %s' % str(e).rstrip()) - - if pkgfile: if pkgfile.endswith(('.deb', '.ipk')): stdout, _ = bb.process.run('ar x %s' % pkgfile, cwd=tmpfdir) stdout, _ = bb.process.run('tar xf control.tar.gz', cwd=tmpfdir) @@ -490,8 +586,8 @@ def create_recipe(args): stdout, _ = bb.process.run('rpm -qp --xml %s > pkginfo.xml' % pkgfile, cwd=tmpfdir) values = convert_rpm_xml(os.path.join(tmpfdir, 'pkginfo.xml')) extravalues.update(values) - finally: - shutil.rmtree(tmpfdir) + finally: + shutil.rmtree(tmpfdir) else: # Assume we're pointing to an existing source tree if args.extract_to: @@ -519,9 +615,9 @@ def create_recipe(args): if args.src_subdir: srcsubdir = os.path.join(srcsubdir, args.src_subdir) - srctree_use = os.path.join(srctree, args.src_subdir) + srctree_use = os.path.abspath(os.path.join(srctree, args.src_subdir)) else: - srctree_use = srctree + srctree_use = os.path.abspath(srctree) if args.outfile and os.path.isdir(args.outfile): outfile = None @@ -543,9 +639,10 @@ def create_recipe(args): # We need a blank line here so that patch_recipe_lines can rewind before the LICENSE comments lines_before.append('') - handled = [] - licvalues = handle_license_vars(srctree_use, lines_before, handled, extravalues, tinfoil.config_data) + # We'll come back and replace this later in handle_license_vars() + lines_before.append('##LICENSE_PLACEHOLDER##') + handled = [] classes = [] # FIXME This is kind of a hack, we probably ought to be using bitbake to do this @@ -581,30 +678,31 @@ def create_recipe(args): else: realpv = None - if srcuri and not realpv or not pn: - name_pn, name_pv = determine_from_url(srcuri) - if name_pn and not pn: - pn = name_pn - if name_pv and not realpv: - realpv = name_pv - if not srcuri: lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') lines_before.append('SRC_URI = "%s"' % srcuri) - (md5value, sha256value) = checksums - if md5value: - lines_before.append('SRC_URI[md5sum] = "%s"' % md5value) - if sha256value: - lines_before.append('SRC_URI[sha256sum] = "%s"' % sha256value) + for key, value in sorted(checksums.items()): + lines_before.append('SRC_URI[%s] = "%s"' % (key, value)) if srcuri and supports_srcrev(srcuri): lines_before.append('') lines_before.append('# Modify these as desired') - lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) + # Note: we have code to replace realpv further down if it gets set to some other value + scheme, _, _, _, _, _ = bb.fetch2.decodeurl(srcuri) + if scheme in ['git', 'gitsm']: + srcpvprefix = 'git' + elif scheme == 'svn': + srcpvprefix = 'svnr' + else: + srcpvprefix = scheme + lines_before.append('PV = "%s+%s${SRCPV}"' % (realpv or '1.0', srcpvprefix)) + pv_srcpv = True if not args.autorev and srcrev == '${AUTOREV}': if os.path.exists(os.path.join(srctree, '.git')): (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) srcrev = stdout.rstrip() lines_before.append('SRCREV = "%s"' % srcrev) + if args.provides: + lines_before.append('PROVIDES = "%s"' % args.provides) lines_before.append('') if srcsubdir and not args.binary: @@ -677,6 +775,15 @@ def create_recipe(args): if '_' in pn: pn = pn.replace('_', '-') + if srcuri and not realpv or not pn: + name_pn, name_pv = determine_from_url(srcuri) + if name_pn and not pn: + pn = name_pn + if name_pv and not realpv: + realpv = name_pv + + licvalues = handle_license_vars(srctree_use, lines_before, handled, extravalues, tinfoil.config_data) + if not outfile: if not pn: log_error_cond('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile', args.devtool) @@ -726,10 +833,11 @@ def create_recipe(args): skipblank = True continue elif line.startswith('SRC_URI = '): - if realpv: + if realpv and not pv_srcpv: line = line.replace(realpv, '${PV}') elif line.startswith('PV = '): if realpv: + # Replace the first part of the PV value line = re.sub('"[^+]*\+', '"%s+' % realpv, line) lines_before.append(line) @@ -768,9 +876,6 @@ def create_recipe(args): outlines.extend(lines_after) if extravalues: - if 'LICENSE' in extravalues and not licvalues: - # Don't blow away 'CLOSED' value that comments say we set - del extravalues['LICENSE'] _, outlines = oe.recipeutils.patch_recipe_lines(outlines, extravalues, trailing_newline=False) if args.extract_to: @@ -807,54 +912,101 @@ def create_recipe(args): return 0 +def check_single_file(fn, fetchuri): + """Determine if a single downloaded file is something we can't handle""" + with open(fn, 'r', errors='surrogateescape') as f: + if '<html' in f.read(100).lower(): + logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri) + sys.exit(1) + +def split_value(value): + if isinstance(value, str): + return value.split() + else: + return value + def handle_license_vars(srctree, lines_before, handled, extravalues, d): + lichandled = [x for x in handled if x[0] == 'license'] + if lichandled: + # Someone else has already handled the license vars, just return their value + return lichandled[0][1] + licvalues = guess_license(srctree, d) + licenses = [] lic_files_chksum = [] lic_unknown = [] + lines = [] if licvalues: - licenses = [] for licvalue in licvalues: if not licvalue[0] in licenses: licenses.append(licvalue[0]) lic_files_chksum.append('file://%s;md5=%s' % (licvalue[1], licvalue[2])) if licvalue[0] == 'Unknown': lic_unknown.append(licvalue[1]) - lines_before.append('# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is') - lines_before.append('# your responsibility to verify that the values are complete and correct.') - if len(licvalues) > 1: - lines_before.append('#') - lines_before.append('# NOTE: multiple licenses have been detected; they have been separated with &') - lines_before.append('# in the LICENSE value for now since it is a reasonable assumption that all') - lines_before.append('# of the licenses apply. If instead there is a choice between the multiple') - lines_before.append('# licenses then you should change the value to separate the licenses with |') - lines_before.append('# instead of &. If there is any doubt, check the accompanying documentation') - lines_before.append('# to determine which situation is applicable.') if lic_unknown: - lines_before.append('#') - lines_before.append('# The following license files were not able to be identified and are') - lines_before.append('# represented as "Unknown" below, you will need to check them yourself:') + lines.append('#') + lines.append('# The following license files were not able to be identified and are') + lines.append('# represented as "Unknown" below, you will need to check them yourself:') for licfile in lic_unknown: - lines_before.append('# %s' % licfile) - lines_before.append('#') - else: - lines_before.append('# Unable to find any files that looked like license statements. Check the accompanying') - lines_before.append('# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.') - lines_before.append('#') - lines_before.append('# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if') - lines_before.append('# this is not accurate with respect to the licensing of the software being built (it') - lines_before.append('# will not be in most cases) you must specify the correct value before using this') - lines_before.append('# recipe for anything other than initial testing/development!') - licenses = ['CLOSED'] - pkg_license = extravalues.pop('LICENSE', None) - if pkg_license: + lines.append('# %s' % licfile) + + extra_license = split_value(extravalues.pop('LICENSE', [])) + if '&' in extra_license: + extra_license.remove('&') + if extra_license: if licenses == ['Unknown']: - lines_before.append('# NOTE: The following LICENSE value was determined from the original package metadata') - licenses = [pkg_license] + licenses = extra_license else: - lines_before.append('# NOTE: Original package metadata indicates license is: %s' % pkg_license) - lines_before.append('LICENSE = "%s"' % ' & '.join(licenses)) - lines_before.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum)) - lines_before.append('') + for item in extra_license: + if item not in licenses: + licenses.append(item) + extra_lic_files_chksum = split_value(extravalues.pop('LIC_FILES_CHKSUM', [])) + for item in extra_lic_files_chksum: + if item not in lic_files_chksum: + lic_files_chksum.append(item) + + if lic_files_chksum: + # We are going to set the vars, so prepend the standard disclaimer + lines.insert(0, '# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is') + lines.insert(1, '# your responsibility to verify that the values are complete and correct.') + else: + # Without LIC_FILES_CHKSUM we set LICENSE = "CLOSED" to allow the + # user to get started easily + lines.append('# Unable to find any files that looked like license statements. Check the accompanying') + lines.append('# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.') + lines.append('#') + lines.append('# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if') + lines.append('# this is not accurate with respect to the licensing of the software being built (it') + lines.append('# will not be in most cases) you must specify the correct value before using this') + lines.append('# recipe for anything other than initial testing/development!') + licenses = ['CLOSED'] + + if extra_license and sorted(licenses) != sorted(extra_license): + lines.append('# NOTE: Original package / source metadata indicates license is: %s' % ' & '.join(extra_license)) + + if len(licenses) > 1: + lines.append('#') + lines.append('# NOTE: multiple licenses have been detected; they have been separated with &') + lines.append('# in the LICENSE value for now since it is a reasonable assumption that all') + lines.append('# of the licenses apply. If instead there is a choice between the multiple') + lines.append('# licenses then you should change the value to separate the licenses with |') + lines.append('# instead of &. If there is any doubt, check the accompanying documentation') + lines.append('# to determine which situation is applicable.') + + lines.append('LICENSE = "%s"' % ' & '.join(licenses)) + lines.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum)) + lines.append('') + + # Replace the placeholder so we get the values in the right place in the recipe file + try: + pos = lines_before.index('##LICENSE_PLACEHOLDER##') + except ValueError: + pos = -1 + if pos == -1: + lines_before.extend(lines) + else: + lines_before[pos:pos+1] = lines + handled.append(('license', licvalues)) return licvalues @@ -951,6 +1103,10 @@ def crunch_license(licfile): crunched_md5sums['1daebd9491d1e8426900b4fa5a422814'] = 'LGPLv2.1' # https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.LGPLv3 crunched_md5sums['2ebfb3bb49b9a48a075cc1425e7f4129'] = 'LGPLv3' + # https://raw.githubusercontent.com/eclipse/mosquitto/v1.4.14/epl-v10 + crunched_md5sums['efe2cb9a35826992b9df68224e3c2628'] = 'EPL-1.0' + # https://raw.githubusercontent.com/eclipse/mosquitto/v1.4.14/edl-v10 + crunched_md5sums['0a9c78c0a398d1bbce4a166757d60387'] = 'EDL-1.0' lictext = [] with open(licfile, 'r', errors='surrogateescape') as f: for line in f: @@ -983,7 +1139,7 @@ def guess_license(srctree, d): md5sums = get_license_md5sums(d) licenses = [] - licspecs = ['*LICEN[CS]E*', 'COPYING*', '*[Ll]icense*', 'LEGAL*', '[Ll]egal*', '*GPL*', 'README.lic*', 'COPYRIGHT*', '[Cc]opyright*'] + licspecs = ['*LICEN[CS]E*', 'COPYING*', '*[Ll]icense*', 'LEGAL*', '[Ll]egal*', '*GPL*', 'README.lic*', 'COPYRIGHT*', '[Cc]opyright*', 'e[dp]l-v10'] licfiles = [] for root, dirs, files in os.walk(srctree): for fn in files: @@ -1142,28 +1298,13 @@ def convert_rpm_xml(xmlfile): return values -def check_npm(tinfoil, debugonly=False): - try: - rd = tinfoil.parse_recipe('nodejs-native') - except bb.providers.NoProvider: - # We still conditionally show the message and exit with the special - # return code, otherwise we can't show the proper message for eSDK - # users - log_error_cond('nodejs-native is required for npm but is not available - you will likely need to add a layer that provides nodejs', debugonly) - sys.exit(14) - bindir = rd.getVar('STAGING_BINDIR_NATIVE') - npmpath = os.path.join(bindir, 'npm') - if not os.path.exists(npmpath): - log_error_cond('npm required to process specified source, but npm is not available - you need to run bitbake -c addto_recipe_sysroot nodejs-native first', debugonly) - sys.exit(14) - return bindir - def register_commands(subparsers): parser_create = subparsers.add_parser('create', help='Create a new recipe', description='Creates a new recipe from a source tree') parser_create.add_argument('source', help='Path or URL to source') parser_create.add_argument('-o', '--outfile', help='Specify filename for recipe to create') + parser_create.add_argument('-p', '--provides', help='Specify an alias for the item provided by the recipe') parser_create.add_argument('-m', '--machine', help='Make recipe machine-specific as opposed to architecture-specific', action='store_true') parser_create.add_argument('-x', '--extract-to', metavar='EXTRACTPATH', help='Assuming source is a URL, fetch it and extract it to the directory specified as %(metavar)s') parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)') @@ -1171,12 +1312,13 @@ def register_commands(subparsers): parser_create.add_argument('-b', '--binary', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure)', action='store_true') parser_create.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') - parser_create.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + group = parser_create.add_mutually_exclusive_group() + group.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + group.add_argument('-S', '--srcrev', help='Source revision to fetch if fetching from an SCM such as git (default latest)') + parser_create.add_argument('-B', '--srcbranch', help='Branch in source repository if fetching from an SCM such as git (default master)') parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') parser_create.add_argument('--fetch-dev', action="store_true", help='For npm, also fetch devDependencies') parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS) - # FIXME I really hate having to set parserecipes for this, but given we may need - # to call into npm (and we don't know in advance if we will or not) and in order - # to do so we need to know npm's recipe sysroot path, there's not much alternative - parser_create.set_defaults(func=create_recipe, parserecipes=True) + parser_create.add_argument('--mirrors', action="store_true", help='Enable PREMIRRORS and MIRRORS for source tree fetching (disabled by default).') + parser_create.set_defaults(func=create_recipe) diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys.py b/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys.py index e914e53aa..4743c740c 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys.py @@ -863,6 +863,10 @@ class SpecFileRecipeHandler(RecipeHandler): break if len(foundvalues) == len(valuemap): break + # Drop values containing unexpanded RPM macros + for k in list(foundvalues.keys()): + if '%' in foundvalues[k]: + del foundvalues[k] if 'PV' in foundvalues: if not validate_pv(foundvalues['PV']): del foundvalues['PV'] diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys_python.py b/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys_python.py index ec5449bee..5bd2aa337 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys_python.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/create_buildsys_python.py @@ -356,6 +356,8 @@ class PythonRecipeHandler(RecipeHandler): # Naive mapping of setup() arguments to PKG-INFO field names for d in [info, non_literals]: for key, value in list(d.items()): + if key is None: + continue new_key = _map(key) if new_key != key: del d[key] diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/create_kmod.py b/import-layers/yocto-poky/scripts/lib/recipetool/create_kmod.py index 7cf188db2..4569b53c8 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/create_kmod.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/create_kmod.py @@ -40,7 +40,7 @@ class KernelModuleRecipeHandler(RecipeHandler): makefiles = [] - files = RecipeHandler.checkfiles(srctree, ['*.c', '*.h'], recursive=True) + files = RecipeHandler.checkfiles(srctree, ['*.c', '*.h'], recursive=True, excludedirs=['contrib', 'test', 'examples']) if files: for cfile in files: # Look in same dir or parent for Makefile diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/create_npm.py b/import-layers/yocto-poky/scripts/lib/recipetool/create_npm.py index cb8f338b8..ae5397262 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/create_npm.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/create_npm.py @@ -21,7 +21,7 @@ import subprocess import tempfile import shutil import json -from recipetool.create import RecipeHandler, split_pkg_licenses, handle_license_vars, check_npm +from recipetool.create import RecipeHandler, split_pkg_licenses, handle_license_vars logger = logging.getLogger('recipetool') @@ -36,6 +36,27 @@ def tinfoil_init(instance): class NpmRecipeHandler(RecipeHandler): lockdownpath = None + def _ensure_npm(self, fixed_setup=False): + if not tinfoil.recipes_parsed: + tinfoil.parse_recipes() + try: + rd = tinfoil.parse_recipe('nodejs-native') + except bb.providers.NoProvider: + if fixed_setup: + msg = 'nodejs-native is required for npm but is not available within this SDK' + else: + msg = 'nodejs-native is required for npm but is not available - you will likely need to add a layer that provides nodejs' + logger.error(msg) + return None + bindir = rd.getVar('STAGING_BINDIR_NATIVE') + npmpath = os.path.join(bindir, 'npm') + if not os.path.exists(npmpath): + tinfoil.build_targets('nodejs-native', 'addto_recipe_sysroot') + if not os.path.exists(npmpath): + logger.error('npm required to process specified source, but nodejs-native did not seem to populate it') + return None + return bindir + def _handle_license(self, data): ''' Handle the license value from an npm package.json file @@ -109,7 +130,6 @@ class NpmRecipeHandler(RecipeHandler): if varname == 'SRC_URI': if not origvalue.startswith('npm://'): src_uri = origvalue.split() - changed = False deplist = {} for dep, depver in optdeps.items(): depdata = self.get_npm_data(dep, depver, d) @@ -123,14 +143,15 @@ class NpmRecipeHandler(RecipeHandler): depdata = self.get_npm_data(dep, depver, d) deplist[dep] = depdata + extra_urls = [] for dep, depdata in deplist.items(): version = depdata.get('version', None) if version: url = 'npm://registry.npmjs.org;name=%s;version=%s;subdir=node_modules/%s' % (dep, version, dep) - scriptutils.fetch_uri(d, url, srctree) - src_uri.append(url) - changed = True - if changed: + extra_urls.append(url) + if extra_urls: + scriptutils.fetch_url(tinfoil, ' '.join(extra_urls), None, srctree, logger) + src_uri.extend(extra_urls) return src_uri, None, -1, True return origvalue, None, 0, True updated, newlines = bb.utils.edit_metadata(lines_before, ['SRC_URI'], varfunc) @@ -143,40 +164,9 @@ class NpmRecipeHandler(RecipeHandler): lines_before.append(line) return updated - def _replace_license_vars(self, srctree, lines_before, handled, extravalues, d): - for item in handled: - if isinstance(item, tuple): - if item[0] == 'license': - del item - break - - calledvars = [] - def varfunc(varname, origvalue, op, newlines): - if varname in ['LICENSE', 'LIC_FILES_CHKSUM']: - for i, e in enumerate(reversed(newlines)): - if not e.startswith('#'): - stop = i - while stop > 0: - newlines.pop() - stop -= 1 - break - calledvars.append(varname) - if len(calledvars) > 1: - # The second time around, put the new license text in - insertpos = len(newlines) - handle_license_vars(srctree, newlines, handled, extravalues, d) - return None, None, 0, True - return origvalue, None, 0, True - updated, newlines = bb.utils.edit_metadata(lines_before, ['LICENSE', 'LIC_FILES_CHKSUM'], varfunc) - if updated: - del lines_before[:] - lines_before.extend(newlines) - else: - raise Exception('Did not find license variables') - def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): import bb.utils - import oe + import oe.package from collections import OrderedDict if 'buildsystem' in handled: @@ -189,7 +179,9 @@ class NpmRecipeHandler(RecipeHandler): files = RecipeHandler.checkfiles(srctree, ['package.json']) if files: d = bb.data.createCopy(tinfoil.config_data) - npm_bindir = check_npm(tinfoil, self._devtool) + npm_bindir = self._ensure_npm() + if not npm_bindir: + sys.exit(14) d.prependVar('PATH', '%s:' % npm_bindir) data = read_package_json(files[0]) @@ -205,10 +197,7 @@ class NpmRecipeHandler(RecipeHandler): fetchdev = extravalues['fetchdev'] or None deps, optdeps, devdeps = self.get_npm_package_dependencies(data, fetchdev) - updated = self._handle_dependencies(d, deps, optdeps, devdeps, lines_before, srctree) - if updated: - # We need to redo the license stuff - self._replace_license_vars(srctree, lines_before, handled, extravalues, d) + self._handle_dependencies(d, deps, optdeps, devdeps, lines_before, srctree) # Shrinkwrap localfilesdir = tempfile.mkdtemp(prefix='recipetool-npm') @@ -219,11 +208,14 @@ class NpmRecipeHandler(RecipeHandler): # Split each npm module out to is own package npmpackages = oe.package.npm_split_package_dirs(srctree) + licvalues = None for item in handled: if isinstance(item, tuple): if item[0] == 'license': licvalues = item[1] break + if not licvalues: + licvalues = handle_license_vars(srctree, lines_before, handled, extravalues, d) if licvalues: # Augment the license list with information we have in the packages licenses = {} @@ -244,13 +236,7 @@ class NpmRecipeHandler(RecipeHandler): all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) if '&' in all_licenses: all_licenses.remove('&') - # Go back and update the LICENSE value since we have a bit more - # information than when that was written out (and we know all apply - # vs. there being a choice, so we can join them with &) - for i, line in enumerate(lines_before): - if line.startswith('LICENSE = '): - lines_before[i] = 'LICENSE = "%s"' % ' & '.join(all_licenses) - break + extravalues['LICENSE'] = ' & '.join(all_licenses) # Need to move S setting after inherit npm for i, line in enumerate(lines_before): diff --git a/import-layers/yocto-poky/scripts/lib/recipetool/newappend.py b/import-layers/yocto-poky/scripts/lib/recipetool/newappend.py index 0b63759d8..decce83fa 100644 --- a/import-layers/yocto-poky/scripts/lib/recipetool/newappend.py +++ b/import-layers/yocto-poky/scripts/lib/recipetool/newappend.py @@ -74,7 +74,7 @@ def newappend(args): return 1 if args.edit: - return scriptutils.run_editor([append_path, recipe_path]) + return scriptutils.run_editor([append_path, recipe_path], logger) else: print(append_path) diff --git a/import-layers/yocto-poky/scripts/lib/scriptutils.py b/import-layers/yocto-poky/scripts/lib/scriptutils.py index 92b601c7e..85b1c949b 100644 --- a/import-layers/yocto-poky/scripts/lib/scriptutils.py +++ b/import-layers/yocto-poky/scripts/lib/scriptutils.py @@ -23,6 +23,8 @@ import argparse import subprocess import tempfile import shutil +import random +import string def logger_create(name, stream=None): logger = logging.getLogger(name) @@ -78,52 +80,139 @@ def git_convert_standalone_clone(repodir): bb.process.run('git repack -a', cwd=repodir) os.remove(alternatesfile) -def fetch_uri(d, uri, destdir, srcrev=None): - """Fetch a URI to a local directory""" +def _get_temp_recipe_dir(d): + # This is a little bit hacky but we need to find a place where we can put + # the recipe so that bitbake can find it. We're going to delete it at the + # end so it doesn't really matter where we put it. + bbfiles = d.getVar('BBFILES').split() + fetchrecipedir = None + for pth in bbfiles: + if pth.endswith('.bb'): + pthdir = os.path.dirname(pth) + if os.access(os.path.dirname(os.path.dirname(pthdir)), os.W_OK): + fetchrecipedir = pthdir.replace('*', 'recipetool') + if pthdir.endswith('workspace/recipes/*'): + # Prefer the workspace + break + return fetchrecipedir + +class FetchUrlFailure(Exception): + def __init__(self, url): + self.url = url + def __str__(self): + return "Failed to fetch URL %s" % self.url + +def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirrors=False): + """ + Fetch the specified URL using normal do_fetch and do_unpack tasks, i.e. + any dependencies that need to be satisfied in order to support the fetch + operation will be taken care of + """ + import bb - tmpparent = d.getVar('BASE_WORKDIR') + + checksums = {} + fetchrecipepn = None + + # We need to put our temp directory under ${BASE_WORKDIR} otherwise + # we may have problems with the recipe-specific sysroot population + tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR') bb.utils.mkdirhier(tmpparent) - tmpworkdir = tempfile.mkdtemp(dir=tmpparent) + tmpdir = tempfile.mkdtemp(prefix='recipetool-', dir=tmpparent) try: - bb.utils.mkdirhier(destdir) - localdata = bb.data.createCopy(d) - - # Set some values to allow extend_recipe_sysroot to work here we're we are not running from a task - localdata.setVar('WORKDIR', tmpworkdir) - localdata.setVar('BB_RUNTASK', 'do_fetch') - localdata.setVar('PN', 'dummy') - localdata.setVar('BB_LIMITEDDEPS', '1') - bb.build.exec_func("extend_recipe_sysroot", localdata) - - # Set some values for the benefit of the fetcher code - localdata.setVar('BB_STRICT_CHECKSUM', '') - localdata.setVar('SRCREV', srcrev) - ret = (None, None) - olddir = os.getcwd() + tmpworkdir = os.path.join(tmpdir, 'work') + logger.debug('fetch_url: temp dir is %s' % tmpdir) + + fetchrecipedir = _get_temp_recipe_dir(tinfoil.config_data) + if not fetchrecipedir: + logger.error('Searched BBFILES but unable to find a writeable place to put temporary recipe') + sys.exit(1) + fetchrecipe = None + bb.utils.mkdirhier(fetchrecipedir) try: - fetcher = bb.fetch2.Fetch([uri], localdata) - for u in fetcher.ud: - ud = fetcher.ud[u] - ud.ignore_checksums = True - fetcher.download() - for u in fetcher.ud: - ud = fetcher.ud[u] - if ud.localpath.rstrip(os.sep) == localdata.getVar('DL_DIR').rstrip(os.sep): - raise Exception('Local path is download directory - please check that the URI "%s" is correct' % uri) - fetcher.unpack(destdir) - for u in fetcher.ud: - ud = fetcher.ud[u] - if ud.method.recommends_checksum(ud): - md5value = bb.utils.md5_file(ud.localpath) - sha256value = bb.utils.sha256_file(ud.localpath) - ret = (md5value, sha256value) + # Generate a dummy recipe so we can follow more or less normal paths + # for do_fetch and do_unpack + # I'd use tempfile functions here but underscores can be produced by that and those + # aren't allowed in recipe file names except to separate the version + rndstring = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)) + fetchrecipe = os.path.join(fetchrecipedir, 'tmp-recipetool-%s.bb' % rndstring) + fetchrecipepn = os.path.splitext(os.path.basename(fetchrecipe))[0] + logger.debug('Generating initial recipe %s for fetching' % fetchrecipe) + with open(fetchrecipe, 'w') as f: + # We don't want to have to specify LIC_FILES_CHKSUM + f.write('LICENSE = "CLOSED"\n') + # We don't need the cross-compiler + f.write('INHIBIT_DEFAULT_DEPS = "1"\n') + # We don't have the checksums yet so we can't require them + f.write('BB_STRICT_CHECKSUM = "ignore"\n') + f.write('SRC_URI = "%s"\n' % srcuri) + f.write('SRCREV = "%s"\n' % srcrev) + f.write('WORKDIR = "%s"\n' % tmpworkdir) + # Set S out of the way so it doesn't get created under the workdir + f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) + if not mirrors: + # We do not need PREMIRRORS since we are almost certainly + # fetching new source rather than something that has already + # been fetched. Hence, we disable them by default. + # However, we provide an option for users to enable it. + f.write('PREMIRRORS = ""\n') + f.write('MIRRORS = ""\n') + + logger.info('Fetching %s...' % srcuri) + + # FIXME this is too noisy at the moment + + # Parse recipes so our new recipe gets picked up + tinfoil.parse_recipes() + + def eventhandler(event): + if isinstance(event, bb.fetch2.MissingChecksumEvent): + checksums.update(event.checksums) + return True + return False + + # Run the fetch + unpack tasks + res = tinfoil.build_targets(fetchrecipepn, + 'do_unpack', + handle_events=True, + extra_events=['bb.fetch2.MissingChecksumEvent'], + event_callback=eventhandler) + if not res: + raise FetchUrlFailure(srcuri) + + # Remove unneeded directories + rd = tinfoil.parse_recipe(fetchrecipepn) + if rd: + pathvars = ['T', 'RECIPE_SYSROOT', 'RECIPE_SYSROOT_NATIVE'] + for pathvar in pathvars: + path = rd.getVar(pathvar) + shutil.rmtree(path) finally: - os.chdir(olddir) + if fetchrecipe: + try: + os.remove(fetchrecipe) + except FileNotFoundError: + pass + try: + os.rmdir(fetchrecipedir) + except OSError as e: + import errno + if e.errno != errno.ENOTEMPTY: + raise + + bb.utils.mkdirhier(destdir) + for fn in os.listdir(tmpworkdir): + shutil.move(os.path.join(tmpworkdir, fn), destdir) + finally: - shutil.rmtree(tmpworkdir) - return ret + if not preserve_tmp: + shutil.rmtree(tmpdir) + tmpdir = None + + return checksums, tmpdir + -def run_editor(fn): +def run_editor(fn, logger=None): if isinstance(fn, str): params = '"%s"' % fn else: @@ -134,8 +223,8 @@ def run_editor(fn): editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi')) try: return subprocess.check_call('%s %s' % (editor, params), shell=True) - except OSError as exc: - logger.error("Execution of editor '%s' failed: %s", editor, exc) + except subprocess.CalledProcessError as exc: + logger.error("Execution of '%s' failed: %s" % (editor, exc)) return 1 def is_src_url(param): diff --git a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/common.wks.inc b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/common.wks.inc index 5cf2fd1f3..89880b417 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/common.wks.inc +++ b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/common.wks.inc @@ -1,3 +1,3 @@ # This file is included into 3 canned wks files from this directory part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 -part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 +part / --source rootfs --use-uuid --fstype=ext4 --label platform --align 1024 diff --git a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg index d5a07d204..c58e74a85 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg +++ b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg @@ -12,16 +12,16 @@ DEFAULT Graphics console boot LABEL Graphics console boot KERNEL /vmlinuz -APPEND label=boot root=/dev/sda2 rootwait +APPEND label=boot rootwait LABEL Serial console boot KERNEL /vmlinuz -APPEND label=boot root=/dev/sda2 rootwait console=ttyS0,115200 +APPEND label=boot rootwait console=ttyS0,115200 LABEL Graphics console install KERNEL /vmlinuz -APPEND label=install root=/dev/sda2 rootwait +APPEND label=install rootwait LABEL Serial console install KERNEL /vmlinuz -APPEND label=install root=/dev/sda2 rootwait console=ttyS0,115200 +APPEND label=install rootwait console=ttyS0,115200 diff --git a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/qemux86-directdisk.wks b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/qemux86-directdisk.wks index db30bbced..1f8466af2 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/qemux86-directdisk.wks +++ b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/qemux86-directdisk.wks @@ -4,5 +4,5 @@ include common.wks.inc -bootloader --timeout=0 --append="vga=0 uvesafb.mode_option=640x480-32 root=/dev/sda2 rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 rootfstype=ext4 " +bootloader --timeout=0 --append="vga=0 uvesafb.mode_option=640x480-32 rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 rootfstype=ext4 " diff --git a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/systemd-bootdisk.wks b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/systemd-bootdisk.wks index 4bd9d6a65..95d7b97a6 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/canned-wks/systemd-bootdisk.wks +++ b/import-layers/yocto-poky/scripts/lib/wic/canned-wks/systemd-bootdisk.wks @@ -2,10 +2,10 @@ # long-description: Creates a partitioned EFI disk image that the user # can directly dd to boot media. The selected bootloader is systemd-boot. -part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk sda --label msdos --active --align 1024 +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk sda --label msdos --active --align 1024 --use-uuid part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid -part swap --ondisk sda --size 44 --label swap1 --fstype=swap +part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid bootloader --ptable gpt --timeout=5 --append="rootwait rootfstype=ext4 console=ttyS0,115200 console=tty0" diff --git a/import-layers/yocto-poky/scripts/lib/wic/engine.py b/import-layers/yocto-poky/scripts/lib/wic/engine.py index f59821fea..edcfab39e 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/engine.py +++ b/import-layers/yocto-poky/scripts/lib/wic/engine.py @@ -30,10 +30,17 @@ import logging import os +import tempfile +import json +import subprocess + +from collections import namedtuple, OrderedDict +from distutils.spawn import find_executable from wic import WicError +from wic.filemap import sparse_copy from wic.pluginbase import PluginMgr -from wic.utils.misc import get_bitbake_var +from wic.misc import get_bitbake_var, exec_cmd logger = logging.getLogger('wic') @@ -201,17 +208,18 @@ def wic_list(args, scripts_path): """ Print the list of images or source plugins. """ - if len(args) < 1: + if args.list_type is None: return False - if args == ["images"]: + if args.list_type == "images": + list_canned_images(scripts_path) return True - elif args == ["source-plugins"]: + elif args.list_type == "source-plugins": list_source_plugins() return True - elif len(args) == 2 and args[1] == "help": - wks_file = args[0] + elif len(args.help_for) == 1 and args.help_for[0] == 'help': + wks_file = args.list_type fullpath = find_canned_image(scripts_path, wks_file) if not fullpath: raise WicError("No image named %s found, exiting. " @@ -224,6 +232,306 @@ def wic_list(args, scripts_path): return False + +class Disk: + def __init__(self, imagepath, native_sysroot, fstypes=('fat', 'ext')): + self.imagepath = imagepath + self.native_sysroot = native_sysroot + self.fstypes = fstypes + self._partitions = None + self._partimages = {} + self._lsector_size = None + self._psector_size = None + self._ptable_format = None + + # find parted + self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/" + if native_sysroot: + for path in self.paths.split(':'): + self.paths = "%s%s:%s" % (native_sysroot, path, self.paths) + + self.parted = find_executable("parted", self.paths) + if not self.parted: + raise WicError("Can't find executable parted") + + self.partitions = self.get_partitions() + + def __del__(self): + for path in self._partimages.values(): + os.unlink(path) + + def get_partitions(self): + if self._partitions is None: + self._partitions = OrderedDict() + out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath)) + parttype = namedtuple("Part", "pnum start end size fstype") + splitted = out.splitlines() + lsector_size, psector_size, self._ptable_format = splitted[1].split(":")[3:6] + self._lsector_size = int(lsector_size) + self._psector_size = int(psector_size) + for line in splitted[2:]: + pnum, start, end, size, fstype = line.split(':')[:5] + partition = parttype(int(pnum), int(start[:-1]), int(end[:-1]), + int(size[:-1]), fstype) + self._partitions[pnum] = partition + + return self._partitions + + def __getattr__(self, name): + """Get path to the executable in a lazy way.""" + if name in ("mdir", "mcopy", "mdel", "mdeltree", "sfdisk", "e2fsck", + "resize2fs", "mkswap", "mkdosfs", "debugfs"): + aname = "_%s" % name + if aname not in self.__dict__: + setattr(self, aname, find_executable(name, self.paths)) + if aname not in self.__dict__: + raise WicError("Can't find executable {}".format(name)) + return self.__dict__[aname] + return self.__dict__[name] + + def _get_part_image(self, pnum): + if pnum not in self.partitions: + raise WicError("Partition %s is not in the image") + part = self.partitions[pnum] + # check if fstype is supported + for fstype in self.fstypes: + if part.fstype.startswith(fstype): + break + else: + raise WicError("Not supported fstype: {}".format(part.fstype)) + if pnum not in self._partimages: + tmpf = tempfile.NamedTemporaryFile(prefix="wic-part") + dst_fname = tmpf.name + tmpf.close() + sparse_copy(self.imagepath, dst_fname, skip=part.start, length=part.size) + self._partimages[pnum] = dst_fname + + return self._partimages[pnum] + + def _put_part_image(self, pnum): + """Put partition image into partitioned image.""" + sparse_copy(self._partimages[pnum], self.imagepath, + seek=self.partitions[pnum].start) + + def dir(self, pnum, path): + if self.partitions[pnum].fstype.startswith('ext'): + return exec_cmd("{} {} -R 'ls -l {}'".format(self.debugfs, + self._get_part_image(pnum), + path), as_shell=True) + else: # fat + return exec_cmd("{} -i {} ::{}".format(self.mdir, + self._get_part_image(pnum), + path)) + + def copy(self, src, pnum, path): + """Copy partition image into wic image.""" + if self.partitions[pnum].fstype.startswith('ext'): + cmd = "echo -e 'cd {}\nwrite {} {}' | {} -w {}".\ + format(path, src, os.path.basename(src), + self.debugfs, self._get_part_image(pnum)) + else: # fat + cmd = "{} -i {} -snop {} ::{}".format(self.mcopy, + self._get_part_image(pnum), + src, path) + exec_cmd(cmd, as_shell=True) + self._put_part_image(pnum) + + def remove(self, pnum, path): + """Remove files/dirs from the partition.""" + partimg = self._get_part_image(pnum) + if self.partitions[pnum].fstype.startswith('ext'): + exec_cmd("{} {} -wR 'rm {}'".format(self.debugfs, + self._get_part_image(pnum), + path), as_shell=True) + else: # fat + cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) + try: + exec_cmd(cmd) + except WicError as err: + if "not found" in str(err) or "non empty" in str(err): + # mdel outputs 'File ... not found' or 'directory .. non empty" + # try to use mdeltree as path could be a directory + cmd = "{} -i {} ::{}".format(self.mdeltree, + partimg, path) + exec_cmd(cmd) + else: + raise err + self._put_part_image(pnum) + + def write(self, target, expand): + """Write disk image to the media or file.""" + def write_sfdisk_script(outf, parts): + for key, val in parts['partitiontable'].items(): + if key in ("partitions", "device", "firstlba", "lastlba"): + continue + if key == "id": + key = "label-id" + outf.write("{}: {}\n".format(key, val)) + outf.write("\n") + for part in parts['partitiontable']['partitions']: + line = '' + for name in ('attrs', 'name', 'size', 'type', 'uuid'): + if name == 'size' and part['type'] == 'f': + # don't write size for extended partition + continue + val = part.get(name) + if val: + line += '{}={}, '.format(name, val) + if line: + line = line[:-2] # strip ', ' + if part.get('bootable'): + line += ' ,bootable' + outf.write("{}\n".format(line)) + outf.flush() + + def read_ptable(path): + out = exec_cmd("{} -dJ {}".format(self.sfdisk, path)) + return json.loads(out) + + def write_ptable(parts, target): + with tempfile.NamedTemporaryFile(prefix="wic-sfdisk-", mode='w') as outf: + write_sfdisk_script(outf, parts) + cmd = "{} --no-reread {} < {} 2>/dev/null".format(self.sfdisk, target, outf.name) + try: + subprocess.check_output(cmd, shell=True) + except subprocess.CalledProcessError as err: + raise WicError("Can't run '{}' command: {}".format(cmd, err)) + + if expand is None: + sparse_copy(self.imagepath, target) + else: + # copy first sectors that may contain bootloader + sparse_copy(self.imagepath, target, length=2048 * self._lsector_size) + + # copy source partition table to the target + parts = read_ptable(self.imagepath) + write_ptable(parts, target) + + # get size of unpartitioned space + free = None + for line in exec_cmd("{} -F {}".format(self.sfdisk, target)).splitlines(): + if line.startswith("Unpartitioned space ") and line.endswith("sectors"): + free = int(line.split()[-2]) + if free is None: + raise WicError("Can't get size of unpartitioned space") + + # calculate expanded partitions sizes + sizes = {} + for num, part in enumerate(parts['partitiontable']['partitions'], 1): + if num in expand: + if expand[num] != 0: # don't resize partition if size is set to 0 + sectors = expand[num] // self._lsector_size + free -= sectors - part['size'] + part['size'] = sectors + sizes[num] = sectors + elif part['type'] != 'f': + sizes[num] = -1 + + for num, part in enumerate(parts['partitiontable']['partitions'], 1): + if sizes.get(num) == -1: + part['size'] += free // len(sizes) + + # write resized partition table to the target + write_ptable(parts, target) + + # read resized partition table + parts = read_ptable(target) + + # copy partitions content + for num, part in enumerate(parts['partitiontable']['partitions'], 1): + pnum = str(num) + fstype = self.partitions[pnum].fstype + + # copy unchanged partition + if part['size'] == self.partitions[pnum].size // self._lsector_size: + logger.info("copying unchanged partition {}".format(pnum)) + sparse_copy(self._get_part_image(pnum), target, seek=part['start'] * self._lsector_size) + continue + + # resize or re-create partitions + if fstype.startswith('ext') or fstype.startswith('fat') or \ + fstype.startswith('linux-swap'): + + partfname = None + with tempfile.NamedTemporaryFile(prefix="wic-part{}-".format(pnum)) as partf: + partfname = partf.name + + if fstype.startswith('ext'): + logger.info("resizing ext partition {}".format(pnum)) + partimg = self._get_part_image(pnum) + sparse_copy(partimg, partfname) + exec_cmd("{} -pf {}".format(self.e2fsck, partfname)) + exec_cmd("{} {} {}s".format(\ + self.resize2fs, partfname, part['size'])) + elif fstype.startswith('fat'): + logger.info("copying content of the fat partition {}".format(pnum)) + with tempfile.TemporaryDirectory(prefix='wic-fatdir-') as tmpdir: + # copy content to the temporary directory + cmd = "{} -snompi {} :: {}".format(self.mcopy, + self._get_part_image(pnum), + tmpdir) + exec_cmd(cmd) + # create new msdos partition + label = part.get("name") + label_str = "-n {}".format(label) if label else '' + + cmd = "{} {} -C {} {}".format(self.mkdosfs, label_str, partfname, + part['size']) + exec_cmd(cmd) + # copy content from the temporary directory to the new partition + cmd = "{} -snompi {} {}/* ::".format(self.mcopy, partfname, tmpdir) + exec_cmd(cmd, as_shell=True) + elif fstype.startswith('linux-swap'): + logger.info("creating swap partition {}".format(pnum)) + label = part.get("name") + label_str = "-L {}".format(label) if label else '' + uuid = part.get("uuid") + uuid_str = "-U {}".format(uuid) if uuid else '' + with open(partfname, 'w') as sparse: + os.ftruncate(sparse.fileno(), part['size'] * self._lsector_size) + exec_cmd("{} {} {} {}".format(self.mkswap, label_str, uuid_str, partfname)) + sparse_copy(partfname, target, seek=part['start'] * self._lsector_size) + os.unlink(partfname) + elif part['type'] != 'f': + logger.warn("skipping partition {}: unsupported fstype {}".format(pnum, fstype)) + +def wic_ls(args, native_sysroot): + """List contents of partitioned image or vfat partition.""" + disk = Disk(args.path.image, native_sysroot) + if not args.path.part: + if disk.partitions: + print('Num Start End Size Fstype') + for part in disk.partitions.values(): + print("{:2d} {:12d} {:12d} {:12d} {}".format(\ + part.pnum, part.start, part.end, + part.size, part.fstype)) + else: + path = args.path.path or '/' + print(disk.dir(args.path.part, path)) + +def wic_cp(args, native_sysroot): + """ + Copy local file or directory to the vfat partition of + partitioned image. + """ + disk = Disk(args.dest.image, native_sysroot) + disk.copy(args.src, args.dest.part, args.dest.path) + +def wic_rm(args, native_sysroot): + """ + Remove files or directories from the vfat partition of + partitioned image. + """ + disk = Disk(args.path.image, native_sysroot) + disk.remove(args.path.part, args.path.path) + +def wic_write(args, native_sysroot): + """ + Write image to a target device. + """ + disk = Disk(args.image, native_sysroot, ('fat', 'ext', 'swap')) + disk.write(args.target, args.expand) + def find_canned(scripts_path, file_name): """ Find a file either by its path or by name in the canned files dir. diff --git a/import-layers/yocto-poky/scripts/lib/wic/filemap.py b/import-layers/yocto-poky/scripts/lib/wic/filemap.py index 1f1aacc52..77e32b9ad 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/filemap.py +++ b/import-layers/yocto-poky/scripts/lib/wic/filemap.py @@ -34,13 +34,9 @@ def get_block_size(file_obj): Returns block size for file object 'file_obj'. Errors are indicated by the 'IOError' exception. """ - - from fcntl import ioctl - import struct - # Get the block size of the host file-system for the image file by calling # the FIGETBSZ ioctl (number 2). - binary_data = ioctl(file_obj, 2, struct.pack('I', 0)) + binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) return struct.unpack('I', binary_data)[0] class ErrorNotSupp(Exception): @@ -228,7 +224,7 @@ class FilemapSeek(_FilemapBase): try: tmp_obj = tempfile.TemporaryFile("w+", dir=directory) except IOError as err: - raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" + raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" \ % (directory, err)) try: @@ -530,8 +526,18 @@ def filemap(image, log=None): except ErrorNotSupp: return FilemapSeek(image, log) -def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): - """Efficiently copy sparse file to or into another file.""" +def sparse_copy(src_fname, dst_fname, skip=0, seek=0, + length=0, api=None): + """ + Efficiently copy sparse file to or into another file. + + src_fname: path to source file + dst_fname: path to destination file + skip: skip N bytes at thestart of src + seek: seek N bytes from the start of dst + length: read N bytes from src and write them to dst + api: FilemapFiemap or FilemapSeek object + """ if not api: api = filemap fmap = api(src_fname) @@ -539,17 +545,32 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): dst_file = open(dst_fname, 'r+b') except IOError: dst_file = open(dst_fname, 'wb') - dst_file.truncate(os.path.getsize(src_fname)) + if length: + dst_size = length + seek + else: + dst_size = os.path.getsize(src_fname) + seek - skip + dst_file.truncate(dst_size) + written = 0 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): start = first * fmap.block_size end = (last + 1) * fmap.block_size + if skip >= end: + continue + if start < skip < end: - fmap._f_image.seek(skip, os.SEEK_SET) - else: - fmap._f_image.seek(start, os.SEEK_SET) - dst_file.seek(offset + start, os.SEEK_SET) + start = skip + + fmap._f_image.seek(start, os.SEEK_SET) + + written += start - skip - written + if length and written >= length: + dst_file.seek(seek + length, os.SEEK_SET) + dst_file.close() + return + + dst_file.seek(seek + start - skip, os.SEEK_SET) chunk_size = 1024 * 1024 to_read = end - start @@ -558,7 +579,14 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): while read < to_read: if read + chunk_size > to_read: chunk_size = to_read - read - chunk = fmap._f_image.read(chunk_size) + size = chunk_size + if length and written + size > length: + size = length - written + chunk = fmap._f_image.read(size) dst_file.write(chunk) - read += chunk_size + read += size + written += size + if written == length: + dst_file.close() + return dst_file.close() diff --git a/import-layers/yocto-poky/scripts/lib/wic/help.py b/import-layers/yocto-poky/scripts/lib/wic/help.py index d6e027d25..2ac45e052 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/help.py +++ b/import-layers/yocto-poky/scripts/lib/wic/help.py @@ -56,7 +56,7 @@ def wic_help(args, usage_str, subcommands): """ Subcommand help dispatcher. """ - if len(args) == 1 or not display_help(args[1], subcommands): + if args.help_topic == None or not display_help(args.help_topic, subcommands): print(usage_str) @@ -82,19 +82,20 @@ def invoke_subcommand(args, parser, main_command_usage, subcommands): Dispatch to subcommand handler borrowed from combo-layer. Should use argparse, but has to work in 2.6. """ - if not args: + if not args.command: logger.error("No subcommand specified, exiting") parser.print_help() return 1 - elif args[0] == "help": + elif args.command == "help": wic_help(args, main_command_usage, subcommands) - elif args[0] not in subcommands: - logger.error("Unsupported subcommand %s, exiting\n", args[0]) + elif args.command not in subcommands: + logger.error("Unsupported subcommand %s, exiting\n", args.command) parser.print_help() return 1 else: - usage = subcommands.get(args[0], subcommand_error)[1] - subcommands.get(args[0], subcommand_error)[0](args[1:], usage) + subcmd = subcommands.get(args.command, subcommand_error) + usage = subcmd[1] + subcmd[0](args, usage) ## @@ -130,10 +131,10 @@ wic_create_usage = """ Create a new OpenEmbedded image usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>] - [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] [-e | --image-name] [-s, --skip-build-check] [-D, --debug] [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] + [-c, --compress-with] [-m, --bmap] This command creates an OpenEmbedded image based on the 'OE kickstart commands' found in the <wks file>. @@ -154,7 +155,7 @@ SYNOPSIS [-e | --image-name] [-s, --skip-build-check] [-D, --debug] [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] - [-c, --compress-with] [-m, --bmap] + [-c, --compress-with] [-m, --bmap] [--no-fstab-update] DESCRIPTION This command creates an OpenEmbedded image based on the 'OE @@ -226,6 +227,11 @@ DESCRIPTION The -m option is used to produce .bmap file for the image. This file can be used to flash image using bmaptool utility. + + The --no-fstab-update option is used to doesn't change fstab file. When + using this option the final fstab file will be same that in rootfs and + wic doesn't update file, e.g adding a new mount point. User can control + the fstab file content in base-files recipe. """ wic_list_usage = """ @@ -283,6 +289,230 @@ DESCRIPTION details. """ +wic_ls_usage = """ + + List content of a partitioned image + + usage: wic ls <image>[:<partition>[<path>]] [--native-sysroot <path>] + + This command outputs either list of image partitions or directory contents + of vfat and ext* partitions. + + See 'wic help ls' for more detailed instructions. + +""" + +wic_ls_help = """ + +NAME + wic ls - List contents of partitioned image or partition + +SYNOPSIS + wic ls <image> + wic ls <image>:<vfat or ext* partition> + wic ls <image>:<vfat or ext* partition><path> + wic ls <image>:<vfat or ext* partition><path> --native-sysroot <path> + +DESCRIPTION + This command lists either partitions of the image or directory contents + of vfat or ext* partitions. + + The first form it lists partitions of the image. + For example: + $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic + Num Start End Size Fstype + 1 1048576 24438783 23390208 fat16 + 2 25165824 50315263 25149440 ext4 + + Second and third form list directory content of the partition: + $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1 + Volume in drive : is boot + Volume Serial Number is 2DF2-5F02 + Directory for ::/ + + efi <DIR> 2017-05-11 10:54 + startup nsh 26 2017-05-11 10:54 + vmlinuz 6922288 2017-05-11 10:54 + 3 files 6 922 314 bytes + 15 818 752 bytes free + + + $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/EFI/boot/ + Volume in drive : is boot + Volume Serial Number is 2DF2-5F02 + Directory for ::/EFI/boot + + . <DIR> 2017-05-11 10:54 + .. <DIR> 2017-05-11 10:54 + grub cfg 679 2017-05-11 10:54 + bootx64 efi 571392 2017-05-11 10:54 + 4 files 572 071 bytes + 15 818 752 bytes free + + The -n option is used to specify the path to the native sysroot + containing the tools(parted and mtools) to use. + +""" + +wic_cp_usage = """ + + Copy files and directories to the vfat or ext* partition + + usage: wic cp <src> <image>:<partition>[<path>] [--native-sysroot <path>] + + This command copies local files or directories to the vfat or ext* partitions +of partitioned image. + + See 'wic help cp' for more detailed instructions. + +""" + +wic_cp_help = """ + +NAME + wic cp - copy files and directories to the vfat or ext* partitions + +SYNOPSIS + wic cp <src> <image>:<partition> + wic cp <src> <image>:<partition><path> + wic cp <src> <image>:<partition><path> --native-sysroot <path> + +DESCRIPTION + This command copies files and directories to the vfat or ext* partition of + the partitioned image. + + The first form of it copies file or directory to the root directory of + the partition: + $ wic cp test.wks tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1 + $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1 + Volume in drive : is boot + Volume Serial Number is DB4C-FD4C + Directory for ::/ + + efi <DIR> 2017-05-24 18:15 + loader <DIR> 2017-05-24 18:15 + startup nsh 26 2017-05-24 18:15 + vmlinuz 6926384 2017-05-24 18:15 + test wks 628 2017-05-24 21:22 + 5 files 6 927 038 bytes + 15 677 440 bytes free + + The second form of the command copies file or directory to the specified directory + on the partition: + $ wic cp test tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/efi/ + $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/efi/ + Volume in drive : is boot + Volume Serial Number is DB4C-FD4C + Directory for ::/efi + + . <DIR> 2017-05-24 18:15 + .. <DIR> 2017-05-24 18:15 + boot <DIR> 2017-05-24 18:15 + test <DIR> 2017-05-24 21:27 + 4 files 0 bytes + 15 675 392 bytes free + + The -n option is used to specify the path to the native sysroot + containing the tools(parted and mtools) to use. +""" + +wic_rm_usage = """ + + Remove files or directories from the vfat or ext* partitions + + usage: wic rm <image>:<partition><path> [--native-sysroot <path>] + + This command removes files or directories from the vfat or ext* partitions of + the partitioned image. + + See 'wic help rm' for more detailed instructions. + +""" + +wic_rm_help = """ + +NAME + wic rm - remove files or directories from the vfat or ext* partitions + +SYNOPSIS + wic rm <src> <image>:<partition><path> + wic rm <src> <image>:<partition><path> --native-sysroot <path> + +DESCRIPTION + This command removes files or directories from the vfat or ext* partition of the + partitioned image: + + $ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1 + Volume in drive : is boot + Volume Serial Number is 11D0-DE21 + Directory for ::/ + + libcom32 c32 186500 2017-06-02 15:15 + libutil c32 24148 2017-06-02 15:15 + syslinux cfg 209 2017-06-02 15:15 + vesamenu c32 27104 2017-06-02 15:15 + vmlinuz 6926384 2017-06-02 15:15 + 5 files 7 164 345 bytes + 16 582 656 bytes free + + $ wic rm ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/libutil.c32 + + $ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1 + Volume in drive : is boot + Volume Serial Number is 11D0-DE21 + Directory for ::/ + + libcom32 c32 186500 2017-06-02 15:15 + syslinux cfg 209 2017-06-02 15:15 + vesamenu c32 27104 2017-06-02 15:15 + vmlinuz 6926384 2017-06-02 15:15 + 4 files 7 140 197 bytes + 16 607 232 bytes free + + The -n option is used to specify the path to the native sysroot + containing the tools(parted and mtools) to use. +""" + +wic_write_usage = """ + + Write image to a device + + usage: wic write <image> <target device> [--expand [rules]] [--native-sysroot <path>] + + This command writes partitioned image to a target device (USB stick, SD card etc). + + See 'wic help write' for more detailed instructions. + +""" + +wic_write_help = """ + +NAME + wic write - write an image to a device + +SYNOPSIS + wic write <image> <target> + wic write <image> <target> --expand auto + wic write <image> <target> --expand 1:100M-2:300M + wic write <image> <target> --native-sysroot <path> + +DESCRIPTION + This command writes an image to a target device (USB stick, SD card etc) + + $ wic write ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic /dev/sdb + + The --expand option is used to resize image partitions. + --expand auto expands partitions to occupy all free space available on the target device. + It's also possible to specify expansion rules in a format + <partition>:<size>[-<partition>:<size>...] for one or more partitions. + Specifying size 0 will keep partition unmodified. + Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is + recommended to use size 0 for boot partition to keep image bootable. + + The --native-sysroot option is used to specify the path to the native sysroot + containing the tools(parted, resize2fs) to use. +""" + wic_plugins_help = """ NAME @@ -740,6 +970,8 @@ DESCRIPTION This option cannot be used with --fixed-size option. + --part-name: This option is specific to wic. It specifies name for GPT partitions. + --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. List of partition type GUIDS can be found here: @@ -758,6 +990,12 @@ DESCRIPTION for the harware that requires non-default partition system ids. The parameter in one byte long hex number either with 0x prefix or without it. + --mkfs-extraopts: This option specifies extra options to pass to mkfs utility. + NOTE, that wic uses default options for some filesystems, for example + '-S 512' for mkfs.fat or '-F -i 8192' for mkfs.ext. Those options will + not take effect when --mkfs-extraopts is used. This should be taken into + account when using --mkfs-extraopts. + * bootloader This command allows the user to specify various bootloader @@ -795,3 +1033,11 @@ DESCRIPTION .wks files. """ + +wic_help_help = """ +NAME + wic help - display a help topic + +DESCRIPTION + Specify a help topic to display it. Topics are shown above. +""" diff --git a/import-layers/yocto-poky/scripts/lib/wic/ksparser.py b/import-layers/yocto-poky/scripts/lib/wic/ksparser.py index d026caad0..7850e81d2 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/ksparser.py +++ b/import-layers/yocto-poky/scripts/lib/wic/ksparser.py @@ -114,7 +114,7 @@ def systemidtype(arg): return arg class KickStart(): - """"Kickstart parser implementation.""" + """Kickstart parser implementation.""" DEFAULT_EXTRA_SPACE = 10*1024 DEFAULT_OVERHEAD_FACTOR = 1.3 @@ -139,10 +139,12 @@ class KickStart(): part.add_argument('--fstype', default='vfat', choices=('ext2', 'ext3', 'ext4', 'btrfs', 'squashfs', 'vfat', 'msdos', 'swap')) + part.add_argument('--mkfs-extraopts', default='') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') part.add_argument("--overhead-factor", type=overheadtype) + part.add_argument('--part-name') part.add_argument('--part-type') part.add_argument('--rootfs-dir') diff --git a/import-layers/yocto-poky/scripts/lib/wic/utils/misc.py b/import-layers/yocto-poky/scripts/lib/wic/misc.py index 37e0ad6a3..ee888b478 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/utils/misc.py +++ b/import-layers/yocto-poky/scripts/lib/wic/misc.py @@ -29,12 +29,12 @@ import logging import os import re +import subprocess from collections import defaultdict from distutils import spawn from wic import WicError -from wic.utils import runner logger = logging.getLogger('wic') @@ -43,6 +43,9 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools", "grub-mkimage": "grub-efi", "isohybrid": "syslinux", "mcopy": "mtools", + "mdel" : "mtools", + "mdeltree" : "mtools", + "mdir" : "mtools", "mkdosfs": "dosfstools", "mkisofs": "cdrtools", "mkfs.btrfs": "btrfs-tools", @@ -52,13 +55,46 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools", "mkfs.vfat": "dosfstools", "mksquashfs": "squashfs-tools", "mkswap": "util-linux", - "mmd": "syslinux", + "mmd": "mtools", "parted": "parted", "sfdisk": "util-linux", "sgdisk": "gptfdisk", "syslinux": "syslinux" } +def runtool(cmdln_or_args): + """ wrapper for most of the subprocess calls + input: + cmdln_or_args: can be both args and cmdln str (shell=True) + return: + rc, output + """ + if isinstance(cmdln_or_args, list): + cmd = cmdln_or_args[0] + shell = False + else: + import shlex + cmd = shlex.split(cmdln_or_args)[0] + shell = True + + sout = subprocess.PIPE + serr = subprocess.STDOUT + + try: + process = subprocess.Popen(cmdln_or_args, stdout=sout, + stderr=serr, shell=shell) + sout, serr = process.communicate() + # combine stdout and stderr, filter None out and decode + out = ''.join([out.decode('utf-8') for out in [sout, serr] if out]) + except OSError as err: + if err.errno == 2: + # [Errno 2] No such file or directory + raise WicError('Cannot run command: %s, lost dependency?' % cmd) + else: + raise # relay + + return process.returncode, out + def _exec_cmd(cmd_and_args, as_shell=False): """ Execute command, catching stderr, stdout @@ -70,9 +106,9 @@ def _exec_cmd(cmd_and_args, as_shell=False): logger.debug(args) if as_shell: - ret, out = runner.runtool(cmd_and_args) + ret, out = runtool(cmd_and_args) else: - ret, out = runner.runtool(args) + ret, out = runtool(args) out = out.strip() if ret != 0: raise WicError("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \ @@ -106,14 +142,11 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): if pseudo: cmd_and_args = pseudo + cmd_and_args - wtools_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", "wic-tools") + native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ + (native_sysroot, native_sysroot, native_sysroot) - native_paths = \ - "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/sbin:%s/usr/sbin:%s/usr/bin" % \ - (wtools_sysroot, wtools_sysroot, wtools_sysroot, - native_sysroot, native_sysroot, native_sysroot) native_cmd_and_args = "export PATH=%s:$PATH;%s" % \ - (native_paths, cmd_and_args) + (native_paths, cmd_and_args) logger.debug("exec_native_cmd: %s", native_cmd_and_args) # If the command isn't in the native sysroot say we failed. @@ -131,8 +164,8 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): "was not found (see details above).\n\n" % prog recipe = NATIVE_RECIPES.get(prog) if recipe: - msg += "Please make sure wic-tools have %s-native in its DEPENDS, bake it with 'bitbake wic-tools' "\ - "and try again.\n" % recipe + msg += "Please make sure wic-tools have %s-native in its DEPENDS, "\ + "build it with 'bitbake wic-tools' and try again.\n" % recipe else: msg += "Wic failed to find a recipe to build native %s. Please "\ "file a bug against wic.\n" % prog diff --git a/import-layers/yocto-poky/scripts/lib/wic/partition.py b/import-layers/yocto-poky/scripts/lib/wic/partition.py index 939e66731..84fe85d62 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/partition.py +++ b/import-layers/yocto-poky/scripts/lib/wic/partition.py @@ -26,10 +26,9 @@ import logging import os -import tempfile from wic import WicError -from wic.utils.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var from wic.pluginbase import PluginMgr logger = logging.getLogger('wic') @@ -47,10 +46,12 @@ class Partition(): self.fsopts = args.fsopts self.fstype = args.fstype self.label = args.label + self.mkfs_extraopts = args.mkfs_extraopts self.mountpoint = args.mountpoint self.no_table = args.no_table self.num = None self.overhead_factor = args.overhead_factor + self.part_name = args.part_name self.part_type = args.part_type self.rootfs_dir = args.rootfs_dir self.size = args.size @@ -205,7 +206,7 @@ class Partition(): """ p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", - "%s/../pseudo" % rootfs_dir) + "%s/../pseudo" % get_bitbake_var("IMAGE_ROOTFS")) p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir) p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1") pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix @@ -257,14 +258,14 @@ class Partition(): with open(rootfs, 'w') as sparse: os.ftruncate(sparse.fileno(), rootfs_size * 1024) - extra_imagecmd = "-i 8192" + extraopts = self.mkfs_extraopts or "-F -i 8192" label_str = "" if self.label: label_str = "-L %s" % self.label - mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ - (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir) + mkfs_cmd = "mkfs.%s %s %s %s -d %s" % \ + (self.fstype, extraopts, rootfs, label_str, rootfs_dir) exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) @@ -290,8 +291,9 @@ class Partition(): if self.label: label_str = "-L %s" % self.label - mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ - (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs) + mkfs_cmd = "mkfs.%s -b %d -r %s %s %s %s" % \ + (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, + self.mkfs_extraopts, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, @@ -313,8 +315,10 @@ class Partition(): if self.fstype == 'msdos': size_str = "-F 16" # FAT 16 - dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, - rootfs, rootfs_size) + extraopts = self.mkfs_extraopts or '-S 512' + + dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ + (label_str, size_str, extraopts, rootfs, rootfs_size) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) @@ -330,8 +334,9 @@ class Partition(): """ Prepare content for a squashfs rootfs partition. """ - squashfs_cmd = "mksquashfs %s %s -noappend" % \ - (rootfs_dir, rootfs) + extraopts = self.mkfs_extraopts or '-noappend' + squashfs_cmd = "mksquashfs %s %s %s" % \ + (rootfs_dir, rootfs, extraopts) exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) def prepare_empty_partition_ext(self, rootfs, oe_builddir, @@ -343,14 +348,14 @@ class Partition(): with open(rootfs, 'w') as sparse: os.ftruncate(sparse.fileno(), size * 1024) - extra_imagecmd = "-i 8192" + extraopts = self.mkfs_extraopts or "-i 8192" label_str = "" if self.label: label_str = "-L %s" % self.label mkfs_cmd = "mkfs.%s -F %s %s %s" % \ - (self.fstype, extra_imagecmd, label_str, rootfs) + (self.fstype, extraopts, label_str, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot) def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, @@ -366,8 +371,9 @@ class Partition(): if self.label: label_str = "-L %s" % self.label - mkfs_cmd = "mkfs.%s -b %d %s %s" % \ - (self.fstype, self.size * 1024, label_str, rootfs) + mkfs_cmd = "mkfs.%s -b %d %s %s %s" % \ + (self.fstype, self.size * 1024, label_str, + self.mkfs_extraopts, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot) def prepare_empty_partition_msdos(self, rootfs, oe_builddir, @@ -385,8 +391,11 @@ class Partition(): if self.fstype == 'msdos': size_str = "-F 16" # FAT 16 - dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, - rootfs, blocks) + extraopts = self.mkfs_extraopts or '-S 512' + + dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ + (label_str, extraopts, size_str, rootfs, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) chmod_cmd = "chmod 644 %s" % rootfs diff --git a/import-layers/yocto-poky/scripts/lib/wic/pluginbase.py b/import-layers/yocto-poky/scripts/lib/wic/pluginbase.py index fb3d179c2..c009820ad 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/pluginbase.py +++ b/import-layers/yocto-poky/scripts/lib/wic/pluginbase.py @@ -24,7 +24,7 @@ from collections import defaultdict from importlib.machinery import SourceFileLoader from wic import WicError -from wic.utils.misc import get_bitbake_var +from wic.misc import get_bitbake_var PLUGIN_TYPES = ["imager", "source"] @@ -137,4 +137,3 @@ class SourcePlugin(metaclass=PluginMeta): 'prepares' the partition to be incorporated into the image. """ logger.debug("SourcePlugin: do_prepare_partition: part: %s", part) - diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py index f2e612733..da1c06106 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py @@ -26,17 +26,20 @@ import logging import os +import random import shutil import tempfile import uuid from time import strftime +from oe.path import copyhardlinktree + from wic import WicError from wic.filemap import sparse_copy from wic.ksparser import KickStart, KickStartError from wic.pluginbase import PluginMgr, ImagerPlugin -from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd +from wic.misc import get_bitbake_var, exec_cmd, exec_native_cmd logger = logging.getLogger('wic') @@ -68,6 +71,7 @@ class DirectPlugin(ImagerPlugin): self.outdir = options.outdir self.compressor = options.compressor self.bmap = options.bmap + self.no_fstab_update = options.no_fstab_update self.name = "%s-%s" % (os.path.splitext(os.path.basename(wks_file))[0], strftime("%Y%m%d%H%M")) @@ -115,24 +119,33 @@ class DirectPlugin(ImagerPlugin): fstab_lines = fstab.readlines() if self._update_fstab(fstab_lines, self.parts): - shutil.copyfile(fstab_path, fstab_path + ".orig") + # copy rootfs dir to workdir to update fstab + # as rootfs can be used by other tasks and can't be modified + new_rootfs = os.path.realpath(os.path.join(self.workdir, "rootfs_copy")) + copyhardlinktree(image_rootfs, new_rootfs) + fstab_path = os.path.join(new_rootfs, 'etc/fstab') + + os.unlink(fstab_path) with open(fstab_path, "w") as fstab: fstab.writelines(fstab_lines) - return fstab_path + return new_rootfs def _update_fstab(self, fstab_lines, parts): """Assume partition order same as in wks""" updated = False for part in parts: if not part.realnum or not part.mountpoint \ - or part.mountpoint in ("/", "/boot"): + or part.mountpoint == "/": continue - # mmc device partitions are named mmcblk0p1, mmcblk0p2.. - prefix = 'p' if part.disk.startswith('mmcblk') else '' - device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum) + if part.use_uuid: + device_name = "PARTUUID=%s" % part.uuid + else: + # mmc device partitions are named mmcblk0p1, mmcblk0p2.. + prefix = 'p' if part.disk.startswith('mmcblk') else '' + device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum) opts = part.fsopts if part.fsopts else "defaults" line = "\t".join([device_name, part.mountpoint, part.fstype, @@ -156,7 +169,13 @@ class DirectPlugin(ImagerPlugin): filesystems from the artifacts directly and combine them into a partitioned image. """ - fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) + if self.no_fstab_update: + new_rootfs = None + else: + new_rootfs = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) + if new_rootfs: + # rootfs was copied to update fstab + self.rootfs_dir['ROOTFS_DIR'] = new_rootfs for part in self.parts: # get rootfs size from bitbake variable if it's not set in .ks file @@ -173,10 +192,6 @@ class DirectPlugin(ImagerPlugin): part.size = int(round(float(rsize_bb))) self._image.prepare(self) - - if fstab_path: - shutil.move(fstab_path + ".orig", fstab_path) - self._image.layout_partitions() self._image.create() @@ -205,8 +220,10 @@ class DirectPlugin(ImagerPlugin): # Generate .bmap if self.bmap: logger.debug("Generating bmap file for %s", disk_name) - exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path), - self.native_sysroot) + python = os.path.join(self.native_sysroot, 'usr/bin/python3-native/python3') + bmaptool = os.path.join(self.native_sysroot, 'usr/bin/bmaptool') + exec_native_cmd("%s %s create %s -o %s.bmap" % \ + (python, bmaptool, full_path, full_path), self.native_sysroot) # Compress the image if self.compressor: logger.debug("Compressing disk %s with %s", disk_name, self.compressor) @@ -296,7 +313,7 @@ class PartitionedImage(): # all partitions (in bytes) self.ptable_format = ptable_format # Partition table format # Disk system identifier - self.identifier = int.from_bytes(os.urandom(4), 'little') + self.identifier = random.SystemRandom().randint(1, 0xffffffff) self.partitions = partitions self.partimages = [] @@ -312,7 +329,7 @@ class PartitionedImage(): part.realnum = 0 else: realnum += 1 - if self.ptable_format == 'msdos' and realnum > 3: + if self.ptable_format == 'msdos' and realnum > 3 and len(partitions) > 4: part.realnum = realnum + 1 continue part.realnum = realnum @@ -352,6 +369,10 @@ class PartitionedImage(): for num in range(len(self.partitions)): part = self.partitions[num] + if self.ptable_format == 'msdos' and part.part_name: + raise WicError("setting custom partition name is not " \ + "implemented for msdos partitions") + if self.ptable_format == 'msdos' and part.part_type: # The --part-type can also be implemented for MBR partitions, # in which case it would map to the 1-byte "partition type" @@ -505,6 +526,13 @@ class PartitionedImage(): self._create_partition(self.path, part.type, parted_fs_type, part.start, part.size_sec) + if part.part_name: + logger.debug("partition %d: set name to %s", + part.num, part.part_name) + exec_native_cmd("sgdisk --change-name=%d:%s %s" % \ + (part.num, part.part_name, + self.path), self.native_sysroot) + if part.part_type: logger.debug("partition %d: set type UID to %s", part.num, part.part_type) @@ -550,7 +578,7 @@ class PartitionedImage(): source = part.source_file if source: # install source_file contents into a partition - sparse_copy(source, self.path, part.start * self.sector_size) + sparse_copy(source, self.path, seek=part.start * self.sector_size) logger.debug("Installed %s in partition %d, sectors %d-%d, " "size %d sectors", source, part.num, part.start, diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py index 9879cb9fc..4c4f36a32 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -31,8 +31,8 @@ import shutil from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, - BOOTDD_EXTRA_SPACE) +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, BOOTDD_EXTRA_SPACE) logger = logging.getLogger('wic') diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py index 13fddbd47..67e5498d5 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -31,7 +31,7 @@ from glob import glob from wic import WicError from wic.pluginbase import SourcePlugin -from wic.utils.misc import exec_cmd, get_bitbake_var +from wic.misc import exec_cmd, get_bitbake_var logger = logging.getLogger('wic') @@ -54,7 +54,7 @@ class BootimgPartitionPlugin(SourcePlugin): - sets up a vfat partition - copies all files listed in IMAGE_BOOT_FILES variable """ - hdddir = "%s/boot" % cr_workdir + hdddir = "%s/boot.%d" % (cr_workdir, part.lineno) install_cmd = "install -d %s" % hdddir exec_cmd(install_cmd) @@ -65,10 +65,19 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Kernel dir: %s', bootimg_dir) - boot_files = get_bitbake_var("IMAGE_BOOT_FILES") + boot_files = None + for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): + if fmt: + var = fmt % id + else: + var = "" + + boot_files = get_bitbake_var("IMAGE_BOOT_FILES" + var) + if boot_files is not None: + break - if not boot_files: - raise WicError('No boot files defined, IMAGE_BOOT_FILES unset') + if boot_files is None: + raise WicError('No boot files defined, IMAGE_BOOT_FILES unset for entry #%d' % part.lineno) logger.debug('Boot files: %s', boot_files) diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 5890c1267..56da468fb 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -29,10 +29,9 @@ import os from wic import WicError from wic.engine import get_custom_config -from wic.utils import runner from wic.pluginbase import SourcePlugin -from wic.utils.misc import (exec_cmd, exec_native_cmd, - get_bitbake_var, BOOTDD_EXTRA_SPACE) +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, BOOTDD_EXTRA_SPACE) logger = logging.getLogger('wic') @@ -46,10 +45,9 @@ class BootimgPcbiosPlugin(SourcePlugin): @classmethod def _get_bootimg_dir(cls, bootimg_dir, dirname): """ - Check if dirname exists in default bootimg_dir or - in wic-tools STAGING_DIR. + Check if dirname exists in default bootimg_dir or in STAGING_DIR. """ - for result in (bootimg_dir, get_bitbake_var("STAGING_DATADIR", "wic-tools")): + for result in (bootimg_dir, get_bitbake_var("STAGING_DATADIR")): if os.path.exists("%s/%s" % (result, dirname)): return result @@ -186,7 +184,7 @@ class BootimgPcbiosPlugin(SourcePlugin): extra_blocks, part.mountpoint, blocks) # dosfs image, created by mkdosfs - bootimg = "%s/boot.img" % cr_workdir + bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno) dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index 1ceba62be..d6bd3bff7 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -29,7 +29,7 @@ import shutil from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var logger = logging.getLogger('wic') @@ -95,7 +95,7 @@ class IsoImagePlugin(SourcePlugin): cfg.write(syslinux_conf) @classmethod - def do_configure_grubefi(cls, part, creator, cr_workdir): + def do_configure_grubefi(cls, part, creator, target_dir): """ Create loader-specific (grub-efi) config """ @@ -109,7 +109,7 @@ class IsoImagePlugin(SourcePlugin): raise WicError("configfile is specified " "but failed to get it from %s", configfile) else: - splash = os.path.join(cr_workdir, "EFI/boot/splash.jpg") + splash = os.path.join(target_dir, "splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: @@ -137,9 +137,10 @@ class IsoImagePlugin(SourcePlugin): if splashline: grubefi_conf += "%s\n" % splashline - logger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg", cr_workdir) + cfg_path = os.path.join(target_dir, "grub.cfg") + logger.debug("Writing grubefi config %s", cfg_path) - with open("%s/EFI/BOOT/grub.cfg" % cr_workdir, "w") as cfg: + with open(cfg_path, "w") as cfg: cfg.write(grubefi_conf) @staticmethod @@ -162,13 +163,14 @@ class IsoImagePlugin(SourcePlugin): if not image_type: raise WicError("Couldn't find INITRAMFS_FSTYPES, exiting.") - target_arch = get_bitbake_var("TRANSLATED_TARGET_ARCH") - if not target_arch: - raise WicError("Couldn't find TRANSLATED_TARGET_ARCH, exiting.") + machine = os.path.basename(initrd_dir) - initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, target_arch, image_type))[0] + pattern = '%s/%s*%s.%s' % (initrd_dir, image_name, machine, image_type) + files = glob.glob(pattern) + if files: + initrd = files[0] - if not os.path.exists(initrd): + if not initrd or not os.path.exists(initrd): # Create initrd from rootfs directory initrd = "%s/initrd.cpio.gz" % cr_workdir initrd_dir = "%s/INITRD" % cr_workdir @@ -206,8 +208,8 @@ class IsoImagePlugin(SourcePlugin): """ isodir = "%s/ISO/" % cr_workdir - if os.path.exists(cr_workdir): - shutil.rmtree(cr_workdir) + if os.path.exists(isodir): + shutil.rmtree(isodir) install_cmd = "install -d %s " % isodir exec_cmd(install_cmd) @@ -312,20 +314,13 @@ class IsoImagePlugin(SourcePlugin): #Create bootloader for efi boot try: - if source_params['loader'] == 'grub-efi': - # Builds grub.cfg if ISODIR didn't exist or - # didn't contains grub.cfg - bootimg_dir = img_iso_dir - if not os.path.exists("%s/EFI/BOOT" % bootimg_dir): - bootimg_dir = "%s/bootimg" % cr_workdir - if os.path.exists(bootimg_dir): - shutil.rmtree(bootimg_dir) - install_cmd = "install -d %s/EFI/BOOT" % bootimg_dir - exec_cmd(install_cmd) - - if not os.path.isfile("%s/EFI/BOOT/boot.cfg" % bootimg_dir): - cls.do_configure_grubefi(part, creator, bootimg_dir) + target_dir = "%s/EFI/BOOT" % isodir + if os.path.exists(target_dir): + shutil.rmtree(target_dir) + + os.makedirs(target_dir) + if source_params['loader'] == 'grub-efi': # Builds bootx64.efi/bootia32.efi if ISODIR didn't exist or # didn't contains it target_arch = get_bitbake_var("TARGET_SYS") @@ -333,37 +328,23 @@ class IsoImagePlugin(SourcePlugin): raise WicError("Coludn't find target architecture") if re.match("x86_64", target_arch): - grub_target = 'x86_64-efi' - grub_image = "bootx64.efi" + grub_image = "grub-efi-bootx64.efi" elif re.match('i.86', target_arch): - grub_target = 'i386-efi' - grub_image = "bootia32.efi" + grub_image = "grub-efi-bootia32.efi" else: raise WicError("grub-efi is incompatible with target %s" % target_arch) - if not os.path.isfile("%s/EFI/BOOT/%s" \ - % (bootimg_dir, grub_image)): - grub_path = get_bitbake_var("STAGING_LIBDIR", "wic-tools") - if not grub_path: - raise WicError("Couldn't find STAGING_LIBDIR, exiting.") - - grub_core = "%s/grub/%s" % (grub_path, grub_target) - if not os.path.exists(grub_core): - raise WicError("Please build grub-efi first") - - grub_cmd = "grub-mkimage -p '/EFI/BOOT' " - grub_cmd += "-d %s " % grub_core - grub_cmd += "-O %s -o %s/EFI/BOOT/%s " \ - % (grub_target, bootimg_dir, grub_image) - grub_cmd += "part_gpt part_msdos ntfs ntfscomp fat ext2 " - grub_cmd += "normal chain boot configfile linux multiboot " - grub_cmd += "search efi_gop efi_uga font gfxterm gfxmenu " - grub_cmd += "terminal minicmd test iorw loadenv echo help " - grub_cmd += "reboot serial terminfo iso9660 loopback tar " - grub_cmd += "memdisk ls search_fs_uuid udf btrfs xfs lvm " - grub_cmd += "reiserfs ata " - exec_native_cmd(grub_cmd, native_sysroot) + grub_target = os.path.join(target_dir, grub_image) + if not os.path.isfile(grub_target): + grub_src = os.path.join(deploy_dir, grub_image) + if not os.path.exists(grub_src): + raise WicError("Grub loader %s is not found in %s. " + "Please build grub-efi first" % (grub_image, deploy_dir)) + shutil.copy(grub_src, grub_target) + + if not os.path.isfile(os.path.join(target_dir, "boot.cfg")): + cls.do_configure_grubefi(part, creator, target_dir) else: raise WicError("unrecognized bootimg-efi loader: %s" % @@ -371,15 +352,6 @@ class IsoImagePlugin(SourcePlugin): except KeyError: raise WicError("bootimg-efi requires a loader, none specified") - if os.path.exists("%s/EFI/BOOT" % isodir): - shutil.rmtree("%s/EFI/BOOT" % isodir) - - shutil.copytree(bootimg_dir+"/EFI/BOOT", isodir+"/EFI/BOOT") - - # If exists, remove cr_workdir/bootimg temporary folder - if os.path.exists("%s/bootimg" % cr_workdir): - shutil.rmtree("%s/bootimg" % cr_workdir) - # Create efi.img that contains bootloader files for EFI booting # if ISODIR didn't exist or didn't contains it if os.path.isfile("%s/efi.img" % img_iso_dir): @@ -413,7 +385,7 @@ class IsoImagePlugin(SourcePlugin): exec_cmd(chmod_cmd) # Prepare files for legacy boot - syslinux_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") + syslinux_dir = get_bitbake_var("STAGING_DATADIR") if not syslinux_dir: raise WicError("Couldn't find STAGING_DATADIR, exiting.") diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py index e1c4f5e7d..e86398ac8 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py @@ -20,7 +20,7 @@ import os from wic import WicError from wic.pluginbase import SourcePlugin -from wic.utils.misc import exec_cmd, get_bitbake_var +from wic.misc import exec_cmd, get_bitbake_var from wic.filemap import sparse_copy logger = logging.getLogger('wic') @@ -32,6 +32,25 @@ class RawCopyPlugin(SourcePlugin): name = 'rawcopy' + @staticmethod + def do_image_label(fstype, dst, label): + if fstype.startswith('ext'): + cmd = 'tune2fs -L %s %s' % (label, dst) + elif fstype in ('msdos', 'vfat'): + cmd = 'dosfslabel %s %s' % (dst, label) + elif fstype == 'btrfs': + cmd = 'btrfs filesystem label %s %s' % (dst, label) + elif fstype == 'swap': + cmd = 'mkswap -L %s %s' % (label, dst) + elif fstype == 'squashfs': + raise WicError("It's not possible to update a squashfs " + "filesystem label '%s'" % (label)) + else: + raise WicError("Cannot update filesystem label: " + "Unknown fstype: '%s'" % (fstype)) + + exec_cmd(cmd) + @classmethod def do_prepare_partition(cls, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, @@ -66,4 +85,7 @@ class RawCopyPlugin(SourcePlugin): if filesize > part.size: part.size = filesize + if part.label: + RawCopyPlugin.do_image_label(part.fstype, dst, part.label) + part.source_file = dst diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rootfs.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rootfs.py index f2e2ca8a2..aec720fb2 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rootfs.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rootfs.py @@ -28,12 +28,13 @@ import logging import os import shutil +import sys from oe.path import copyhardlinktree from wic import WicError from wic.pluginbase import SourcePlugin -from wic.utils.misc import get_bitbake_var, exec_cmd +from wic.misc import get_bitbake_var logger = logging.getLogger('wic') @@ -47,7 +48,7 @@ class RootfsPlugin(SourcePlugin): @staticmethod def __get_rootfs_dir(rootfs_dir): if os.path.isdir(rootfs_dir): - return rootfs_dir + return os.path.realpath(rootfs_dir) image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) if not os.path.isdir(image_rootfs_dir): @@ -55,7 +56,7 @@ class RootfsPlugin(SourcePlugin): "named %s has been found at %s, exiting." % (rootfs_dir, image_rootfs_dir)) - return image_rootfs_dir + return os.path.realpath(image_rootfs_dir) @classmethod def do_prepare_partition(cls, part, source_params, cr, cr_workdir, @@ -80,25 +81,25 @@ class RootfsPlugin(SourcePlugin): raise WicError("Couldn't find --rootfs-dir=%s connection or " "it is not a valid path, exiting" % part.rootfs_dir) - real_rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) + part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) + new_rootfs = None # Handle excluded paths. if part.exclude_path is not None: # We need a new rootfs directory we can delete files from. Copy to # workdir. - new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs")) + new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno)) if os.path.lexists(new_rootfs): shutil.rmtree(os.path.join(new_rootfs)) - copyhardlinktree(real_rootfs_dir, new_rootfs) - - real_rootfs_dir = new_rootfs + copyhardlinktree(part.rootfs_dir, new_rootfs) 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 +107,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. @@ -120,6 +122,5 @@ class RootfsPlugin(SourcePlugin): # Delete whole directory. shutil.rmtree(full_path) - part.rootfs_dir = real_rootfs_dir part.prepare_rootfs(cr_workdir, oe_builddir, - real_rootfs_dir, native_sysroot) + new_rootfs or part.rootfs_dir, native_sysroot) diff --git a/import-layers/yocto-poky/scripts/lib/wic/utils/__init__.py b/import-layers/yocto-poky/scripts/lib/wic/utils/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/import-layers/yocto-poky/scripts/lib/wic/utils/__init__.py +++ /dev/null diff --git a/import-layers/yocto-poky/scripts/lib/wic/utils/runner.py b/import-layers/yocto-poky/scripts/lib/wic/utils/runner.py deleted file mode 100644 index 4aa00fbe2..000000000 --- a/import-layers/yocto-poky/scripts/lib/wic/utils/runner.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2011 Intel, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. -import subprocess - -from wic import WicError - -def runtool(cmdln_or_args): - """ wrapper for most of the subprocess calls - input: - cmdln_or_args: can be both args and cmdln str (shell=True) - return: - rc, output - """ - if isinstance(cmdln_or_args, list): - cmd = cmdln_or_args[0] - shell = False - else: - import shlex - cmd = shlex.split(cmdln_or_args)[0] - shell = True - - sout = subprocess.PIPE - serr = subprocess.STDOUT - - try: - process = subprocess.Popen(cmdln_or_args, stdout=sout, - stderr=serr, shell=shell) - sout, serr = process.communicate() - # combine stdout and stderr, filter None out and decode - out = ''.join([out.decode('utf-8') for out in [sout, serr] if out]) - except OSError as err: - if err.errno == 2: - # [Errno 2] No such file or directory - raise WicError('Cannot run command: %s, lost dependency?' % cmd) - else: - raise # relay - - return process.returncode, out |