Browse Source

add menu for flashing normal or bypass kernels

TheWildJames 2 months ago
parent
commit
ea42c023ac
1 changed files with 69 additions and 34 deletions
  1. 69 34
      .github/actions/build-kernel/patches/bypass.patch

+ 69 - 34
.github/actions/build-kernel/patches/bypass.patch

@@ -1,47 +1,82 @@
 diff --git a/anykernel.sh b/anykernel.sh
-index 7ac0233..864ecf4 100755
+index 6a97197..c01bdde 100755
 --- a/anykernel.sh
 +++ b/anykernel.sh
-@@ -21,7 +21,6 @@ supported.patchlevels=
+@@ -19,7 +19,7 @@ device.name5=
+ supported.versions=
+ supported.patchlevels=
  supported.vendorpatchlevels=
+-keycheck.timeout=10
++keycheck.timeout=20
  '; } # end properties
  
--
- ### AnyKernel install
- ## boot shell variables
- block=boot
+ 
 diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh
-index dfbec13..c9900f7 100755
+index 098506e..52a9e35 100755
 --- a/tools/ak3-core.sh
 +++ b/tools/ak3-core.sh
-@@ -1051,8 +1051,30 @@ do_check_boot_version() {
-   ui_print "  -> Kernel version: COMPATIBLE ($new_ver >= $dev_ver)"
- }
- 
-+do_flash_bypass() {
-+  # do.flash_bypass=0 in anykernel.sh skips bypass option and flashs normal
-+  if [ "$(file_getprop anykernel.sh do.flash_bypass)" != 1 ]; then
-+    ui_print "  -> [NORMAL] do.flash_bypass=0: bypass option SKIPPED."
-+    if [ -f "$AKHOME/Image" ]; then
-+      ui_print "  -> [NORMAL] Flashing Normal Image..."
-+    else
-+      abort "  -> ERROR: Image not found. Abort."
-+    fi
-+  else
-+    ui_print "  -> [BYPASS] do.flash_bypass=1: flash bypass option ENABLED."
-+    if [ -f "$AKHOME/Bypass-Image" ]; then
-+      cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image" || abort "  -> ERROR: Failed to copy Bypass-Image. Abort."
-+      ui_print "  -> [BYPASS] Flashing Bypass Image..."
-+    else
-+      abort "  -> ERROR: Bypass-Image not found. Abort."
-+    fi
-+  fi
-+}
-+ 
- ### end methods
- 
+@@ -1141,3 +1141,63 @@ handle_input() {
  setup_ak;
  
  do_check_boot_version;
 +
-+do_flash_bypass;
++# Kernel image selection prompt
++
++KERNEL_MODE="normal"
++
++show_kernel_menu() {
++    ui_print " "
++    ui_print "================================"
++    ui_print "       Kernel Image Mode"
++    ui_print "================================"
++    ui_print " "
++    ui_print "Most users should use Normal Mode."
++    ui_print " "
++    ui_print "Bypass Mode is only for devices"
++    ui_print "that fail to boot due to kernel"
++    ui_print "module compatibility issues."
++    ui_print " "
++    ui_print "IMPORTANT:"
++    ui_print "Bypass Mode does NOT hide root."
++    ui_print "It does NOT bypass detection."
++    ui_print " "
++    ui_print "--------------------------------"
++    ui_print "VOL- : Normal Mode (Recommended)"
++    ui_print "VOL+ : Bypass Mode (Advanced)"
++    ui_print "--------------------------------"
++    ui_print " "
++    ui_print "================================"
++
++    handle_input
++
++    KEY_RESULT=$(cat /tmp/ak3_key_result 2>/dev/null)
++
++    case "$KEY_RESULT" in
++        KEY_VOLUMEUP)
++            KERNEL_MODE="bypass"
++            ui_print " "
++            ui_print "Selected: Bypass Mode"
++            ui_print "Using Bypass-Image"
++            ui_print " "
++            ;;
++
++        KEY_VOLUMEDOWN)
++            KERNEL_MODE="normal"
++            ui_print " "
++            ui_print "Selected: Normal Mode"
++            ui_print "Using standard Image"
++            ui_print " "
++            ;;
++
++        TIMEOUT)
++            KERNEL_MODE="normal"
++            ui_print " "
++            ui_print "Timeout reached."
++            ui_print "Defaulting to Normal Mode."
++            ui_print " "
++            ;;
++    esac
++}
++
++show_kernel_menu
+\ No newline at end of file