aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools')
-rw-r--r--recipes-devtools/debugcc/debugcc_git.bb26
-rw-r--r--recipes-devtools/pil-squasher/pil-squasher_git.bb21
-rw-r--r--recipes-devtools/qc-image-unpacker/qc-image-unpacker/0001-Move-image-format-detection-to-separate-handlers.patch140
-rw-r--r--recipes-devtools/qc-image-unpacker/qc-image-unpacker/0002-Add-support-for-bootldr-images.patch239
-rw-r--r--recipes-devtools/qc-image-unpacker/qc-image-unpacker/0003-Do-not-let-dirname-tamper-with-inputFile.patch30
-rw-r--r--recipes-devtools/qc-image-unpacker/qc-image-unpacker/0004-Fail-if-an-image-can-not-be-opened.patch63
-rw-r--r--recipes-devtools/qc-image-unpacker/qc-image-unpacker_git.bb28
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-ath10k-bdencoder-Switch-to-python3.patch146
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-read-powers-port-to-python3.patch212
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-bdencoder-Add-option-to-switch-to-ath11k-mode.patch116
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-fwencoder-port-to-python3.patch272
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0003-scripts-port-to-python3.patch34
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-board-2_json.sh30
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-pci-board-2_json.sh30
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath11k-generate-board-2_json.sh23
-rw-r--r--recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife_git.bb34
-rw-r--r--recipes-devtools/qdl/qdl_git.bb2
-rw-r--r--recipes-devtools/skales/files/0002-mkbootimg-use-python3.patch23
-rw-r--r--recipes-devtools/skales/skales_git.bb11
19 files changed, 1473 insertions, 7 deletions
diff --git a/recipes-devtools/debugcc/debugcc_git.bb b/recipes-devtools/debugcc/debugcc_git.bb
new file mode 100644
index 0000000..6907a61
--- /dev/null
+++ b/recipes-devtools/debugcc/debugcc_git.bb
@@ -0,0 +1,26 @@
+SUMMARY = "A tool to debug Qualcomm clock controllers."
+HOMEPAGE = "https://github.com/andersson/debugcc/"
+SECTION = "devel"
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://debugcc.c;beginline=5;endline=29;md5=5598b6b886a3af944e4d19bb7d947095"
+
+SRC_URI = "\
+ git://github.com/andersson/debugcc.git;branch=master;protocol=https \
+"
+
+SRCREV = "1f2d56984ec60e6ca0a18718c75c4e593542cefc"
+
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE = "CC='${CC}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${B}/debugcc ${D}${bindir}
+ for f in ${B}/*-debugcc ; do
+ ln -r -s -T ${D}${bindir}/debugcc ${D}${bindir}/`basename $f`
+ done
+}
diff --git a/recipes-devtools/pil-squasher/pil-squasher_git.bb b/recipes-devtools/pil-squasher/pil-squasher_git.bb
new file mode 100644
index 0000000..062eff1
--- /dev/null
+++ b/recipes-devtools/pil-squasher/pil-squasher_git.bb
@@ -0,0 +1,21 @@
+SUMMARY = "MDT to MBN conversion tool"
+HOMEPAGE = "https://github.com/andersson/pil-squasher.git"
+SECTION = "devel"
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=aac743f09c3b727c9fa920ed48cc946d"
+
+SRCREV = "e25efba9b3abb16643262e9a9e3eb330c48cf9a5"
+SRC_URI = " \
+ git://github.com/linux-msm/${BPN}.git;branch=master;protocol=https \
+"
+
+PV = "0.0+${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install () {
+ oe_runmake install DESTDIR=${D} prefix=${prefix}
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0001-Move-image-format-detection-to-separate-handlers.patch b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0001-Move-image-format-detection-to-separate-handlers.patch
new file mode 100644
index 0000000..468d9db
--- /dev/null
+++ b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0001-Move-image-format-detection-to-separate-handlers.patch
@@ -0,0 +1,140 @@
+From 6b8c83b622984360e4b130e8dd9206c0bca5bffb Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Wed, 10 Nov 2021 01:13:00 +0300
+Subject: [PATCH 1/4] Move image format detection to separate handlers
+
+In preparation to adding another file format, separate header checks
+into foo_image_detect() functions, to keep all the details away from the
+main file.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+---
+ src/meta_image.c | 12 ++++++++++++
+ src/meta_image.h | 1 +
+ src/packed_image.c | 12 ++++++++++++
+ src/packed_image.h | 1 +
+ src/qc_image_unpacker.c | 16 ++++++++--------
+ 5 files changed, 34 insertions(+), 8 deletions(-)
+
+diff --git a/src/meta_image.c b/src/meta_image.c
+index eecf87871a44..300b3fecd796 100644
+--- a/src/meta_image.c
++++ b/src/meta_image.c
+@@ -25,6 +25,18 @@
+ #include "common.h"
+ #include "utils.h"
+
++bool meta_image_detect(u1 *buf, size_t bufSz)
++{
++ meta_header_t *pMetaHeader;
++
++ if (bufSz < sizeof(meta_header_t))
++ return false;
++
++ pMetaHeader = (meta_header_t *)buf;
++
++ return pMetaHeader->magic == META_IMG_MAGIC;
++}
++
+ bool meta_image_extract(u1 *buf, size_t bufSz, char *filePath, char *outputDir) {
+ meta_header_t *pMetaHeader;
+ meta_img_header_entry_t *pImgHeaderEntry;
+diff --git a/src/meta_image.h b/src/meta_image.h
+index 67c1b6d7835f..2bae503f89df 100644
+--- a/src/meta_image.h
++++ b/src/meta_image.h
+@@ -44,6 +44,7 @@ typedef struct meta_img_header_entry {
+ u4 size;
+ } meta_img_header_entry_t;
+
++bool meta_image_detect(u1 *, size_t);
+ bool meta_image_extract(u1 *, size_t, char *, char *);
+
+ #endif
+diff --git a/src/packed_image.c b/src/packed_image.c
+index 4117b14f81a0..585772a2cfac 100644
+--- a/src/packed_image.c
++++ b/src/packed_image.c
+@@ -25,6 +25,18 @@
+ #include "common.h"
+ #include "utils.h"
+
++bool packed_image_detect(u1 *buf, size_t bufSz)
++{
++ packed_header_t *pPackedHeader;
++
++ if (bufSz < sizeof(packed_header_t))
++ return false;
++
++ pPackedHeader = (packed_header_t *)buf;
++
++ return pPackedHeader->magic == PACKED_IMG_MAGIC;
++}
++
+ static bool process_fbpt(u1 *buf, size_t bufSz) {
+ fbpt_header_t *pFBPT = (fbpt_header_t *)buf;
+ if (pFBPT->signature != FBPT_SIGNATURE) {
+diff --git a/src/packed_image.h b/src/packed_image.h
+index f66ce2cf22f2..fba081dc1426 100644
+--- a/src/packed_image.h
++++ b/src/packed_image.h
+@@ -110,6 +110,7 @@ typedef struct fbpt_entry {
+ char pad[2]; // Usually is 0x3030
+ } fbpt_entry_t; // sizeof == 124
+
++bool packed_image_detect(u1 *, size_t);
+ bool packed_image_extract(u1 *, size_t, char *, char *);
+
+ #endif
+diff --git a/src/qc_image_unpacker.c b/src/qc_image_unpacker.c
+index 4fbe8fa6ad6e..44d737803ea0 100644
+--- a/src/qc_image_unpacker.c
++++ b/src/qc_image_unpacker.c
+@@ -122,8 +122,6 @@ int main(int argc, char **argv) {
+ off_t fileSz = 0;
+ int srcfd = -1;
+ u1 *buf = NULL;
+- meta_header_t *pMetaHeader;
+- packed_header_t *pPackedHeader;
+
+ LOGMSG(l_DEBUG, "Processing '%s'", pFiles.files[f]);
+
+@@ -133,27 +131,29 @@ int main(int argc, char **argv) {
+ continue;
+ }
+
+- if ((size_t)fileSz < sizeof(meta_header_t) && (size_t)fileSz < sizeof(packed_header_t)) {
++ /*
++ * Check only if we have something to detect here.
++ * Individual _image_detect() functions check header size.
++ */
++ if ((size_t)fileSz < sizeof(u4)) {
+ LOGMSG(l_ERROR, "Invalid input size - skipping '%s'", pFiles.files[f]);
+ goto next_file;
+ }
+
+- pMetaHeader = (meta_header_t *)buf;
+- pPackedHeader = (packed_header_t *)buf;
+- if (pMetaHeader->magic == META_IMG_MAGIC) {
++ if (meta_image_detect(buf, (size_t)fileSz)) {
+ LOGMSG(l_DEBUG, "Meta image header found");
+ if (!meta_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+ goto next_file;
+ }
+- } else if (pPackedHeader->magic == PACKED_IMG_MAGIC) {
++ } else if (packed_image_detect(buf, (size_t)fileSz)) {
+ LOGMSG(l_DEBUG, "packed image header found");
+ if (!packed_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+ goto next_file;
+ }
+ } else {
+- LOGMSG(l_ERROR, "Invalid magic header 0x%x - skipping '%s'", pMetaHeader->magic,
++ LOGMSG(l_ERROR, "Invalid magic header 0x%x - skipping '%s'", *(u4*)buf,
+ pFiles.files[f]);
+ goto next_file;
+ }
+--
+2.35.1
+
diff --git a/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0002-Add-support-for-bootldr-images.patch b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0002-Add-support-for-bootldr-images.patch
new file mode 100644
index 0000000..69be8a9
--- /dev/null
+++ b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0002-Add-support-for-bootldr-images.patch
@@ -0,0 +1,239 @@
+From edc81e94e416e45b49c698456c9c6e5cd2caa041 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Wed, 10 Nov 2021 01:14:53 +0300
+Subject: [PATCH 2/4] Add support for bootldr images
+
+Add support for BOOTLDR! images found e.g. in the Pixel2/2XL binary
+blobs archive. They are used with the msm8998 (SDM835) Snapdragon SoCs.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+---
+ src/bootldr_image.c | 132 ++++++++++++++++++++++++++++++++++++++++
+ src/bootldr_image.h | 50 +++++++++++++++
+ src/qc_image_unpacker.c | 7 +++
+ 3 files changed, 189 insertions(+)
+ create mode 100644 src/bootldr_image.c
+ create mode 100644 src/bootldr_image.h
+
+diff --git a/src/bootldr_image.c b/src/bootldr_image.c
+new file mode 100644
+index 000000000000..739f6eb2a9c6
+--- /dev/null
++++ b/src/bootldr_image.c
+@@ -0,0 +1,132 @@
++/*
++
++ qc_image_unpacker
++ -----------------------------------------
++
++ Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
++ Copyright 2019 - 2020 by CENSUS S.A. All Rights Reserved.
++ Copyright 2021 by Linaro Ltd.
++
++ Licensed under the Apache License, Version 2.0 (the "License");
++ you may not use this file except in compliance with the License.
++ You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++
++*/
++
++#include "bootldr_image.h"
++
++#include "common.h"
++#include "utils.h"
++
++bool bootldr_image_detect(u1 *buf, size_t bufSz)
++{
++ bootldr_header_t *pBootLdrHeader;
++
++ if (bufSz < sizeof(bootldr_header_t))
++ return false;
++
++ pBootLdrHeader = (bootldr_header_t *)buf;
++
++ return (pBootLdrHeader->magic1 == BOOTLDR_IMG_MAGIC1) &&
++ (pBootLdrHeader->magic2 == BOOTLDR_IMG_MAGIC2);
++}
++
++bool bootldr_image_extract(u1 *buf, size_t bufSz, char *filePath, char *outputDir) {
++ bootldr_header_t *pBootLdrHeader;
++ bootldr_img_header_entry_t *pImgHeaderEntry;
++ u4 i = 0, j = 0, images, start_offset;
++ u1 *pImageEnd = NULL;
++ bool PnameTerminated = false;
++ char outPath[PATH_MAX], outFile[PATH_MAX];
++
++ if (bufSz < sizeof(bootldr_header_t)) {
++ LOGMSG(l_ERROR, "Invalid input size (%zu < %zu)", bufSz, sizeof(bootldr_header_t));
++ return false;
++ }
++
++ pBootLdrHeader = (bootldr_header_t *)buf;
++ if (pBootLdrHeader->magic1 != BOOTLDR_IMG_MAGIC1) {
++ LOGMSG(l_ERROR, "Invalid magic header (0x%x != 0x%x)", pBootLdrHeader->magic1, BOOTLDR_IMG_MAGIC1);
++ return false;
++ }
++
++ if (pBootLdrHeader->magic2 != BOOTLDR_IMG_MAGIC2) {
++ LOGMSG(l_ERROR, "Invalid magic header (0x%x != 0x%x)", pBootLdrHeader->magic2, BOOTLDR_IMG_MAGIC2);
++ return false;
++ }
++
++ pImgHeaderEntry = (bootldr_img_header_entry_t *)(buf + sizeof(bootldr_header_t));
++ images = pBootLdrHeader->images;
++ start_offset = pBootLdrHeader->start_offset;
++
++ if ((size_t)bufSz <= sizeof(bootldr_header_t) + images * sizeof(bootldr_img_header_entry_t)) {
++ LOGMSG(l_ERROR, "The size is smaller than image header size + entry size");
++ return false;
++ }
++
++ pImageEnd = buf + bufSz;
++
++ // Create output root directory to place extracted images
++ memset(outPath, 0, sizeof(outPath));
++ snprintf(outPath, sizeof(outPath), "%s/%s_images", outputDir, utils_fileBasename(filePath));
++ if (mkdir(outPath, 0755)) {
++ LOGMSG_P(l_ERROR, "mkdir(%s) failed", outPath);
++ return false;
++ }
++
++ LOGMSG(l_DEBUG, "Processing '%u' images", images);
++ for (i = 0; i < images; i++) {
++ int dstfd = -1;
++ PnameTerminated = false;
++ if (pImgHeaderEntry[i].ptn_name[0] == 0x00 ||
++ pImgHeaderEntry[i].size == 0)
++ break;
++
++ if (pImageEnd < buf + start_offset + pImgHeaderEntry[i].size) {
++ LOGMSG(l_ERROR, "Image size mismatch");
++ return false;
++ }
++
++ for (j = 0; j < BOOTLDR_PARTITION_NAME_SZ; j++) {
++ if (!(pImgHeaderEntry[i].ptn_name[j])) {
++ PnameTerminated = true;
++ break;
++ }
++ }
++ if (!PnameTerminated) {
++ LOGMSG(l_ERROR, "ptn_name string not terminated properly");
++ return false;
++ }
++
++ // Write output file
++ memset(outFile, 0, sizeof(outFile));
++ if (snprintf(outFile, sizeof(outFile), "%s/%s", outPath, pImgHeaderEntry[i].ptn_name) < 0) {
++ LOGMSG(l_ERROR, "Failed to construct output path string");
++ return false;
++ }
++ dstfd = open(outFile, O_CREAT | O_EXCL | O_RDWR, 0644);
++ if (dstfd == -1) {
++ LOGMSG_P(l_ERROR, "Couldn't create output file '%s' in input directory", outFile);
++ return false;
++ }
++
++ if (!utils_writeToFd(dstfd, buf + start_offset, pImgHeaderEntry[i].size)) {
++ close(dstfd);
++ return false;
++ }
++
++ close(dstfd);
++
++ start_offset += pImgHeaderEntry[i].size;
++ }
++
++ return true;
++}
+diff --git a/src/bootldr_image.h b/src/bootldr_image.h
+new file mode 100644
+index 000000000000..15e188491b79
+--- /dev/null
++++ b/src/bootldr_image.h
+@@ -0,0 +1,50 @@
++/*
++
++ qc_image_unpacker
++ -----------------------------------------
++
++ Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
++ Copyright 2019 - 2020 by CENSUS S.A. All Rights Reserved.
++ Copyright 2021 by Linaro Ltd.
++
++ Licensed under the Apache License, Version 2.0 (the "License");
++ you may not use this file except in compliance with the License.
++ You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++
++*/
++
++#ifndef _BOOTLDR_IMAGE_H_
++#define _BOOTLDR_IMAGE_H_
++
++#include "common.h"
++
++#define BOOTLDR_IMG_MAGIC1 0x544f4f42
++#define BOOTLDR_IMG_MAGIC2 0x2152444c
++#define BOOTLDR_PARTITION_NAME_SZ 0x40
++//#define MAX_IMAGES_IN_BOOTLDRIMG 32
++
++typedef struct bootldr_header {
++ u4 magic1;
++ u4 magic2;
++ u4 images;
++ u4 start_offset;
++ u4 full_size;
++} bootldr_header_t;
++
++typedef struct bootldr_img_header_entry {
++ char ptn_name[BOOTLDR_PARTITION_NAME_SZ];
++ u4 size;
++} bootldr_img_header_entry_t;
++
++bool bootldr_image_detect(u1 *, size_t);
++bool bootldr_image_extract(u1 *, size_t, char *, char *);
++
++#endif
+diff --git a/src/qc_image_unpacker.c b/src/qc_image_unpacker.c
+index 44d737803ea0..ea7fd0779645 100644
+--- a/src/qc_image_unpacker.c
++++ b/src/qc_image_unpacker.c
+@@ -25,6 +25,7 @@
+
+ #include "common.h"
+ #include "log.h"
++#include "bootldr_image.h"
+ #include "meta_image.h"
+ #include "packed_image.h"
+ #include "utils.h"
+@@ -152,6 +153,12 @@ int main(int argc, char **argv) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+ goto next_file;
+ }
++ } else if (bootldr_image_detect(buf, (size_t)fileSz)) {
++ LOGMSG(l_DEBUG, "bootldr image header found");
++ if (!bootldr_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
++ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
++ goto next_file;
++ }
+ } else {
+ LOGMSG(l_ERROR, "Invalid magic header 0x%x - skipping '%s'", *(u4*)buf,
+ pFiles.files[f]);
+--
+2.35.1
+
diff --git a/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0003-Do-not-let-dirname-tamper-with-inputFile.patch b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0003-Do-not-let-dirname-tamper-with-inputFile.patch
new file mode 100644
index 0000000..11bddd7
--- /dev/null
+++ b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0003-Do-not-let-dirname-tamper-with-inputFile.patch
@@ -0,0 +1,30 @@
+From 86690e6824c175e1fa7710ead34beb1d73c5a850 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Wed, 10 Nov 2021 01:21:46 +0300
+Subject: [PATCH 3/4] Do not let dirname tamper with inputFile
+
+The function dirname() can change passed string, resulting in
+pFiles.inputFile being changed. To prevent pFiles.inputFile change, pass
+a copy of the string to the dirname().
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+---
+ src/qc_image_unpacker.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/qc_image_unpacker.c b/src/qc_image_unpacker.c
+index ea7fd0779645..faddf6b1dd21 100644
+--- a/src/qc_image_unpacker.c
++++ b/src/qc_image_unpacker.c
+@@ -114,7 +114,7 @@ int main(int argc, char **argv) {
+ // It output directory not set, put extracted images under input directory
+ if (!pRunArgs.outputDir)
+ pRunArgs.outputDir =
+- utils_isValidDir(pFiles.inputFile) ? pFiles.inputFile : dirname(pFiles.inputFile);
++ utils_isValidDir(pFiles.inputFile) ? pFiles.inputFile : dirname(strdup(pFiles.inputFile));
+
+ size_t processedImgs = 0;
+ LOGMSG(l_INFO, "Processing %zu file(s) from %s", pFiles.fileCnt, pFiles.inputFile);
+--
+2.35.1
+
diff --git a/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0004-Fail-if-an-image-can-not-be-opened.patch b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0004-Fail-if-an-image-can-not-be-opened.patch
new file mode 100644
index 0000000..45ef04c
--- /dev/null
+++ b/recipes-devtools/qc-image-unpacker/qc-image-unpacker/0004-Fail-if-an-image-can-not-be-opened.patch
@@ -0,0 +1,63 @@
+From 9358721f0eed626d744437170b29dd6a18276ade Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Wed, 10 Nov 2021 01:29:29 +0300
+Subject: [PATCH 4/4] Fail if an image can not be opened
+
+In order to be sure that the images are really processed, fail if an
+image can not be opened.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+---
+ src/qc_image_unpacker.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/qc_image_unpacker.c b/src/qc_image_unpacker.c
+index faddf6b1dd21..bf5507bc011a 100644
+--- a/src/qc_image_unpacker.c
++++ b/src/qc_image_unpacker.c
+@@ -138,36 +138,36 @@ int main(int argc, char **argv) {
+ */
+ if ((size_t)fileSz < sizeof(u4)) {
+ LOGMSG(l_ERROR, "Invalid input size - skipping '%s'", pFiles.files[f]);
+- goto next_file;
++ exit(EXIT_FAILURE);
+ }
+
+ if (meta_image_detect(buf, (size_t)fileSz)) {
+ LOGMSG(l_DEBUG, "Meta image header found");
+ if (!meta_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+- goto next_file;
++ exit(EXIT_FAILURE);
+ }
+ } else if (packed_image_detect(buf, (size_t)fileSz)) {
+ LOGMSG(l_DEBUG, "packed image header found");
+ if (!packed_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+- goto next_file;
++ exit(EXIT_FAILURE);
+ }
+ } else if (bootldr_image_detect(buf, (size_t)fileSz)) {
+ LOGMSG(l_DEBUG, "bootldr image header found");
+ if (!bootldr_image_extract(buf, (size_t)fileSz, pFiles.files[f], pRunArgs.outputDir)) {
+ LOGMSG(l_ERROR, "Skipping '%s'", pFiles.files[f]);
+- goto next_file;
++ exit(EXIT_FAILURE);
+ }
+ } else {
+ LOGMSG(l_ERROR, "Invalid magic header 0x%x - skipping '%s'", *(u4*)buf,
+ pFiles.files[f]);
+- goto next_file;
++ exit(EXIT_FAILURE);
+ }
+
+ processedImgs++;
+
+- next_file:
++ //next_file:
+ // Clean-up
+ munmap(buf, fileSz);
+ buf = NULL;
+--
+2.35.1
+
diff --git a/recipes-devtools/qc-image-unpacker/qc-image-unpacker_git.bb b/recipes-devtools/qc-image-unpacker/qc-image-unpacker_git.bb
new file mode 100644
index 0000000..ab92253
--- /dev/null
+++ b/recipes-devtools/qc-image-unpacker/qc-image-unpacker_git.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Android Qualcomm Image Unpacker"
+HOMEPAGE = "https://github.com/anestisb/qc_image_unpacker"
+SECTION = "devel"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../LICENSE;md5=138532bb21858341808df2740a1d13bf"
+
+SRC_URI = " \
+ git://github.com/anestisb/qc_image_unpacker;protocol=https;branch=master\
+ file://0001-Move-image-format-detection-to-separate-handlers.patch;patchdir=.. \
+ file://0002-Add-support-for-bootldr-images.patch;patchdir=.. \
+ file://0003-Do-not-let-dirname-tamper-with-inputFile.patch;patchdir=.. \
+ file://0004-Fail-if-an-image-can-not-be-opened.patch;patchdir=.. \
+"
+
+SRCREV = "dbaf73822205753c9a7722b330f74673cad183a5"
+
+PV = "0.2.0+${SRCPV}"
+S = "${WORKDIR}/git/src"
+
+DEPENDS = "zlib"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${S}/qc_image_unpacker ${D}${bindir}
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-ath10k-bdencoder-Switch-to-python3.patch b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-ath10k-bdencoder-Switch-to-python3.patch
new file mode 100644
index 0000000..3be757b
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-ath10k-bdencoder-Switch-to-python3.patch
@@ -0,0 +1,146 @@
+From 71d960adea6e5287ac80e976e58865f59328f6c4 Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Wed, 14 Oct 2020 15:52:02 +0200
+Subject: [PATCH 1/2] ath10k-bdencoder: Switch to python3
+
+Python 2.x is EOL since January 2020. The first distributions already
+started to drop the interpreters from their next distribution release. Just
+add some minor changes to make it python3 compatible.
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+---
+ tools/scripts/ath10k/ath10k-bdencoder | 35 ++++++++++++++-------------
+ 1 file changed, 18 insertions(+), 17 deletions(-)
+
+diff --git a/tools/scripts/ath10k/ath10k-bdencoder b/tools/scripts/ath10k/ath10k-bdencoder
+index 5f41a6be9446..1635e87b6f5f 100755
+--- a/tools/scripts/ath10k/ath10k-bdencoder
++++ b/tools/scripts/ath10k/ath10k-bdencoder
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ #
+ # Copyright (c) 2015 Qualcomm Atheros, Inc.
+ # Copyright (c) 2018, The Linux Foundation. All rights reserved.
+@@ -33,7 +33,7 @@ import mailbox
+ MAX_BUF_LEN = 2000000
+
+ # the signature length also includes null byte and padding
+-ATH10K_BOARD_SIGNATURE = "QCA-ATH10K-BOARD"
++ATH10K_BOARD_SIGNATURE = b"QCA-ATH10K-BOARD"
+ ATH10K_BOARD_SIGNATURE_LEN = 20
+
+ PADDING_MAGIC = 0x6d
+@@ -83,7 +83,7 @@ def add_ie(buf, offset, id, value):
+ def xclip(msg):
+ p = subprocess.Popen(['xclip', '-selection', 'clipboard'],
+ stdin=subprocess.PIPE)
+- p.communicate(msg)
++ p.communicate(msg.encode())
+
+
+ # to workaround annoying python feature of returning negative hex values
+@@ -105,7 +105,8 @@ class BoardName():
+ def parse_ie(buf, offset, length):
+ self = BoardName()
+ fmt = '<%ds' % length
+- (self.name, ) = struct.unpack_from(fmt, buf, offset)
++ (name, ) = struct.unpack_from(fmt, buf, offset)
++ self.name = name.decode()
+
+ logging.debug('BoardName.parse_ie(): offset %d length %d self %s' %
+ (offset, length, self))
+@@ -310,7 +311,7 @@ class BoardContainer:
+ allnames.append(name)
+
+ def _add_signature(self, buf, offset):
+- signature = ATH10K_BOARD_SIGNATURE + '\0'
++ signature = ATH10K_BOARD_SIGNATURE + b'\0'
+ length = len(signature)
+ pad_len = padding_needed(length)
+ length = length + pad_len
+@@ -321,7 +322,7 @@ class BoardContainer:
+ struct.pack_into('<B', padding, i, PADDING_MAGIC)
+
+ fmt = '<%ds%ds' % (len(signature), pad_len)
+- struct.pack_into(fmt, buf, offset, signature.encode(), padding.raw)
++ struct.pack_into(fmt, buf, offset, signature, padding.raw)
+ offset += length
+
+ # make sure ATH10K_BOARD_SIGNATURE_LEN is correct
+@@ -445,7 +446,7 @@ def cmd_extract(args):
+ b['data'] = filename
+ mapping.append(b)
+
+- f = open(filename, 'w')
++ f = open(filename, 'wb')
+ f.write(board.data.data)
+ f.close()
+
+@@ -483,11 +484,11 @@ def diff_boardfiles(filename1, filename2, diff):
+
+ container1 = BoardContainer().open(filename1)
+ (temp1_fd, temp1_pathname) = tempfile.mkstemp()
+- os.write(temp1_fd, container1.get_summary(sort=True))
++ os.write(temp1_fd, container1.get_summary(sort=True).encode())
+
+ container2 = BoardContainer().open(filename2)
+ (temp2_fd, temp2_pathname) = tempfile.mkstemp()
+- os.write(temp2_fd, container2.get_summary(sort=True))
++ os.write(temp2_fd, container2.get_summary(sort=True).encode())
+
+ # this function is used both with --diff and --diffstat
+ if diff:
+@@ -509,7 +510,7 @@ def diff_boardfiles(filename1, filename2, diff):
+ print('Failed to run wdiff: %s' % (e))
+ return 1
+
+- result += '%s\n' % (output)
++ result += '%s\n' % (output.decode())
+
+ # create simple statistics about changes in board images
+
+@@ -577,7 +578,7 @@ def cmd_add_board(args):
+ new_filename = args.add_board[1]
+ new_names = args.add_board[2:]
+
+- f = open(new_filename, 'r')
++ f = open(new_filename, 'rb')
+ new_data = f.read()
+ f.close()
+
+@@ -620,15 +621,15 @@ def cmd_add_mbox(args):
+ name = filename.rstrip(BIN_SUFFIX)
+ board_files[name] = part.get_payload(decode=True)
+
+- print 'Found mail "%s" with %d board files' % (msg['Subject'],
+- len(board_files))
++ print('Found mail "%s" with %d board files' % (msg['Subject'],
++ len(board_files)))
+
+ # copy the original file for diff
+ (temp_fd, temp_pathname) = tempfile.mkstemp()
+ shutil.copyfile(board_filename, temp_pathname)
+
+ container = BoardContainer.open(board_filename)
+- for name, data in board_files.iteritems():
++ for name, data in board_files.items():
+ names = [name]
+ container.add_board(data, names)
+
+@@ -650,9 +651,9 @@ def cmd_add_mbox(args):
+
+ os.remove(temp_pathname)
+
+- print '----------------------------------------------'
+- print applied_msg
+- print '----------------------------------------------'
++ print('----------------------------------------------')
++ print(applied_msg)
++ print('----------------------------------------------')
+
+ xclip(applied_msg)
+
+--
+2.29.2
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-read-powers-port-to-python3.patch b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-read-powers-port-to-python3.patch
new file mode 100644
index 0000000..5c69e81
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0001-read-powers-port-to-python3.patch
@@ -0,0 +1,212 @@
+From 4ffa07ff681c628750ba7c66e8a97f5f57b35fa0 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dbaryshkov@gmail.com>
+Date: Thu, 17 Dec 2020 00:37:39 +0300
+Subject: [PATCH 1/3] read-powers: port to python3
+
+Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
+---
+ tools/scripts/ath9k/read-powers | 74 ++++++++++++++++-----------------
+ 1 file changed, 37 insertions(+), 37 deletions(-)
+
+diff --git a/tools/scripts/ath9k/read-powers b/tools/scripts/ath9k/read-powers
+index 1d430e78b695..535747db8f0b 100755
+--- a/tools/scripts/ath9k/read-powers
++++ b/tools/scripts/ath9k/read-powers
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2010 Atheros Communications Inc.
+ #
+@@ -117,7 +117,7 @@ def powertx_rate1 (val):
+ ofdm_rates["12"] = (val >> 16) & 0xff
+ ofdm_rates["18"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 1", val)
++ print("%010s: 0x%08x" % ("Rate 1", val))
+
+ def powertx_rate2 (val):
+ ofdm_rates["24"] = (val >> 0) & 0xff;
+@@ -125,7 +125,7 @@ def powertx_rate2 (val):
+ ofdm_rates["48"] = (val >> 16) & 0xff
+ ofdm_rates["54"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 2", val)
++ print("%010s: 0x%08x" % ("Rate 2", val))
+
+ def powertx_rate3 (val):
+ cck_rates["1L"] = (val >> 0) & 0xff;
+@@ -134,7 +134,7 @@ def powertx_rate3 (val):
+ cck_rates["2L"] = (val >> 16) & 0xff;
+ cck_rates["2S"] = (val >> 24) & 0xff;
+
+- print "%010s: 0x%08x" % ("Rate 3", val)
++ print("%010s: 0x%08x" % ("Rate 3", val))
+
+ def powertx_rate4 (val):
+ cck_rates["5.5L"] = (val >> 0) & 0xff;
+@@ -142,7 +142,7 @@ def powertx_rate4 (val):
+ cck_rates["11L"] = (val >> 16) & 0xff
+ cck_rates["11S"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 4", val)
++ print("%010s: 0x%08x" % ("Rate 4", val))
+
+ def powertx_rate5 (val):
+ mcs_rates_ht20["0"] = (val >> 0) & 0xff;
+@@ -165,7 +165,7 @@ def powertx_rate5 (val):
+
+ mcs_rates_ht20["5"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 5", val)
++ print("%010s: 0x%08x" % ("Rate 5", val))
+
+ def powertx_rate6 (val):
+ mcs_rates_ht20["6"] = (val >> 0) & 0xff;
+@@ -173,7 +173,7 @@ def powertx_rate6 (val):
+ mcs_rates_ht20["12"] = (val >> 16) & 0xff
+ mcs_rates_ht20["13"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 6", val)
++ print("%010s: 0x%08x" % ("Rate 6", val))
+
+ def powertx_rate7 (val):
+ mcs_rates_ht40["0"] = (val >> 0) & 0xff;
+@@ -196,7 +196,7 @@ def powertx_rate7 (val):
+
+ mcs_rates_ht40["5"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 7", val)
++ print("%010s: 0x%08x" % ("Rate 7", val))
+
+ def powertx_rate8 (val):
+ mcs_rates_ht40["6"] = (val >> 0) & 0xff;
+@@ -204,7 +204,7 @@ def powertx_rate8 (val):
+ mcs_rates_ht40["12"] = (val >> 16) & 0xff
+ mcs_rates_ht40["13"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 8", val)
++ print("%010s: 0x%08x" % ("Rate 8", val))
+
+ # What is 40 dup CCK, 40 dup OFDM, 20 ext cck, 20 ext ODFM ?
+ def powertx_rate9 (val):
+@@ -213,7 +213,7 @@ def powertx_rate9 (val):
+ ext_dup_rates["20 ext CCK"] = (val >> 16) & 0xff
+ ext_dup_rates["20 ext OFDM"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 9", val)
++ print("%010s: 0x%08x" % ("Rate 9", val))
+
+ def powertx_rate10 (val):
+ mcs_rates_ht20["14"] = (val >> 0) & 0xff;
+@@ -221,7 +221,7 @@ def powertx_rate10 (val):
+ mcs_rates_ht20["20"] = (val >> 16) & 0xff
+ mcs_rates_ht20["21"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 10", val)
++ print("%010s: 0x%08x" % ("Rate 10", val))
+
+ def powertx_rate11 (val):
+ mcs_rates_ht20["22"] = (val >> 0) & 0xff;
+@@ -230,7 +230,7 @@ def powertx_rate11 (val):
+ mcs_rates_ht40["22"] = (val >> 16) & 0xff
+ mcs_rates_ht40["23"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 11", val)
++ print("%010s: 0x%08x" % ("Rate 11", val))
+
+ def powertx_rate12 (val):
+ mcs_rates_ht40["14"] = (val >> 0) & 0xff;
+@@ -238,7 +238,7 @@ def powertx_rate12 (val):
+ mcs_rates_ht40["20"] = (val >> 16) & 0xff
+ mcs_rates_ht40["21"] = (val >> 24) & 0xff
+
+- print "%010s: 0x%08x" % ("Rate 12", val)
++ print("%010s: 0x%08x" % ("Rate 12", val))
+
+ registers = {
+ "0x00a3c0" : powertx_rate1,
+@@ -256,43 +256,43 @@ registers = {
+ }
+
+ def process_cck_rates():
+- print "CCK Rates"
+- print "======================"
+- for rate, double_dbm in cck_rates.iteritems():
++ print("CCK Rates")
++ print("======================")
++ for rate, double_dbm in cck_rates.items():
+ dbm = "%.2f dBm" % (double_dbm / 2)
+- print "%010s %010s" % (rate + " Mbps", dbm)
++ print("%010s %010s" % (rate + " Mbps", dbm))
+
+ def process_ofdm_rates():
+- print "OFDM Rates"
+- print "======================"
+- for rate, double_dbm in sorted(map(lambda (k,v): (int(k,0), v), ofdm_rates.iteritems())):
++ print("OFDM Rates")
++ print("======================")
++ for rate, double_dbm in sorted(ofdm_rates.items(), key=lambda i: int(i[0], 0)):
+ rate_s = "%s" % rate
+ dbm = "%.02f dBm" % (double_dbm / 2)
+- print "%010s %010s" % (rate_s + " Mbps", dbm)
++ print("%010s %010s" % (rate_s + " Mbps", dbm))
+
+ def process_mcs_ht20_rates():
+- print "MCS20 Rates"
+- print "======================"
+- for rate, double_dbm in sorted(map(lambda (k,v): (int(k,0), v), mcs_rates_ht20.iteritems())):
++ print("MCS20 Rates")
++ print("======================")
++ for rate, double_dbm in sorted(mcs_rates_ht20.items(), key=lambda i: int(i[0], 0)):
+ rate_s = "%s" % rate
+ dbm = "%.02f dBm" % (double_dbm / 2)
+- print "%010s %010s" % ("MCS" + rate_s, dbm)
++ print("%010s %010s" % ("MCS" + rate_s, dbm))
+
+
+ def process_mcs_ht40_rates():
+- print "MCS40 Rates"
+- print "======================"
+- for rate, double_dbm in sorted(map(lambda (k,v): (int(k,0), v), mcs_rates_ht40.iteritems())):
++ print("MCS40 Rates")
++ print("======================")
++ for rate, double_dbm in sorted(mcs_rates_ht40.items(), key=lambda i: int(i[0], 0)):
+ rate_s = "%s" % rate
+ dbm = "%.2f dBm" % (double_dbm / 2)
+- print "%010s %010s" % ("MCS" + rate_s, dbm)
++ print("%010s %010s" % ("MCS" + rate_s, dbm))
+
+ def process_ext_dup_rates():
+- print "EXT-DUP Rates"
+- print "=========================="
+- for rate, double_dbm in ext_dup_rates.iteritems():
++ print("EXT-DUP Rates")
++ print("==========================")
++ for rate, double_dbm in ext_dup_rates.items():
+ dbm = "%.2f dBm" % (double_dbm / 2)
+- print "%015s %010s" % (rate, dbm)
++ print("%015s %010s" % (rate, dbm))
+
+ def print_power_reg (reg, val):
+ if not reg in map(lambda x: int(x, 0), registers.keys()):
+@@ -300,12 +300,12 @@ def print_power_reg (reg, val):
+ registers.get("0x%06x" % reg)(val)
+
+ try:
+- print "Power register"
+- print "======================"
++ print("Power register")
++ print("======================")
+ for line in sys.stdin.readlines():
+- reg, val = map(lambda x: int(x, 0), string.split(line))
++ reg, val = map(lambda x: int(x, 0), line.split())
+ print_power_reg(reg, val)
+- print "-------------------------------------"
++ print("-------------------------------------")
+
+ process_cck_rates()
+ process_ofdm_rates()
+--
+2.29.2
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-bdencoder-Add-option-to-switch-to-ath11k-mode.patch b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-bdencoder-Add-option-to-switch-to-ath11k-mode.patch
new file mode 100644
index 0000000..b5aa1c8
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-bdencoder-Add-option-to-switch-to-ath11k-mode.patch
@@ -0,0 +1,116 @@
+From 68fd447a4d1e137307927fb9c0d9e05c6559bc96 Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Wed, 14 Oct 2020 17:26:19 +0200
+Subject: [PATCH 2/2] ath10k-bdencoder: Add option to switch to ath11k mode
+
+The board-2.bin also exists on ath11k but there is no encoder available at
+the moment. Just use an option to change the two positions where the ath11k
+differs from the ath10k board-2.bin
+
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+[DB: fixed firmware url]
+Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
+---
+ tools/scripts/ath10k/ath10k-bdencoder | 35 ++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 4 deletions(-)
+
+diff --git a/tools/scripts/ath10k/ath10k-bdencoder b/tools/scripts/ath10k/ath10k-bdencoder
+index 1635e87b6f5f..d613f6340bf9 100755
+--- a/tools/scripts/ath10k/ath10k-bdencoder
++++ b/tools/scripts/ath10k/ath10k-bdencoder
+@@ -34,6 +34,8 @@ MAX_BUF_LEN = 2000000
+
+ # the signature length also includes null byte and padding
+ ATH10K_BOARD_SIGNATURE = b"QCA-ATH10K-BOARD"
++ATH11K_BOARD_SIGNATURE = b"QCA-ATH11K-BOARD"
++BOARD_SIGNATURE = b''
+ ATH10K_BOARD_SIGNATURE_LEN = 20
+
+ PADDING_MAGIC = 0x6d
+@@ -44,6 +46,7 @@ TYPE_LENGTH_SIZE = 8
+ BIN_SUFFIX = '.bin'
+
+ ATH10K_FIRMWARE_URL = 'https://github.com/kvalo/ath10k-firmware/commit'
++ATH11K_FIRMWARE_URL = 'https://github.com/kvalo/ath11k-firmware/commit'
+
+ ATH10K_BD_IE_BOARD = 0
+ ATH10K_BD_IE_BOARD_EXT = 1
+@@ -311,7 +314,7 @@ class BoardContainer:
+ allnames.append(name)
+
+ def _add_signature(self, buf, offset):
+- signature = ATH10K_BOARD_SIGNATURE + b'\0'
++ signature = BOARD_SIGNATURE + b'\0'
+ length = len(signature)
+ pad_len = padding_needed(length)
+ length = length + pad_len
+@@ -343,10 +346,10 @@ class BoardContainer:
+
+ offset = 0
+
+- fmt = '<%dsb' % (len(ATH10K_BOARD_SIGNATURE))
++ fmt = '<%dsb' % (len(BOARD_SIGNATURE))
+ (signature, null) = struct.unpack_from(fmt, buf, offset)
+
+- if signature != ATH10K_BOARD_SIGNATURE or null != 0:
++ if signature != BOARD_SIGNATURE or null != 0:
+ print("invalid signature found in %s" % name)
+ return 1
+
+@@ -600,6 +603,11 @@ def git_get_head_id():
+
+
+ def cmd_add_mbox(args):
++ if args.mode == 10:
++ firmware_url = ATH10K_FIRMWARE_URL
++ elif args.mode == 11:
++ firmware_url = ATH11K_FIRMWARE_URL
++
+ board_filename = args.add_mbox[0]
+ mbox_filename = args.add_mbox[1]
+
+@@ -658,8 +666,19 @@ def cmd_add_mbox(args):
+ xclip(applied_msg)
+
+
++def mode_parse(v):
++ if v == 'ath10k':
++ return 10
++ elif v == 'ath11k':
++ return 11
++ else:
++ raise argparse.ArgumentTypeError('ath10k or ath11k expected.')
++
++
+ def main():
+- description = '''ath10k board-N.bin files manegement tool
++ global BOARD_SIGNATURE
++
++ description = '''ath10k/ath11k board-N.bin files management tool
+
+ ath10k-bdencoder is for creating (--create), listing (--info) and
+ comparing (--diff, --diffstat) ath10k board-N.bin files. The
+@@ -709,12 +728,20 @@ can use --extract switch to see examples from real board-N.bin files.
+ parser.add_argument("-o", "--output", metavar="BOARD_FILE",
+ help='name of the output file, otherwise the default is: %s' %
+ (DEFAULT_BOARD_FILE))
++ parser.add_argument("-m", "--mode", metavar='MODE',
++ help='select between ath10k and ath11k mode (default: ath10k)',
++ default=10, type=mode_parse)
+
+ args = parser.parse_args()
+
+ if args.verbose:
+ logging.basicConfig(level=logging.DEBUG)
+
++ if args.mode == 10:
++ BOARD_SIGNATURE = ATH10K_BOARD_SIGNATURE
++ elif args.mode == 11:
++ BOARD_SIGNATURE = ATH11K_BOARD_SIGNATURE
++
+ if args.create:
+ return cmd_create(args)
+ elif args.extract:
+--
+2.29.2
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-fwencoder-port-to-python3.patch b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-fwencoder-port-to-python3.patch
new file mode 100644
index 0000000..1c3c648
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0002-ath10k-fwencoder-port-to-python3.patch
@@ -0,0 +1,272 @@
+From 3d23932fd812e1ec7a989ca7e594fcf04d42c8a6 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dbaryshkov@gmail.com>
+Date: Thu, 17 Dec 2020 01:32:47 +0300
+Subject: [PATCH 2/3] ath10k-fwencoder: port to python3
+
+Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
+---
+ tools/scripts/ath10k/ath10k-fwencoder | 70 +++++++++++++--------------
+ 1 file changed, 35 insertions(+), 35 deletions(-)
+
+diff --git a/tools/scripts/ath10k/ath10k-fwencoder b/tools/scripts/ath10k/ath10k-fwencoder
+index 6934a694e832..bbbe0344f014 100755
+--- a/tools/scripts/ath10k/ath10k-fwencoder
++++ b/tools/scripts/ath10k/ath10k-fwencoder
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2012-2015 Qualcomm Atheros, Inc.
+ #
+@@ -30,7 +30,7 @@ import hashlib
+
+ DEFAULT_FW_API_VERSION = 4
+
+-ATH10K_SIGNATURE = "QCA-ATH10K"
++ATH10K_SIGNATURE = b"QCA-ATH10K"
+ MAX_LEN = 2000000
+
+ ATH10K_FW_IE_FW_VERSION = 0
+@@ -327,7 +327,7 @@ class Ath10kFirmwareContainer(object):
+ elif is_int(s):
+ version = s
+ else:
+- print 'Error: Invalid HTT OP version: %s' % s
++ print('Error: Invalid HTT OP version: %s' % s)
+ return 1
+
+ self.htt_op_version = version
+@@ -337,7 +337,7 @@ class Ath10kFirmwareContainer(object):
+
+ # find value from the dict
+ try:
+- name = [key for key, value in htt_op_version_map.iteritems()
++ name = [key for key, value in htt_op_version_map.items()
+ if value == version][0]
+ except IndexError:
+ name = str(version)
+@@ -353,7 +353,7 @@ class Ath10kFirmwareContainer(object):
+ elif is_int(s):
+ version = s
+ else:
+- print 'Error: Invalid WMI OP version: %s' % s
++ print('Error: Invalid WMI OP version: %s' % s)
+ return 1
+
+ self.wmi_op_version = version
+@@ -363,7 +363,7 @@ class Ath10kFirmwareContainer(object):
+
+ # find value from the dict
+ try:
+- name = [key for key, value in wmi_op_version_map.iteritems()
++ name = [key for key, value in wmi_op_version_map.items()
+ if value == version][0]
+ except IndexError:
+ name = str(version)
+@@ -376,7 +376,7 @@ class Ath10kFirmwareContainer(object):
+ enabled = []
+ for capa in self.features:
+ if capa not in feature_map:
+- print "Error: '%s' not found from the feature map" % capa
++ print("Error: '%s' not found from the feature map" % capa)
+ return 1
+
+ enabled.append(feature_map[capa])
+@@ -434,7 +434,7 @@ class Ath10kFirmwareContainer(object):
+ self.fw_version = fw_version
+ # reserve one byte for null
+ if len(self.fw_version) > ETHTOOL_FWVERS_LEN - 1:
+- print 'Firmware version string too long: %d' % (len(self.fw_version))
++ print('Firmware version string too long: %d' % (len(self.fw_version)))
+ return 1
+
+ def get_fw_version(self):
+@@ -500,7 +500,7 @@ class Ath10kFirmwareContainer(object):
+ elif e == ATH10K_FW_IE_FW_CODE_SWAP_IMAGE:
+ self.fw_code_swap_image = c.elements[e]
+ else:
+- print "Unknown IE: ", e
++ print("Unknown IE: ", e)
+
+ def save(self, filename):
+ self.container = FirmwareContainer(ATH10K_SIGNATURE)
+@@ -585,7 +585,7 @@ def write_file(filename, buf):
+ def info(options, args):
+
+ if len(args) != 1:
+- print 'Filename missing'
++ print('Filename missing')
+ return 1
+
+ filename = args[0]
+@@ -593,13 +593,13 @@ def info(options, args):
+ c = Ath10kFirmwareContainer()
+ c.load(filename)
+
+- print c.get_summary()
++ print(c.get_summary())
+
+
+ def dump(options, args):
+
+ if len(args) != 1:
+- print 'Filename missing'
++ print('Filename missing')
+ return 1
+
+ filename = args[0]
+@@ -607,34 +607,34 @@ def dump(options, args):
+ c = Ath10kFirmwareContainer()
+ c.load(filename)
+
+- print "ath10k-fwencoder --create \\"
++ print("ath10k-fwencoder --create \\")
+
+ if c.get_fw_version():
+- print "--firmware-version=%s \\" % c.get_fw_version()
++ print("--firmware-version=%s \\" % c.get_fw_version())
+
+ if c.get_timestamp() and options.show_timestamp:
+- print "--timestamp=%u \\" % c.get_timestamp()
++ print("--timestamp=%u \\" % c.get_timestamp())
+
+ if c.get_features():
+- print "--features=%s \\" % c.get_features()
++ print("--features=%s \\" % c.get_features())
+
+ if c.get_fw_image():
+ name = "athwlan.bin"
+- print "--firmware=%s \\" % name
++ print("--firmware=%s \\" % name)
+
+ if c.get_otp_image():
+ name = "otp.bin"
+- print "--otp=%s \\" % name
++ print("--otp=%s \\" % name)
+
+ if c.get_wmi_op_version():
+- print '--set-wmi-op-version=%s \\' % c.get_wmi_op_version()
++ print('--set-wmi-op-version=%s \\' % c.get_wmi_op_version())
+
+ if c.get_htt_op_version():
+- print '--set-htt-op-version=%s \\' % (c.get_htt_op_version())
++ print('--set-htt-op-version=%s \\' % (c.get_htt_op_version()))
+
+ if c.get_fw_code_swap_image():
+ name = "athwlan.codeswap.bin"
+- print "--firmware-codeswap=%s \\" % name
++ print("--firmware-codeswap=%s \\" % name)
+
+ print
+
+@@ -642,7 +642,7 @@ def dump(options, args):
+ def extract(options, args):
+
+ if len(args) != 1:
+- print 'Filename missing'
++ print('Filename missing')
+ return 1
+
+ filename = args[0]
+@@ -653,24 +653,24 @@ def extract(options, args):
+ if c.get_fw_image():
+ name = "athwlan.bin"
+ write_file(name, c.get_fw_image())
+- print '%s extracted: %d B' % (name, len(c.get_fw_image()))
++ print('%s extracted: %d B' % (name, len(c.get_fw_image())))
+
+ if c.get_otp_image():
+ name = "otp.bin"
+ write_file(name, c.get_otp_image())
+- print '%s extracted: %d B' % (name, len(c.get_otp_image()))
++ print('%s extracted: %d B' % (name, len(c.get_otp_image())))
+
+ if c.get_fw_code_swap_image():
+ name = "athwlan.codeswap.bin"
+ write_file(name, c.get_fw_code_swap_image())
+- print '%s extracted: %d B' % (name, len(c.get_fw_code_swap_image()))
++ print('%s extracted: %d B' % (name, len(c.get_fw_code_swap_image())))
+
+ print
+
+
+ def modify(options, args):
+ if len(args) != 1:
+- print 'Filename missing'
++ print('Filename missing')
+ return 1
+
+ filename = args[0]
+@@ -710,7 +710,7 @@ def modify(options, args):
+
+ file_len = c.save(filename)
+
+- print '%s modified: %d B' % (filename, file_len)
++ print('%s modified: %d B' % (filename, file_len))
+
+
+ def create(options):
+@@ -752,25 +752,25 @@ def create(options):
+
+ file_len = c.save(output)
+
+- print '%s created: %d B' % (output, file_len)
++ print('%s created: %d B' % (output, file_len))
+
+
+ def cmd_crc32(options, args):
+ if len(args) != 1:
+- print 'Filename missing'
++ print('Filename missing')
+ return 1
+
+ filename = args[0]
+
+ f = open(filename, 'r')
+ buf = f.read()
+- print '%08x' % (_crc32(buf))
++ print('%08x' % (_crc32(buf)))
+ f.close()
+
+
+ def cmd_diff(options, args):
+ if len(args) != 2:
+- print 'Usage: ath10k-fwencoder --diff FILE FILE'
++ print('Usage: ath10k-fwencoder --diff FILE FILE')
+ return 1
+
+ filename1 = args[0]
+@@ -804,7 +804,7 @@ def cmd_diff(options, args):
+ logger.error('Failed to run wdiff: %s' % (e))
+ return 1
+
+- print output
++ print(output)
+
+ os.close(temp1_fd)
+ os.close(temp2_fd)
+@@ -896,10 +896,10 @@ def main():
+ try:
+ return create(options)
+ except FWEncoderError as e:
+- print 'Create failed: %s' % e
++ print('Create failed: %s' % e)
+ sys.exit(2)
+ except Exception as e:
+- print 'Create failed: %s' % e
++ print('Create failed: %s' % e)
+ traceback.print_exc()
+ sys.exit(3)
+ elif options.dump:
+@@ -915,7 +915,7 @@ def main():
+ elif options.diff:
+ return cmd_diff(options, args)
+ else:
+- print 'Action command missing'
++ print('Action command missing')
+ return 1
+
+ if __name__ == "__main__":
+--
+2.29.2
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0003-scripts-port-to-python3.patch b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0003-scripts-port-to-python3.patch
new file mode 100644
index 0000000..bfdad9f
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/0003-scripts-port-to-python3.patch
@@ -0,0 +1,34 @@
+From 26ca6eff75f78fec9efff4a69fca7103b97f1ab1 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dbaryshkov@gmail.com>
+Date: Thu, 17 Dec 2020 01:33:01 +0300
+Subject: [PATCH 3/3] scripts: port to python3
+
+Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
+---
+ tools/scripts/ath10k/ath10k-fw-repo | 2 +-
+ tools/scripts/ath11k/ath11k-fw-repo | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/scripts/ath10k/ath10k-fw-repo b/tools/scripts/ath10k/ath10k-fw-repo
+index 00b6d859209a..4cf044c04c5a 100755
+--- a/tools/scripts/ath10k/ath10k-fw-repo
++++ b/tools/scripts/ath10k/ath10k-fw-repo
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2016 Qualcomm Atheros, Inc.
+ # Copyright (c) 2018, The Linux Foundation. All rights reserved.
+diff --git a/tools/scripts/ath11k/ath11k-fw-repo b/tools/scripts/ath11k/ath11k-fw-repo
+index 1ac6023aaf12..51ca33c5dd7b 100755
+--- a/tools/scripts/ath11k/ath11k-fw-repo
++++ b/tools/scripts/ath11k/ath11k-fw-repo
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2016 Qualcomm Atheros, Inc.
+ # Copyright (c) 2018,2020 The Linux Foundation. All rights reserved.
+--
+2.29.2
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-board-2_json.sh b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-board-2_json.sh
new file mode 100644
index 0000000..373689f
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-board-2_json.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+JSON="$2"
+
+iter=0
+echo "[" > "${JSON}"
+for file in $1/bdwlan.*; do
+ case `basename "${file}"` in
+ *.txt)
+ continue
+ ;;
+ bdwlan.bin)
+ file_ext="ff"
+ ;;
+ bdwlan.*)
+ file_ext="$(basename "${file}" | sed -E 's:^.*\.b?0*([0-9a-f]+)$:\1:')"
+ ;;
+ esac
+
+ iter=$((iter+1))
+ [ $iter -ne 1 ] && echo " }," >> "${JSON}"
+
+ echo " {" >> "${JSON}"
+ echo " \"data\": \"$file\"," >> "${JSON}"
+ echo " \"names\": [\"bus=snoc,qmi-board-id=${file_ext}\"]" >> "${JSON}"
+done
+
+echo " }" >> "${JSON}"
+echo "]" >> "${JSON}"
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-pci-board-2_json.sh b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-pci-board-2_json.sh
new file mode 100644
index 0000000..403c8f2
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath10k-generate-pci-board-2_json.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+JSON="$2"
+
+iter=0
+echo "[" > "${JSON}"
+for file in $1/bdwlan*.*; do
+ case `basename "${file}"` in
+ *.txt)
+ continue
+ ;;
+ bdwlan*.bin)
+ file_ext="ff"
+ ;;
+ bdwlan*.b*)
+ file_ext="$(basename "${file}" | sed -E 's:^.*\.b?0*([0-9a-f]+)$:\1:')"
+ ;;
+ esac
+
+ iter=$((iter+1))
+ [ $iter -ne 1 ] && echo " }," >> "${JSON}"
+
+ echo " {" >> "${JSON}"
+ echo " \"data\": \"$file\"," >> "${JSON}"
+ echo " \"names\": [\"bus=pci,bmi-chip-id=0,bmi-board-id=${file_ext}\"]" >> "${JSON}"
+done
+
+echo " }" >> "${JSON}"
+echo "]" >> "${JSON}"
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath11k-generate-board-2_json.sh b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath11k-generate-board-2_json.sh
new file mode 100644
index 0000000..0e3cc10
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife/ath11k-generate-board-2_json.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+JSON="$2"
+
+iter=0
+echo "[" > "${JSON}"
+for file in $1/bdwlan.elf $1/bdwlan.e* ; do
+ iter=$((iter+1))
+ [ $iter -ne 1 ] && echo " }," >> "${JSON}"
+
+ echo " {" >> "${JSON}"
+ echo " \"data\": \"$file\"," >> "${JSON}"
+ if [ `basename $file` = "bdwlan.elf" ]; then
+ file_ext="255"
+ else
+ file_ext="$(( $(basename "${file}" | sed -E 's:^.*\.e?([0-9a-f]*)$:0x\1:') ))"
+ fi
+ echo " \"names\": [\"bus=pci,qmi-chip-id=0,qmi-board-id=${file_ext}\"]" >> "${JSON}"
+done
+
+echo " }" >> "${JSON}"
+echo "]" >> "${JSON}"
+
diff --git a/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife_git.bb b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife_git.bb
new file mode 100644
index 0000000..5d81eaf
--- /dev/null
+++ b/recipes-devtools/qca-swiss-army-knife/qca-swiss-army-knife_git.bb
@@ -0,0 +1,34 @@
+SUMMARY = "A set of utilities to help QCA driver development."
+HOMEPAGE = "https://github.com/qca/qca-swiss-army-knife"
+SECTION = "devel"
+
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=884c3f3a874b2a0cfa283c7db0e5d604"
+
+SRCREV = "5ede3cc07e9a52f115101c28f833242b772eeaab"
+SRC_URI = " \
+ git://github.com/qca/${BPN}.git;branch=master;protocol=https \
+ file://0001-ath10k-bdencoder-Switch-to-python3.patch \
+ file://0002-ath10k-bdencoder-Add-option-to-switch-to-ath11k-mode.patch \
+ file://0001-read-powers-port-to-python3.patch \
+ file://0002-ath10k-fwencoder-port-to-python3.patch \
+ file://0003-scripts-port-to-python3.patch \
+ file://ath10k-generate-board-2_json.sh \
+ file://ath10k-generate-pci-board-2_json.sh \
+ file://ath11k-generate-board-2_json.sh \
+"
+
+PV = "0.0+${SRCPV}"
+S = "${WORKDIR}/git"
+
+do_install () {
+ install -d ${D}/${bindir}
+ install -m 0755 tools/scripts/*/* ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/ath10k-generate-board-2_json.sh ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/ath10k-generate-pci-board-2_json.sh ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/ath11k-generate-board-2_json.sh ${D}/${bindir}
+}
+
+BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS:${PN} += "perl python3-core"
diff --git a/recipes-devtools/qdl/qdl_git.bb b/recipes-devtools/qdl/qdl_git.bb
index aba3cec..b053388 100644
--- a/recipes-devtools/qdl/qdl_git.bb
+++ b/recipes-devtools/qdl/qdl_git.bb
@@ -6,7 +6,7 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://qdl.c;beginline=1;endline=31;md5=1c7d712d897368d3d3c161e5493efc6a"
DEPENDS = "libxml2"
-DEPENDS_append_class-target = " udev "
+DEPENDS:append:class-target = " udev "
inherit pkgconfig
diff --git a/recipes-devtools/skales/files/0002-mkbootimg-use-python3.patch b/recipes-devtools/skales/files/0002-mkbootimg-use-python3.patch
new file mode 100644
index 0000000..2abac7d
--- /dev/null
+++ b/recipes-devtools/skales/files/0002-mkbootimg-use-python3.patch
@@ -0,0 +1,23 @@
+From aadbb5dd64abc2efbb5548d1d0b168d476875157 Mon Sep 17 00:00:00 2001
+From: Peter Griffin <peter.griffin@linaro.org>
+Date: Wed, 29 Jan 2020 22:55:41 +0100
+Subject: [PATCH 2/2] mkbootimg: use python3
+
+Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
+---
+ mkbootimg | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkbootimg b/mkbootimg
+index c0e7dcb..adfc54b 100755
+--- a/mkbootimg
++++ b/mkbootimg
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#! /usr/bin/env python3
+ #
+ # Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ #
+--
+2.7.4
+
diff --git a/recipes-devtools/skales/skales_git.bb b/recipes-devtools/skales/skales_git.bb
index 71928e8..6e80204 100644
--- a/recipes-devtools/skales/skales_git.bb
+++ b/recipes-devtools/skales/skales_git.bb
@@ -1,24 +1,23 @@
SUMMARY = "Tools to create boot images for QCOM SoC"
-HOMEPAGE = "https://www.codeaurora.org/cgit/quic/kernel/skales/"
+HOMEPAGE = "https://git.codelinaro.org/clo/qsdk/oss/tools/skales"
SECTION = "devel"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://mkbootimg;beginline=3;endline=29;md5=114b84083e657f3886bfa2c1e5de7deb"
-DEPENDS = "python dtc"
-
-SRCREV = "6eac9e943de53c4aaaede3697e9226a47686fe25"
+SRCREV = "1ccd3e924f6955b1c9d5f921e5311c8db8411787"
PV = "1.5.0+git${SRCPV}"
-SRC_URI = "git://codeaurora.org/quic/kernel/skales"
+SRC_URI = "git://git.codelinaro.org/clo/qsdk/oss/tools/skales.git;protocol=https;branch=caf_migration/skales/master \
+ file://0002-mkbootimg-use-python3.patch \
+ "
S = "${WORKDIR}/git"
do_install () {
install -d ${D}${bindir}/skales
install -m 0755 ${S}/mkbootimg ${D}${bindir}/skales
- install -m 0755 ${S}/dtbTool ${D}${bindir}/skales
}
BBCLASSEXTEND = "native"