yocto-bsp: qualify user files with machine name

The bblayer abstraction makes it where multiple layers can be
configured and used at the same time.  Some layers make changes to
support a specific machine, and should not have any affect when other
machines are in use.

For linux-yocto, all bsps are created with a user-config.cfg and
user-config.cfg and user-patches.scc.  This means that those files
will be pulled from the first location found, which might correspond
to files customized for a different machine.

Instead of using the names user-config.cfg and user-patches.scc, I
propose a machine specific name be used such as
{{=machine}}user-patches.scc and {{=machine}}user-config.cfg.  This
would necessitate that all references changed to these new names,
which would affect the yocto-bsp and yocto-kernel scripts.

With this change, it would be possible to have multiple machine BSPs
searched at the same time and to select which to build against by
using a command like MACHINE=qmeux86 bitbake core-image-sato to
override the default.

Note many of the standard BSPs do not seem to suffer this problem as
they do not use the common files user-config.cfg and user-patches.scc
that the yocto-* scripts depend upon.

Additions by Tom Zanussi:
 - renamed user-config.cfg to {{=machine}}-user-config.cfg everywhere
 - renamed user-patches.scc to {{=machine}}-user-patches.scc everywhere
 - added the user-config/patches SRC_URI items to the qemu -rt kernel recipes
 - fixed conflicts due to the new open_user_file() helper function
 - updated user filename conflicts caused by directory renaming
 - updated custom kernel files to match

Fixes [YOCTO #3731]

(From meta-yocto rev: c20bef60aa8d52971fb061d4b8d473ad19c03180)

Signed-off-by: Brian A. Lloyd <brian.lloyd@familyhonor.net>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Brian A. Lloyd
2013-01-24 14:57:38 -06:00
committed by Richard Purdie
parent 2f1aba504c
commit ffff37f8f9
45 changed files with 93 additions and 89 deletions

View File

@@ -160,11 +160,11 @@ def open_user_file(scripts_path, machine, userfile, mode):
def read_config_items(scripts_path, machine):
"""
Find and return a list of config items (CONFIG_XXX) in a machine's
user-defined config fragment [user-config.cfg].
user-defined config fragment [${machine}-user-config.cfg].
"""
config_items = []
f = open_user_file(scripts_path, machine, "user-config.cfg", "r")
f = open_user_file(scripts_path, machine, machine+"-user-config.cfg", "r")
lines = f.readlines()
for line in lines:
s = line.strip()
@@ -178,9 +178,9 @@ def read_config_items(scripts_path, machine):
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].
machine's user-defined config fragment [${machine}=user-config.cfg].
"""
f = open_user_file(scripts_path, machine, "user-config.cfg", "w")
f = open_user_file(scripts_path, machine, machine+"-user-config.cfg", "w")
for item in config_items:
f.write(item + "\n")
f.close()
@@ -191,7 +191,7 @@ def write_config_items(scripts_path, machine, config_items):
def yocto_kernel_config_list(scripts_path, machine):
"""
Display the list of config items (CONFIG_XXX) in a machine's
user-defined config fragment [user-config.cfg].
user-defined config fragment [${machine}-user-config.cfg].
"""
config_items = read_config_items(scripts_path, machine)
@@ -202,7 +202,7 @@ def yocto_kernel_config_list(scripts_path, machine):
def yocto_kernel_config_rm(scripts_path, machine):
"""
Display the list of config items (CONFIG_XXX) in a machine's
user-defined config fragment [user-config.cfg], prompt the user
user-defined config fragment [${machine}-user-config.cfg], prompt the user
for one or more to remove, and remove them.
"""
config_items = read_config_items(scripts_path, machine)
@@ -235,7 +235,7 @@ def yocto_kernel_config_rm(scripts_path, machine):
def yocto_kernel_config_add(scripts_path, machine, config_items):
"""
Add one or more config items (CONFIG_XXX) to a machine's
user-defined config fragment [user-config.cfg].
user-defined config fragment [${machine}-user-config.cfg].
"""
new_items = []
@@ -304,11 +304,11 @@ def find_filesdir(scripts_path, machine):
def read_patch_items(scripts_path, machine):
"""
Find and return a list of patch items in a machine's user-defined
patch list [user-patches.scc].
patch list [${machine}-user-patches.scc].
"""
patch_items = []
f = open_user_file(scripts_path, machine, "user-patches.scc", "r")
f = open_user_file(scripts_path, machine, machine+"-user-patches.scc", "r")
lines = f.readlines()
for line in lines:
s = line.strip()
@@ -325,9 +325,9 @@ def read_patch_items(scripts_path, machine):
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].
patch list [${machine}-user-patches.scc].
"""
f = open_user_file(scripts_path, machine, "user-patches.scc", "w")
f = open_user_file(scripts_path, machine, machine+"-user-patches.scc", "w")
for item in patch_items:
f.write("patch " + item + "\n")
f.close()
@@ -338,7 +338,7 @@ def write_patch_items(scripts_path, machine, patch_items):
def yocto_kernel_patch_list(scripts_path, machine):
"""
Display the list of patches in a machine's user-defined patch list
[user-patches.scc].
[${machine}-user-patches.scc].
"""
patches = read_patch_items(scripts_path, machine)
@@ -349,7 +349,7 @@ def yocto_kernel_patch_list(scripts_path, machine):
def yocto_kernel_patch_rm(scripts_path, machine):
"""
Remove one or more patches from a machine's user-defined patch
list [user-patches.scc].
list [${machine}-user-patches.scc].
"""
patches = read_patch_items(scripts_path, machine)
@@ -390,7 +390,7 @@ def yocto_kernel_patch_rm(scripts_path, machine):
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].
[${machine}-user-patches.scc].
"""
existing_patches = read_patch_items(scripts_path, machine)