Merge "db845c/rb5: Make version 4 as the default boot image header" into main
diff --git a/Android.bp b/Android.bp
index c9f7e86..4572d82 100644
--- a/Android.bp
+++ b/Android.bp
@@ -49,8 +49,9 @@
 }
 
 subdirs = [
-    "qcom/pd-mapper",
-    "qcom/qrtr",
-    "qcom/rmtfs",
-    "qcom/tqftpserv",
+    "shared/utils/bdaddr",
+    "shared/utils/pd-mapper",
+    "shared/utils/qrtr",
+    "shared/utils/rmtfs",
+    "shared/utils/tqftpserv",
 ]
diff --git a/db845c/device.mk b/db845c/device.mk
index 637cd0a..7dac78b 100644
--- a/db845c/device.mk
+++ b/db845c/device.mk
@@ -33,10 +33,17 @@
     android.hardware.boot@1.2-impl.recovery \
     android.hardware.boot@1.2-service
 
+# Set BT address
+PRODUCT_PACKAGES += bdaddr
+
+# Install bdaddr script
+PRODUCT_COPY_FILES += \
+    device/linaro/dragonboard/shared/utils/bdaddr/set_bdaddr.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_bdaddr.sh
+
 # Install scripts to set vendor.* properties
 PRODUCT_COPY_FILES += \
-    device/linaro/dragonboard/qcom/set_hw.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_hw.sh \
-    device/linaro/dragonboard/qcom/set_udc.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_udc.sh
+    device/linaro/dragonboard/shared/utils/set_hw.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_hw.sh \
+    device/linaro/dragonboard/shared/utils/set_udc.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_udc.sh
 
 # Install scripts to set Ethernet MAC address
 PRODUCT_COPY_FILES += \
diff --git a/full.mk b/full.mk
index e2fd3ee..66f6414 100644
--- a/full.mk
+++ b/full.mk
@@ -230,7 +230,7 @@
     tqftpserv
 
 PRODUCT_COPY_FILES += \
-    $(LOCAL_PATH)/qcom/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.qcom.rc
+    $(LOCAL_PATH)/shared/utils/init.utils.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.utils.rc
 
 # Copy standard platform config files
 PRODUCT_COPY_FILES +=  \
diff --git a/rb5/device.mk b/rb5/device.mk
index f0100cf..656b7aa 100644
--- a/rb5/device.mk
+++ b/rb5/device.mk
@@ -33,9 +33,16 @@
     android.hardware.boot@1.2-impl.recovery \
     android.hardware.boot@1.2-service
 
+# Set BT address
+PRODUCT_PACKAGES += bdaddr
+
+# Install bdaddr script
+PRODUCT_COPY_FILES += \
+    device/linaro/dragonboard/shared/utils/bdaddr/set_bdaddr.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_bdaddr.sh
+
 # Install scripts to set vendor.* properties
 PRODUCT_COPY_FILES += \
-    device/linaro/dragonboard/qcom/set_hw.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_hw.sh
+    device/linaro/dragonboard/shared/utils/set_hw.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_hw.sh
 
 PRODUCT_VENDOR_PROPERTIES += ro.soc.manufacturer=Qualcomm
 PRODUCT_VENDOR_PROPERTIES += ro.soc.model=QRB5165
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index c7eb6db..a74f361 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -61,6 +61,7 @@
 /vendor/bin/rmtfs									u:object_r:rmtfs_exec:s0
 /vendor/bin/tqftpserv									u:object_r:tqftpserv_exec:s0
 /vendor/bin/suspend_blocker								u:object_r:suspend_blocker_exec:s0
+/vendor/bin/set_bdaddr\.sh								u:object_r:set_bdaddr_exec:s0
 /vendor/bin/set_hw\.sh									u:object_r:set_hw_exec:s0
 /vendor/bin/set_udc\.sh									u:object_r:set_udc_exec:s0
 
