diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.1/third_party_selinux-flex-bison-path.patch b/recipes-openharmony/openharmony/openharmony-standard-3.1/third_party_selinux-flex-bison-path.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d79e492434f449ea4ef6007db837d4d09fd5f897
--- /dev/null
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.1/third_party_selinux-flex-bison-path.patch
@@ -0,0 +1,48 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+Patch for //third_party/selinux git repository of OpenHarmony 3.1 codebase.
+
+This allows overriding the path to flex and bison tools using GN arguments.
+
+Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
+Upstream-Status: Pending
+
+diff --git a/BUILD.gn b/BUILD.gn
+index 34616600fac4..a8fb10dbc96c 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -20,8 +20,13 @@ SECILC_ROOT_DIR = "//third_party/selinux/secilc"
+ LIBFTS_ROOT_DIR = "//third_party/FreeBSD"
+ LIBPCRE2_ROOT_DIR = "//third_party/pcre2"
+ 
++declare_args() {
++  flex_path = "/usr/bin/flex"
++  bison_path = "/usr/bin/bison"
++}
++
+ ohos_shared_library("libsepol") {
+-  exec_script("/usr/bin/flex",
++  exec_script(flex_path,
+               [
+                 "-o",
+                 rebase_path("libsepol/cil/src/cil_lexer.c"),
+@@ -314,7 +319,7 @@ ohos_executable("getpidcon") {
+ }
+ 
+ ohos_executable("checkpolicy") {
+-  exec_script("/usr/bin/bison",
++  exec_script(bison_path,
+               [
+                 "-y",
+                 "-d",
+@@ -323,7 +328,7 @@ ohos_executable("checkpolicy") {
+                 rebase_path("checkpolicy/y.tab.c"),
+               ],
+               "")
+-  exec_script("/usr/bin/flex",
++  exec_script(flex_path,
+               [
+                 "-o",
+                 rebase_path("checkpolicy/policy_scan.c"),
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
index 99cd4d145f95c71c6102ef3b78db451e30ee64c4..40014b5236284959d500344f07de87c8e3249c6b 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb
@@ -65,6 +65,7 @@ SRC_URI += "file://ace_engine-openssl-legacy-provider.patch;patchdir=${S}/founda
 SRC_URI += "file://developtools_hdc_standard-gcc.patch;patchdir=${S}/developtools/hdc_standard"
 SRC_URI += "file://foundation_graphic_standard-hdi-display-layer.patch;patchdir=${S}/foundation/graphic/standard"
 SRC_URI += "file://third_party_weston-hdi-display-layer.patch;patchdir=${S}/third_party/weston"
+SRC_URI += "file://third_party_selinux-flex-bison-path.patch;patchdir=${S}/third_party/selinux"
 SRC_URI += "file://features.json;subdir=${OHOS_BUILD_CONFIGS_DIR}"
 
 # Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony
@@ -111,6 +112,8 @@ GN_ARGS += 'treat_warnings_as_errors=false'
 GN_ARGS += 'node_path="${RECIPE_SYSROOT_NATIVE}/usr/bin"'
 GN_ARGS += 'host_toolchain="//oniro:clang_x64"'
 GN_ARGS += 'install_oniro_third_party=false'
+GN_ARGS += 'flex_path="${RECIPE_SYSROOT_NATIVE}/usr/bin/flex"'
+GN_ARGS += 'bison_path="${RECIPE_SYSROOT_NATIVE}/usr/bin/bison"'
 
 # OpenHarmony unit tests are statically linked and therefore not stripped
 # binaries sum up to almost 80GB which makes it difficult to build OpenHarmony