Compare commits

..

1 Commits

Author SHA1 Message Date
topjohnwu
0bbc736051 Properly set abiList with config.prop for APK 2025-12-16 02:38:27 -08:00
3 changed files with 22 additions and 6 deletions

View File

@@ -46,11 +46,25 @@ class MagiskPlugin : Plugin<Project> {
private fun Project.applyPlugin() {
initRandom(rootProject.file("dict.txt"))
props.clear()
rootProject.file("gradle.properties").inputStream().use { props.load(it) }
// Get gradle properties relevant to Magisk
props.putAll(properties.filter { (key, _) -> key.startsWith("magisk.") })
// Load config.prop
val configPath: String? by this
val config = rootFile(configPath ?: "config.prop")
if (config.exists())
config.inputStream().use { props.load(it) }
val configFile = rootFile(configPath ?: "config.prop")
if (configFile.exists()) {
configFile.inputStream().use {
val config = Properties()
config.load(it)
// Remove properties that should be passed by commandline
config.remove("abiList")
props.putAll(config)
}
}
// Commandline override
findProperty("abiList")?.let { props.put("abiList", it) }
val repo = FileRepository(rootFile(".git"))
val refId = repo.refDatabase.exactRef("HEAD").objectId

View File

@@ -406,6 +406,7 @@ def build_apk(module: str):
gradlew,
f"{module}:assemble{build_type}",
f"-PconfigPath={props}",
f"-PabiList={','.join(build_abis.keys())}",
],
env=env,
)

View File

@@ -292,7 +292,7 @@ static int find_dtb_offset(const uint8_t *buf, unsigned sz) {
auto fdt_hdr = reinterpret_cast<const fdt_header *>(curr);
// Check that fdt_header.totalsize does not overflow kernel image size or is empty dtb
// https://github.com/torvalds/linux/commit/7b937cc243e5b1df8780a0aa743ce800df6c68d1
// https://github.com/torvalds/linux/commit/7b937cc243e5b1df8780a0aa743ce800df6c68d1
uint32_t totalsize = fdt_hdr->totalsize;
if (totalsize > end - curr || totalsize <= 0x48)
continue;
@@ -913,6 +913,8 @@ void repack(Utf8CStr src_img, Utf8CStr out_img, bool skip_comp) {
file_align();
}
off.tail = lseek(fd, 0, SEEK_CUR);
// Proprietary stuffs
if (boot.flags[SEANDROID_FLAG]) {
xwrite(fd, SEANDROID_MAGIC, 16);
@@ -923,7 +925,6 @@ void repack(Utf8CStr src_img, Utf8CStr out_img, bool skip_comp) {
xwrite(fd, LG_BUMP_MAGIC, 16);
}
off.tail = lseek(fd, 0, SEEK_CUR);
file_align();
// vbmeta