Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
3f013636
Commit
3f013636
authored
Jan 25, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move nand flash handling into boot_patch.sh
parent
e92d77bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
29 deletions
+22
-29
MagiskInstaller.kt
...n/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
+11
-18
boot_patch.sh
scripts/boot_patch.sh
+10
-0
util_functions.sh
scripts/util_functions.sh
+1
-11
No files found.
app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
View file @
3f013636
...
@@ -327,23 +327,19 @@ abstract class MagiskInstallImpl protected constructor(
...
@@ -327,23 +327,19 @@ abstract class MagiskInstallImpl protected constructor(
private
fun
patchBoot
():
Boolean
{
private
fun
patchBoot
():
Boolean
{
"cd $installDir"
.
sh
()
"cd $installDir"
.
sh
()
var
srcNand
:
File
?
=
null
var
isSigned
=
false
if
(
"[ -c $srcBoot ] && nanddump -f boot.img $srcBoot"
.
sh
().
isSuccess
)
{
if
(
srcBoot
.
let
{
it
!
is
SuFile
||
!
it
.
isCharacter
})
{
srcNand
=
srcBoot
try
{
srcBoot
=
installDirFile
(
"boot.img"
)
SuFileInputStream
(
srcBoot
).
use
{
}
if
(
SignBoot
.
verifySignature
(
it
,
null
))
{
isSigned
=
true
var
isSigned
:
Boolean
console
.
add
(
"- Boot image is signed with AVB 1.0"
)
try
{
}
SuFileInputStream
(
srcBoot
).
use
{
isSigned
=
SignBoot
.
verifySignature
(
it
,
null
)
if
(
isSigned
)
{
console
.
add
(
"- Boot image is signed with AVB 1.0"
)
}
}
}
catch
(
e
:
IOException
)
{
console
.
add
(
"! Unable to check signature"
)
return
false
}
}
}
catch
(
e
:
IOException
)
{
console
.
add
(
"! Unable to check signature"
)
return
false
}
}
val
FLAGS
=
val
FLAGS
=
...
@@ -354,9 +350,6 @@ abstract class MagiskInstallImpl protected constructor(
...
@@ -354,9 +350,6 @@ abstract class MagiskInstallImpl protected constructor(
if
(!
"$FLAGS sh boot_patch.sh $srcBoot"
.
sh
().
isSuccess
)
if
(!
"$FLAGS sh boot_patch.sh $srcBoot"
.
sh
().
isSuccess
)
return
false
return
false
if
(
srcNand
!=
null
)
srcBoot
=
srcNand
val
job
=
Shell
.
sh
(
"./magiskboot cleanup"
,
"cd /"
)
val
job
=
Shell
.
sh
(
"./magiskboot cleanup"
,
"cd /"
)
val
patched
=
installDirFile
(
"new-boot.img"
)
val
patched
=
installDirFile
(
"new-boot.img"
)
...
...
scripts/boot_patch.sh
View file @
3f013636
...
@@ -60,6 +60,13 @@ fi
...
@@ -60,6 +60,13 @@ fi
BOOTIMAGE
=
"
$1
"
BOOTIMAGE
=
"
$1
"
[
-e
"
$BOOTIMAGE
"
]
||
abort
"
$BOOTIMAGE
does not exist!"
[
-e
"
$BOOTIMAGE
"
]
||
abort
"
$BOOTIMAGE
does not exist!"
# Dump image for MTD/NAND character device boot partitions
if
[
-c
"
$BOOTIMAGE
"
]
;
then
nanddump
-f
boot.img
"
$BOOTIMAGE
"
BOOTNAND
=
"
$BOOTIMAGE
"
BOOTIMAGE
=
boot.img
fi
# Flags
# Flags
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
false
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
false
[
-z
$KEEPFORCEENCRYPT
]
&&
KEEPFORCEENCRYPT
=
false
[
-z
$KEEPFORCEENCRYPT
]
&&
KEEPFORCEENCRYPT
=
false
...
@@ -188,5 +195,8 @@ ui_print "- Repacking boot image"
...
@@ -188,5 +195,8 @@ ui_print "- Repacking boot image"
# Sign chromeos boot
# Sign chromeos boot
$CHROMEOS
&&
sign_chromeos
$CHROMEOS
&&
sign_chromeos
# Restore the original boot partition path
[
-e
"
$BOOTNAND
"
]
&&
BOOTIMAGE
=
"
$BOOTNAND
"
# Reset any error code
# Reset any error code
true
true
scripts/util_functions.sh
View file @
3f013636
...
@@ -438,14 +438,7 @@ flash_image() {
...
@@ -438,14 +438,7 @@ flash_image() {
install_magisk
()
{
install_magisk
()
{
cd
$MAGISKBIN
cd
$MAGISKBIN
# Dump image for MTD/NAND character device boot partitions
if
[
$API
-ge
21
-a
!
-c
$BOOTIMAGE
]
;
then
if
[
-c
$BOOTIMAGE
]
;
then
nanddump
-f
boot.img
$BOOTIMAGE
local
BOOTNAND
=
$BOOTIMAGE
BOOTIMAGE
=
boot.img
fi
if
[
$API
-ge
21
]
;
then
eval
$BOOTSIGNER
-verify
<
$BOOTIMAGE
&&
BOOTSIGNED
=
true
eval
$BOOTSIGNER
-verify
<
$BOOTIMAGE
&&
BOOTSIGNED
=
true
$BOOTSIGNED
&&
ui_print
"- Boot image is signed with AVB 1.0"
$BOOTSIGNED
&&
ui_print
"- Boot image is signed with AVB 1.0"
fi
fi
...
@@ -455,9 +448,6 @@ install_magisk() {
...
@@ -455,9 +448,6 @@ install_magisk() {
.
./boot_patch.sh
"
$BOOTIMAGE
"
.
./boot_patch.sh
"
$BOOTIMAGE
"
ui_print
"- Flashing new boot image"
ui_print
"- Flashing new boot image"
# Restore the original boot partition path
[
"
$BOOTNAND
"
]
&&
BOOTIMAGE
=
$BOOTNAND
flash_image new-boot.img
"
$BOOTIMAGE
"
flash_image new-boot.img
"
$BOOTIMAGE
"
case
$?
in
case
$?
in
1
)
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment