mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
wic: bootimg-partition: Add do_configure_partition() method
We want to add some u-boot specific config file. Before doing this, we need know what files will be installed into this partition. So move the codes about parsing the IMAGE_BOOT_FILES into do_configure_partition(). No function change. (From OE-Core rev: 3203037471c761f635d1f1c512cb623ff6977a41) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9f66ec6cb8
commit
cb78ff423e
@@ -44,27 +44,17 @@ class BootimgPartitionPlugin(SourcePlugin):
|
|||||||
name = 'bootimg-partition'
|
name = 'bootimg-partition'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
|
def do_configure_partition(cls, part, source_params, cr, cr_workdir,
|
||||||
oe_builddir, bootimg_dir, kernel_dir,
|
oe_builddir, bootimg_dir, kernel_dir,
|
||||||
rootfs_dir, native_sysroot):
|
native_sysroot):
|
||||||
"""
|
"""
|
||||||
Called to do the actual content population for a partition i.e. it
|
Called before do_prepare_partition()
|
||||||
'prepares' the partition to be incorporated into the image.
|
|
||||||
In this case, does the following:
|
|
||||||
- sets up a vfat partition
|
|
||||||
- copies all files listed in IMAGE_BOOT_FILES variable
|
|
||||||
"""
|
"""
|
||||||
hdddir = "%s/boot.%d" % (cr_workdir, part.lineno)
|
|
||||||
install_cmd = "install -d %s" % hdddir
|
|
||||||
exec_cmd(install_cmd)
|
|
||||||
|
|
||||||
if not kernel_dir:
|
if not kernel_dir:
|
||||||
kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||||
if not kernel_dir:
|
if not kernel_dir:
|
||||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||||
|
|
||||||
logger.debug('Kernel dir: %s', bootimg_dir)
|
|
||||||
|
|
||||||
boot_files = None
|
boot_files = None
|
||||||
for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)):
|
for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)):
|
||||||
if fmt:
|
if fmt:
|
||||||
@@ -94,9 +84,9 @@ class BootimgPartitionPlugin(SourcePlugin):
|
|||||||
logger.debug('Destination entry: %r', dst_entry)
|
logger.debug('Destination entry: %r', dst_entry)
|
||||||
deploy_files.append(dst_entry)
|
deploy_files.append(dst_entry)
|
||||||
|
|
||||||
|
cls.install_task = [];
|
||||||
for deploy_entry in deploy_files:
|
for deploy_entry in deploy_files:
|
||||||
src, dst = deploy_entry
|
src, dst = deploy_entry
|
||||||
install_task = []
|
|
||||||
if '*' in src:
|
if '*' in src:
|
||||||
# by default install files under their basename
|
# by default install files under their basename
|
||||||
entry_name_fn = os.path.basename
|
entry_name_fn = os.path.basename
|
||||||
@@ -113,11 +103,34 @@ class BootimgPartitionPlugin(SourcePlugin):
|
|||||||
for entry in srcs:
|
for entry in srcs:
|
||||||
src = os.path.relpath(entry, kernel_dir)
|
src = os.path.relpath(entry, kernel_dir)
|
||||||
entry_dst_name = entry_name_fn(entry)
|
entry_dst_name = entry_name_fn(entry)
|
||||||
install_task.append((src, entry_dst_name)))
|
cls.install_task.append((src, entry_dst_name))
|
||||||
else:
|
else:
|
||||||
install_task = [(src, dst)]
|
cls.install_task.append((src, dst))
|
||||||
|
|
||||||
for task in install_task:
|
@classmethod
|
||||||
|
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
|
||||||
|
oe_builddir, bootimg_dir, kernel_dir,
|
||||||
|
rootfs_dir, native_sysroot):
|
||||||
|
"""
|
||||||
|
Called to do the actual content population for a partition i.e. it
|
||||||
|
'prepares' the partition to be incorporated into the image.
|
||||||
|
In this case, does the following:
|
||||||
|
- sets up a vfat partition
|
||||||
|
- copies all files listed in IMAGE_BOOT_FILES variable
|
||||||
|
"""
|
||||||
|
hdddir = "%s/boot.%d" % (cr_workdir, part.lineno)
|
||||||
|
install_cmd = "install -d %s" % hdddir
|
||||||
|
exec_cmd(install_cmd)
|
||||||
|
|
||||||
|
if not kernel_dir:
|
||||||
|
kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||||
|
if not kernel_dir:
|
||||||
|
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||||
|
|
||||||
|
logger.debug('Kernel dir: %s', bootimg_dir)
|
||||||
|
|
||||||
|
|
||||||
|
for task in cls.install_task:
|
||||||
src_path, dst_path = task
|
src_path, dst_path = task
|
||||||
logger.debug('Install %s as %s', src_path, dst_path)
|
logger.debug('Install %s as %s', src_path, dst_path)
|
||||||
install_cmd = "install -m 0644 -D %s %s" \
|
install_cmd = "install -m 0644 -D %s %s" \
|
||||||
|
|||||||
Reference in New Issue
Block a user