BSP tools: add support for custom kernel
cover BSP tools: add support for custom kernel
From: Tom Zanussi <[email protected]>
This pathset implements 'custom kernel' support in the yocto-bsp and yocto-kernel tools. This work is tracked by [YOCTO #3166] 'yocto-bsp:
add support for linux-yocto-custom kernels'.
For yocto-bsp it adds a new 'custom' item to the kernel choices presented by the 'menu-driven' interface. It allows users to point the kernel recipe at an arbitrary git-based kernel repo located either remotely or locally. It checks that the repo is a valid git repo that it can connect to and won't allow the user to continue further until a valid repo is specified. It also allows the user to specify various other important pieces of information needed to generate a functional kernel including any special (non-master) branch it may need, and an optional user-specified defconfig. The kernel recipe it's based on is the linux-yocto-custom.bb in meta-skeleton/recipes-kernel/linux.
The menu-driven interface has been set up with defaults that have been verified to work, but that were mainly chosen to provide examples that would allow users to easily substitute their own values.
yocto-kernel has also been enhanced to work with the custom kernel recipe and a significant amount of cleanup has been done as well, mainly because patch management has been made much easier.
It's been tested on local and remote kernel repos, with and without non-master branches, with and without defconfigs, etc, and has produced BSPs that boot fine into saton on qemux86 and actual crownbay hardware.
The following changes since commit 45915123a727f86b106da7ccb761b23067b1ff88:
Documentation: poky-ref-manual - Updates to WORKDIR structure (2012-12-11 16:17:57 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib.git tzanussi/yocto-bsp-custom
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=tzanussi/yocto-bsp-custom
Tom Zanussi (12):
yocto-bsp: add custom kernel support
yocto-bsp: add 'custom' choice to kernels()
yocto-bsp: update existing templates for linux-yocto-custom
yocto-bsp: add 'edit-git-repo' input line
yocto-bsp: add 'edit-file' input line
yocto-bsp: add replace_file()
yocto-kernel: create open_user_file() wrapper function
yocto-kernel: don't list comments in config and patch listings
yocto-kernel: remove assumption that kernel has a version
yocto-kernel: handle SRC_URIs in .bb files
yocto-bsp: remove patch-related SRC_URI processing
yocto-kernel: add support for PRs of the form rN to pr_inc()
scripts/lib/bsp/engine.py | 151 ++++++++++-
scripts/lib/bsp/kernel.py | 293 ++++++---------------
.../target/arch/arm/conf/machine/{{=machine}}.conf | 9 +-
.../arm/recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-non_hardware.cfg" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../recipes-kernel/linux/kernel-list.noinstall | 26 ++
...choice == \"custom\": }} linux-yocto-custom.bb" | 57 ++++
.../defconfig" | 5 +
.../user-config.cfg" | 8 +
.../user-patches.scc" | 8 +
.../{{=machine}}.cfg" | 3 +
.../{{=machine}}.scc" | 17 ++
.../arch/i386/conf/machine/{{=machine}}.conf | 16 +-
.../recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../arch/mips/conf/machine/{{=machine}}.conf | 9 +-
.../recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../arch/powerpc/conf/machine/{{=machine}}.conf | 9 +-
.../recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../arch/qemu/conf/machine/{{=machine}}.conf | 9 +-
.../recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../arch/x86_64/conf/machine/{{=machine}}.conf | 9 +-
.../recipes-kernel/linux/kernel-list.noinstall | 3 +-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
scripts/lib/bsp/tags.py | 2 +-
59 files changed, 418 insertions(+), 231 deletions(-)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-non_hardware.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-non_hardware.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
create mode 100644 scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom.bb"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/defconfig"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-config.cfg"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-patches.scc"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.cfg"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.scc"
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)Signature · 1 line
1.7.11.4
PATCH 1/12 yocto-bsp: add custom kernel support
From: Tom Zanussi <[email protected]>
Add a template to support custom kernels via a custom kernel recipe derived from linux-yocto-custom.bb.
---
.../recipes-kernel/linux/kernel-list.noinstall | 26 ++++++++++
...choice == \"custom\": }} linux-yocto-custom.bb" | 57 ++++++++++++++++++++++
.../defconfig" | 4 ++
.../user-config.cfg" | 8 +++
.../user-patches.scc" | 8 +++
.../{{=machine}}.cfg" | 3 ++
.../{{=machine}}.scc" | 17 +++++++
7 files changed, 123 insertions(+)
create mode 100644 scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom.bb"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/defconfig"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-config.cfg"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-patches.scc"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.cfg"
create mode 100644 "scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.scc"scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall new file +26 -0
@@ -0,0 +1,26 @@ +{{ if kernel_choice == "custom": }} +{{ input type:"boolean" name:"custom_kernel_remote" prio:"20" msg:"Is the custom kernel you'd like to use in a remote git repo? (y/n)" default:"y"}} + +{{ if kernel_choice == "custom" and custom_kernel_remote == "y": }} +{{ input type:"edit-git-repo" name:"custom_kernel_remote_path" prio:"20" msg:"Please enter the full URI to the remote git repo (the default corresponds to linux-stable v3.4.21)" default:"git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"}} + +{{ if kernel_choice == "custom" and custom_kernel_remote == "n": }} +{{ input type:"edit-git-repo" name:"custom_kernel_local_path" prio:"20" msg:"You've indicated that you're not using a remote git repo. Please enter the full path to the local git repo you want to use (the default assumes a local linux-stable v3.4.21)" default:"/home/trz/yocto/kernels/linux-stable.git"}} + +{{ if kernel_choice == "custom": }} +{{ input type:"boolean" name:"custom_kernel_need_kbranch" prio:"20" msg:"Do you need to use a specific (non-master) branch? (y/n)" default:"n"}} + +{{ if kernel_choice == "custom" and custom_kernel_need_kbranch == "y": }} +{{ input type:"edit" name:"custom_kernel_kbranch" prio:"20" msg:"Please enter the branch you want to use (the default branch corresponds to the linux-stable 'linux-3.4.y' branch):" default:"linux-3.4.y"}} + +{{ if kernel_choice == "custom": }} +{{ input type:"edit" name:"custom_kernel_srcrev" prio:"20" msg:"Please enter the SRCREV (commit id) you'd like to use (use '${AUTOREV}' to track the current HEAD):" default:"${AUTOREV}"}} + +{{ if kernel_choice == "custom": }} +{{ input type:"edit" name:"custom_kernel_linux_version" prio:"20" msg:"Please enter the Linux version of the kernel you've specified:" default:"3.4.21"}} + +{{ if kernel_choice == "custom": }} +{{ input type:"edit" name:"custom_kernel_linux_version_extension" prio:"20" msg:"Please enter a Linux version extension if you want (it will show up at the end of the kernel name shown by uname):" default:"-custom"}} + +{{ if kernel_choice == "custom": }} +{{ input type:"edit-file" name:"custom_kernel_defconfig" prio:"20" msg:"It's recommended (but not required) that custom kernels be built using a defconfig. Please enter the full path to the defconfig for your kernel (NOTE: if you don't specify a defconfig the kernel probably won't build or boot):" default:""}}
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom.bb new file +57 -0
57 lines not on this page · raw message
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/defconfig new file +4 -0
@@ -0,0 +1,4 @@ +# +# Placeholder for custom default kernel configuration. yocto-bsp will +# replace this file with a user-specified defconfig. +#
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-config.cfg new file +8 -0
@@ -0,0 +1,8 @@ +# +# Used by yocto-kernel to manage config options. +# +# yocto-kernel may change the contents of this file in any +# way it sees fit, including removing comments like this, +# so don't manually make any modifications you don't want +# to lose. +#
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/user-patches.scc new file +8 -0
@@ -0,0 +1,8 @@ +# +# Used by yocto-kernel to manage patches. +# +# yocto-kernel may change the contents of this file in any +# way it sees fit, including removing comments like this, +# so don't manually make any modifications you don't want +# to lose. +#
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.cfg new file +3 -0
@@ -0,0 +1,3 @@ +# +# A convenient place to add config options, nothing more. +#
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/{{=machine}}.scc new file +17 -0
@@ -0,0 +1,17 @@ +# +# The top-level 'feature' for the {{=machine}} custom kernel. +# +# Essentially this is a convenient top-level container or starting +# point for adding lower-level config fragements and features. +# + +# {{=machine}}.cfg in the linux-yocto-custom subdir is just a +# convenient place for adding random config fragments. + +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 user-config.cfg +include user-patches.scc
Signature · 1 line
1.7.11.4
PATCH 2/12 yocto-bsp: add 'custom' choice to kernels()
From: Tom Zanussi <[email protected]>
Add a synthetic choice for linux-yocto-custom to the list of available kernels. Choosing this will lead the user down the path of options needed to specify a custom kernel.
--- scripts/lib/bsp/kernel.py | 2 ++ 1 file changed, 2 insertions(+)
scripts/lib/bsp/kernel.py +2 -0
@@ -623,6 +623,8 @@ def kernels(context): filename = filename[idx + len(CLOSE_TAG):].strip() kernels.append(filename) + kernels.append("custom") + return kernels
Signature · 1 line
1.7.11.4
PATCH 3/12 yocto-bsp: update existing templates for linux-yocto-custom
In reply to [email protected]From: Tom Zanussi <[email protected]>
Update existing templates to integrate with linux-yocto-custom.
---
.../target/arch/arm/conf/machine/{{=machine}}.conf | 9 +++++++--
.../arch/arm/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-non_hardware.cfg" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../target/arch/i386/conf/machine/{{=machine}}.conf | 16 +++++++++++++---
.../arch/i386/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../target/arch/mips/conf/machine/{{=machine}}.conf | 9 +++++++--
.../arch/mips/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../target/arch/powerpc/conf/machine/{{=machine}}.conf | 9 +++++++--
.../powerpc/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../target/arch/qemu/conf/machine/{{=machine}}.conf | 9 +++++++--
.../arch/qemu/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
.../target/arch/x86_64/conf/machine/{{=machine}}.conf | 9 +++++++--
.../x86_64/recipes-kernel/linux/kernel-list.noinstall | 3 ++-
.../user-config.cfg" | 0
.../user-patches.scc" | 0
.../{{=machine}}-preempt-rt.scc" | 0
.../{{=machine}}-standard.scc" | 0
.../{{=machine}}.cfg" | 0
.../{{=machine}}.scc" | 0
49 files changed, 60 insertions(+), 19 deletions(-)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-non_hardware.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-non_hardware.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-config.cfg => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-patches.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-standard.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.cfg => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg" (100%)
rename scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.scc => "scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc" (100%)scripts/lib/bsp/substrate/target/arch/arm/conf/machine/{{=machine}}.conf +7 -2
@@ -70,8 +70,13 @@ EXTRA_IMAGECMD_jffs2 = "-lnp " # earlier kernels use ttyS2 SERIAL_CONSOLE = "115200 ttyO2" -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-non_hardware.cfg renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-non_hardware.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
scripts/lib/bsp/substrate/target/arch/i386/conf/machine/{{=machine}}.conf +13 -3
@@ -3,8 +3,13 @@ #@DESCRIPTION: Machine configuration for {{=machine}} systems -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
@@ -31,7 +36,12 @@ require conf/machine/include/meta-intel.inc {{ input type:"choice" val:"xserver_emgd" msg:"EMGD xserver support (proprietary)" }} {{ input type:"choice" val:"xserver_i915" msg:"i915 xserver support" }} -{{ if xserver == "y" and kernel_choice != "linux-yocto_3.4": xserver_choice = "xserver_i915" }} +{{ if xserver == "y" and kernel_choice == "custom": }} +{{ input type:"choicelist" name:"xserver_choice" prio:"50" msg:"Please select an xserver for this machine:" default:"xserver_i915" }} +{{ input type:"choice" val:"xserver_vesa" msg:"VESA xserver support" }} +{{ input type:"choice" val:"xserver_i915" msg:"i915 xserver support" }} + +{{ if xserver == "y" and kernel_choice != "linux-yocto_3.4" and kernel_choice != "custom": xserver_choice = "xserver_i915" }} {{ if xserver == "y": }} XSERVER ?= "${XSERVER_IA32_BASE} \
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
scripts/lib/bsp/substrate/target/arch/mips/conf/machine/{{=machine}}.conf +7 -2
@@ -10,8 +10,13 @@ MACHINE_FEATURES = "screen keyboard pci usbhost ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" KERNEL_ALT_IMAGETYPE = "vmlinux.bin" -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/conf/machine/{{=machine}}.conf +7 -2
@@ -34,8 +34,13 @@ SERIAL_CONSOLE = "115200 ttyS0" MACHINE_FEATURES = "keyboard pci ext2 ext3 serial" -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/{{=machine}}.conf +7 -2
@@ -3,8 +3,13 @@ #@DESCRIPTION: Machine configuration for {{=machine}} systems -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/conf/machine/{{=machine}}.conf +7 -2
@@ -3,8 +3,13 @@ #@DESCRIPTION: Machine configuration for {{=machine}} systems -{{ preferred_kernel = kernel_choice.split('_')[0] }} -{{ preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "custom": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom": }} PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall +2 -1
@@ -1,4 +1,5 @@ +{{ if kernel_choice != "custom": }} {{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.4) kernel? (y/n)" default:"y"}} -{{ if use_default_kernel == "n": }} +{{ 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_3.4"}}
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-config.cfg renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-config.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/user-patches.scc renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/user-patches.scc +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-preempt-rt.scc renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-preempt-rt.scc +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}-standard.scc renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}-standard.scc +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.cfg renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.cfg +0 -0
scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != \"custom\": }} files/{{=machine}}.scc renamed from scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/{{=machine}}.scc +0 -0
Signature · 1 line
1.7.11.4
PATCH 4/12 yocto-bsp: add 'edit-git-repo' input line
In reply to [email protected]From: Tom Zanussi <[email protected]>
Add a subclassed edit box that verifies the existence of a user-specified git repo.
Also adds a verify_git_repo() function that can be used as a basic sanity check for local git setup.
--- scripts/lib/bsp/engine.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
scripts/lib/bsp/engine.py +76 -0
@@ -37,6 +37,7 @@ from abc import ABCMeta, abstractmethod from tags import * import shlex import json +import subprocess class Line(): """
@@ -204,6 +205,45 @@ class EditBoxInputLine(InputLine): return line +class GitRepoEditBoxInputLine(EditBoxInputLine): + """ + Base class for 'editbox' Input lines for user input of remote git + repos. This class verifies the existence and connectivity of the + specified git repo. + + props: + name: example - "Load address" + msg: example - "Please enter the load address" + result: + Sets the value of the variable specified by 'name' to + whatever the user typed. + """ + def __init__(self, props, tag, lineno): + EditBoxInputLine.__init__(self, props, tag, lineno) + + def gen(self, context = None): + EditBoxInputLine.gen(self, context) + name = self.props["name"] + if not name: + self.parse_error("No input 'name' property found", + self.lineno, self.line) + msg = self.props["msg"] + if not msg: + self.parse_error("No input 'msg' property found", + self.lineno, self.line) + + try: + default_choice = self.props["default"] + except KeyError: + default_choice = "" + + msg += " [default: " + default_choice + "]" + + line = name + " = get_verified_git_repo(\"" + msg + "\"," + name + ")" + + return line + + class BooleanInputLine(InputLine): """ Base class for boolean Input lines.
@@ -435,6 +475,40 @@ def default(input_str, name): return input_str.strip() +def verify_git_repo(giturl): + """ + Verify that the giturl passed in can be connected to. This can be + used as a check for the existence of the given repo and/or basic + git remote connectivity. + + Returns True if the connection was successful, fals otherwise + """ + if not giturl: + return False + + gitcmd = "git ls-remote %s > /dev/null 2>&1" % (giturl) + rc = subprocess.call(gitcmd, shell=True) + if rc == 0: + return True + + return False + + +def get_verified_git_repo(input_str, name): + """ + Return git repo if verified, otherwise loop forever asking user + for filename. + """ + msg = input_str.strip() + " " + + giturl = default(raw_input(msg), name) + + while True: + if verify_git_repo(giturl): + return giturl + giturl = default(raw_input(msg), name) + + def boolean(input_str, name): """ Return lowercase version of first char in string, or value in name.
@@ -649,6 +723,8 @@ class SubstrateBase(object): return BooleanInputLine(props, tag, lineno) if input_type == "edit": return EditBoxInputLine(props, tag, lineno) + if input_type == "edit-git-repo": + return GitRepoEditBoxInputLine(props, tag, lineno) elif input_type == "choicelist": self.prev_choicelist = ChoicelistInputLine(props, tag, lineno) return self.prev_choicelist
Signature · 1 line
1.7.11.4
PATCH 5/12 yocto-bsp: add 'edit-file' input line
In reply to [email protected]From: Tom Zanussi <[email protected]>
Add a subclassed edit box that verifies the existence of a user-specified file.
--- scripts/lib/bsp/engine.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)
scripts/lib/bsp/engine.py +57 -0
@@ -244,6 +244,44 @@ class GitRepoEditBoxInputLine(EditBoxInputLine): return line +class FileEditBoxInputLine(EditBoxInputLine): + """ + Base class for 'editbox' Input lines for user input of existing + files. This class verifies the existence of the specified file. + + props: + name: example - "Load address" + msg: example - "Please enter the load address" + result: + Sets the value of the variable specified by 'name' to + whatever the user typed. + """ + def __init__(self, props, tag, lineno): + EditBoxInputLine.__init__(self, props, tag, lineno) + + def gen(self, context = None): + EditBoxInputLine.gen(self, context) + name = self.props["name"] + if not name: + self.parse_error("No input 'name' property found", + self.lineno, self.line) + msg = self.props["msg"] + if not msg: + self.parse_error("No input 'msg' property found", + self.lineno, self.line) + + try: + default_choice = self.props["default"] + except KeyError: + default_choice = "" + + msg += " [default: " + default_choice + "]" + + line = name + " = get_verified_file(\"" + msg + "\"," + name + ", True)" + + return line + + class BooleanInputLine(InputLine): """ Base class for boolean Input lines.
@@ -509,6 +547,23 @@ def get_verified_git_repo(input_str, name): giturl = default(raw_input(msg), name) +def get_verified_file(input_str, name, filename_can_be_null): + """ + Return filename if the file exists, otherwise loop forever asking + user for filename. + """ + msg = input_str.strip() + " " + + filename = default(raw_input(msg), name) + + while True: + if not filename and filename_can_be_null: + return filename + if os.path.isfile(filename): + return filename + filename = default(raw_input(msg), name) + + def boolean(input_str, name): """ Return lowercase version of first char in string, or value in name.
@@ -725,6 +780,8 @@ class SubstrateBase(object): return EditBoxInputLine(props, tag, lineno) if input_type == "edit-git-repo": return GitRepoEditBoxInputLine(props, tag, lineno) + if input_type == "edit-file": + return FileEditBoxInputLine(props, tag, lineno) elif input_type == "choicelist": self.prev_choicelist = ChoicelistInputLine(props, tag, lineno) return self.prev_choicelist
Signature · 1 line
1.7.11.4
PATCH 6/12 yocto-bsp: add replace_file()
In reply to [email protected]From: Tom Zanussi <[email protected]>
Add a function that can be used to replace a template file by a user-specified file. The initial use of this capability is to allow users-specified defconfigs.
--- scripts/lib/bsp/engine.py | 18 +++++++++++++++--- .../defconfig" | 1 + scripts/lib/bsp/tags.py | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-)
scripts/lib/bsp/engine.py +15 -3
@@ -38,6 +38,7 @@ from tags import * import shlex import json import subprocess +import shutil class Line(): """
@@ -83,7 +84,7 @@ class NormalLine(Line): def gen(self, context = None): if self.is_filename: - line = "of = open(\"" + os.path.join(self.out_filebase, self.escape(self.line)) + "\", \"w\")" + line = "current_file = \"" + os.path.join(self.out_filebase, self.escape(self.line)) + "\"; of = open(current_file, \"w\")" elif self.is_dirname: dirname = os.path.join(self.out_filebase, self.escape(self.line)) line = "if not os.path.exists(\"" + dirname + "\"): os.mkdir(\"" + dirname + "\")"
@@ -134,7 +135,7 @@ class AssignmentLine(NormalLine): idx = line.find(ASSIGN_TAG) line = line[:idx] + replacement + line[idx + assignment.end - assignment.start:] if self.is_filename: - return "of = open(\"" + os.path.join(self.out_filebase, line) + "\", \"w\")" + return "current_file = \"" + os.path.join(self.out_filebase, line) + "\"; of = open(current_file, \"w\")" elif self.is_dirname: dirname = os.path.join(self.out_filebase, line) return "if not os.path.exists(\"" + dirname + "\"): os.mkdir(\"" + dirname + "\")"
@@ -564,6 +565,17 @@ def get_verified_file(input_str, name, filename_can_be_null): filename = default(raw_input(msg), name) +def replace_file(replace_this, with_this): + """ + Replace the given file with the contents of filename, retaining + the original filename. + """ + try: + shutil.copy(with_this, replace_this) + except IOError: + pass + + def boolean(input_str, name): """ Return lowercase version of first char in string, or value in name.
@@ -1197,7 +1209,7 @@ def gen_program_header_lines(program_lines): """ Generate any imports we need. """ - pass + program_lines.append("current_file = \"\"") def gen_supplied_property_vals(properties, program_lines):
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == \"custom\": }} linux-yocto-custom/defconfig +1 -0
@@ -2,3 +2,4 @@ # Placeholder for custom default kernel configuration. yocto-bsp will # replace this file with a user-specified defconfig. # +{{ if custom_kernel_defconfig: replace_file(current_file, custom_kernel_defconfig) }}
scripts/lib/bsp/tags.py +1 -1
@@ -35,7 +35,7 @@ INDENT_STR = " " BLANKLINE_STR = "of.write(\"\\n\")" NORMAL_START = "of.write" -OPEN_START = "of = open" +OPEN_START = "current_file =" INPUT_TYPE_PROPERTY = "type"
Signature · 1 line
1.7.11.4
PATCH 7/12 yocto-kernel: create open_user_file() wrapper function
In reply to [email protected]From: Tom Zanussi <[email protected]>
With the addition of custom kernels, we can no longer rely on a hard-coded /files directory for BSPs - we need to be able to find the user_config/patches files in a number of different directories.
We now hide the search inside a new open_user_file() function that accomplishes the same thing as before but with a more flexible scope.
--- scripts/lib/bsp/kernel.py | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-)
scripts/lib/bsp/kernel.py +28 -17
@@ -133,6 +133,30 @@ def gen_choices_str(choices): return choices_str +def open_user_file(scripts_path, machine, userfile, mode): + """ + Find one of the user files (user-config.cfg, user-patches.scc) + associated with the machine (could be in files/, + linux-yocto-custom/, etc). Returns the open file if found, None + otherwise. + + The caller is responsible for closing the file returned. + """ + layer = find_bsp_layer(scripts_path, machine) + linuxdir = os.path.join(layer, "recipes-kernel/linux") + linuxdir_list = os.listdir(linuxdir) + for fileobj in linuxdir_list: + fileobj_path = os.path.join(linuxdir, fileobj) + if os.path.isdir(fileobj_path): + userfile_name = os.path.join(fileobj_path, userfile) + try: + f = open(userfile_name, mode) + return f + except IOError: + continue + return None + + def read_config_items(scripts_path, machine): """ Find and return a list of config items (CONFIG_XXX) in a machine's
@@ -140,10 +164,7 @@ def read_config_items(scripts_path, machine): """ config_items = [] - layer = find_bsp_layer(scripts_path, machine) - cfg = os.path.join(layer, "recipes-kernel/linux/files/user-config.cfg") - - f = open(cfg, "r") + f = open_user_file(scripts_path, machine, "user-config.cfg", "r") lines = f.readlines() for line in lines: s = line.strip()
@@ -159,10 +180,7 @@ def write_config_items(scripts_path, machine, config_items): Write (replace) the list of config items (CONFIG_XXX) in a machine's user-defined config fragment [user-config.cfg]. """ - layer = find_bsp_layer(scripts_path, machine) - cfg = os.path.join(layer, "recipes-kernel/linux/files/user-config.cfg") - - f = open(cfg, "w") + f = open_user_file(scripts_path, machine, "user-config.cfg", "w") for item in config_items: f.write(item + "\n") f.close()
@@ -377,10 +395,7 @@ def read_patch_items(scripts_path, machine): """ patch_items = [] - layer = find_bsp_layer(scripts_path, machine) - patches = os.path.join(layer, "recipes-kernel/linux/files/user-patches.scc") - - f = open(patches, "r") + f = open_user_file(scripts_path, machine, "user-patches.scc", "r") lines = f.readlines() for line in lines: s = line.strip()
@@ -399,11 +414,7 @@ def write_patch_items(scripts_path, machine, patch_items): Write (replace) the list of patches in a machine's user-defined patch list [user-patches.scc]. """ - layer = find_bsp_layer(scripts_path, machine) - - patches = os.path.join(layer, "recipes-kernel/linux/files/user-patches.scc") - - f = open(patches, "w") + f = open_user_file(scripts_path, machine, "user-patches.scc", "w") for item in patch_items: pass # this currently breaks do_patch, but is really what we want
Signature · 1 line
1.7.11.4
PATCH 8/12 yocto-kernel: don't list comments in config and patch listings
In reply to [email protected]From: Tom Zanussi <[email protected]>
After adding comments to the config and patch templates, I noticed they were displayed as items, which they shouldn't be. This prevents them from being displayed.
--- scripts/lib/bsp/kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/lib/bsp/kernel.py +2 -2
@@ -168,7 +168,7 @@ def read_config_items(scripts_path, machine): lines = f.readlines() for line in lines: s = line.strip() - if s: + if s and not s.startswith("#"): config_items.append(s) f.close()
@@ -399,7 +399,7 @@ def read_patch_items(scripts_path, machine): lines = f.readlines() for line in lines: s = line.strip() - if s: + if s and not s.startswith("#"): fields = s.split() if not fields[0] == "patch": continue
Signature · 1 line
1.7.11.4
PATCH 9/12 yocto-kernel: remove assumption that kernel has a version
In reply to [email protected]From: Tom Zanussi <[email protected]>
Kernels don't need to have a PREFERRED_VERSION, so remove that assumption from the code that looks for the kernel definition.
--- scripts/lib/bsp/kernel.py | 2 ++ 1 file changed, 2 insertions(+)
scripts/lib/bsp/kernel.py +2 -0
@@ -289,6 +289,8 @@ def find_current_kernel(bsp_layer, machine): if preferred_kernel and preferred_kernel_version: return preferred_kernel + "_" + preferred_kernel_version + elif preferred_kernel: + return preferred_kernel def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False):
Signature · 1 line
1.7.11.4
PATCH 10/12 yocto-kernel: handle SRC_URIs in .bb files
In reply to [email protected]From: Tom Zanussi <[email protected]>
Previously we assumed we were always dealing with .bbappends. With custom kernels, we now have SRC_URIs in .bb files, so add .bb files to the list of file types we examine and modify.
--- scripts/lib/bsp/kernel.py | 51 +++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 17 deletions(-)
scripts/lib/bsp/kernel.py +34 -17
@@ -295,11 +295,11 @@ def find_current_kernel(bsp_layer, machine): def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): """ - Parse the SRC_URI append in the kernel .bbappend, returing a list - of individual components, and the start/end positions of the - SRC_URI statement, so it can be regenerated in the same position. - If start_end_only is True, don't return the list of elements, only - the start and end positions. + Parse the SRC_URI append in the kernel .bb or .bbappend, returing + a list of individual components, and the start/end positions of + the SRC_URI statement, so it can be regenerated in the same + position. If start_end_only is True, don't return the list of + elements, only the start and end positions. Returns (SRC_URI start line, SRC_URI end_line, list of split SRC_URI items).
@@ -318,9 +318,17 @@ def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): print "Couldn't determine the kernel for this BSP, exiting." sys.exit(1) - kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") + try: + f = open(kernel_bbfile, "r") + except IOError: + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") + try: + f = open(kernel_bbfile, "r") + except IOError: + print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." + sys.exit(1) - f = open(kernel_bbappend, "r") src_uri_line = "" in_src_uri = False lines = f.readlines()
@@ -561,12 +569,16 @@ def kernel_contents_changed(scripts_path, machine): print "Couldn't determine the kernel for this BSP, exiting." sys.exit(1) - kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") - kernel_bbappend_prev = kernel_bbappend + ".prev" - shutil.copyfile(kernel_bbappend, kernel_bbappend_prev) + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") + if not os.path.isfile(kernel_bbfile): + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") + if not os.path.isfile(kernel_bbfile): + return + kernel_bbfile_prev = kernel_bbfile + ".prev" + shutil.copyfile(kernel_bbfile, kernel_bbfile_prev) - ifile = open(kernel_bbappend_prev, "r") - ofile = open(kernel_bbappend, "w") + ifile = open(kernel_bbfile_prev, "r") + ofile = open(kernel_bbfile, "w") ifile_lines = ifile.readlines() for ifile_line in ifile_lines: if ifile_line.strip().startswith("PR"):
@@ -588,14 +600,19 @@ def write_kernel_src_uri(scripts_path, machine, src_uri): print "Couldn't determine the kernel for this BSP, exiting." sys.exit(1) - kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") + if not os.path.isfile(kernel_bbfile): + kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") + if not os.path.isfile(kernel_bbfile): + print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." + sys.exit(1) (uri_start_line, uri_end_line, unused) = find_bsp_kernel_src_uri(scripts_path, machine, True) - kernel_bbappend_prev = kernel_bbappend + ".prev" - shutil.copyfile(kernel_bbappend, kernel_bbappend_prev) - ifile = open(kernel_bbappend_prev, "r") - ofile = open(kernel_bbappend, "w") + kernel_bbfile_prev = kernel_bbfile + ".prev" + shutil.copyfile(kernel_bbfile, kernel_bbfile_prev) + ifile = open(kernel_bbfile_prev, "r") + ofile = open(kernel_bbfile, "w") ifile_lines = ifile.readlines() if uri_start_line == -1:
Signature · 1 line
1.7.11.4
PATCH 11/12 yocto-bsp: remove patch-related SRC_URI processing
In reply to [email protected]From: Tom Zanussi <[email protected]>
We no longer have to include patches in the SRC_URI, since things now work using only patch in the .scc file, so remove anything to do with maintaining patches in the SRC_URI and fix up all previous users of that code.
--- scripts/lib/bsp/kernel.py | 227 +++++++--------------------------------------- 1 file changed, 34 insertions(+), 193 deletions(-)
scripts/lib/bsp/kernel.py +34 -193
@@ -199,18 +199,6 @@ def yocto_kernel_config_list(scripts_path, machine): print gen_choices_str(config_items) -def map_choice(choice_str, array): - """ - Match the text of a choice with a list of choices, returning the - index of the match, or -1 if not found. - """ - for i, item in enumerate(array): - if choice_str == array[i]: - return i - - return -1 - - def yocto_kernel_config_rm(scripts_path, machine): """ Display the list of config items (CONFIG_XXX) in a machine's
@@ -293,109 +281,24 @@ def find_current_kernel(bsp_layer, machine): return preferred_kernel -def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): +def find_filesdir(scripts_path, machine): """ - Parse the SRC_URI append in the kernel .bb or .bbappend, returing - a list of individual components, and the start/end positions of - the SRC_URI statement, so it can be regenerated in the same - position. If start_end_only is True, don't return the list of - elements, only the start and end positions. - - Returns (SRC_URI start line, SRC_URI end_line, list of split - SRC_URI items). - - If no SRC_URI, start line = -1. - - NOTE: this and all the src_uri functions are temporary and - deprecated and will be removed, but are needed until the - equivalent .scc mechanism works. i.e. for now we unfortunately - can't get around putting patches in the SRC_URI. + Find the name of the 'files' dir associated with the machine + (could be in files/, linux-yocto-custom/, etc). Returns the name + of the files dir if found, None otherwise. """ layer = find_bsp_layer(scripts_path, machine) + filesdir = None + linuxdir = os.path.join(layer, "recipes-kernel/linux") + linuxdir_list = os.listdir(linuxdir) + for fileobj in linuxdir_list: + fileobj_path = os.path.join(linuxdir, fileobj) + if os.path.isdir(fileobj_path): + # this could be files/ or linux-yocto-custom/, we have no way of distinguishing + # so we take the first (and normally only) dir we find as the 'filesdir' + filesdir = fileobj_path - kernel = find_current_kernel(layer, machine) - if not kernel: - print "Couldn't determine the kernel for this BSP, exiting." - sys.exit(1) - - kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") - try: - f = open(kernel_bbfile, "r") - except IOError: - kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") - try: - f = open(kernel_bbfile, "r") - except IOError: - print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." - sys.exit(1) - - src_uri_line = "" - in_src_uri = False - lines = f.readlines() - first_line = last_line = -1 - quote_start = quote_end = -1 - for n, line in enumerate(lines): - line = line.strip() - if line.startswith("SRC_URI"): - first_line = n - in_src_uri = True - if in_src_uri: - src_uri_line += line - if quote_start == -1: - idx = line.find("\"") - if idx != -1: - quote_start = idx + 1 - idx = line.find("\"", quote_start) - quote_start = 0 # set to 0 for all but first line - if idx != -1: - quote_end = idx - last_line = n - break - - if first_line == -1: # no SRC_URI, which is fine too - return (-1, -1, None) - if quote_start == -1: - print "Bad kernel SRC_URI (missing opening quote), exiting." - sys.exit(1) - if quote_end == -1: - print "Bad SRC_URI (missing closing quote), exiting." - sys.exit(1) - if start_end_only: - return (first_line, last_line, None) - - idx = src_uri_line.find("\"") - src_uri_line = src_uri_line[idx + 1:] - idx = src_uri_line.find("\"") - src_uri_line = src_uri_line[:idx] - - src_uri = src_uri_line.split() - for i, item in enumerate(src_uri): - idx = item.find("\\") - if idx != -1: - src_uri[i] = item[idx + 1:] - - if not src_uri[len(src_uri) - 1]: - src_uri.pop() - - for i, item in enumerate(src_uri): - idx = item.find(SRC_URI_FILE) - if idx == -1: - print "Bad SRC_URI (invalid item, %s), exiting." % item - sys.exit(1) - src_uri[i] = item[idx + len(SRC_URI_FILE):] - - return (first_line, last_line, src_uri) - - -def find_patches(src_uri): - """ - Filter out the top-level patches from the SRC_URI. - """ - patches = [] - for item in src_uri: - if item.endswith(".patch") and "/" not in item: - patches.append(item) - return patches + return filesdir def read_patch_items(scripts_path, machine):
@@ -426,10 +329,7 @@ def write_patch_items(scripts_path, machine, patch_items): """ f = open_user_file(scripts_path, machine, "user-patches.scc", "w") for item in patch_items: - pass - # this currently breaks do_patch, but is really what we want - # once this works, we can remove all the src_uri stuff - # f.write("patch " + item + "\n") + f.write("patch " + item + "\n") f.close() kernel_contents_changed(scripts_path, machine)
@@ -440,8 +340,7 @@ def yocto_kernel_patch_list(scripts_path, machine): Display the list of patches in a machine's user-defined patch list [user-patches.scc]. """ - (start_line, end_line, src_uri) = find_bsp_kernel_src_uri(scripts_path, machine) - patches = find_patches(src_uri) + patches = read_patch_items(scripts_path, machine) print "The current set of machine-specific patches for %s is:" % machine print gen_choices_str(patches)
@@ -452,8 +351,7 @@ def yocto_kernel_patch_rm(scripts_path, machine): Remove one or more patches from a machine's user-defined patch list [user-patches.scc]. """ - (start_line, end_line, src_uri) = find_bsp_kernel_src_uri(scripts_path, machine) - patches = find_patches(src_uri) + patches = read_patch_items(scripts_path, machine) print "Specify the patches to remove:" input = raw_input(gen_choices_str(patches))
@@ -462,8 +360,10 @@ def yocto_kernel_patch_rm(scripts_path, machine): removed = [] - layer = find_bsp_layer(scripts_path, machine) - src_uri_dir = os.path.join(layer, "recipes-kernel/linux/files") + filesdir = find_filesdir(scripts_path, machine) + if not filesdir: + print "Couldn't rm patch(es) since we couldn't find a 'files' dir" + sys.exit(1) for choice in reversed(rm_choices): try:
@@ -474,14 +374,13 @@ def yocto_kernel_patch_rm(scripts_path, machine): if idx < 0 or idx >= len(patches): print "Invalid choice (%d), exiting" % (idx + 1) sys.exit(1) - src_uri_patch = os.path.join(src_uri_dir, patches[idx]) - if os.path.isfile(src_uri_patch): - os.remove(src_uri_patch) - idx = map_choice(patches[idx], src_uri) - removed.append(src_uri.pop(idx)) + filesdir_patch = os.path.join(filesdir, patches[idx]) + if os.path.isfile(filesdir_patch): + os.remove(filesdir_patch) + removed.append(patches[idx]) + patches.pop(idx) write_patch_items(scripts_path, machine, patches) - write_kernel_src_uri(scripts_path, machine, src_uri) print "Removed patches:" for r in removed:
@@ -493,16 +392,17 @@ def yocto_kernel_patch_add(scripts_path, machine, patches): Add one or more patches to a machine's user-defined patch list [user-patches.scc]. """ - (start_line, end_line, src_uri) = find_bsp_kernel_src_uri(scripts_path, machine) - src_uri_patches = find_patches(src_uri) + existing_patches = read_patch_items(scripts_path, machine) for patch in patches: - if os.path.basename(patch) in src_uri_patches: + if os.path.basename(patch) in existing_patches: print "Couldn't add patch (%s) since it's already been added" % os.path.basename(patch) sys.exit(1) - layer = find_bsp_layer(scripts_path, machine) - src_uri_dir = os.path.join(layer, "recipes-kernel/linux/files") + filesdir = find_filesdir(scripts_path, machine) + if not filesdir: + print "Couldn't add patch (%s) since we couldn't find a 'files' dir to add it to" % os.path.basename(patch) + sys.exit(1) new_patches = []
@@ -511,33 +411,19 @@ def yocto_kernel_patch_add(scripts_path, machine, patches): print "Couldn't find patch (%s), exiting" % patch sys.exit(1) basename = os.path.basename(patch) - src_uri_patch = os.path.join(src_uri_dir, basename) - shutil.copyfile(patch, src_uri_patch) + filesdir_patch = os.path.join(filesdir, basename) + shutil.copyfile(patch, filesdir_patch) new_patches.append(basename) cur_items = read_patch_items(scripts_path, machine) cur_items.extend(new_patches) write_patch_items(scripts_path, machine, cur_items) - (unused, unused, src_uri) = find_bsp_kernel_src_uri(scripts_path, machine) - src_uri.extend(new_patches) - write_kernel_src_uri(scripts_path, machine, src_uri) - print "Added patches:" for n in new_patches: print "\t%s" % n -def write_uri_lines(ofile, src_uri): - """ - Write URI elements to output file ofile. - """ - ofile.write("SRC_URI += \" \\\n") - for item in src_uri: - ofile.write("\t%s%s \\\n" % (SRC_URI_FILE, item)) - ofile.write("\t\"\n") - - def inc_pr(line): """ Add 1 to the PR value in the given bbappend PR line. For the PR
@@ -588,51 +474,6 @@ def kernel_contents_changed(scripts_path, machine): ifile.close() -def write_kernel_src_uri(scripts_path, machine, src_uri): - """ - Write (replace) the SRC_URI append for a machine from a list - SRC_URI elements. - """ - layer = find_bsp_layer(scripts_path, machine) - - kernel = find_current_kernel(layer, machine) - if not kernel: - print "Couldn't determine the kernel for this BSP, exiting." - sys.exit(1) - - kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") - if not os.path.isfile(kernel_bbfile): - kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") - if not os.path.isfile(kernel_bbfile): - print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." - sys.exit(1) - - (uri_start_line, uri_end_line, unused) = find_bsp_kernel_src_uri(scripts_path, machine, True) - - kernel_bbfile_prev = kernel_bbfile + ".prev" - shutil.copyfile(kernel_bbfile, kernel_bbfile_prev) - ifile = open(kernel_bbfile_prev, "r") - ofile = open(kernel_bbfile, "w") - - ifile_lines = ifile.readlines() - if uri_start_line == -1: - uri_end_line = len(ifile_lines) # make sure we add at end - wrote_src_uri = False - for i, ifile_line in enumerate(ifile_lines): - if ifile_line.strip().startswith("PR"): - ifile_line = inc_pr(ifile_line) - if i < uri_start_line: - ofile.write(ifile_line) - elif i > uri_end_line: - ofile.write(ifile_line) - else: - if not wrote_src_uri: - write_uri_lines(ofile, src_uri) - wrote_src_uri = True - if uri_start_line == -1: - write_uri_lines(ofile, src_uri) - - def kernels(context): """ Return the list of available kernels in the BSP i.e. corresponding
Signature · 1 line
1.7.11.4
PATCH 12/12 yocto-kernel: add support for PRs of the form rN to pr_inc()
In reply to [email protected]From: Tom Zanussi <[email protected]>
With the addition of custom kernel support, we also need to handle the normal PR format found in .bb files.
--- scripts/lib/bsp/kernel.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
scripts/lib/bsp/kernel.py +8 -4
@@ -427,16 +427,20 @@ def yocto_kernel_patch_add(scripts_path, machine, patches): def inc_pr(line): """ Add 1 to the PR value in the given bbappend PR line. For the PR - lines in kernel .bbappends after modifications. + lines in kernel .bbappends after modifications. Handles PRs of + the form PR := "${PR}.1" as well as PR = "r0". """ idx = line.find("\"") pr_str = line[idx:] pr_str = pr_str.replace('\"','') fields = pr_str.split('.') - fields[1] = str(int(fields[1]) + 1) - pr_str = "\"" + '.'.join(fields) + "\"\n" - + if len(fields) > 1: + fields[1] = str(int(fields[1]) + 1) + pr_str = "\"" + '.'.join(fields) + "\"\n" + else: + pr_val = pr_str[1:] + pr_str = "\"" + "r" + str(int(pr_val) + 1) + "\"\n" idx2 = line.find("\"", idx + 1) line = line[:idx] + pr_str
Signature · 1 line
1.7.11.4