diff --git a/sepolicy/set_bdaddr.te b/sepolicy/set_bdaddr.te
new file mode 100644
index 0000000..e81d6ab
--- /dev/null
+++ b/sepolicy/set_bdaddr.te
@@ -0,0 +1,11 @@
+type set_bdaddr, domain;
+type set_bdaddr_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(set_bdaddr);
+
+# audit2allow
+allow set_bdaddr proc_cmdline:file { open read };
+allow set_bdaddr rootfs:dir { open read };
+allow set_bdaddr self:bluetooth_socket { bind create read write };
+allow set_bdaddr self:capability net_admin;
+allow set_bdaddr vendor_file:file execute_no_trans;
+allow set_bdaddr vendor_toolbox_exec:file execute_no_trans;
diff --git a/shared/utils/bdaddr/Android.bp b/shared/utils/bdaddr/Android.bp
new file mode 100644
index 0000000..fe1eb29
--- /dev/null
+++ b/shared/utils/bdaddr/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2023 The Android Open-Source Project
+//
+// 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.
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_binary {
+    name: "bdaddr",
+    relative_install_path: "hw",
+    vendor: true,
+
+    srcs: ["bdaddr.c"],
+    shared_libs: ["liblog"],
+    init_rc: ["bdaddr.rc"],
+}
diff --git a/shared/utils/bdaddr/bdaddr.c b/shared/utils/bdaddr/bdaddr.c
new file mode 100644
index 0000000..d71fcfc
--- /dev/null
+++ b/shared/utils/bdaddr/bdaddr.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#define LOG_TAG "bdaddr"
+
+#include <stdint.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <log/log.h>
+
+#define HCI_DEV_NONE  0xffff
+#define HCI_CHANNEL_CONTROL  3
+#define BTPROTO_HCI  1
+
+struct sockaddr_hci {
+    sa_family_t hci_family;
+    uint16_t hci_dev;
+    uint16_t hci_channel;
+};
+
+#define BTMGMT_CMD_READ_CONFIG_INFO  0x0037
+#define BTMGMT_CMD_SET_PUBLIC_ADDR  0x0039
+#define BTMGMT_EV_CMD_COMPLETE  0x0001
+#define BTMGMT_EV_CMD_STATUS  0x0002
+#define BTMGMT_EV_UNCONF_INDEX_ADDED  0x001d
+#define BTMGMT_OPT_PUBLIC_ADDRESS  (1 << 1)
+#define BTMGMT_ERR_INVALID_INDEX  0x11
+
+struct btmgmt_hdr {
+    uint16_t cmd;
+    uint16_t id;
+    uint16_t len;
+} __attribute__((packed));
+
+struct btmgmt_cmd_set_public_addr {
+    struct btmgmt_hdr hdr;
+    uint8_t addr[6];
+} __attribute__((packed));
+
+struct btmgmt_ev_cmd_status {
+    struct btmgmt_hdr hdr;
+    uint16_t cmd;
+    uint8_t status;
+} __attribute__((packed));
+
+struct btmgmt_ev_cc_config_info {
+    struct btmgmt_ev_cmd_status ev;
+    uint16_t manufacturer;
+    uint32_t supported_options;
+    uint32_t missing_options;
+} __attribute__((packed));
+
+// TODO: Make this configurable
+#define HCI_CONTROLLER  0
+
+#define MAC_ADDRESS_SIZE    6
+#define MAC_ADDRESS_LENGTH  (MAC_ADDRESS_SIZE*2 + MAC_ADDRESS_SIZE-1)
+#define MAC_ADDRESS_FORMAT  "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
+#define MAC_ADDRESS_ARGS(addr) \
+    (addr)[5], (addr)[4], (addr)[3], (addr)[2], (addr)[1], (addr)[0]
+
+#define MESSAGE_BUFFER  512
+
+static int btmgmt_connect() {
+    int s = socket(PF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC, BTPROTO_HCI);
+    if (s < 0)
+        return -1;
+
+    struct sockaddr_hci addr = {
+        .hci_family = AF_BLUETOOTH,
+        .hci_dev = HCI_DEV_NONE,
+        .hci_channel = HCI_CHANNEL_CONTROL,
+    };
+    if (bind(s, (struct sockaddr*) &addr, sizeof(addr)) < 0) {
+        close(s);
+        return -1;
+    }
+
+    return s;
+}
+
+static void btmgmt_request_config_info(int s) {
+    struct btmgmt_hdr cmd = {
+        .cmd = BTMGMT_CMD_READ_CONFIG_INFO,
+        .id = HCI_CONTROLLER,
+        .len = 0,
+    };
+
+    if (write(s, &cmd, sizeof(cmd)) < 0) {
+        ALOGE("Failed to request controller configuration information: %s",
+            strerror(errno));
+    }
+}
+
+static void btmgmt_set_public_addr(int s, const uint8_t bdaddr[MAC_ADDRESS_SIZE]) {
+    struct btmgmt_cmd_set_public_addr cmd = {
+        .hdr = {
+            .cmd = BTMGMT_CMD_SET_PUBLIC_ADDR,
+            .id = HCI_CONTROLLER,
+            .len = sizeof(cmd) - sizeof(cmd.hdr),
+        },
+    };
+    memcpy(cmd.addr, bdaddr, sizeof(cmd.addr));
+
+    if (write(s, &cmd, sizeof(cmd)) != sizeof(cmd)) {
+        ALOGE("Failed to write set public address command: %s", strerror(errno));
+    }
+}
+
+static void btmgmt_complete_set_public_addr(struct btmgmt_ev_cmd_status* ev,
+        const uint8_t bdaddr[MAC_ADDRESS_SIZE]) {
+    if (ev->status == 0) {
+        ALOGI("Updated public address to " MAC_ADDRESS_FORMAT,
+            MAC_ADDRESS_ARGS(bdaddr));
+    } else {
+        ALOGE("Failed to update public address to " MAC_ADDRESS_FORMAT
+            ": error 0x%x", MAC_ADDRESS_ARGS(bdaddr), ev->status);
+    }
+}
+
+static bool btmgmt_config_needs_public_addr(struct btmgmt_ev_cmd_status* ev) {
+    struct btmgmt_ev_cc_config_info* info = (struct btmgmt_ev_cc_config_info*) ev;
+    if (info->ev.status) {
+        if (info->ev.status != BTMGMT_ERR_INVALID_INDEX)
+            ALOGE("Failed to read controller configuration information: 0x%x",
+                info->ev.status);
+        return false;
+    }
+
+    if (info->ev.hdr.cmd != BTMGMT_EV_CMD_COMPLETE
+            || info->ev.hdr.len < sizeof(*info) - sizeof(info->ev.hdr))
+        return false;
+
+    if (info->missing_options & BTMGMT_OPT_PUBLIC_ADDRESS) {
+        return true;
+    } else {
+        ALOGD("Controller is already configured with a public address");
+        return false;
+    }
+}
+
+int main(int argc, char* argv[]) {
+    if (argc < 2) {
+        ALOGE("Usage: bdaddr <bdaddr>");
+        return 1;
+    }
+
+    uint8_t bdaddr[MAC_ADDRESS_SIZE];
+    if (strlen(argv[1]) != MAC_ADDRESS_LENGTH
+        || sscanf(argv[1], MAC_ADDRESS_FORMAT,
+            &bdaddr[5], &bdaddr[4], &bdaddr[3],
+            &bdaddr[2], &bdaddr[1], &bdaddr[0]) != MAC_ADDRESS_SIZE) {
+        ALOGE("Invalid MAC address: %s", argv[1]);
+        return 1;
+    }
+
+    int s = btmgmt_connect();
+    if (s < 0) {
+        ALOGE("Failed to create Bluetooth management socket: %s", strerror(errno));
+        return 1;
+    }
+
+    btmgmt_request_config_info(s);
+
+    char buf[MESSAGE_BUFFER];
+    struct btmgmt_hdr* hdr = (struct btmgmt_hdr*) buf;
+    struct btmgmt_ev_cmd_status* ev = (struct btmgmt_ev_cmd_status*) hdr;
+
+    while (true) {
+        ssize_t len = read(s, buf, sizeof(buf));
+        if (len < (ssize_t) sizeof(struct btmgmt_hdr))
+            continue;
+        if (len < (ssize_t) sizeof(struct btmgmt_hdr) + hdr->len)
+            continue;
+        if (hdr->id != HCI_CONTROLLER)
+            continue;
+
+        switch (hdr->cmd) {
+        case BTMGMT_EV_CMD_COMPLETE:
+        case BTMGMT_EV_CMD_STATUS:
+            if (hdr->len < sizeof(*ev) - sizeof(hdr))
+                continue;
+
+            switch (ev->cmd) {
+            case BTMGMT_CMD_READ_CONFIG_INFO:
+                if (btmgmt_config_needs_public_addr(ev))
+                    btmgmt_set_public_addr(s, bdaddr);
+                break;
+            case BTMGMT_CMD_SET_PUBLIC_ADDR:
+                btmgmt_complete_set_public_addr(ev, bdaddr);
+                break;
+            }
+
+            break;
+        case BTMGMT_EV_UNCONF_INDEX_ADDED:
+            btmgmt_request_config_info(s);
+            break;
+        }
+    }
+}
diff --git a/shared/utils/bdaddr/bdaddr.rc b/shared/utils/bdaddr/bdaddr.rc
new file mode 100644
index 0000000..d4f007d
--- /dev/null
+++ b/shared/utils/bdaddr/bdaddr.rc
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2023 The Android Open Source Project
+#
+# 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.
+#
+
+service set_bdaddr /vendor/bin/set_bdaddr.sh
+    class core
+    user root
+    group system
+    capabilities NET_ADMIN
+
+on post-fs
+    start set_bdaddr
diff --git a/shared/utils/bdaddr/set_bdaddr.sh b/shared/utils/bdaddr/set_bdaddr.sh
new file mode 100644
index 0000000..299626d
--- /dev/null
+++ b/shared/utils/bdaddr/set_bdaddr.sh
@@ -0,0 +1,33 @@
+#! /vendor/bin/sh
+# Set Bluetooth address (BT_ADDR).
+
+#
+# Copyright (C) 2023 The Android Open Source Project
+#
+# 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.
+#
+
+# Get the unique board serial number from /proc/cmdline,
+# prepend '0's to the serial number to fill 5 LSBs of the
+# BT address and prepend "C0" as MSB to prepare a 6 byte
+# Bluetooth Random Static Address. Reference:
+# https://www.bluetooth.com/wp-content/uploads/2022/05/Bluetooth_LE_Primer_Paper.pdf [Page 23]
+#
+# Format the output in xx:xx:xx:xx:xx:xx format for the
+# "bdaddr" command to work.
+
+BTADDR=`/vendor/bin/cat /proc/cmdline | vendor/bin/grep -o serialno.* |\
+	/vendor/bin/cut -f2 -d'=' | /vendor/bin/awk '{printf("C0%010s\n", $1)}' |\
+	/vendor/bin/sed 's/\(..\)/\1:/g' | /vendor/bin/sed '$s/:$//'`
+
+/vendor/bin/hw/bdaddr "${BTADDR}"
diff --git a/qcom/init.qcom.rc b/shared/utils/init.utils.rc
similarity index 100%
rename from qcom/init.qcom.rc
rename to shared/utils/init.utils.rc
diff --git a/qcom/pd-mapper/Android.bp b/shared/utils/pd-mapper/Android.bp
similarity index 100%
rename from qcom/pd-mapper/Android.bp
rename to shared/utils/pd-mapper/Android.bp
diff --git a/qcom/pd-mapper/LICENSE b/shared/utils/pd-mapper/LICENSE
similarity index 100%
rename from qcom/pd-mapper/LICENSE
rename to shared/utils/pd-mapper/LICENSE
diff --git a/qcom/pd-mapper/Makefile b/shared/utils/pd-mapper/Makefile
similarity index 100%
rename from qcom/pd-mapper/Makefile
rename to shared/utils/pd-mapper/Makefile
diff --git a/qcom/pd-mapper/assoc.c b/shared/utils/pd-mapper/assoc.c
similarity index 100%
rename from qcom/pd-mapper/assoc.c
rename to shared/utils/pd-mapper/assoc.c
diff --git a/qcom/pd-mapper/assoc.h b/shared/utils/pd-mapper/assoc.h
similarity index 100%
rename from qcom/pd-mapper/assoc.h
rename to shared/utils/pd-mapper/assoc.h
diff --git a/qcom/pd-mapper/json.c b/shared/utils/pd-mapper/json.c
similarity index 100%
rename from qcom/pd-mapper/json.c
rename to shared/utils/pd-mapper/json.c
diff --git a/qcom/pd-mapper/json.h b/shared/utils/pd-mapper/json.h
similarity index 100%
rename from qcom/pd-mapper/json.h
rename to shared/utils/pd-mapper/json.h
diff --git a/qcom/pd-mapper/pd-mapper.c b/shared/utils/pd-mapper/pd-mapper.c
similarity index 100%
rename from qcom/pd-mapper/pd-mapper.c
rename to shared/utils/pd-mapper/pd-mapper.c
diff --git a/qcom/pd-mapper/pd-mapper.service.in b/shared/utils/pd-mapper/pd-mapper.service.in
similarity index 100%
rename from qcom/pd-mapper/pd-mapper.service.in
rename to shared/utils/pd-mapper/pd-mapper.service.in
diff --git a/qcom/pd-mapper/servreg_loc.c b/shared/utils/pd-mapper/servreg_loc.c
similarity index 100%
rename from qcom/pd-mapper/servreg_loc.c
rename to shared/utils/pd-mapper/servreg_loc.c
diff --git a/qcom/pd-mapper/servreg_loc.h b/shared/utils/pd-mapper/servreg_loc.h
similarity index 100%
rename from qcom/pd-mapper/servreg_loc.h
rename to shared/utils/pd-mapper/servreg_loc.h
diff --git a/qcom/pd-mapper/servreg_loc.qmi b/shared/utils/pd-mapper/servreg_loc.qmi
similarity index 100%
rename from qcom/pd-mapper/servreg_loc.qmi
rename to shared/utils/pd-mapper/servreg_loc.qmi
diff --git a/qcom/qrtr/Android.bp b/shared/utils/qrtr/Android.bp
similarity index 100%
rename from qcom/qrtr/Android.bp
rename to shared/utils/qrtr/Android.bp
diff --git a/qcom/qrtr/LICENSE b/shared/utils/qrtr/LICENSE
similarity index 100%
rename from qcom/qrtr/LICENSE
rename to shared/utils/qrtr/LICENSE
diff --git a/qcom/qrtr/Makefile b/shared/utils/qrtr/Makefile
similarity index 100%
rename from qcom/qrtr/Makefile
rename to shared/utils/qrtr/Makefile
diff --git a/qcom/qrtr/lib/libqrtr.h b/shared/utils/qrtr/lib/libqrtr.h
similarity index 100%
rename from qcom/qrtr/lib/libqrtr.h
rename to shared/utils/qrtr/lib/libqrtr.h
diff --git a/qcom/qrtr/lib/logging.c b/shared/utils/qrtr/lib/logging.c
similarity index 100%
rename from qcom/qrtr/lib/logging.c
rename to shared/utils/qrtr/lib/logging.c
diff --git a/qcom/qrtr/lib/logging.h b/shared/utils/qrtr/lib/logging.h
similarity index 100%
rename from qcom/qrtr/lib/logging.h
rename to shared/utils/qrtr/lib/logging.h
diff --git a/qcom/qrtr/lib/qmi.c b/shared/utils/qrtr/lib/qmi.c
similarity index 100%
rename from qcom/qrtr/lib/qmi.c
rename to shared/utils/qrtr/lib/qmi.c
diff --git a/qcom/qrtr/lib/qrtr.c b/shared/utils/qrtr/lib/qrtr.c
similarity index 100%
rename from qcom/qrtr/lib/qrtr.c
rename to shared/utils/qrtr/lib/qrtr.c
diff --git a/qcom/qrtr/qrtr-ns.service.in b/shared/utils/qrtr/qrtr-ns.service.in
similarity index 100%
rename from qcom/qrtr/qrtr-ns.service.in
rename to shared/utils/qrtr/qrtr-ns.service.in
diff --git a/qcom/qrtr/qrtr.py b/shared/utils/qrtr/qrtr.py
similarity index 100%
rename from qcom/qrtr/qrtr.py
rename to shared/utils/qrtr/qrtr.py
diff --git a/qcom/qrtr/src/addr.c b/shared/utils/qrtr/src/addr.c
similarity index 100%
rename from qcom/qrtr/src/addr.c
rename to shared/utils/qrtr/src/addr.c
diff --git a/qcom/qrtr/src/addr.h b/shared/utils/qrtr/src/addr.h
similarity index 100%
rename from qcom/qrtr/src/addr.h
rename to shared/utils/qrtr/src/addr.h
diff --git a/qcom/qrtr/src/cfg.c b/shared/utils/qrtr/src/cfg.c
similarity index 100%
rename from qcom/qrtr/src/cfg.c
rename to shared/utils/qrtr/src/cfg.c
diff --git a/qcom/qrtr/src/hash.c b/shared/utils/qrtr/src/hash.c
similarity index 100%
rename from qcom/qrtr/src/hash.c
rename to shared/utils/qrtr/src/hash.c
diff --git a/qcom/qrtr/src/hash.h b/shared/utils/qrtr/src/hash.h
similarity index 100%
rename from qcom/qrtr/src/hash.h
rename to shared/utils/qrtr/src/hash.h
diff --git a/qcom/qrtr/src/list.h b/shared/utils/qrtr/src/list.h
similarity index 100%
rename from qcom/qrtr/src/list.h
rename to shared/utils/qrtr/src/list.h
diff --git a/qcom/qrtr/src/lookup.c b/shared/utils/qrtr/src/lookup.c
similarity index 100%
rename from qcom/qrtr/src/lookup.c
rename to shared/utils/qrtr/src/lookup.c
diff --git a/qcom/qrtr/src/map.c b/shared/utils/qrtr/src/map.c
similarity index 100%
rename from qcom/qrtr/src/map.c
rename to shared/utils/qrtr/src/map.c
diff --git a/qcom/qrtr/src/map.h b/shared/utils/qrtr/src/map.h
similarity index 100%
rename from qcom/qrtr/src/map.h
rename to shared/utils/qrtr/src/map.h
diff --git a/qcom/qrtr/src/ns.c b/shared/utils/qrtr/src/ns.c
similarity index 100%
rename from qcom/qrtr/src/ns.c
rename to shared/utils/qrtr/src/ns.c
diff --git a/qcom/qrtr/src/ns.h b/shared/utils/qrtr/src/ns.h
similarity index 100%
rename from qcom/qrtr/src/ns.h
rename to shared/utils/qrtr/src/ns.h
diff --git a/qcom/qrtr/src/util.c b/shared/utils/qrtr/src/util.c
similarity index 100%
rename from qcom/qrtr/src/util.c
rename to shared/utils/qrtr/src/util.c
diff --git a/qcom/qrtr/src/util.h b/shared/utils/qrtr/src/util.h
similarity index 100%
rename from qcom/qrtr/src/util.h
rename to shared/utils/qrtr/src/util.h
diff --git a/qcom/qrtr/src/waiter.c b/shared/utils/qrtr/src/waiter.c
similarity index 100%
rename from qcom/qrtr/src/waiter.c
rename to shared/utils/qrtr/src/waiter.c
diff --git a/qcom/qrtr/src/waiter.h b/shared/utils/qrtr/src/waiter.h
similarity index 100%
rename from qcom/qrtr/src/waiter.h
rename to shared/utils/qrtr/src/waiter.h
diff --git a/qcom/rmtfs/Android.bp b/shared/utils/rmtfs/Android.bp
similarity index 100%
rename from qcom/rmtfs/Android.bp
rename to shared/utils/rmtfs/Android.bp
diff --git a/qcom/rmtfs/LICENSE b/shared/utils/rmtfs/LICENSE
similarity index 100%
rename from qcom/rmtfs/LICENSE
rename to shared/utils/rmtfs/LICENSE
diff --git a/qcom/rmtfs/Makefile b/shared/utils/rmtfs/Makefile
similarity index 100%
rename from qcom/rmtfs/Makefile
rename to shared/utils/rmtfs/Makefile
diff --git a/qcom/rmtfs/qmi_rmtfs.c b/shared/utils/rmtfs/qmi_rmtfs.c
similarity index 100%
rename from qcom/rmtfs/qmi_rmtfs.c
rename to shared/utils/rmtfs/qmi_rmtfs.c
diff --git a/qcom/rmtfs/qmi_rmtfs.h b/shared/utils/rmtfs/qmi_rmtfs.h
similarity index 100%
rename from qcom/rmtfs/qmi_rmtfs.h
rename to shared/utils/rmtfs/qmi_rmtfs.h
diff --git a/qcom/rmtfs/qmi_rmtfs.qmi b/shared/utils/rmtfs/qmi_rmtfs.qmi
similarity index 100%
rename from qcom/rmtfs/qmi_rmtfs.qmi
rename to shared/utils/rmtfs/qmi_rmtfs.qmi
diff --git a/qcom/rmtfs/qmi_tlv.c b/shared/utils/rmtfs/qmi_tlv.c
similarity index 100%
rename from qcom/rmtfs/qmi_tlv.c
rename to shared/utils/rmtfs/qmi_tlv.c
diff --git a/qcom/rmtfs/rmtfs.c b/shared/utils/rmtfs/rmtfs.c
similarity index 100%
rename from qcom/rmtfs/rmtfs.c
rename to shared/utils/rmtfs/rmtfs.c
diff --git a/qcom/rmtfs/rmtfs.h b/shared/utils/rmtfs/rmtfs.h
similarity index 100%
rename from qcom/rmtfs/rmtfs.h
rename to shared/utils/rmtfs/rmtfs.h
diff --git a/qcom/rmtfs/rmtfs.service.in b/shared/utils/rmtfs/rmtfs.service.in
similarity index 100%
rename from qcom/rmtfs/rmtfs.service.in
rename to shared/utils/rmtfs/rmtfs.service.in
diff --git a/qcom/rmtfs/rproc.c b/shared/utils/rmtfs/rproc.c
similarity index 100%
rename from qcom/rmtfs/rproc.c
rename to shared/utils/rmtfs/rproc.c
diff --git a/qcom/rmtfs/sharedmem.c b/shared/utils/rmtfs/sharedmem.c
similarity index 100%
rename from qcom/rmtfs/sharedmem.c
rename to shared/utils/rmtfs/sharedmem.c
diff --git a/qcom/rmtfs/storage.c b/shared/utils/rmtfs/storage.c
similarity index 100%
rename from qcom/rmtfs/storage.c
rename to shared/utils/rmtfs/storage.c
diff --git a/qcom/rmtfs/util.c b/shared/utils/rmtfs/util.c
similarity index 100%
rename from qcom/rmtfs/util.c
rename to shared/utils/rmtfs/util.c
diff --git a/qcom/rmtfs/util.h b/shared/utils/rmtfs/util.h
similarity index 100%
rename from qcom/rmtfs/util.h
rename to shared/utils/rmtfs/util.h
diff --git a/qcom/set_hw.sh b/shared/utils/set_hw.sh
similarity index 100%
rename from qcom/set_hw.sh
rename to shared/utils/set_hw.sh
diff --git a/qcom/set_udc.sh b/shared/utils/set_udc.sh
similarity index 100%
rename from qcom/set_udc.sh
rename to shared/utils/set_udc.sh
diff --git a/qcom/tqftpserv/Android.bp b/shared/utils/tqftpserv/Android.bp
similarity index 100%
rename from qcom/tqftpserv/Android.bp
rename to shared/utils/tqftpserv/Android.bp
diff --git a/qcom/tqftpserv/LICENSE b/shared/utils/tqftpserv/LICENSE
similarity index 100%
rename from qcom/tqftpserv/LICENSE
rename to shared/utils/tqftpserv/LICENSE
diff --git a/qcom/tqftpserv/Makefile b/shared/utils/tqftpserv/Makefile
similarity index 100%
rename from qcom/tqftpserv/Makefile
rename to shared/utils/tqftpserv/Makefile
diff --git a/qcom/tqftpserv/list.h b/shared/utils/tqftpserv/list.h
similarity index 100%
rename from qcom/tqftpserv/list.h
rename to shared/utils/tqftpserv/list.h
diff --git a/qcom/tqftpserv/tqftpserv.c b/shared/utils/tqftpserv/tqftpserv.c
similarity index 100%
rename from qcom/tqftpserv/tqftpserv.c
rename to shared/utils/tqftpserv/tqftpserv.c
diff --git a/qcom/tqftpserv/tqftpserv.service.in b/shared/utils/tqftpserv/tqftpserv.service.in
similarity index 100%
rename from qcom/tqftpserv/tqftpserv.service.in
rename to shared/utils/tqftpserv/tqftpserv.service.in
diff --git a/qcom/tqftpserv/translate.c b/shared/utils/tqftpserv/translate.c
similarity index 100%
rename from qcom/tqftpserv/translate.c
rename to shared/utils/tqftpserv/translate.c
diff --git a/qcom/tqftpserv/translate.h b/shared/utils/tqftpserv/translate.h
similarity index 100%
rename from qcom/tqftpserv/translate.h
rename to shared/utils/tqftpserv/translate.h