diff --git a/meta-oniro-staging/0001-lib-oe-cve_check-refactor-update_symlinks-with-saver.patch b/meta-oniro-staging/0001-lib-oe-cve_check-refactor-update_symlinks-with-saver.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8811c4986b3b82138176066721077795e9d55786
--- /dev/null
+++ b/meta-oniro-staging/0001-lib-oe-cve_check-refactor-update_symlinks-with-saver.patch
@@ -0,0 +1,43 @@
+From 00feddb14d45e0a738a709ecb61ae71b3f7be1d5 Mon Sep 17 00:00:00 2001
+From: Davide Gardenal <davide.gardenal@huawei.com>
+Date: Mon, 27 Jun 2022 15:37:43 +0200
+Subject: [PATCH 1/3] lib/oe/cve_check: refactor update_symlinks with saver
+ version
+
+Now update_symlinks has more checks to prevent unwanted exception.
+It returns False if the link is not created/updated, True otherwise.
+
+Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
+---
+ meta/lib/oe/cve_check.py | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
+index aa06497727..688693520e 100644
+--- a/meta/lib/oe/cve_check.py
++++ b/meta/lib/oe/cve_check.py
+@@ -169,7 +169,17 @@ def update_symlinks(target_path, link_path):
+     Update a symbolic link link_path to point to target_path.
+     Remove the link and recreate it if exist and is different.
+     """
+-    if link_path != target_path and os.path.exists(target_path):
+-        if os.path.exists(os.path.realpath(link_path)):
+-            os.remove(link_path)
+-        os.symlink(os.path.basename(target_path), link_path)
++    import os
++
++    if target_path == link_path or \
++        target_path is None or \
++        link_path is None or \
++        not os.path.exists(target_path):
++
++        return False
++
++    if os.path.lexists(link_path):
++        os.remove(link_path)
++    
++    os.symlink(target_path, link_path)
++    return True
+-- 
+2.34.1
+
diff --git a/meta-oniro-staging/0002-lib-oe-rootfs-create-image_list_installed_packages_p.patch b/meta-oniro-staging/0002-lib-oe-rootfs-create-image_list_installed_packages_p.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a858aa54dbd58a60a863510b43ee6c5d570699b6
--- /dev/null
+++ b/meta-oniro-staging/0002-lib-oe-rootfs-create-image_list_installed_packages_p.patch
@@ -0,0 +1,37 @@
+From 4b82cd9ecb14f0e5c4e17d2f719e19d419c97e70 Mon Sep 17 00:00:00 2001
+From: Davide Gardenal <davide.gardenal@huawei.com>
+Date: Mon, 27 Jun 2022 15:41:00 +0200
+Subject: [PATCH 2/3] lib/oe/rootfs: create image_list_installed_packages_pn
+ function
+
+image_list_installed_packages_pn has been taken from cve-check.bbclass
+to make it available for other classes.
+
+Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
+---
+ meta/lib/oe/rootfs.py | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
+index 9e6b411fb6..54a356102f 100644
+--- a/meta/lib/oe/rootfs.py
++++ b/meta/lib/oe/rootfs.py
+@@ -393,6 +393,15 @@ def image_list_installed_packages(d, rootfs_dir=None):
+     cls = importlib.import_module('oe.package_manager.' + img_type)
+     return cls.PMPkgsList(d, rootfs_dir).list_pkgs()
+ 
++def image_list_installed_packages_pn(d):
++    recipies = set()
++    for pkg in list(image_list_installed_packages(d)):
++        pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
++                                'runtime-reverse', pkg)
++        pkg_data = oe.packagedata.read_pkgdatafile(pkg_info)
++        recipies.add(pkg_data["PN"])
++    return recipies
++
+ if __name__ == "__main__":
+     """
+     We should be able to run this as a standalone script, from outside bitbake
+-- 
+2.34.1
+
diff --git a/meta-oniro-staging/0003-lib-oe-utils-create-get_current_recipe_layer-functio.patch b/meta-oniro-staging/0003-lib-oe-utils-create-get_current_recipe_layer-functio.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8dc591688d27b4d76e3bd0025b0369395832fb15
--- /dev/null
+++ b/meta-oniro-staging/0003-lib-oe-utils-create-get_current_recipe_layer-functio.patch
@@ -0,0 +1,32 @@
+From e89de5d10e374612187ffa4fbeddac2af3f99921 Mon Sep 17 00:00:00 2001
+From: Davide Gardenal <davide.gardenal@huawei.com>
+Date: Mon, 27 Jun 2022 15:43:14 +0200
+Subject: [PATCH 3/3] lib/oe/utils: create get_current_recipe_layer function
+
+get_current_recipe_layer returns the recipe layer given its
+file path.
+
+Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
+---
+ meta/lib/oe/utils.py | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
+index 46fc76c261..4e17b1b40e 100644
+--- a/meta/lib/oe/utils.py
++++ b/meta/lib/oe/utils.py
+@@ -584,3 +584,11 @@ def directory_size(root, blocksize=4096):
+         total += sum(roundup(getsize(os.path.join(root, name))) for name in files)
+         total += roundup(getsize(root))
+     return total
++
++def get_current_recipe_layer(d):
++    """
++    Extract the recipe layer from it's path.
++    Returns the layer name.
++    """
++    fdir_name  = d.getVar("FILE_DIRNAME")
++    return fdir_name.split("/")[-3]
+-- 
+2.34.1
+