diff --git a/jenkins/multi-branch-ci.groovy b/jenkins/multi-branch-ci.groovy index 49be7bd..016e734 100644 --- a/jenkins/multi-branch-ci.groovy +++ b/jenkins/multi-branch-ci.groovy @@ -18,7 +18,9 @@ def getBuildNumber() { def getVersion(file) { def version = file =~ /ro\.tesla-android\.build\.version\s*=\s*([0-9]+\.[0-9]+\.[0-9]+(?:\.[0-9]+)?)/; - return version[0][0] + def fullVersion = version[0][0]; + def versionNumber = fullVersion.split('=')[1].trim() + return versionNumber; } void setBuildStatus(String message, String state) { @@ -72,14 +74,14 @@ pipeline { stage('Capture artifacts') { steps { script { - file = readFile('aosptree/vendor/tesla-android/vendor.mk'); + file = readFile('aosptree/vendor/tesla-android/vendor.mk'); VERSION = getVersion(file); ARTIFACT_NAME = 'TeslaAndroid-' + VERSION + '-CI-' + getCurrentBranch() + '-' + getCommitSha() + '-BUILD-' + getBuildNumber() + '-rpi4' } dir("out") { - sh 'mv tesla_android_rpi4-ota-' + getBuildNumber() + '.zip ' + ARTIFACT_NAME + '-OTA.zip' - sh 'mv sdcard.img ' + ARTIFACT_NAME + '-single-image-installer.img' - sh 'zip ' + ARTIFACT_NAME + '-single-image-installer.img.zip ' + ARTIFACT_NAME + '-single-image-installer.img' + sh('mv tesla_android_rpi4-ota-' + getBuildNumber() + '.zip ' + ARTIFACT_NAME + '-OTA.zip') + sh('mv sdcard.img ' + ARTIFACT_NAME + '-single-image-installer.img') + sh('zip ' + ARTIFACT_NAME + '-single-image-installer.img.zip ' + ARTIFACT_NAME + '-single-image-installer.img') archiveArtifacts artifacts: ARTIFACT_NAME + '-single-image-installer.img.zip', fingerprint: true archiveArtifacts artifacts: ARTIFACT_NAME + '-OTA.zip', fingerprint: true } diff --git a/patches-aosp/build/soong/0001-GLODROID-Don-t-use-clang-tidy.patch b/patches-aosp/build/soong/0001-GLODROID-Don-t-use-clang-tidy.patch new file mode 100644 index 0000000..1ba4cde --- /dev/null +++ b/patches-aosp/build/soong/0001-GLODROID-Don-t-use-clang-tidy.patch @@ -0,0 +1,29 @@ +From 01daa7236225d6e714bcf2572cd7003345d98d39 Mon Sep 17 00:00:00 2001 +From: Roman Stratiienko +Date: Sun, 21 May 2023 00:44:46 +0300 +Subject: [PATCH] GLODROID: Don't use clang-tidy + +It's pointless, time, and energy inefficient to run it globally. + +Change-Id: I12b94488c6f9e273786e099670a0610830ba024a +Signed-off-by: Roman Stratiienko +--- + cc/tidy.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cc/tidy.go b/cc/tidy.go +index 750e9de1e..63f525e00 100644 +--- a/cc/tidy.go ++++ b/cc/tidy.go +@@ -74,7 +74,7 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags { + // If not explicitly disabled, set flags.Tidy to generate .tidy rules. + // Note that libraries and binaries will depend on .tidy files ONLY if + // the global WITH_TIDY or module 'tidy' property is true. +- flags.Tidy = true ++ flags.Tidy = false + + // If explicitly enabled, by global default or local tidy property, + // set flags.NeedTidyFiles to make this module depend on .tidy files. +-- +2.39.2 + diff --git a/patches-aosp/system/core/0002-Offline-mode-tesla-android-domains.patch b/patches-aosp/system/core/0002-Offline-mode-tesla-android-domains.patch deleted file mode 100755 index 53ee3dc..0000000 --- a/patches-aosp/system/core/0002-Offline-mode-tesla-android-domains.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5beed69c1e322b2b692849052046f5e6b99a884b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20Gapi=C5=84ski?= -Date: Tue, 16 May 2023 18:39:30 +0000 -Subject: [PATCH 1/1] Offline mode + tesla android domains - -Change-Id: I1dc47436e1e46d744fe5ba84cfb033197063f2c1 ---- - rootdir/etc/hosts | 18 ++++++++++++++++-- - 1 file changed, 16 insertions(+), 2 deletions(-) - -diff --git a/rootdir/etc/hosts b/rootdir/etc/hosts -index 649151cef..48367aa88 100644 ---- a/rootdir/etc/hosts -+++ b/rootdir/etc/hosts -@@ -1,2 +1,16 @@ --127.0.0.1 localhost --::1 ip6-localhost -+100.64.255.1 connman.vn.tesla.services -+100.64.255.1 www.teslamotors.com -+100.64.255.1 hermes-prd.vn.tesla.services -+ -+100.64.255.1 connman.vn.cloud.tesla.cn -+100.64.255.1 www.tesla.cn -+100.64.255.1 hermes-prd.vn.cloud.tesla.cn -+ -+100.64.255.1 www.youtu.be -+100.64.255.1 fullscreen.app.teslaandroid.com -+100.64.255.1 www.fullscreen.app.teslaandroid.com -+100.64.255.1 app.teslaandroid.com -+100.64.255.1 www.app.teslaandroid.com -+ -+127.0.0.1 localhost -+::1 ip6-localhost --- -2.34.1 - diff --git a/patches-aosp/system/core/0003-Block-Tesla-telemetry-and-firmware-distribution-CDN.patch b/patches-aosp/system/core/0003-Block-Tesla-telemetry-and-firmware-distribution-CDN.patch deleted file mode 100644 index a0163ee..0000000 --- a/patches-aosp/system/core/0003-Block-Tesla-telemetry-and-firmware-distribution-CDN.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e0a9dd4fa758fde1508df9b75d46d4512626c3ee Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20Gapi=C5=84ski?= -Date: Thu, 18 May 2023 17:33:28 +0000 -Subject: [PATCH 1/1] Block Tesla telemetry and firmware distribution CDN - -Change-Id: I49087d6daf1185a9ceb0cc45ff84a6c89b845738 ---- - rootdir/etc/hosts | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/rootdir/etc/hosts b/rootdir/etc/hosts -index 48367aa88..f7bc662db 100644 ---- a/rootdir/etc/hosts -+++ b/rootdir/etc/hosts -@@ -6,6 +6,15 @@ - 100.64.255.1 www.tesla.cn - 100.64.255.1 hermes-prd.vn.cloud.tesla.cn - -+100.64.255.1 telemetry-prd.vn.tesla.services -+100.64.255.1 telemetry-prd.ap.tesla.services -+100.64.255.1 va.teslamotors.com -+100.64.255.1 apf-api.prd.vn.cloud.tesla.com -+100.64.255.1 x1.ap.tesla.services -+100.64.255.1 s3.ap.tesla.services -+100.64.255.1 tesla-hermes-snapshot-eu.s3-eu-central-1.amazonaws.com -+100.64.255.1 tesla-hermes-snapshot.s3-us-west-2.amazonaws.com -+ - 100.64.255.1 www.youtu.be - 100.64.255.1 fullscreen.app.teslaandroid.com - 100.64.255.1 www.fullscreen.app.teslaandroid.com --- -2.34.1 - diff --git a/patches-aosp/system/netd/0001-Disable-IPV6-forwarding.patch b/patches-aosp/system/netd/0001-Disable-IPV6-forwarding.patch new file mode 100644 index 0000000..c6caa19 --- /dev/null +++ b/patches-aosp/system/netd/0001-Disable-IPV6-forwarding.patch @@ -0,0 +1,35 @@ +From 5a09f0d4bb2b1124a04998190ae5e70cbb74cba8 Mon Sep 17 00:00:00 2001 +From: "jenkins@teslaandroid.com" +Date: Fri, 19 May 2023 08:10:58 +0000 +Subject: [PATCH 1/2] Disable IPV6 forwarding + +Change-Id: Iace59dbe567e314e06848178ef6107c5a82aab5f +--- + server/TetherController.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/server/TetherController.cpp b/server/TetherController.cpp +index 7919357..e5b57d7 100644 +--- a/server/TetherController.cpp ++++ b/server/TetherController.cpp +@@ -74,7 +74,7 @@ namespace { + + const char BP_TOOLS_MODE[] = "bp-tools"; + const char IPV4_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv4/ip_forward"; +-const char IPV6_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv6/conf/all/forwarding"; ++//const char IPV6_FORWARDING_PROC_FILE[] = "/proc/sys/net/ipv6/conf/all/forwarding"; + const char SEPARATOR[] = "|"; + constexpr const char kTcpBeLiberal[] = "/proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal"; + +@@ -172,7 +172,7 @@ bool TetherController::setIpFwdEnabled() { + const char* value = disable ? "0" : "1"; + ALOGD("Setting IP forward enable = %s", value); + success &= writeToFile(IPV4_FORWARDING_PROC_FILE, value); +- success &= writeToFile(IPV6_FORWARDING_PROC_FILE, value); ++ //success &= writeToFile(IPV6_FORWARDING_PROC_FILE, value); + if (disable) { + // Turning off the forwarding sysconf in the kernel has the side effect + // of turning on ICMP redirect, which is a security hazard. +-- +2.34.1 + diff --git a/patches-aosp/system/netd/0002-Configurable-offline-mode.patch b/patches-aosp/system/netd/0002-Configurable-offline-mode.patch new file mode 100644 index 0000000..6a933a1 --- /dev/null +++ b/patches-aosp/system/netd/0002-Configurable-offline-mode.patch @@ -0,0 +1,93 @@ +From 1bc0c404db9ff0aef3815679437e6137ddbf6b54 Mon Sep 17 00:00:00 2001 +From: "jenkins@teslaandroid.com" +Date: Fri, 19 May 2023 08:14:40 +0000 +Subject: [PATCH] Configurable offline mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change-Id: I2724c97f88d1744e74f3dcc51e001244a854dac6 +Signed-off-by: Michał Gapiński +--- + server/TetherController.cpp | 44 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/server/TetherController.cpp b/server/TetherController.cpp +index 79193574..abaf5a11 100644 +--- a/server/TetherController.cpp ++++ b/server/TetherController.cpp +@@ -125,6 +125,15 @@ bool inBpToolsMode() { + return !strcmp(BP_TOOLS_MODE, bootmode); + } + ++int get_system_property_int(const char* prop_name) { ++ char prop_value[PROPERTY_VALUE_MAX]; ++ if (property_get(prop_name, prop_value, nullptr) > 0) { ++ return atoi(prop_value); ++ } else { ++ return -1; ++ } ++} ++ + } // namespace + + auto TetherController::iptablesRestoreFunction = execIptablesRestoreWithOutput; +@@ -223,6 +232,10 @@ int TetherController::startTethering(bool usingLegacyDnsProxy, int num_addrs, ch + return -res; + } + ++ int offlineModeEnabled = get_system_property_int("persist.tesla-android.offline-mode.is_enabled"); ++ int offlineModeTelemetryEnabled = get_system_property_int("persist.tesla-android.offline-mode.telemetry.is_enabled"); ++ int offlineModeTeslaFirmwareDownload = get_system_property_int("persist.tesla-android.offline-mode.tesla-firmware-downloads"); ++ + // Set parameters + Fwmark fwmark; + fwmark.netId = NetworkController::LOCAL_NET_ID; +@@ -234,6 +247,8 @@ int TetherController::startTethering(bool usingLegacyDnsProxy, int num_addrs, ch + + std::vector argVector = { + "/system/bin/dnsmasq", ++ "--address=/gapinski.eu/100.64.255.1", ++ "--address=/gapinski.com/100.64.255.1", + "--keep-in-foreground", + "--no-resolv", + "--no-poll", +@@ -257,6 +272,35 @@ int TetherController::startTethering(bool usingLegacyDnsProxy, int num_addrs, ch + dhcp_ranges[addrIndex + 1])); + } + ++ argVector.push_back("--address=/www.youtu.be/100.64.255.1"); ++ argVector.push_back("--address=/fullscreen.app.teslaandroid.com/100.64.255.1"); ++ argVector.push_back("--address=/www.fullscreen.app.teslaandroid.com/100.64.255.1"); ++ argVector.push_back("--address=/app.teslaandroid.com/100.64.255.1"); ++ argVector.push_back("--address=/www.app.teslaandroid.com/100.64.255.1"); ++ ++ ++ if(offlineModeEnabled == 1) { ++ argVector.push_back("--address=/connman.vn.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/www.teslamotors.com/100.64.255.1"); ++ argVector.push_back("--address=/hermes-prd.vn.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/connman.vn.cloud.tesla.cn/100.64.255.1"); ++ argVector.push_back("--address=/www.tesla.cn/100.64.255.1"); ++ argVector.push_back("--address=/hermes-prd.vn.cloud.tesla.cn/100.64.255.1"); ++ if(offlineModeTelemetryEnabled == 0) { ++ argVector.push_back("--address=/telemetry-prd.vn.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/telemetry-prd.ap.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/apf-api.prd.vn.cloud.tesla.com/100.64.255.1"); ++ argVector.push_back("--address=/x1.ap.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/s3.ap.tesla.services/100.64.255.1"); ++ argVector.push_back("--address=/tesla-hermes-snapshot-eu.s3-eu-central-1.amazonaws.com/100.64.255.1"); ++ argVector.push_back("--address=/tesla-hermes-snapshot.s3-us-west-2.amazonaws.com/100.64.255.1"); ++ } ++ if(offlineModeTeslaFirmwareDownload == 0) { ++ argVector.push_back("--address=/va.teslamotors.com/100.64.255.1"); ++ } ++ } ++ ++ + std::vector args(argVector.size() + 1); + for (unsigned i = 0; i < argVector.size(); i++) { + args[i] = (char*)argVector[i].c_str(); +-- +2.34.1 +