1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-13 20:54:12 +01:00

Update bootctl

Close #5134
This commit is contained in:
topjohnwu 2022-01-13 02:24:02 -08:00
parent 21505a7470
commit 9c93fe6003
7 changed files with 35 additions and 12 deletions

View File

@ -20,9 +20,6 @@ object Const {
const val TMPDIR = "/dev/tmp"
const val MAGISK_LOG = "/cache/magisk.log"
// Versions
const val BOOTCTL_REVISION = "22.0"
// Misc
val USER_ID = Process.myUid() / 100000
val APP_IS_CANARY get() = Version.isCanary(BuildConfig.VERSION_CODE)

View File

@ -388,10 +388,10 @@ abstract class MagiskInstallImpl protected constructor(
private fun flashBoot() = "direct_install $installDir $srcBoot".sh().isSuccess
private suspend fun postOTA(): Boolean {
private fun postOTA(): Boolean {
try {
val bootctl = File.createTempFile("bootctl", null, context.cacheDir)
service.fetchBootctl().byteStream().writeTo(bootctl)
context.assets.open("bootctl").writeTo(bootctl)
"post_ota $bootctl".sh()
} catch (e: IOException) {
console.add("! Unable to download bootctl")

View File

@ -1,6 +1,5 @@
package com.topjohnwu.magisk.data.network
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.model.BranchInfo
import com.topjohnwu.magisk.core.model.UpdateInfo
import okhttp3.ResponseBody
@ -11,7 +10,6 @@ private const val BRANCH = "branch"
private const val REPO = "repo"
private const val FILE = "file"
const val MAGISK_FILES = "topjohnwu/magisk-files"
const val MAGISK_MAIN = "topjohnwu/Magisk"
interface GithubPageServices {
@ -22,10 +20,6 @@ interface GithubPageServices {
interface JSDelivrServices {
@GET("$MAGISK_FILES@{$REVISION}/bootctl")
@Streaming
suspend fun fetchBootctl(@Path(REVISION) revision: String = Const.BOOTCTL_REVISION): ResponseBody
@GET("$MAGISK_MAIN@{$REVISION}/scripts/module_installer.sh")
@Streaming
suspend fun fetchInstaller(@Path(REVISION) revision: String): ResponseBody

View File

@ -59,7 +59,6 @@ class NetworkService(
}
// Fetch files
suspend fun fetchBootctl() = wrap { jsd.fetchBootctl() }
suspend fun fetchInstaller() = wrap {
val sha = fetchMainVersion()
jsd.fetchInstaller(sha)

View File

@ -125,6 +125,7 @@ fun Project.setupApp() {
from(rootProject.file("scripts")) {
include("util_functions.sh", "boot_patch.sh", "uninstaller.sh", "addon.d.sh")
}
from(rootProject.file("tools/bootctl"))
into("chromeos") {
from(rootProject.file("tools/futility"))
from(rootProject.file("tools/keys")) {

BIN
tools/bootctl Normal file

Binary file not shown.

32
tools/bootctl.patch Executable file
View File

@ -0,0 +1,32 @@
# How to build the bootctl bundled within the Magisk app:
#
# 1. Checkout and sync the AOSP tree:
# https://source.android.com/setup/build/downloading
# 2. Build for arm64:
# lunch aosp_arm64-eng
# 3. Apply patches:
# cd system/extras; patch -p1 < bootctl.patch
# 4. Build the executable:
# m bootctl
diff --git a/bootctl/Android.bp b/bootctl/Android.bp
index f63871cf..8a551bbe 100644
--- a/bootctl/Android.bp
+++ b/bootctl/Android.bp
@@ -26,11 +26,15 @@ cc_binary {
"-Werror",
],
- shared_libs: [
+ static_libs: [
"android.hardware.boot@1.0",
"android.hardware.boot@1.1",
"android.hardware.boot@1.2",
+ ],
+ shared_libs: [
"libhidlbase",
"libutils",
+ "libcutils",
+ "liblog",
],
}