22
33ipsw_openssh=1 # OpenSSH will be added to jailbreak/custom IPSW if set to 1.
44device_rd_build=" " # You can change the version of SSH Ramdisk and Pwned iBSS/iBEC here. (default is 10B329 for most devices)
5+ device_bootargs_default=" pio-error=0 debug=0x2014e serial=3"
56jelbrek=" ../resources/jailbreak"
67ssh_port=6414
78
@@ -2423,11 +2424,12 @@ ipsw_preference_set() {
24232424 # it should be in system, but restore puts it in data instead due to it being in var.
24242425 # for some reason though, it does it correctly on 4.x for 3gs and touch 2, so its enabled for those.
24252426 # it also does it correctly on 3.1.3-4.x for s5l8900 devices, so its also enabled there.
2427+ # for 3.x 3gs, kernel is patched so its also enabled there.
24262428 case $device_target_vers in
24272429 9.3.[4321] | 9.3 | 9.[210]* | [8765]* | 4.[32]* ) ipsw_canjailbreak=1;;
24282430 3.1.3 )
2429- case $device_proc in
2430- 1 ) ipsw_canjailbreak=1;;
2431+ case $device_type in
2432+ iPhone1 * | iPod1,1 | iPhone2, 1 ) ipsw_canjailbreak=1;;
24312433 * ) ipsw_nojailbreak_message;;
24322434 esac
24332435 ;;
@@ -2436,8 +2438,6 @@ ipsw_preference_set() {
24362438 if [[ $device_type == " iPhone1,2" || $device_type == " iPhone2,1" || $device_type == " iPod2,1" ]]; then
24372439 case $device_target_vers in
24382440 4* ) ipsw_canjailbreak=1;;
2439- 3.1.3 ) : ;;
2440- 3.[10]* ) ipsw_nojailbreak_message;;
24412441 esac
24422442 else
24432443 case $device_target_vers in
@@ -3933,13 +3933,7 @@ ipsw_prepare_ios4multipart() {
39333933 local JBFiles=()
39343934 ipsw_custom_part2=" ${device_type} _${device_target_vers} _${device_target_build} _CustomNP-${device_ecid} "
39353935 local all_flash2=" $ipsw_custom_part2 /$all_flash "
3936- local ExtraArgs2=" --boot-partition --boot-ramdisk --logo4"
39373936 local iboot
3938- case $device_target_vers in
3939- 4.2.9 | 4.2.10 ) : ;;
3940- * ) ExtraArgs2+=" --433" ;;
3941- esac
3942- ExtraArgs2+=" -b"
39433937
39443938 if [[ -e " ../$ipsw_custom_part2 .ipsw" && -e " $ipsw_custom .ipsw" ]]; then
39453939 log " Found existing Custom IPSWs. Skipping IPSW creation."
@@ -4058,11 +4052,18 @@ ipsw_prepare_ios4multipart() {
40584052 rm $all_flash2 /DeviceTree.${device_model} ap.img3
40594053 unzip -o -j " $ipsw_path .ipsw" $all_flash /DeviceTree.${device_model} ap.img3 -d $all_flash2
40604054
4061- local ExtraArgs3=" pio-error=0"
4055+ local ExtraArr=(" --boot-partition" " --boot-ramdisk" " --logo4" )
4056+ case $device_target_vers in
4057+ 4.2.9 | 4.2.10 ) : ;;
4058+ * ) ExtraArr+=(" --433" );;
4059+ esac
4060+ local bootargs=" $device_bootargs_default "
40624061 if [[ $ipsw_verbose == 1 ]]; then
4063- ExtraArgs3+= " -v"
4062+ bootargs= " pio-error=0 -v"
40644063 fi
4065- patch_iboot $ExtraArgs2 " $ExtraArgs3 "
4064+ ExtraArr+=(" -b" " $bootargs " )
4065+ patch_iboot " ${ExtraArr[@]} "
4066+
40664067 if [[ $device_type == " iPad1,1" && $device_target_vers == " 3" * ]]; then
40674068 cp iBoot ../saved/iPad1,1/iBoot3_$device_ecid
40684069 elif [[ $device_type == " iPad1,1" ]]; then
@@ -4421,7 +4422,6 @@ ipsw_prepare_ios4patches() {
44214422
44224423ipsw_prepare_ios4powder () {
44234424 local ExtraArgs=" -apticket $shsh_path "
4424- local ExtraArgs2=" --boot-partition --boot-ramdisk --logo4 "
44254425 local JBFiles=()
44264426 ipsw_prepare_usepowder=1
44274427
@@ -4457,14 +4457,19 @@ ipsw_prepare_ios4powder() {
44574457 device_dump activation
44584458 ExtraArgs+=" ../saved/$device_type /activation-$device_ecid .tar"
44594459 fi
4460+
4461+ local ExtraArr=(" --boot-partition" " --boot-ramdisk" " --logo4" )
44604462 case $device_target_vers in
44614463 4.3.[45] ) : ;;
4462- * ) ExtraArgs2+= " --433 " ;;
4464+ * ) ExtraArr+=( " --433" ) ;;
44634465 esac
4466+ local bootargs=" $device_bootargs_default "
44644467 if [[ $ipsw_verbose == 1 ]]; then
4465- ExtraArgs2+= " -b -v"
4468+ bootargs= " pio-error=0 -v"
44664469 fi
4467- patch_iboot $ExtraArgs2
4470+ ExtraArr+=(" -b" " $bootargs " )
4471+ patch_iboot " ${ExtraArr[@]} "
4472+
44684473 tar -rvf src/bin.tar iBoot
44694474 if [[ $device_type == " iPad1,1" ]]; then
44704475 cp iBoot iBEC
@@ -4554,6 +4559,10 @@ ipsw_prepare_powder() {
45544559 fi
45554560
45564561 local ExtraArr=(" --boot-partition" " --boot-ramdisk" )
4562+ local bootargs=" $device_bootargs_default "
4563+ if [[ $ipsw_verbose == 1 ]]; then
4564+ bootargs=" pio-error=0 -v"
4565+ fi
45574566 case $device_target_vers in
45584567 [789]* ) : ;;
45594568 * ) ExtraArr+=(" --logo" );;
@@ -4566,22 +4575,16 @@ ipsw_prepare_powder() {
45664575 if [[ $device_target_vers == " 9" * ]]; then
45674576 ExtraArr[0]+=" 9"
45684577 fi
4569- local bootargs
45704578 if [[ $ipsw_jailbreak == 1 && $device_target_vers != " 7" * ]]; then
4571- bootargs+=" cs_enforcement_disable=1 amfi_get_out_of_my_way=1 amfi=0xff"
4572- fi
4573- if [[ $ipsw_verbose == 1 ]]; then
4574- bootargs+=" -v"
4579+ bootargs+=" cs_enforcement_disable=1 amfi_get_out_of_my_way=1 amfi=0xff"
45754580 fi
45764581 ExtraArr+=(" -b" " $bootargs " )
45774582 patch_iboot " ${ExtraArr[@]} "
45784583 tar -cvf iBoot.tar iBoot
45794584 ExtraArgs+=" iBoot.tar"
45804585 elif [[ $device_type == " iPad1,1" ]]; then
45814586 # ipad 1 ramdiskH jumps to /iBEC instead
4582- if [[ $ipsw_verbose == 1 ]]; then
4583- ExtraArr+=(" -b" " -v" )
4584- fi
4587+ ExtraArr+=(" -b" " $bootargs " )
45854588 patch_iboot " ${ExtraArr[@]} "
45864589 mv iBoot iBEC
45874590 tar -cvf iBoot.tar iBEC
@@ -4848,13 +4851,13 @@ ipsw_prepare_custom() {
48484851 ;;
48494852 * )
48504853 ipsw_prepare_patchcomp LLB
4851- local ExtraArgs3=" pio-error=0"
4854+ local ExtraArgs3=" $device_bootargs_default "
4855+ if [[ $ipsw_verbose == 1 ]]; then
4856+ ExtraArgs3=" pio-error=0 -v"
4857+ fi
48524858 if [[ $device_target_vers == " 3" * ]]; then
48534859 ExtraArgs3+=" amfi=0xff cs_enforcement_disable=1"
48544860 fi
4855- if [[ $ipsw_verbose == 1 ]]; then
4856- ExtraArgs3+=" -v"
4857- fi
48584861 local path=" Firmware/all_flash/all_flash.${device_model} ap.production"
48594862 local name=" iBoot.${device_model} ap.RELEASE.img3"
48604863 patch_iboot -b " $ExtraArgs3 "
@@ -6145,18 +6148,12 @@ device_ramdisk() {
61456148 $scp -P $ssh_port $jelbrek /$untether root@127.0.0.1:/mnt1
61466149 # 3.1.3-4.1 untether needs to be extracted early (before data partition is mounted)
61476150 case $vers in
6148- 4.[10]* | 3.2 * )
6151+ 4.[10]* | 3.[21] * )
61496152 untether=" ${device_type} _${build} .tar"
61506153 log " Extracting $untether "
61516154 $ssh -p $ssh_port root@127.0.0.1 " tar -xvf /mnt1/$untether -C /mnt1; rm /mnt1/$untether "
61526155 ;;
61536156 esac
6154- # Do not extract untether for 3GS 3.1.x
6155- if [[ $vers == " 3.1" * && $device_type != " iPhone2,1" ]]; then
6156- untether=" ${device_type} _${build} .tar"
6157- log " Extracting $untether "
6158- $ssh -p $ssh_port root@127.0.0.1 " tar -xvf /mnt1/$untether -C /mnt1; rm /mnt1/$untether "
6159- fi
61606157 log " Mounting data partition"
61616158 $ssh -p $ssh_port root@127.0.0.1 " mount.sh pv"
61626159 case $vers in
@@ -7317,7 +7314,7 @@ menu_restore() {
73177314 esac
73187315 menu_items+=(" Other (powdersn0w $text2 blobs)" )
73197316 fi
7320- if (( device_proc < 5 )) ; then
7317+ if [[ $1 != " ipsw " ]] && (( device_proc < 5 )) ; then
73217318 menu_items+=(" Other (Custom IPSW)" )
73227319 fi
73237320 if [[ $device_proc != 1 ]]; then
@@ -7342,13 +7339,10 @@ menu_restore() {
73427339 print " > Main Menu > Misc Utilities > Create Custom IPSW"
73437340 else
73447341 print " > Main Menu > Restore/Downgrade"
7345- fi
7346- if [[ -z $1 ]]; then
73477342 if [[ $device_proc == 1 ]]; then
73487343 print " * Select \" Other (Custom IPSW)\" to restore to other iOS versions (2.0 to 3.1.2)"
73497344 echo
7350- fi
7351- if [[ $device_type == " iPod2,1" ]]; then
7345+ elif [[ $device_type == " iPod2,1" ]]; then
73527346 print " * Select \" Other (Custom IPSW)\" to restore to other iOS versions (2.1.1 to 3.0)"
73537347 echo
73547348 fi
@@ -9254,7 +9248,7 @@ menu_justboot() {
92549248 print " * Custom Bootargs: $device_bootargs "
92559249 else
92569250 print " * You may enter custom bootargs (optional, experimental option)"
9257- print " * Default Bootargs: -v pio-error=0"
9251+ print " * Default Bootargs: pio-error=0 -v "
92589252 fi
92599253 echo
92609254 input " Select an option:"
@@ -9296,7 +9290,7 @@ menu_justboot() {
92969290
92979291device_justboot () {
92989292 if [[ -z $device_bootargs ]]; then
9299- device_bootargs=" -v pio-error=0"
9293+ device_bootargs=" pio-error=0 -v "
93009294 fi
93019295 if [[ $main_argmode == " device_justboot" ]]; then
93029296 cat " $device_rd_build " > " ../saved/$device_type /justboot_${device_ecid} "
0 commit comments