├── .gitignore ├── GalaxySFrontend └── LowLevelUnbrick │ ├── build.xml │ ├── flowchart.odg │ ├── icon.png │ ├── manifest.mf │ ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml │ └── src │ ├── META-INF │ └── services │ │ └── org.jdesktop.application.Application │ ├── README │ └── com │ └── AdamOutler │ └── LowLevelUnBrick │ ├── FileOperations.java │ ├── LinkLauncher.java │ ├── Log.java │ ├── LowLevelUnbrickOneClickApp.java │ ├── LowLevelUnbrickOneClickView.form │ ├── LowLevelUnbrickOneClickView.java │ ├── Shell.java │ ├── Statics.java │ ├── TimeOutOptionPane.java │ ├── Unzip.java │ └── resources │ ├── LowLevelUnbrickOneClickApp.properties │ ├── LowLevelUnbrickOneClickView.properties │ ├── NewApplication.properties │ ├── UnBrickPack.zip │ ├── WindowsProblem.properties │ └── images │ ├── DebugMode.jpg │ ├── DeviceNotFound.jpg │ ├── DownloadMode.jpg │ ├── MassStorage.jpg │ ├── MediaPlayer.jpeg │ ├── S5PC110.jpg │ ├── SamsungKies.jpg │ ├── SamsungKies.png │ ├── TI.jpg │ ├── Unbrickable.png │ └── fastboot.jpg ├── HummingBirdInterceptorBootloader ├── BL1_stage1.bin ├── Captivate_SBL.bin ├── HIBL.ASM ├── HIBL.bin ├── S8500_BL3.bin ├── S8530_BL3.bin ├── functions.inc ├── infuse.inc ├── init_by_rebell.bin ├── sgs.inc └── uart_test.ASM └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /GalaxySFrontend/LowLevelUnbrick/nbproject/private/ 2 | /GalaxySFrontend/LowLevelUnbrick/build/ 3 | /GalaxySFrontend/LowLevelUnbrick/dist/ -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Builds, tests, and runs the project LowLevelUnBrick. 12 | 13 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/flowchart.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/flowchart.odg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/icon.png -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Must set src.dir 234 | Must set test.src.dir 235 | Must set build.dir 236 | Must set dist.dir 237 | Must set build.classes.dir 238 | Must set dist.javadoc.dir 239 | Must set build.test.classes.dir 240 | Must set build.test.results.dir 241 | Must set build.classes.excludes 242 | Must set dist.jar 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | Must set javac.includes 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | No tests executed. 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | Must set JVM to use for profiling in profiler.info.jvm 723 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent 724 | 725 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | Must select some files in the IDE or set javac.includes 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | To run this application from the command line without Ant, try: 1002 | 1003 | java -jar "${dist.jar.resolved}" 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | Must select one file in the IDE or set run.class 1051 | 1052 | 1053 | 1054 | Must select one file in the IDE or set run.class 1055 | 1056 | 1057 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | Must select one file in the IDE or set debug.class 1082 | 1083 | 1084 | 1085 | 1086 | Must select one file in the IDE or set debug.class 1087 | 1088 | 1089 | 1090 | 1091 | Must set fix.includes 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1103 | 1106 | 1107 | This target only works when run from inside the NetBeans IDE. 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | Must select one file in the IDE or set profile.class 1117 | This target only works when run from inside the NetBeans IDE. 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | This target only works when run from inside the NetBeans IDE. 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | This target only works when run from inside the NetBeans IDE. 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | Must select one file in the IDE or set run.class 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | Must select some files in the IDE or set test.includes 1184 | 1185 | 1186 | 1187 | 1188 | Must select one file in the IDE or set run.class 1189 | 1190 | 1191 | 1192 | 1193 | Must select one file in the IDE or set applet.url 1194 | 1195 | 1196 | 1197 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | Must select some files in the IDE or set javac.includes 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | Some tests failed; see details above. 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | Must select some files in the IDE or set test.includes 1306 | 1307 | 1308 | 1309 | Some tests failed; see details above. 1310 | 1311 | 1312 | 1313 | Must select some files in the IDE or set test.class 1314 | Must select some method in the IDE or set test.method 1315 | 1316 | 1317 | 1318 | Some tests failed; see details above. 1319 | 1320 | 1321 | 1326 | 1327 | Must select one file in the IDE or set test.class 1328 | 1329 | 1330 | 1331 | Must select one file in the IDE or set test.class 1332 | Must select some method in the IDE or set test.method 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1349 | 1350 | Must select one file in the IDE or set applet.url 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1362 | 1363 | Must select one file in the IDE or set applet.url 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=86fed732 2 | build.xml.script.CRC32=dc21daf1 3 | build.xml.stylesheet.CRC32=28e38971@1.43.1.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=23a47b73 7 | nbproject/build-impl.xml.script.CRC32=97932733 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | application.desc=Ultimate UnBrick Resurrection 6 | application.homepage=http://www.adamoutler.com 7 | application.splash=/home/adam/code/HeimdallOneClick/src/resources/splash.png 8 | application.title=Heimdall One-Click 9 | application.vendor=Adam Outler 10 | build.classes.dir=${build.dir}/classes 11 | build.classes.excludes=**/*.java,**/*.form 12 | # This directory is removed when the project is cleaned: 13 | build.dir=build 14 | build.generated.dir=${build.dir}/generated 15 | build.generated.sources.dir=${build.dir}/generated-sources 16 | # Only compile against the classpath explicitly listed here: 17 | build.sysclasspath=ignore 18 | build.test.classes.dir=${build.dir}/test/classes 19 | build.test.results.dir=${build.dir}/test/results 20 | debug.classpath=\ 21 | ${run.classpath} 22 | debug.test.classpath=\ 23 | ${run.test.classpath} 24 | # This directory is removed when the project is cleaned: 25 | dist.dir=dist 26 | dist.jar=${dist.dir}/LowLevelUnbrick.jar 27 | dist.javadoc.dir=${dist.dir}/javadoc 28 | endorsed.classpath= 29 | excludes= 30 | includes=** 31 | jar.archive.disabled=${jnlp.enabled} 32 | jar.compress=false 33 | jar.index=${jnlp.enabled} 34 | javac.classpath=\ 35 | ${libs.swing-app-framework.classpath} 36 | # Space-separated list of extra javac options 37 | javac.compilerargs= 38 | javac.deprecation=false 39 | javac.external.vm=false 40 | javac.processorpath=\ 41 | ${javac.classpath} 42 | javac.source=1.6 43 | javac.target=1.6 44 | javac.test.classpath=\ 45 | ${javac.classpath}:\ 46 | ${build.classes.dir} 47 | javadoc.additionalparam= 48 | javadoc.author=false 49 | javadoc.encoding=${source.encoding} 50 | javadoc.noindex=false 51 | javadoc.nonavbar=false 52 | javadoc.notree=false 53 | javadoc.private=false 54 | javadoc.splitindex=true 55 | javadoc.use=true 56 | javadoc.version=true 57 | javadoc.windowtitle= 58 | jnlp.codebase.type=no.codebase 59 | jnlp.descriptor=application 60 | jnlp.enabled=false 61 | jnlp.mixed.code=default 62 | jnlp.offline-allowed=false 63 | jnlp.signed=false 64 | jnlp.signing= 65 | jnlp.signing.alias= 66 | jnlp.signing.keystore= 67 | main.class=com.AdamOutler.LowLevelUnBrick.LowLevelUnbrickOneClickApp 68 | # Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. 69 | manifest.custom.application.library.allowable.codebase= 70 | # Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. 71 | manifest.custom.caller.allowable.codebase= 72 | # Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed 73 | manifest.custom.codebase= 74 | # Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) 75 | manifest.custom.permissions= 76 | manifest.file=manifest.mf 77 | meta.inf.dir=${src.dir}/META-INF 78 | mkdist.disabled=false 79 | platform.active=default_platform 80 | run.classpath=\ 81 | ${javac.classpath}:\ 82 | ${build.classes.dir} 83 | # Space-separated list of JVM arguments used when running the project 84 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 85 | # or test-sys-prop.name=value to set system properties for unit tests): 86 | run.jvmargs= 87 | run.test.classpath=\ 88 | ${javac.test.classpath}:\ 89 | ${build.test.classes.dir} 90 | source.encoding=UTF-8 91 | src.dir=src 92 | test.src.dir=test 93 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | LowLevelUnbrick 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/META-INF/services/org.jdesktop.application.Application: -------------------------------------------------------------------------------- 1 | com.AdamOutler.HeimdallOneClick.LowLevelUnbrick -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/README: -------------------------------------------------------------------------------- 1 | If you are reading this, you are doing something wrong. 2 | 3 | This is an executable file, it should not be decompressed. 4 | 5 | Please visit the following site to ensure you have the latest version of Java 6 | http://java.com/en/download/installed.jsp 7 | 8 | Then right-click and open this file as an executable. 9 | 10 | 11 | Again, if you are trying to use this program, you should not be in here. 12 | 13 | If you're trying to see what makes the program tick, then visit this site 14 | http://oneclick.adamoutler.com for source code. 15 | 16 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/FileOperations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | package com.AdamOutler.LowLevelUnBrick; 23 | 24 | import java.io.BufferedOutputStream; 25 | import java.io.BufferedWriter; 26 | import java.io.DataOutputStream; 27 | import java.io.File; 28 | import java.io.FileInputStream; 29 | import java.io.FileOutputStream; 30 | import java.io.FileWriter; 31 | import java.io.IOException; 32 | import java.io.InputStream; 33 | import java.io.InputStreamReader; 34 | import java.nio.channels.FileChannel; 35 | import java.util.logging.Level; 36 | import java.util.logging.Logger; 37 | import javax.swing.JOptionPane; 38 | 39 | 40 | /** 41 | * 42 | * @author adam 43 | */ 44 | public class FileOperations { 45 | Log Log = new Log(); 46 | Shell shellCommand = new Shell(); 47 | 48 | public FileOperations(){ 49 | } 50 | 51 | 52 | 53 | public boolean copyFromResourceToFile(String Resource, String toFile){ 54 | try { 55 | InputStream resourceAsStream = getClass().getResourceAsStream(Resource); 56 | try { 57 | if ( resourceAsStream.available() >= 1 ){ 58 | File Destination = new File(toFile); 59 | writeInputStreamToFile(resourceAsStream, Destination); 60 | if (Destination.length() >= 1){ 61 | return true; 62 | } else { 63 | 64 | Log.level0("Failed to write file"); 65 | return false; 66 | } 67 | 68 | } else { 69 | Log.level0("Critical Error copying " + Resource); 70 | } 71 | } catch ( NullPointerException e){ 72 | return false; 73 | } 74 | 75 | 76 | 77 | 78 | } catch (IOException ex) { 79 | Logger.getLogger(FileOperations.class.getName()).log(Level.SEVERE, null, ex); 80 | Log.level0("Critical Error copying "+ Resource); 81 | return false; 82 | } 83 | return false; 84 | } 85 | 86 | public void recursiveDelete(String path){ 87 | recursiveDelete(new File(path)); 88 | } 89 | 90 | public void recursiveDelete(File path){ 91 | File[] c = path.listFiles(); 92 | if (path.exists()){ 93 | Log.level2("Cleaning up folder:" + path.toString()); 94 | 95 | for (File file : c){ 96 | if (file.isDirectory()){ 97 | Log.level3("Deleting " + file.toString()); 98 | recursiveDelete(file); 99 | file.delete(); 100 | } else { 101 | file.delete(); 102 | } 103 | } 104 | path.delete(); 105 | } 106 | } 107 | 108 | 109 | public boolean verifyPermissionsRecursive(String path){ 110 | File Check = new File(path); 111 | File[] c = Check.listFiles(); 112 | if (Check.exists()){ 113 | Log.level2("Verifying permissions in folder:" + path.toString()); 114 | for (File file : c){ 115 | if (!file.canWrite()){ 116 | return false; 117 | } 118 | } 119 | } 120 | return true; 121 | } 122 | public String findRecursive(String PathToSearch,String FileName){ 123 | File Check = new File(PathToSearch); 124 | File[] c = Check.listFiles(); 125 | if (Check.exists()){ 126 | Log.level2("Searching for file in folder:" + PathToSearch.toString()); 127 | for (File file : c){ 128 | String x = file.getName(); 129 | if (file.isDirectory()){ 130 | Log.level3("Searching " + file.toString()); 131 | File[] subdir = file.listFiles(); 132 | for (File sub : subdir){ 133 | if (sub.isDirectory()) { 134 | String FoundFile = findRecursive(sub.toString(),FileName); 135 | if (FoundFile.toString().endsWith("heimdall.exe")){ 136 | return FoundFile; 137 | } 138 | } else { 139 | if (sub.toString().equals(FileName)) return sub.toString(); 140 | } 141 | } 142 | } else if (file.getName().equals("heimdall.exe")){ 143 | return file.getAbsoluteFile().toString(); 144 | } 145 | } 146 | } 147 | return null; 148 | } 149 | 150 | 151 | 152 | 153 | 154 | public boolean makeFolder(String Folder){ 155 | Boolean CreatedFolder = false; 156 | File folder= new File(Folder); 157 | 158 | if (folder.exists()){ 159 | return false; 160 | } else{ 161 | CreatedFolder=folder.mkdir(); 162 | } 163 | if ( CreatedFolder ){ 164 | Log.level2("System temp folder created sucessfully in: "+Folder); 165 | }else{ 166 | 167 | CreatedFolder=false; 168 | Log.level0("Could not create temp folder in " + Folder); 169 | } 170 | 171 | return CreatedFolder; 172 | } 173 | 174 | 175 | private boolean writeInputStreamToFile(InputStream is, File file) { 176 | Log.level3("Attempting to write "+file.getPath()); 177 | try { 178 | DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); 179 | int c; 180 | if (is.available() > 0 ){ 181 | while((c = is.read()) != -1) { 182 | out.writeByte(c); 183 | } 184 | } else { 185 | Log.level0("ERROR: FILE READ WAS 0 LENGTH"); 186 | return false; 187 | } 188 | is.close(); 189 | out.close(); 190 | 191 | } catch(IOException e) { 192 | System.err.print(e); 193 | System.err.println("Error Writing/Reading Streams."); 194 | return false; 195 | } 196 | if ((file.exists()) && (file.length() >= 4)){ 197 | return true; 198 | } else { 199 | return false; 200 | } 201 | 202 | } 203 | 204 | 205 | 206 | 207 | 208 | 209 | public Boolean deleteFile(String FileName){ 210 | Boolean Deleted=true; 211 | File file = new File(FileName); 212 | if (file.exists()){ 213 | Deleted=false; 214 | if (file.delete()){ 215 | Deleted=true; 216 | Log.level3("Deleted "+ FileName); 217 | } else { 218 | Deleted=false; 219 | Log.level0("ERROR DELETING FILE:" + FileName); 220 | JOptionPane.showMessageDialog(null, "Could not delete "+FileName+ 221 | ". Delete this folder manually", 222 | "file error", JOptionPane.ERROR_MESSAGE); 223 | 224 | } 225 | } else { 226 | Deleted=true; 227 | } 228 | return Deleted; 229 | } 230 | 231 | public void copyFile(File sourceFile, File destFile) throws IOException { 232 | 233 | Log.level3("Copying " + sourceFile.getPath() + " to " + destFile.getPath()); 234 | if(!destFile.exists()) { 235 | destFile.createNewFile(); 236 | } 237 | FileChannel source = null; 238 | FileChannel destination = null; 239 | try { 240 | source = new FileInputStream(sourceFile).getChannel(); 241 | destination = new FileOutputStream(destFile).getChannel(); 242 | destination.transferFrom(source, 0, source.size()); 243 | } finally { 244 | if(source != null) { 245 | source.close(); 246 | } 247 | } 248 | if(destination != null) { 249 | destination.close(); 250 | 251 | } 252 | 253 | 254 | } 255 | 256 | public String currentDir() { 257 | String CurrentDir=new File(".").getAbsolutePath(); 258 | Log.level3("Detected current folder: "+ CurrentDir); 259 | if (CurrentDir.endsWith(".")){ 260 | CurrentDir=CurrentDir.substring(0,CurrentDir.length()-1); 261 | } 262 | return CurrentDir; 263 | } 264 | public boolean copyFile(String FromFile, String ToFile){ 265 | File OriginalFile = new File(FromFile); 266 | File DestinationFile = new File(ToFile); 267 | try { 268 | copyFile(OriginalFile, DestinationFile); 269 | return true; 270 | } catch (IOException ex) { 271 | return false; 272 | } 273 | 274 | } 275 | 276 | public boolean verifyFileExists(String Folder){ 277 | File FileFolder = new File(Folder); 278 | boolean Result=(FileFolder.length()>=1); 279 | Log.level3("Verifying "+Folder+" . Result="+Result); 280 | Log.level3("Result=" +Result); 281 | return (Result); 282 | } 283 | 284 | public boolean setExecutableBit(String Executable){ 285 | File Exe = new File(Executable); 286 | boolean Result = Exe.setExecutable(true); 287 | Log.level3("Setting executable "+Exe+". Result="+Result); 288 | return Result; 289 | } 290 | 291 | 292 | 293 | public boolean verifyResource(String Res){ 294 | boolean Result; 295 | //this.statusAnimationLabel.setText(Res); 296 | Log.progress("Uncompressing "+Res+".... "); 297 | deleteFile(Res); 298 | Result=copyFromResourceToFile(setRes(Res), setDest(Res)); 299 | //Log.level3("Unpacking " + setDest(Res) + " Performed correctly: " + Result ); 300 | if (Result){ 301 | Log.progress("Uncompressed\n"); 302 | } else { 303 | Log.progress("FAILED!!!!\n"); 304 | } 305 | return Result; 306 | } 307 | private String setDest(String FileName){ 308 | return Statics.TempFolder + FileName; 309 | } 310 | 311 | 312 | 313 | 314 | 315 | private String setRes(String FileName ){ 316 | return Statics.ROMPackageResourceFolder + FileName; 317 | } 318 | 319 | public String readTextFromResource(String Resource){ 320 | FileInputStream fis = null; 321 | InputStreamReader in = null; 322 | String TextFile=""; 323 | InputStream resourceAsStream = getClass().getResourceAsStream(Resource); 324 | StringBuilder text = new StringBuilder(); 325 | try { 326 | in = new InputStreamReader(resourceAsStream, "UTF-8"); 327 | int read; 328 | while ((read = in.read())!= -1 ){ 329 | char C = Character.valueOf((char)read); 330 | text.append(C); 331 | } 332 | 333 | } catch (IOException ex) { 334 | Logger.getLogger(FileOperations.class.getName()).log(Level.SEVERE, null, ex); 335 | } 336 | Log.level2(text.toString()); 337 | return text.toString(); 338 | } 339 | 340 | 341 | 342 | 343 | public void writeToFile(String Text, String File) throws IOException{ 344 | 345 | BufferedWriter bw; 346 | bw = new BufferedWriter(new FileWriter(File,true)); 347 | bw.write(Text); 348 | bw.close(); 349 | 350 | } 351 | } 352 | 353 | 354 | 355 | 356 | 357 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/LinkLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.AdamOutler.LowLevelUnBrick; 6 | 7 | import java.awt.Desktop; 8 | import java.io.IOException; 9 | import java.net.URI; 10 | import java.net.URISyntaxException; 11 | 12 | /** 13 | * 14 | * @author adam 15 | */ 16 | public class LinkLauncher implements Runnable { 17 | static String Link; 18 | public void launchLink(String link){ 19 | Link = link; 20 | Runnable runnable = new LinkLauncher(); 21 | Thread thread = new Thread(runnable); 22 | thread.start(); 23 | } 24 | public void run() { 25 | 26 | Shell Shell = new Shell(); 27 | String Cmd[]={"firefox", Link}; 28 | String LaunchRes=Shell.sendShellCommand(Cmd); 29 | if (LaunchRes.contains("CritERROR!!!")){ 30 | String MCmd[]={"open" , Link}; 31 | String MLaunchRes=Shell.sendShellCommand(MCmd); 32 | if (MLaunchRes.contains("CritERROR!!!")){ 33 | String WCmd[]={"explorer", Link}; 34 | String WLaunchRes=Shell.sendShellCommand(WCmd); 35 | if (WLaunchRes.contains("CritERROR!!!")){ 36 | if (Desktop.isDesktopSupported()) { 37 | Desktop desktop; 38 | desktop = Desktop.getDesktop(); 39 | URI uri = null; 40 | try { 41 | uri = new URI(Link); 42 | desktop.browse(uri); 43 | } catch (IOException ioe) { 44 | } catch (URISyntaxException use) { 45 | } 46 | } 47 | } 48 | } 49 | } 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | package com.AdamOutler.LowLevelUnBrick; 22 | 23 | import java.io.FileWriter; 24 | import java.io.IOException; 25 | import java.io.PrintWriter; 26 | import javax.swing.text.BadLocationException; 27 | 28 | /** 29 | * 30 | * @author adam 31 | * Logging levels: 32 | * Logging levels are set in Statics 33 | * 34 | * Level0: silent, keep this for future critical tasks 35 | * Level1: Information for user to see 36 | * Level2: Information for developers to see 37 | * Level3: verbose information, use for conversions and random tasks 38 | * 39 | */ 40 | 41 | public class Log{ 42 | 43 | 44 | 45 | public Log(){ 46 | } 47 | 48 | private void consoleOut(String data) { 49 | System.out.println(data); 50 | if (!"".equals(data)){ 51 | if (! "\n".equals(data)){ 52 | try{ 53 | Statics.ProgressArea.append("\n"+data); 54 | Statics.ProgressArea.setCaretPosition( 55 | Statics.ProgressArea.getDocument() 56 | .getLength()); 57 | }catch (NullPointerException e){ 58 | Statics.PreStatus=Statics.PreStatus+data; 59 | } 60 | 61 | } 62 | } 63 | } 64 | 65 | 66 | // level 0 is used for errors.. basically silent. Use level 1 for 67 | // for most tasks 68 | public void level0(String data) { 69 | if (Statics.ConsoleLevel >= 0) { 70 | consoleOut(data); 71 | 72 | } 73 | if (Statics.LogLevel >= 0) { 74 | debugOut(data); 75 | 76 | } 77 | } 78 | 79 | // level 1 is for user data 80 | public void level1(String data) { 81 | if (Statics.ConsoleLevel >= 1) { 82 | consoleOut(data); 83 | } 84 | if (Statics.LogLevel >= 1) { 85 | debugOut(data); 86 | 87 | } 88 | 89 | } 90 | 91 | // level 2 is for debugging data 92 | public void level2(String data) { 93 | if (Statics.ConsoleLevel >= 2) { 94 | consoleOut(data); 95 | } 96 | if (Statics.LogLevel >= 2) { 97 | debugOut(data); 98 | 99 | } 100 | } 101 | 102 | // level 3 is conversions and other random test data 103 | public void level3(String data) { 104 | if (Statics.ConsoleLevel >= 3) { 105 | consoleOut(data); 106 | } 107 | if (Statics.LogLevel >= 3) { 108 | debugOut(data); 109 | 110 | } 111 | } 112 | 113 | 114 | public void copyError(String Filename) { 115 | //standard unexpected token failure 116 | this.level0("File Copy Error: " + Filename); 117 | } 118 | 119 | public void genericError(String Message) { 120 | this.level0("Error: " + Message); 121 | } 122 | public void writeToLogFile(String data){ 123 | debugOut(data); 124 | } 125 | private void debugOut(String data) { 126 | 127 | FileWriter WriteFile = null; 128 | try { 129 | WriteFile = new FileWriter(Statics.TempFolder+"log.txt", true); 130 | } catch (IOException ex) { 131 | } 132 | PrintWriter out = new PrintWriter(WriteFile); 133 | Statics.OutFile=out; 134 | if (Statics.OutFile != null){Statics.LogCreated=true;} 135 | out.print(data); 136 | out.close(); 137 | 138 | } 139 | 140 | public void progress(String data) { 141 | try { 142 | Statics.ProgressArea.append(data); 143 | Statics.ProgressArea.setCaretPosition(Statics.ProgressArea.getDocument().getLength()); 144 | } catch (NullPointerException e){ 145 | System.out.print(data); 146 | } 147 | 148 | } 149 | public void LiveUpdate(String data){ 150 | System.out.println(data); 151 | Statics.ProgressArea.append(data); 152 | Statics.ProgressArea.setCaretPosition(Statics.ProgressArea.getDocument().getLength()); 153 | 154 | } 155 | public void beginLine(){ 156 | try { 157 | int start=Statics.ProgressArea.getLineStartOffset 158 | (Statics.ProgressArea.getLineCount()-1); 159 | int end = Statics.ProgressArea.getText().length(); 160 | 161 | Statics.ProgressArea.replaceRange("", start, end); 162 | 163 | int x=1; 164 | System.out.print(x); 165 | } 166 | catch (BadLocationException ex) { 167 | } 168 | } 169 | 170 | } 171 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/LowLevelUnbrickOneClickApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | package com.AdamOutler.LowLevelUnBrick; 23 | 24 | import java.io.IOException; 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | import java.util.zip.ZipException; 28 | import org.jdesktop.application.Application; 29 | import org.jdesktop.application.SingleFrameApplication; 30 | 31 | /** 32 | * The main class of the application. 33 | */ 34 | public class LowLevelUnbrickOneClickApp extends SingleFrameApplication { 35 | 36 | /** 37 | * At startup create and show the main frame of the application. 38 | */ 39 | @Override protected void startup() { 40 | if ((getClass().getResource(Statics.ROMPackageTGZ))==null){ 41 | show(new LowLevelUnbrickOneClickView(this,false)); 42 | } else{ 43 | show(new LowLevelUnbrickOneClickView(this,true)); 44 | } 45 | } 46 | 47 | /** 48 | * This method is to initialize the specified window by injecting resources. 49 | * Windows shown in our application come fully initialized from the GUI 50 | * builder, so this additional configuration is not needed. 51 | */ 52 | @Override protected void configureWindow(java.awt.Window root) { 53 | } 54 | 55 | /** 56 | * A convenient static getter for the application instance. 57 | * @return the instance of LowLevelUnBrick 58 | */ 59 | public static LowLevelUnbrickOneClickApp getApplication() { 60 | return Application.getInstance(LowLevelUnbrickOneClickApp.class); 61 | } 62 | 63 | /** 64 | * Main method launching the application. 65 | */ 66 | public static void main(String[] args) { 67 | 68 | //delete the temp folder before starting. 69 | FileOperations FileOperations=new FileOperations(); 70 | Log Log = new Log(); 71 | FileOperations.makeFolder(Statics.TempFolder); 72 | Log.level1("\nUncompressing HIBL Payload to " + Statics.TempFolder +"/n"); 73 | FileOperations.copyFromResourceToFile("/com/AdamOutler/LowLevelUnBrick/resources/UnBrickPack.zip", Statics.TempFolder+"UnBrickPack.zip"); 74 | Unzip Unzip=new Unzip(); 75 | try { 76 | Unzip.unzip(Statics.TempFolder+"UnBrickPack.zip"); 77 | } catch (ZipException ex) { 78 | Logger.getLogger(LowLevelUnbrickOneClickView.class.getName()).log(Level.SEVERE, null, ex); 79 | Log.level0("ERROR, INVALID ZIP FILE IN PACKAGE"); 80 | } catch (IOException ex) { 81 | Logger.getLogger(LowLevelUnbrickOneClickView.class.getName()).log(Level.SEVERE, null, ex); 82 | Log.level0("ERROR, OUT OF SPACE OR NO ACCESS TO TEMP FOLDER"); 83 | } 84 | launch(LowLevelUnbrickOneClickApp.class, args); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/LowLevelUnbrickOneClickView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 |
248 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/LowLevelUnbrickOneClickView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | package com.AdamOutler.LowLevelUnBrick; 22 | 23 | import java.awt.Dimension; 24 | import java.io.IOException; 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | import java.util.ArrayList; 28 | 29 | import java.awt.event.ActionEvent; 30 | import java.awt.event.ActionListener; 31 | import javax.swing.Timer; 32 | import javax.swing.ImageIcon; 33 | import org.jdesktop.application.FrameView; 34 | import org.jdesktop.application.SingleFrameApplication; 35 | 36 | /** 37 | * The application's main frame. 38 | */ 39 | public class LowLevelUnbrickOneClickView extends FrameView { 40 | 41 | private static Shell ShellCommand = new Shell(); 42 | FileOperations fileOperations = new FileOperations(); 43 | /** 44 | * 250ms 45 | */ 46 | private final int QUARTER_SECOND = 250; //ms 47 | /** 48 | * 1000ms 49 | */ 50 | public final static int ONE_SECOND = 1000; 51 | private static boolean ButtonStatusChangedRequested = true; //used by timer on form oneclickview 52 | private static boolean LabelStatusChangedRequested = true; // used by timer on form oneclickview 53 | Log Log = new Log(); 54 | final public static String DebugMode = "resources/images/DebugMode.jpg"; 55 | final public static String S5PC110 = "resources/images/S5PC110.jpg"; 56 | final public static String Fastboot = "resources/images/fastboot.jpg"; 57 | final public static String DeviceNotFound = "resources/images/Unbrickable.png"; 58 | final public static String DownloadMode = "resources/images/DownloadMode.jpg"; 59 | final public static String MassStorage = "resources/images/MassStorage.jpg"; 60 | final public static String MediaPlayer = "resources/images/MediaPlayer.jpeg"; 61 | final public static String SamsungKies = "resources/images/SamsungKies.jpg"; 62 | final public static String TexasInstruments = "resources/images/TI.jpg"; 63 | Timer monitoringTimer = new Timer(QUARTER_SECOND, new ActionListener() { 64 | 65 | public void actionPerformed(ActionEvent evt) { 66 | 67 | String Result = ShellCommand.silentShellCommand(new String[]{"lsusb"}); 68 | if (Result.contains("04e8:1234")) { 69 | jLabel2.setText("S5PC110 detected"); 70 | jLabel3.setText("Begin Resurrection- Press the Download Mode Button"); 71 | jLabel1.setIcon(createImageIcon(S5PC110, "S5PC110 Mode")); 72 | } else { 73 | if (Result.contains("04e8:6601")) { 74 | jLabel1.setIcon(createImageIcon(DownloadMode, "Download Mode.")); 75 | jLabel2.setText("Download Mode"); 76 | jLabel3.setText("Start Firmware Download with Heimdall or Odin"); 77 | } else if (Result.contains("04e8:6877")) { 78 | jLabel1.setIcon(createImageIcon(SamsungKies, "Samsung Kies.")); 79 | jLabel2.setText("Samsung Kies"); 80 | jLabel3.setText("Kies Mode detected"); 81 | } else if (Result.contains("04e8:68a9")) { 82 | jLabel1.setIcon(createImageIcon(MediaPlayer, "Media Player.")); 83 | jLabel2.setText("Media Player"); 84 | jLabel3.setText("Samsung Media Player"); 85 | } else if (Result.contains("04e8:681d")) { 86 | jLabel1.setIcon(createImageIcon(MassStorage, "Mass Storage.")); 87 | jLabel3.setText("Mass storage device"); 88 | jLabel2.setText("Mass Storage"); 89 | } else if (Result.contains("04e8:681c")) { 90 | jLabel1.setIcon(createImageIcon(DebugMode, "Debug Mode.")); 91 | jLabel3.setText("Android Debug Bridge"); 92 | jLabel2.setText("Debug Mode Detected"); 93 | } else if (Result.contains("04e8:685e")) { 94 | jLabel1.setIcon(createImageIcon(DebugMode, "Debug Mode.")); 95 | jLabel3.setText("Android Debug Bridge"); 96 | jLabel2.setText("Debug Mode Detected"); 97 | } else if (Result.contains("04e8:684e")) { 98 | jLabel1.setIcon(createImageIcon(DeviceNotFound, "Samsung GMO Modem")); 99 | jLabel3.setText("Samsung GMO Modem"); 100 | jLabel2.setText("Debug Mode"); 101 | } else if (Result.contains("18d1:4e20")) { 102 | jLabel1.setIcon(createImageIcon(Fastboot, "Fastboot")); 103 | jLabel3.setText("Fastboot"); 104 | jLabel2.setText("Fastboot mode"); 105 | } else if (Result.contains("0451:d00e")) { 106 | jLabel1.setIcon(createImageIcon(TexasInstruments, "Texas Instruments")); 107 | jLabel3.setText("TI USB"); 108 | jLabel2.setText("Unnown 0451:d010 TI debug mode"); 109 | } else if (Result.contains("0451:d010")) { 110 | jLabel1.setIcon(createImageIcon(TexasInstruments, "Texas Instruments")); 111 | jLabel3.setText("TI USB"); 112 | jLabel2.setText("Unnown 0451:d00e TI debug mode"); 113 | } else if (Result.contains("0955:7820")) { 114 | jLabel1.setIcon(createImageIcon(DeviceNotFound, "The device is connected.")); 115 | jLabel3.setText("NVidia"); 116 | jLabel2.setText("Unnown 0955:7820 NVFlash Mode"); 117 | } else { 118 | jLabel1.setIcon(createImageIcon(DeviceNotFound, "The device is connected.")); 119 | jLabel3.setText("No device detected"); 120 | jLabel2.setText("Device not found"); 121 | } 122 | } 123 | 124 | monitoringTimer.start(); 125 | } 126 | }); 127 | 128 | public LowLevelUnbrickOneClickView(SingleFrameApplication app, boolean UseTGZFormat) { 129 | super(app); 130 | Statics.UseTGZFormat = UseTGZFormat; 131 | initComponents(); 132 | Dimension MinSize = new Dimension(635, 600); 133 | Dimension RecSize = new Dimension(635, 600); 134 | this.getFrame().setMinimumSize(MinSize); 135 | this.getFrame().setSize(RecSize); 136 | this.getFrame().setTitle("UnBrickable Resurrector - Revision41"); 137 | Statics Statics = new Statics(); 138 | if (Statics.isLinux()) { 139 | monitoringTimer.start(); 140 | } else { 141 | TimeOutOptionPane timeOutOptionPane = new TimeOutOptionPane(); 142 | int DResult = timeOutOptionPane.showTimeoutDialog( 143 | 10, //timeout 144 | null, //parentComponent 145 | "This app will only work under Linux. This app has not been designed\n" 146 | + "to work with any other OS.", 147 | "Linux Not Detected", //DisplayTitle 148 | TimeOutOptionPane.OK_OPTION, // Options buttons 149 | TimeOutOptionPane.INFORMATION_MESSAGE, //Icon 150 | new String[]{"OK"}, // option buttons 151 | "OK"); //Default{ 152 | } 153 | for (int i = 0; i < ResurrectorsDB.length; i++) { 154 | this.jComboBox1.addItem(ResurrectorsDB[i][0]); 155 | } 156 | 157 | 158 | } 159 | 160 | /** 161 | * 162 | */ 163 | 164 | 165 | @SuppressWarnings("unchecked") 166 | // //GEN-BEGIN:initComponents 167 | private void initComponents() { 168 | 169 | mainPanel = new javax.swing.JPanel(); 170 | Statics.HeimdallOneClickView=this; 171 | jScrollPane2 = new javax.swing.JScrollPane(); 172 | jTextArea2 = new javax.swing.JTextArea(); 173 | ConnectedLabel = new javax.swing.JLabel(); 174 | jLabel1 = new javax.swing.JLabel(); 175 | jLabel2 = new javax.swing.JLabel(); 176 | jLabel3 = new javax.swing.JLabel(); 177 | jPanel1 = new javax.swing.JPanel(); 178 | jComboBox1 = new javax.swing.JComboBox(); 179 | jButton2 = new javax.swing.JButton(); 180 | jButton1 = new javax.swing.JButton(); 181 | 182 | mainPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); 183 | mainPanel.setMinimumSize(new java.awt.Dimension(600, 450)); 184 | mainPanel.setName("mainPanel"); // NOI18N 185 | mainPanel.setOpaque(false); 186 | mainPanel.setPreferredSize(new java.awt.Dimension(635, 520)); 187 | mainPanel.setRequestFocusEnabled(false); 188 | mainPanel.setVerifyInputWhenFocusTarget(false); 189 | Statics.HeimdallOneClickView=this; 190 | 191 | jScrollPane2.setBorder(null); 192 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.AdamOutler.LowLevelUnBrick.LowLevelUnbrickOneClickApp.class).getContext().getResourceMap(LowLevelUnbrickOneClickView.class); 193 | jScrollPane2.setViewportBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("jScrollPane2.viewportBorder.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jScrollPane2.viewportBorder.titleFont"))); // NOI18N 194 | jScrollPane2.setName("jScrollPane2"); // NOI18N 195 | 196 | jTextArea2.setBackground(resourceMap.getColor("jTextArea2.background")); // NOI18N 197 | jTextArea2.setColumns(20); 198 | jTextArea2.setFont(resourceMap.getFont("jTextArea2.font")); // NOI18N 199 | jTextArea2.setRows(5); 200 | jTextArea2.setText(resourceMap.getString("jTextArea2.text")); // NOI18N 201 | jTextArea2.setBorder(null); 202 | jTextArea2.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); 203 | jTextArea2.setName("jTextArea2"); // NOI18N 204 | Statics.ProgressArea=this.jTextArea2; 205 | jScrollPane2.setViewportView(jTextArea2); 206 | 207 | ConnectedLabel.setLabelFor(ConnectedLabel); 208 | ConnectedLabel.setName("ConnectedLabel"); // NOI18N 209 | 210 | jLabel1.setIcon(resourceMap.getIcon("jLabel1.icon")); // NOI18N 211 | jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N 212 | jLabel1.setName("jLabel1"); // NOI18N 213 | 214 | jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N 215 | jLabel2.setName("jLabel2"); // NOI18N 216 | 217 | jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N 218 | jLabel3.setName("jLabel3"); // NOI18N 219 | 220 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("jPanel1.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel1.border.titleFont"))); // NOI18N 221 | jPanel1.setFont(resourceMap.getFont("jPanel1.font")); // NOI18N 222 | jPanel1.setName("jPanel1"); // NOI18N 223 | 224 | jComboBox1.setName("jComboBox1"); // NOI18N 225 | jComboBox1.addActionListener(new java.awt.event.ActionListener() { 226 | public void actionPerformed(java.awt.event.ActionEvent evt) { 227 | jComboBox1ActionPerformed(evt); 228 | } 229 | }); 230 | 231 | jButton2.setText(resourceMap.getString("Flash.text")); // NOI18N 232 | jButton2.setToolTipText(resourceMap.getString("Flash.toolTipText")); // NOI18N 233 | jButton2.setFocusPainted(false); 234 | jButton2.setName("Flash"); // NOI18N 235 | jButton2.setRequestFocusEnabled(false); 236 | jButton2.addActionListener(new java.awt.event.ActionListener() { 237 | public void actionPerformed(java.awt.event.ActionEvent evt) { 238 | jButton2ActionPerformed(evt); 239 | } 240 | }); 241 | 242 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N 243 | jButton1.setName("jButton1"); // NOI18N 244 | jButton1.addActionListener(new java.awt.event.ActionListener() { 245 | public void actionPerformed(java.awt.event.ActionEvent evt) { 246 | jButton1ActionPerformed(evt); 247 | } 248 | }); 249 | 250 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 251 | jPanel1.setLayout(jPanel1Layout); 252 | jPanel1Layout.setHorizontalGroup( 253 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 254 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 255 | .addComponent(jComboBox1, 0, 198, Short.MAX_VALUE) 256 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 257 | .addComponent(jButton2) 258 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 259 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) 260 | .addContainerGap()) 261 | ); 262 | jPanel1Layout.setVerticalGroup( 263 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 264 | .addGroup(jPanel1Layout.createSequentialGroup() 265 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 266 | .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 267 | .addComponent(jButton1) 268 | .addComponent(jButton2)) 269 | .addContainerGap(2, Short.MAX_VALUE)) 270 | ); 271 | 272 | javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); 273 | mainPanel.setLayout(mainPanelLayout); 274 | mainPanelLayout.setHorizontalGroup( 275 | mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 276 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() 277 | .addContainerGap() 278 | .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 279 | .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 579, javax.swing.GroupLayout.PREFERRED_SIZE) 280 | .addGroup(mainPanelLayout.createSequentialGroup() 281 | .addGap(6, 6, 6) 282 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE) 283 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 284 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 416, javax.swing.GroupLayout.PREFERRED_SIZE)) 285 | .addGroup(mainPanelLayout.createSequentialGroup() 286 | .addComponent(ConnectedLabel) 287 | .addGap(5, 5, 5) 288 | .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 289 | .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 596, Short.MAX_VALUE) 290 | .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) 291 | .addGap(17, 17, 17)) 292 | ); 293 | mainPanelLayout.setVerticalGroup( 294 | mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 295 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() 296 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE) 297 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 298 | .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 299 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) 300 | .addComponent(jLabel2)) 301 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 302 | .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 303 | .addGroup(mainPanelLayout.createSequentialGroup() 304 | .addComponent(ConnectedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) 305 | .addGap(56, 56, 56)) 306 | .addGroup(mainPanelLayout.createSequentialGroup() 307 | .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE) 308 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 309 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) 310 | .addContainerGap()))) 311 | ); 312 | 313 | setComponent(mainPanel); 314 | }// //GEN-END:initComponents 315 | 316 | private void writeScript() { 317 | FileOperations FileOperations = new FileOperations(); 318 | 319 | 320 | if (Statics.isLinux()) { 321 | if (Interface.equals("SMDK")){ 322 | Shell Shell = new Shell(); 323 | String[] arch = {"arch"}; 324 | String ArchReturn = Shell.sendShellCommand(arch); 325 | String SMDK = ""; 326 | if (ArchReturn.contains("64")) { 327 | Log.level3("64Bit detected"); 328 | SMDK = Statics.TempFolder + "UnBrickPack" + Statics.Slash + "smdk-usbdl64"; 329 | } else { 330 | Log.level3("32Bit detected"); 331 | SMDK = Statics.TempFolder + "UnBrickPack" + Statics.Slash + "smdk-usbdl"; 332 | } 333 | 334 | if (FileOperations.verifyFileExists(SMDK)) { 335 | Log.level3("Verified Binary:" + SMDK); 336 | } else { 337 | if (FileOperations.verifyFileExists(SMDK)) { 338 | Log.level3("Error: Could not find " + SMDK); 339 | } 340 | } 341 | if (FileOperations.setExecutableBit(SMDK)) { 342 | Log.level3("Set Executable Bit " + SMDK); 343 | } else { 344 | Log.level3("Error: Could not Set Executable Bit " + SMDK); 345 | } 346 | 347 | if (FileOperations.verifyFileExists(Statics.TempFolder + "Script.sh")) { 348 | Log.level1("Clearing Previous Instance"); 349 | FileOperations.deleteFile(Statics.TempFolder + "Script.sh"); 350 | } 351 | 352 | Log.level1("Building command list"); 353 | String Command = SMDK + " -f " + Statics.TempFolder + "UnBrickPack" 354 | + Statics.Slash + InitialBootloader+" -a "+InitialMemoryLocation+";\n test $? && echo \\\\n Interceptor Injection Complete. Injecting modified SBL\\\\n\\\\n||echo Interceptor Injection Failure!!!\\\\n\\\\n;\n sleep 3;\n" 355 | + SMDK + " -f " + Statics.TempFolder + "UnBrickPack" 356 | + Statics.Slash + SecondaryBootloader+" -a " +SecondaryMemoryLocation+";\n" 357 | + "test $? = 0 && echo \"Modified SBL Injection Completed Download Mode Activated\"|| echo \"SBL Injection Failure\""; 358 | 359 | try { 360 | FileOperations.writeToFile(Command, Statics.TempFolder + "Script.sh"); 361 | } catch (IOException ex) { 362 | Logger.getLogger(LowLevelUnbrickOneClickView.class.getName()).log(Level.SEVERE, null, ex); 363 | Log.level0("ERROR WRITING TO TEMP FOLDER"); 364 | } 365 | 366 | Statics.LiveSendCommand = new ArrayList(); 367 | Statics.LiveSendCommand.add("gksudo"); 368 | Statics.LiveSendCommand.add("-D"); 369 | Statics.LiveSendCommand.add("UnBrickable Resurrector"); 370 | Statics.LiveSendCommand.add(Statics.TempFolder + "Script.sh"); 371 | FileOperations.setExecutableBit(Statics.TempFolder + "Script.sh"); 372 | } 373 | } else { 374 | TimeOutOptionPane timeOutOptionPane = new TimeOutOptionPane(); 375 | timeOutOptionPane.showTimeoutDialog( 376 | 5, //timeout 377 | null, //parentComponent 378 | "This app will only work under Linux. This app has not been designed\n" 379 | + "to work with any other OS.", 380 | "Linux Not Detected", //DisplayTitle 381 | TimeOutOptionPane.OK_OPTION, // Options buttons 382 | TimeOutOptionPane.INFORMATION_MESSAGE, //Icon 383 | new String[]{"OK"}, // option buttons 384 | "OK"); //Default{ 385 | } 386 | } 387 | 388 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed 389 | Shell Shell = new Shell(); 390 | Log.level1("\n\n Begin Resurrection Sequence\n"); 391 | Log.level1("Requesting Permission to access device"); 392 | Log.level0("\n Please wait.... Uploading.."); 393 | Log.level0("-------------------------------------------------------------\n Hummingbird Interceptor Boot Loader (HIBL) v2.1\n Copyright (C) Rebellos 2011\n-------------------------------------------------------------\n"); 394 | 395 | Shell.liveShellCommand(); 396 | 397 | 398 | 399 | // 402244000 400 | 401 | //Log.level1(Command.toString()); 402 | 403 | 404 | 405 | }//GEN-LAST:event_jButton2ActionPerformed 406 | 407 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 408 | LinkLauncher LinkLauncher = new LinkLauncher(); 409 | LinkLauncher.launchLink("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YYAWENUMGYWU2"); 410 | }//GEN-LAST:event_jButton1ActionPerformed 411 | 412 | private String GalaxyInstructions = "1. Apply UnBrickable Mod\n" 413 | + "2. Remove then insert Device battery\n" 414 | + "3. Connect to computer via USB.\n" 415 | + "4. Click the Download Mode button\n" 416 | + "5. Download new software with Heimdall.\n "; 417 | private String NexusSInstructions = "1. Apply UnBrickable Mod\n" 418 | + "2. Remove then insert Device battery\n" 419 | + "3. Connect to computer via USB.\n" 420 | + "4. Click the Download Mode button\n" 421 | + "5. Download new software with fastboot for Linux.\n "; 422 | private String[][] ResurrectorsDB = { 423 | //Name Friendly Tool initial init mem secondary secondary mem 424 | {"S5PC110 (Galaxy S)", "SMDK", "HIBL.bin", "D0020000", "Sbl.bin", "40244000", GalaxyInstructions}, 425 | {"S5PC110 (Nexus S)", "SMDK", "HIBL.bin", "D0020000", "nexus_sbl.bin", "33040000", NexusSInstructions}, 426 | {"S5PC111 (Galaxy Player)", "SMDK", "HIBL.bin", "D0020000", "GPSbl.bin", "40244000", GalaxyInstructions} 427 | 428 | }; 429 | private String DeviceName=""; 430 | private String Interface=""; 431 | private String InitialBootloader=""; 432 | private String InitialMemoryLocation=""; 433 | private String SecondaryBootloader=""; 434 | private String SecondaryMemoryLocation=""; 435 | private String Instructions=""; 436 | 437 | private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed 438 | DeviceName=ResurrectorsDB[jComboBox1.getSelectedIndex()][0]; 439 | Interface=ResurrectorsDB[jComboBox1.getSelectedIndex()][1]; 440 | InitialBootloader=ResurrectorsDB[jComboBox1.getSelectedIndex()][2]; 441 | InitialMemoryLocation=ResurrectorsDB[jComboBox1.getSelectedIndex()][3]; 442 | SecondaryBootloader=ResurrectorsDB[jComboBox1.getSelectedIndex()][4]; 443 | SecondaryMemoryLocation=ResurrectorsDB[jComboBox1.getSelectedIndex()][5]; 444 | Instructions=ResurrectorsDB[jComboBox1.getSelectedIndex()][6]; 445 | this.writeScript(); 446 | Log.level1("#"+DeviceName+"\n#RESURRECTOR SELECTED:"+InitialBootloader+ " LOCATION:0x"+ InitialMemoryLocation+"\n#SBL: "+SecondaryBootloader+ " LOCATION:0x"+ SecondaryMemoryLocation+" tool:"+Interface +"\n"+Instructions); 447 | 448 | }//GEN-LAST:event_jComboBox1ActionPerformed 449 | 450 | public void enableButtons(boolean State) { 451 | } 452 | 453 | private static void launchLink(String Link) { 454 | LinkLauncher LinkLauncher = new LinkLauncher(); 455 | LinkLauncher.launchLink(Link); 456 | } 457 | 458 | /** 459 | * 460 | * @param path 461 | * @param description 462 | * @return 463 | */ 464 | protected ImageIcon createImageIcon(String path, String description) { 465 | java.net.URL imgURL = getClass().getResource(path); 466 | if (imgURL != null) { 467 | return new ImageIcon(imgURL, description); 468 | } else { 469 | System.err.println("Couldn't find file: " + path); 470 | return null; 471 | } 472 | } 473 | // Variables declaration - do not modify//GEN-BEGIN:variables 474 | private javax.swing.JLabel ConnectedLabel; 475 | private javax.swing.JButton jButton1; 476 | private javax.swing.JButton jButton2; 477 | private javax.swing.JComboBox jComboBox1; 478 | private javax.swing.JLabel jLabel1; 479 | private javax.swing.JLabel jLabel2; 480 | private javax.swing.JLabel jLabel3; 481 | private javax.swing.JPanel jPanel1; 482 | private javax.swing.JScrollPane jScrollPane2; 483 | public static javax.swing.JTextArea jTextArea2; 484 | private javax.swing.JPanel mainPanel; 485 | // End of variables declaration//GEN-END:variables 486 | } 487 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/Shell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | package com.AdamOutler.LowLevelUnBrick; 22 | import java.io.BufferedReader; 23 | import java.io.IOException; 24 | import java.io.InputStreamReader; 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | 28 | 29 | /** 30 | * 31 | * @author adam 32 | */ 33 | //define to this abstract class 34 | public class Shell implements Runnable{ 35 | 36 | //for internal access 37 | public Shell() {} 38 | 39 | //for external access 40 | 41 | 42 | 43 | 44 | 45 | 46 | Log log = new Log(); 47 | 48 | 49 | 50 | //Send a command to the shell 51 | 52 | 53 | public String elevateSimpleCommand(String[] cmd){ 54 | String[] newCmd; 55 | 56 | if (!Statics.OSName.equals("Windows XP")){ 57 | newCmd=new String[3]; 58 | newCmd[0]=Statics.WinElevatorInTempFolder; 59 | newCmd[1]="-wait"; 60 | newCmd[2]=cmd[0]; 61 | 62 | } else { 63 | 64 | //TODO check permissions here 65 | newCmd = cmd; 66 | } 67 | log.level3("Executing elevate simple:" + this.arrayToString(newCmd)); 68 | String Result=sendShellCommand(newCmd); 69 | return Result; 70 | } 71 | 72 | 73 | 74 | 75 | public String sendShellCommand(String[] cmd){ 76 | log.level3("\n###executing: "+ cmd[0]+ "###"); 77 | String AllText=""; 78 | try { 79 | String line; 80 | Process process = new ProcessBuilder(cmd).start(); 81 | BufferedReader STDOUT = new BufferedReader( new InputStreamReader(process.getInputStream())); 82 | BufferedReader STDERR = new BufferedReader( new InputStreamReader(process.getErrorStream())); 83 | try { 84 | process.waitFor(); 85 | } catch (InterruptedException ex) { 86 | Logger.getLogger(Shell.class.getName()).log(Level.SEVERE, null, ex); 87 | } 88 | while ((line = STDOUT.readLine()) != null) { 89 | AllText=AllText+"\n"+line; 90 | while ((line = STDERR.readLine()) != null) { 91 | AllText=AllText+"\n"+line; 92 | } 93 | } 94 | //log.level0(cmd[0]+"\":"+AllText); 95 | return AllText; 96 | } catch (IOException ex) { 97 | log.level2("Problem while executing"+ arrayToString(cmd)+ 98 | " in Shell.sendShellCommand() Received " +AllText); 99 | return "CritERROR!!!"; 100 | } 101 | 102 | } 103 | 104 | public String silentShellCommand(String[] cmd){ 105 | 106 | String AllText=""; 107 | try { 108 | String line; 109 | Process process = new ProcessBuilder(cmd).start(); 110 | BufferedReader STDOUT = new BufferedReader( new InputStreamReader(process.getInputStream())); 111 | while ((line = STDOUT.readLine()) != null) { 112 | AllText=AllText+"\n"+line; 113 | 114 | } 115 | return AllText; 116 | } catch (IOException ex) { 117 | return "error"; 118 | } 119 | 120 | } 121 | 122 | 123 | 124 | public String arrayToString(String[] stringarray){ 125 | String str = " "; 126 | for (int i = 0; i < stringarray.length; i++) { 127 | str = str + " " + stringarray[i]; 128 | } 129 | log.level3("arrayToString " + stringarray + " expanded to: " + str); 130 | return str; 131 | } 132 | 133 | private boolean testForException(Process process){ 134 | 135 | if ( process.exitValue() >= 0 ){ 136 | 137 | return false; 138 | } else { 139 | return true; 140 | } 141 | 142 | 143 | } 144 | 145 | public void liveShellCommand(){ 146 | 147 | 148 | Runnable r = new Runnable(){ 149 | public void run(){ 150 | boolean LinkLaunched = false; 151 | try { 152 | String[] params = (String[]) Statics.LiveSendCommand.toArray(new String[0]); 153 | Process process = new ProcessBuilder(params).start(); 154 | BufferedReader STDOUT = new BufferedReader( new InputStreamReader(process.getInputStream())); 155 | BufferedReader STDERR = new BufferedReader( new InputStreamReader(process.getErrorStream())); 156 | String LineRead =null; 157 | String CharRead = null; 158 | boolean ResetLine=false; 159 | int c; 160 | while( (c = STDOUT.read()) >-1) { 161 | if (ResetLine){ 162 | log.beginLine(); 163 | ResetLine=!ResetLine; 164 | } 165 | CharRead=Character.toString((char)c); 166 | LineRead=LineRead+CharRead; 167 | log.progress(CharRead); 168 | if ((! LinkLaunched)&&(LineRead.contains("Modified SBL Injection Completed Download Mode Activated"))){ 169 | LinkLaunched=true; 170 | TimeOutOptionPane timeOutOptionPane = new TimeOutOptionPane(); 171 | int DResult= timeOutOptionPane.showTimeoutDialog( 172 | 7, //timeout 173 | null, //parentComponent 174 | "Don't forget to use the donate button.\n"+ 175 | "Donations help developers justify time spent on projects " 176 | + "to their wives :).", 177 | "Succes!s",//DisplayTitle 178 | TimeOutOptionPane.OK_OPTION, // Options buttons 179 | TimeOutOptionPane.INFORMATION_MESSAGE, //Icon 180 | new String[]{"OK"}, // option buttons 181 | "No"); //Default{ 182 | if ( DResult == 0 ){ 183 | } 184 | } 185 | } 186 | while ((LineRead=STDERR.readLine()) != null){ 187 | log.progress(LineRead); 188 | } 189 | 190 | } catch (IOException ex) { 191 | String[] ArrayList = Statics.LiveSendCommand.toArray(new String[0]); 192 | log.level2("Problem while executing"+ ArrayList + 193 | " in Shell.liveShellCommand()"); 194 | Logger.getLogger(Shell.class.getName()).log(Level.SEVERE, null, ex); 195 | } 196 | } 197 | }; 198 | Thread t = new Thread(r); 199 | t.start(); 200 | } 201 | public void run() { 202 | throw new UnsupportedOperationException("Not supported yet."); 203 | } 204 | 205 | 206 | 207 | 208 | 209 | } -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/Statics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Adam Outler 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | package com.AdamOutler.LowLevelUnBrick; 22 | import java.io.PrintWriter; 23 | import java.util.ArrayList; 24 | import java.util.Random; 25 | import javax.swing.JTextArea; 26 | 27 | 28 | 29 | /** 30 | * 31 | * @author adam 32 | * 33 | * Statics is used for any type of static variable 34 | * It is the Static Class for information to be used 35 | * everywhere in the program. 36 | */ 37 | public class Statics { 38 | public Statics(){ 39 | } 40 | 41 | /*increase or decrease the logging level*/ 42 | public static int ConsoleLevel=2; //userdata is output to console 43 | /*increase or decrease the logging level*/ 44 | public static int LogLevel=2; //all logs are output to file 45 | 46 | /* 47 | * miscellanious variables 48 | */ 49 | static Shell shellCommand = new Shell(); 50 | static Log Log = new Log(); 51 | public static ArrayList LiveSendCommand = new ArrayList(); 52 | public static PrintWriter OutFile; 53 | public static boolean LogCreated=false; //used by log class 54 | public static LowLevelUnbrickOneClickView HeimdallOneClickView; 55 | /* 56 | *Form data for Heimdall One-Click View 57 | */ 58 | public static String DeviceModel;//Set by FileOperations, Read by one-click view 59 | public static String DeviceFriendlyName; 60 | public static String DeveloperTeam; 61 | public static String DeveloperMembers; 62 | public static String ROMName; 63 | public static String ROMRevision; 64 | public static String Platform; 65 | public static String PlatformVersion; 66 | public static String Manufacturer; 67 | public static String DeveloperWebsiteLink; 68 | public static String DeveloperDonateLink; 69 | public static JTextArea ProgressArea; //used by log to update Progress 70 | public static JTextArea StatusArea; //used by Log to set carret and apped data 71 | public static String PreStatus ="";//Buffer for data before form has been created 72 | public static String PreProgress=""; 73 | public static int ConnectionSatus=5; 74 | 75 | public static String Slash=System.getProperty("file.separator"); 76 | final public static String HeimdallCheckString=" Glass Echidna"; 77 | 78 | 79 | 80 | 81 | 82 | 83 | private static String TempF=null; 84 | //TempFolder is the folder used for file operations 85 | public static String TempFolder=getTempFolder(); 86 | private static String getTempFolder(){ 87 | 88 | if (TempF == null){ 89 | TempF = System.getProperty("java.io.tmpdir"); 90 | if (!TempF.endsWith(Slash))TempF=TempF + Slash; 91 | String UserName=System.getenv("USERNAME"); 92 | if ( UserName == null){ 93 | TempF=TempF+"TempHeimdallOneClick"; 94 | } else { 95 | TempF=TempF+UserName+"HeimdallOneClick"; 96 | } 97 | String Randomness = ""; 98 | String Characters="123456789ABCDEF"; 99 | Random RandomNumberGenerator=new Random(); 100 | for (int i = 0; i < 8; i++){ 101 | Randomness=Randomness+ Characters.charAt(RandomNumberGenerator.nextInt(Characters.length())); 102 | } 103 | TempF=TempF+Randomness; 104 | if (!TempF.endsWith(Slash))TempF=TempF + Slash; 105 | } 106 | return TempF; 107 | } 108 | 109 | 110 | 111 | /* 112 | * Cross-Platform data storage 113 | */ 114 | public static String OSName=System.getProperty("os.name"); 115 | public static String OSType=""; //used for logging 116 | public static String Arch=""; 117 | public static String HeimdallInstallFileName="unsupported"; 118 | public static String HeimdallBinaryFileName="heimdall"; 119 | public static String InstalledHeimdallVersion=""; 120 | public static String ResourceHeimdallVersion=""; 121 | public static String HeimdallVersionContained="v1.3.0"; 122 | /* 123 | * Windows resources 124 | */ 125 | //Windows drivers 126 | final public static String WinLibUSBInTempFolder = Statics.TempFolder+"heimdall-win32\\Heimdall Suite 1.3.0\\libusb-1.0.dll"; 127 | //libusb driver 128 | final public static String WinDriverDeploymentInTempFolder = Statics.TempFolder+"heimdall-win32\\Heimdall Suite 1.3.0\\Drivers\\zadig.exe"; 129 | 130 | //Windows Visual C++ 131 | final public static String WinVCRedistFolderInTempFolder= Statics.TempFolder+"vcredist_x86.exe"; 132 | //Windows Heimdall file 133 | final public static String WinHeimdallInTempFolder=TempFolder+"heimdall-win32\\Heimdall Suite 1.3.0\\heimdall.exe"; 134 | //Windows permission elevation in temporary folder 135 | final public static String WinElevatorInTempFolder=Statics.TempFolder+"\\Elevate.exe"; 136 | //Windows Loader in case Elevate does not work 137 | final public static String WinPermissionsLoaderResource="/com/AdamOutler/HeimdallOneClick/resources/HeimdallPackage/oneclickloader.exe"; 138 | //Windows VCRedist location in package 139 | final public static String WinVCRedistributableResource="/com/AdamOutler/HeimdallOneClick/resources/vcredist_x86.exe"; 140 | //Windows permissions elevator 141 | final public static String WinElevatorResource="/com/AdamOutler/HeimdallOneClick/resources/Elevate.exe"; 142 | 143 | 144 | /* 145 | * Cross platform resources 146 | */ 147 | //Heimdall Version text file 148 | final public static String HeimdallVersionText="/com/AdamOutler/HeimdallOneClick/resources/HeimdallPackage/HeimdallVersion"; 149 | //Resources folder in package 150 | final public static String ROMPackageFolderResource="/com/AdamOutler/HeimdallOneClick/resources/ROMPackage"; 151 | //XML location in package 152 | final public static String ROMPackageTXTFileForFolderResource="/com/AdamOutler/HeimdallOneClick/ROMPackage/PROPERTIES.txt"; 153 | //ROM location in package 154 | final public static String HeimdallBinariesResource="resources/HeimdallPackage/"; 155 | //Connected Icon 156 | final public static String ConnectedIcon="resources/images/Connected.png"; 157 | //disconnected Icon 158 | final public static String DisonnectedIcon="resources/images/Disconnected.png"; 159 | //unknown icon 160 | final public static String UnknownIcon="resources/images/Unknown.png"; 161 | //ROM Package in tar.gz format 162 | final public static String ROMPackageResourceFolder="/com/AdamOutler/HeimdallOneClick/resources/ROMPackage/"; 163 | //if heimdall was detected as installed 164 | public static boolean HeimdallInstalled=false; 165 | //used for communication between checkbox on heimdallOneClickView and FlashPrep 166 | public static boolean FlashBootloaders = false; 167 | 168 | 169 | /* 170 | * Variables for TGZFormat 171 | */ 172 | public static boolean UseTGZFormat=false; 173 | //Firmware XML in resource 174 | public static String ROMPackageTGZXMLResource="/com/AdamOutler/HeimdallOneClick/resources/ROMPackage/firmware.xml"; 175 | //Firmware package in resource 176 | final public static String ROMPackageTGZ="/com/AdamOutler/HeimdallOneClick/resources/ROMPackage/HeimdallPackage.tar.gz"; 177 | //ROM Package In Temp Folder 178 | final public static String ROMPackageDeployed=Statics.TempFolder+"ROMPACKAGE/"; 179 | //Firmware XML Temp FOlder 180 | public static String ROMPackageFirmwareXMLTempFolder= Statics.TempFolder+"firmware.xml"; 181 | 182 | 183 | /* 184 | * Determines if Linux, Mac or Windows 185 | */ 186 | //Check for windows 187 | public static boolean isWindows(){ 188 | String os = System.getProperty("os.name").toLowerCase(); 189 | return (os.indexOf( "win" ) >= 0); } 190 | //Check for Mac 191 | public static boolean isMac(){ 192 | String os = System.getProperty("os.name").toLowerCase(); 193 | return (os.indexOf( "mac" ) >= 0);} 194 | //Check for Linux 195 | public static boolean isLinux(){ 196 | String os = System.getProperty("os.name").toLowerCase(); 197 | return (os.indexOf( "nux") >=0);} 198 | 199 | 200 | 201 | 202 | /* 203 | * sets system information, including heimdall presence, operating system and archetecture 204 | */ 205 | public void setSystemInfo(){ 206 | 207 | if(isWindows()){ 208 | 209 | Statics.HeimdallInstallFileName="heimdall-win32.zip"; 210 | Statics.OSType="Windows"; 211 | Statics.Slash="\\"; 212 | 213 | 214 | } else if (isMac()) { 215 | OSType="Mac"; 216 | HeimdallInstallFileName="heimdall-mac.dmg"; 217 | Statics.Slash="/"; 218 | HeimdallBinaryFileName="heimdall"; 219 | 220 | }else if(isLinux()){ 221 | OSType="Linux"; 222 | Statics.Slash="/"; 223 | HeimdallBinaryFileName="heimdall"; 224 | String[] Command={ "dpkg", "--version"}; 225 | String dpkgResults=shellCommand.sendShellCommand(Command); 226 | if (dpkgResults.contains("Debian")){ 227 | OSType="Debian Based"; 228 | String[] CommandArch={"arch"}; 229 | Arch=shellCommand.sendShellCommand(CommandArch); 230 | if (Arch.contains("i686")){ 231 | HeimdallInstallFileName="heimdall_i386.deb"; 232 | Arch="i686"; 233 | } else if (Arch.contains("x86_64")) { 234 | HeimdallInstallFileName="heimdall_amd64.deb"; 235 | Arch="x86_64"; 236 | } else { 237 | HeimdallInstallFileName=""; 238 | Arch="Unexpected Processor Archetecture"; 239 | } 240 | }else { 241 | OSType="Linux"; 242 | HeimdallInstallFileName=""; 243 | } 244 | } 245 | 246 | FileOperations FileOperations=new FileOperations(); 247 | boolean MadeFolder; 248 | 249 | if (! FileOperations.verifyFileExists(Statics.TempFolder)){ 250 | MadeFolder = FileOperations.makeFolder(Statics.TempFolder); 251 | } else { 252 | MadeFolder = true; 253 | } 254 | if (MadeFolder){ 255 | Log.level3("Set Temporary Folder:" + Statics.TempFolder ); 256 | //Log.level1("Log:" + Statics.TempFolder +"log.txt"); 257 | } 258 | HeimdallInstalled=false; 259 | Log.level3("Statics.setSystemInfo(): " + OSType + " "+ Arch ); 260 | Log.level1("Operating System: " + OSType + " "+ Arch ); 261 | String HeimdallCmd=Statics.HeimdallBinaryFileName; 262 | String[] CommandHeimdall={HeimdallCmd}; 263 | String Version=shellCommand.sendShellCommand(CommandHeimdall); 264 | String SplitComma=Version.split(",")[0]; 265 | if ( ! (Version.equals("")) ) { 266 | String SplitReturn=""; 267 | try { 268 | if (! SplitReturn.equals("")){ 269 | SplitReturn=SplitComma.split("\n")[2]; 270 | InstalledHeimdallVersion=SplitReturn; 271 | HeimdallInstalled=true; 272 | } else { 273 | String[] CommandHeimdall2={Statics.HeimdallBinaryFileName,"version"}; 274 | Version = shellCommand.sendShellCommand(CommandHeimdall2); 275 | 276 | if (Version.equals("v1.3")){ 277 | HeimdallInstalled=true; 278 | InstalledHeimdallVersion=Version.replace("\n", ""); 279 | 280 | return; 281 | } else if (Version.equals("\nv1.3 (beta)")) { 282 | InstalledHeimdallVersion=Version.replace("\n", ""); 283 | Log.level1("Found Heimdall Version: "+InstalledHeimdallVersion); 284 | InstalledHeimdallVersion=Version.replace("\n", ""); 285 | HeimdallInstalled=true; 286 | 287 | return; 288 | } else if (Version.equals("\nv1.3.0")) { 289 | InstalledHeimdallVersion=Version.replace("\n", ""); 290 | Log.level1("Found Heimdall Version: "+InstalledHeimdallVersion); 291 | InstalledHeimdallVersion=Version.replace("\n", ""); 292 | HeimdallInstalled=true; 293 | 294 | return; 295 | } 296 | 297 | } 298 | if (SplitReturn.contains("Arguments")){ 299 | String[] CommandHeimdall2={Statics.HeimdallBinaryFileName, "version" }; 300 | InstalledHeimdallVersion=shellCommand.sendShellCommand(CommandHeimdall2).replace("\n", ""); 301 | } 302 | Log.level1("Found Heimdall Version: "+InstalledHeimdallVersion); 303 | HeimdallInstalled=true; 304 | if (InstalledHeimdallVersion.equals("") ){ 305 | InstalledHeimdallVersion="Unknown version"; 306 | 307 | } 308 | return; 309 | } catch (ArrayIndexOutOfBoundsException e) { 310 | HeimdallInstalled=false; 311 | } 312 | } else { 313 | HeimdallInstalled=false; 314 | Log.progress("\nHeimdall is not installed!!"); 315 | } 316 | } 317 | 318 | 319 | 320 | 321 | 322 | 323 | } 324 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/TimeOutOptionPane.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Gio Gilligan, Mar 14, 2007 4 | * http://www.jguru.com/faq/view.jsp?EID=266182 5 | * Unlicensed 6 | */ 7 | package com.AdamOutler.LowLevelUnBrick; 8 | 9 | import java.awt.Component; 10 | import javax.swing.JDialog; 11 | import javax.swing.JOptionPane; 12 | 13 | /** 14 | * 15 | * @author adam 16 | */ 17 | public class TimeOutOptionPane extends JOptionPane { 18 | 19 | public TimeOutOptionPane() { 20 | super(); 21 | } 22 | 23 | static int PRESET_TIME = 335; 24 | /* 25 | int showTimeoutDialog = timeOutOptionPane.showTimeoutDialog( 26 | 5, //timeout 27 | null, //parentComponent 28 | "My Message", //Display Message 29 | "My Title", //DisplayTitle 30 | TimeOutOptionPane.YES_OPTION, // Options buttons 31 | TimeOutOptionPane.INFORMATION_MESSAGE, //Icon 32 | new String[]{"blah", "hey", "yo"}, // option buttons 33 | "yo"); //seconds before auto "yo" 34 | * 35 | * 36 | */ 37 | public int showTimeoutDialog(final int PRESET_TIME, Component parentComponent, Object message, final String title, int optionType, 38 | int messageType, Object[] options, final Object initialValue) { 39 | JOptionPane pane = new JOptionPane(message, messageType, optionType, null, options, initialValue); 40 | 41 | pane.setInitialValue(initialValue); 42 | 43 | final JDialog dialog = pane.createDialog(parentComponent, title); 44 | 45 | pane.selectInitialValue(); 46 | new Thread() { 47 | public void run() { 48 | try { 49 | for (int i=PRESET_TIME; i>=0; i--) { 50 | Thread.sleep(1000); 51 | if (dialog.isVisible() && i<300) { 52 | dialog.setTitle(title + " (" + i + " seconds before auto \""+ initialValue + "\")"); 53 | } 54 | } 55 | if (dialog.isVisible()) { 56 | dialog.setVisible(false); 57 | } 58 | } catch (Throwable t) { 59 | //ok - ugly I know! 60 | } 61 | } 62 | }.start(); 63 | dialog.setVisible(true); 64 | 65 | Object selectedValue = pane.getValue(); 66 | if (selectedValue.equals("uninitializedValue")) { 67 | selectedValue = initialValue; 68 | } 69 | if (selectedValue == null) 70 | return CLOSED_OPTION; 71 | if (options == null) { 72 | if (selectedValue instanceof Integer) 73 | return ((Integer) selectedValue).intValue(); 74 | return CLOSED_OPTION; 75 | } 76 | for (int counter = 0, maxCounter = options.length; counter < maxCounter; counter++) { 77 | if (options[counter].equals(selectedValue)) 78 | return counter; 79 | } 80 | return CLOSED_OPTION; 81 | } 82 | 83 | 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/Unzip.java: -------------------------------------------------------------------------------- 1 | package com.AdamOutler.LowLevelUnBrick; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.BufferedOutputStream; 5 | import java.io.File; 6 | import java.io.FileOutputStream; 7 | import java.io.IOException; 8 | import java.util.Enumeration; 9 | import java.util.zip.ZipEntry; 10 | import java.util.zip.ZipException; 11 | import java.util.zip.ZipFile; 12 | 13 | /** 14 | * 15 | * @author adam 16 | * Licensed under the "I Found This On Stack Overflow License" 17 | */ 18 | public class Unzip { 19 | public void unzip(String zipFile) throws ZipException, IOException { 20 | System.out.println(zipFile); 21 | int BUFFER = 2048; 22 | File file = new File(zipFile); 23 | ZipFile zip = new ZipFile(file); 24 | String newPath = zipFile.substring(0, zipFile.length() - 4)+"/"; 25 | new File(newPath).mkdirs(); 26 | Enumeration zipFileEntries = zip.entries(); 27 | // Process each entry 28 | while (zipFileEntries.hasMoreElements()) { 29 | // grab a zip file entry 30 | ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); 31 | String currentEntry = entry.getName(); 32 | File destFile = new File(newPath, currentEntry); 33 | destFile = new File(newPath, destFile.getName()); 34 | File destinationParent = destFile.getParentFile(); 35 | // create the parent directory structure if needed 36 | destinationParent.mkdirs(); 37 | System.out.println(); 38 | if (!entry.isDirectory()) { 39 | //if (Static) 40 | BufferedInputStream is = new BufferedInputStream(zip 41 | .getInputStream(entry)); 42 | int currentByte; 43 | // establish buffer for writing file 44 | byte data[] = new byte[BUFFER]; 45 | // write the current file to disk 46 | FileOutputStream fos = new FileOutputStream(newPath+entry); 47 | BufferedOutputStream dest = new BufferedOutputStream(fos, 48 | BUFFER); 49 | // read and write until last byte is encountered 50 | while ((currentByte = is.read(data, 0, BUFFER)) != -1) { 51 | dest.write(data, 0, currentByte); 52 | } 53 | dest.flush(); 54 | dest.close(); 55 | is.close(); 56 | } else if ( entry.isDirectory()) { 57 | System.out.println(newPath+entry.getName()); 58 | new File(newPath+entry.getName()).mkdirs(); 59 | } 60 | if (currentEntry.endsWith(".zip")) { 61 | // found a zip file, try to open 62 | unzip(destFile.getAbsolutePath()); 63 | } 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/LowLevelUnbrickOneClickApp.properties: -------------------------------------------------------------------------------- 1 | # Application global resources 2 | 3 | Application.name = LowLevelUnBrick 4 | Application.title = LowLevelUnBrick 5 | Application.version = 1.3Beta8 6 | Application.vendor = Adam Outler 7 | Application.homepage = http://www.adamoutler.com 8 | Application.description = low level unbricker for UnBrickable Mod 9 | Application.vendorId = com.AdamOutler 10 | Application.id = LowLevelUnBrick 11 | Application.lookAndFeel = system 12 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/LowLevelUnbrickOneClickView.properties: -------------------------------------------------------------------------------- 1 | 2 | # @Action resources 3 | 4 | showAboutBox.Action.text = &About... 5 | showAboutBox.Action.shortDescription = Show the application's information dialog 6 | 7 | # status bar resources 8 | StatusBar.messageTimeout = 5000 9 | StatusBar.busyAnimationRate = 30 10 | StatusBar.idleIcon = images/busyicons/idle-icon.png 11 | StatusBar.busyIcons[0] = images/busyicons/busy-icon0.png 12 | StatusBar.busyIcons[1] = images/busyicons/busy-icon1.png 13 | StatusBar.busyIcons[2] = images/busyicons/busy-icon2.png 14 | StatusBar.busyIcons[3] = images/busyicons/busy-icon3.png 15 | StatusBar.busyIcons[4] = images/busyicons/busy-icon4.png 16 | StatusBar.busyIcons[5] = images/busyicons/busy-icon5.png 17 | StatusBar.busyIcons[6] = images/busyicons/busy-icon6.png 18 | StatusBar.busyIcons[7] = images/busyicons/busy-icon7.png 19 | StatusBar.busyIcons[8] = images/busyicons/busy-icon8.png 20 | StatusBar.busyIcons[9] = images/busyicons/busy-icon9.png 21 | StatusBar.busyIcons[10] = images/busyicons/busy-icon10.png 22 | StatusBar.busyIcons[11] = images/busyicons/busy-icon11.png 23 | StatusBar.busyIcons[12] = images/busyicons/busy-icon12.png 24 | StatusBar.busyIcons[13] = images/busyicons/busy-icon13.png 25 | StatusBar.busyIcons[14] = images/busyicons/busy-icon14.png 26 | 27 | Flash.text=Perform Resurrection - Download Mode 28 | Flash.toolTipText=perform firmware flash 29 | #NOI18N 30 | jTextArea2.background=242, 241, 240 31 | jScrollPane2.viewportBorder.title=Status 32 | #NOI18N 33 | jScrollPane2.viewportBorder.titleFont=Dialog-Plain-10 34 | jTextArea2.text=Credits: \nAdamOutler- Hardware Analisys/Modification/high level software development\nRebellos- Firmware development\nMidas5, mijoma, TheBeano- UART Output Debugging/Firmware Support 35 | jLabel1.text= 36 | #NOI18N 37 | jLabel1.icon=images/Unbrickable.png 38 | jLabel2.text=jLabel2 39 | jLabel3.text=jLabel3 40 | jButton1.text=Donate 41 | #NOI18N 42 | jTextArea2.font=Ubuntu-Plain-15 43 | jPanel1.border.title=Device Type 44 | #NOI18N 45 | jPanel1.font=Ubuntu-Plain-12 46 | #NOI18N 47 | jPanel1.border.titleFont=Dialog-Plain-10 48 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/NewApplication.properties: -------------------------------------------------------------------------------- 1 | cutMenuItem.text=Cut 2 | helpMenu.text=Help 3 | deleteMenuItem.text=Delete 4 | aboutMenuItem.text=About 5 | contentsMenuItem.text=Contents 6 | openMenuItem.text=Open 7 | fileMenu.text=File 8 | pasteMenuItem.text=Paste 9 | copyMenuItem.text=Copy 10 | exitMenuItem.text=Exit 11 | editMenu.text=Edit 12 | saveMenuItem.text=Save 13 | saveAsMenuItem.text=Save As ... 14 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/UnBrickPack.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/UnBrickPack.zip -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/WindowsProblem.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | #NOI18N 5 | jLayeredPane4.background=178, 171, 167 6 | jLabel1.text=Welcome to the Windows Problem Resolution Center 7 | #NOI18N 8 | jLabel1.font=Ubuntu 24-Plain-24 9 | jLabel2.text=From here you can automatically install files required for Heimdall One-Click, or place them in the current folder to run them yourself 10 | jButton2.text=Run the file 11 | jButton1.text=Extract to current folder 12 | jLabel8.text=libwdi 13 | jLabel7.text=Zadig 14 | #NOI18N 15 | jLabel7.font=Ubuntu 15 Bold 16 | jTextArea3.text=The Zadig drivers are required to interface with the device. These drivers should be installed before running Heimdall. Installation is as follows:\n1. Put your device into download mode \n2. Connect your device to the computer\n3. Right click the program and "Run as administrator"\n4. Select Options>List all devices\n5. Select USB Gadget (gadget serial)\n6. Click install. \nMore Info here: http://www.libusb.org/wiki/winusb_driver_installation 17 | #NOI18N 18 | jLayeredPane3.background=178, 171, 167 19 | jButton6.text=Run the file 20 | jButton5.text=Extract to current folder 21 | jLabel10.text= Microsoft 22 | jLabel9.text=VC Redist 23 | #NOI18N 24 | jLabel9.font=Ubuntu 15 Bold 25 | jTextArea4.text=The Visual C redistributable package provides the framework needed . Installation is as follows:\n1. Right click the program and "Run as administrator"\n2. click next through the steps 26 | jLabel3.text= 27 | #NOI18N 28 | jLabel3.icon=images/microsuck.png 29 | jLabel5.text=libusb 30 | -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DebugMode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DebugMode.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DeviceNotFound.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DeviceNotFound.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DownloadMode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/DownloadMode.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/MassStorage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/MassStorage.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/MediaPlayer.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/MediaPlayer.jpeg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/S5PC110.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/S5PC110.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/SamsungKies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/SamsungKies.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/SamsungKies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/SamsungKies.png -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/TI.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/TI.jpg -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/Unbrickable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/Unbrickable.png -------------------------------------------------------------------------------- /GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/fastboot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/GalaxySFrontend/LowLevelUnbrick/src/com/AdamOutler/LowLevelUnBrick/resources/images/fastboot.jpg -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/BL1_stage1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/BL1_stage1.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/Captivate_SBL.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/Captivate_SBL.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/HIBL.ASM: -------------------------------------------------------------------------------- 1 | ; Hummingbird Interceptor Boot Loader (HIBL) 2 | ; 3 | ; Copyright 2011 Dominik Marszk 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | format binary as 'bin' 18 | include 'functions.inc' 19 | processor 0x2FFFFFE 20 | coprocessor 0x30F8 21 | 22 | org 0xD0020000 23 | align 4 24 | c_start: 25 | file 'BL1_stage1.bin' ; must be signed for secure boot 26 | db 0x2000 - ($-c_start) dup 0 ; here starts our BL1_stage1 0xD0022000 27 | 28 | dw 0x0 ; secure boot header - we are out of secure boot already, thanks to Samsung for signing BL1_stage1 which drops secure boot 29 | dw 0x0 30 | dw 0x0 31 | dw 0x0 32 | 33 | B StartUp 34 | ;ARM core jump vector table 35 | _undefined_instruction: 36 | b _undefined_instruction 37 | _software_interrupt: 38 | b _software_interrupt 39 | _prefetch_abort: 40 | b _prefetch_abort 41 | _data_abort: 42 | b _data_abort 43 | _not_used: 44 | b _not_used 45 | _irq: 46 | b _irq 47 | _fiq: 48 | b _fiq 49 | ;endof ARM core handlers 50 | 51 | StartUp: 52 | 53 | LDR R1, [PSHOLD_SFR] 54 | LDR R0, [R1] 55 | ORR R0, R0, 0x300 56 | ORR R0, R0, 1 57 | STR R0, [R1] 58 | LDR R1, [WDOG_CTRL_SFR] 59 | MOV R0, 0 60 | STR R0, [R1] 61 | LDR R0, [magic_determ_location] 62 | LDR R0, [R0] 63 | LDR R1, [infuse_magic] 64 | CMP R0, R1 65 | BEQ load_infuse 66 | LDR R0, [sgs_ptrs_l] 67 | BL load_ptrs 68 | B ptrsloaded 69 | load_infuse: 70 | LDR R0, [infuse_ptrs_l] 71 | BL load_ptrs 72 | ptrsloaded: 73 | BL uart_sel 74 | MOV R0, 0xA 75 | BL debug_print_byte 76 | LDR R0, [s_detected_irom_a] 77 | BL debug_print 78 | LDR R0, [irom_rev_str_a] 79 | BL debug_print 80 | 81 | 82 | MOV R0, 0xA 83 | BL debug_print_byte 84 | LDR R0, [s_om_value_a] 85 | BL debug_print 86 | LDR R0, [OM_REG] 87 | LDR R0, [R0] 88 | BL printhexint 89 | 90 | 91 | MOV R0, 0xA 92 | BL debug_print_byte 93 | 94 | LDR R0, [s_welcome_a] 95 | BL debug_print 96 | 97 | MOV R0, 0xA 98 | BL debug_print_byte 99 | 100 | LDR R0, [s_ibl_jumpout_a] 101 | BL debug_print 102 | 103 | BL jump_to_sgs_ibl 104 | LDR R0, [s_done_a] 105 | BL debug_print 106 | 107 | 108 | BL init_system 109 | 110 | 111 | LDR R0, [s_ram_test_a] 112 | BL debug_print 113 | LDR R0, [BL3_memblock] 114 | LDR R1, [ram_test_magic1] 115 | STR R1, [R0] 116 | LDR R2, [R0] 117 | CMP R1, R2 118 | BNE fail 119 | LDR R0, [s_done_a] 120 | BL debug_print 121 | 122 | 123 | 124 | LDR R0, [s_iram_init_a] 125 | BL debug_print 126 | 127 | LDR R0, [uart_reg] 128 | LDR R6, [R0] 129 | 130 | LDR R0, [mirror_copy_start] 131 | LDR R1, [init_vars_start] 132 | LDR R2, [init_vars_size] 133 | BL rebell_memcpy 134 | 135 | LDR R0, [uart_reg] 136 | STR R6, [R0] 137 | 138 | LDR R0, [s_done_a] 139 | BL debug_print 140 | 141 | LDR R0, [s_otg_clean_a] 142 | BL debug_print 143 | LDR R0, [otg_info] 144 | MOV R1, 0 145 | MOV R2, 0x128 146 | BL rebell_fillmem 147 | 148 | LDR R0, [s_done_a] 149 | BL debug_print 150 | 151 | LDR R0, [s_dl_start_a] 152 | BL debug_print 153 | BL start_usb_booting 154 | MOV R3, R0 155 | BL printhexint 156 | MOV R0, 0xA 157 | BL debug_print_byte 158 | MOV R0, R3 159 | CMP R0, 0 160 | BNE fail 161 | 162 | LDR R0, [s_bl3_ep_a] 163 | BL debug_print 164 | LDR R0, [upload_ep_ptr] 165 | LDR R0, [R0] 166 | BL printhexint 167 | 168 | MOV R0, 0xA 169 | BL debug_print_byte 170 | 171 | LDR R0, [s_bl3start_a] 172 | BL debug_print 173 | LDR R0, [upload_ep_ptr] 174 | LDR R0, [R0] 175 | BX R0 176 | 177 | 178 | 179 | fail: 180 | LDR R0, [s_failed_a] 181 | BL debug_print 182 | MOV R0, 3 183 | BL countdown 184 | endless_loop: 185 | b endless_loop 186 | 187 | s_welcome_a dw s_welcome 188 | s_bl3_ep_a dw s_bl3_ep 189 | s_ibl_jumpout_a dw s_ibl_jumpout 190 | s_iram_init_a dw s_iram_init 191 | s_otg_clean_a dw s_otg_clean 192 | s_ram_test_a dw s_ram_test 193 | s_dl_start_a dw s_dl_start 194 | s_failed_a dw s_failed 195 | s_bl3start_a dw s_bl3start 196 | s_done_a dw s_done 197 | s_detected_irom_a dw s_detected_irom 198 | s_om_value_a dw s_om_value 199 | 200 | s_welcome db 0xA,\ 201 | '-------------------------------------------------------------',0xA,\ 202 | ' Hummingbird Interceptor Boot Loader (HIBL) v2.5',0xA,\ 203 | ' Copyright (C) Dominik Marszk 2011',0xA,\ 204 | '-------------------------------------------------------------',0xA,0x0 205 | 206 | s_detected_irom db 'Detected iROM version: ',0x0 207 | s_om_value db 'OM register: ',0x0 208 | s_bl3_ep db 'BL3 EP: ',0x0 209 | s_ibl_jumpout db 'Calling IBL Stage2',0x0 210 | s_iram_init db 'iRAM reinit',0x0 211 | s_otg_clean db 'cleaning OTG context',0x0 212 | s_ram_test db 'Testing DRAM1',0x0 213 | s_dl_start db 'Chain of Trust has been successfully compromised.',0xA,0xA,'Begin unsecure download now...',0xA,0x0 214 | s_failed db 'FAILED! Phone will hang...',0xA,0x0 215 | s_bl3start db 'Download complete, hold download mode key combination.',0xA,0xA,'Starting BL3 in...',0xA,0x0 216 | s_done db ' ...OK',0xA,0x0 217 | align 4 218 | 219 | 220 | BL3_memblock dw 0x40200000 221 | ram_test_magic1 dw 0x12349876 222 | OM_REG dw 0xE010E100 223 | PSHOLD_SFR dw 0xE010E81C 224 | WDOG_CTRL_SFR dw 0xE2700000 225 | MP05_CTRL dw 0xE0200360 226 | MP05_DATA dw 0xE0200364 227 | magic_determ_location dw 0xD0000100 228 | 229 | infuse_magic dw 0xE5925000 230 | infuse_ptrs_l dw infuse_ptrs 231 | sgs_magic dw 0x11A0F000 232 | sgs_ptrs_l dw sgs_ptrs 233 | irom_rev_str_a dw irom_rev_str 234 | 235 | 236 | 237 | 238 | infuse_ptrs: 239 | include 'infuse.inc' 240 | 241 | sgs_ptrs: 242 | include 'sgs.inc' 243 | 244 | uart_sel: ;uart select is MP05(7) 245 | STMFD SP!, {R1-R3,LR} 246 | LDR R1, [MP05_CTRL] 247 | LDR R2, [R1] 248 | BIC R2, 0xF0000000 249 | ORR R2, R2, 0x10000000 ;output 250 | STR R2, [R1] 251 | AND r0, r0, 0x1 252 | MOV R0, R0, LSL#7 253 | LDR R1, [MP05_DATA] 254 | LDR R2, [R1] 255 | BIC R2, R2, 0x80 256 | ORR R2, R2, R0 257 | STR R2, [R1] 258 | LDMFD SP!, {R1-R3,PC} 259 | 260 | load_ptrs: 261 | STMFD SP!, {R1-R3,LR} 262 | MOV R1, 0 263 | ldr r2, [BL_abs_ptr] 264 | copy_loop: 265 | ldr r3, [r0] 266 | str r3, [r2] 267 | add r0, r0, 4 268 | add r2, r2, 4 269 | add r1, r1, 4 270 | cmp r1, #bl_abs_st_len 271 | bcc copy_loop 272 | LDMFD SP!, {R1-R3,PC} 273 | 274 | align 4 275 | bl_abs_st: 276 | irom_rev_str db 32 dup 0 277 | mirror_copy_start dw 0 278 | init_vars_size dw 0 279 | upload_ep_ptr dw 0 280 | init_vars_start dw 0 281 | uart_reg dw 0 282 | otg_info dw 0 283 | v_init_system dw 0 284 | v_start_usb_booting dw 0 285 | v_system_pause dw 0 286 | v_debug_print_irom dw 0 287 | v_debug_print_byte_irom dw 0 288 | 289 | bl_abs_st_end: 290 | BL_abs_ptr dw bl_abs_st 291 | bl_abs_st_len = bl_abs_st_end - bl_abs_st 292 | 293 | 294 | init_system: ldr pc, [v_init_system] 295 | start_usb_booting: ldr pc, [v_start_usb_booting] 296 | system_pause: ldr pc, [v_system_pause] 297 | debug_print_irom: ldr pc, [v_debug_print_irom] 298 | debug_print_byte_irom: ldr pc, [v_debug_print_byte_irom] 299 | 300 | 301 | jump_to_sgs_ibl: 302 | STMFD SP!, {LR} 303 | B sgs_ibl_stage2 304 | FUNCTIONS 305 | 306 | 307 | align 4 308 | 309 | db 0x4000 - ($-c_start) dup 0 310 | sgs_ibl_stage2: 311 | file 'init_by_rebell.bin' 312 | 313 | 314 | db 0x6000 - ($-c_start) dup 0 315 | 316 | 317 | 318 | -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/HIBL.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/HIBL.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/S8500_BL3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/S8500_BL3.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/S8530_BL3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/S8530_BL3.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/functions.inc: -------------------------------------------------------------------------------- 1 | ; Hummingbird Interceptor Boot Loader (HIBL) 2 | ; 3 | ; Copyright 2011 Dominik Marszk 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | macro FUNCTIONS 18 | { 19 | ;int rebell_strlen(char* str) 20 | rebell_strlen: 21 | STMFD SP!, {R1-R4,LR\} 22 | MOV R1, 0 23 | rebell_strlen_loop: 24 | LDRB R2, [R0], 1 25 | CMP R2, 0x0 26 | BEQ rebell_strlen_ret 27 | ADD R1, R1, 1 28 | B rebell_strlen_loop 29 | rebell_strlen_ret: 30 | MOV R0, R1 31 | LDMFD SP!, {R1-R4,PC\} 32 | 33 | 34 | ;countdown, 1-9 35 | countdown: 36 | STMFD SP!, {R2-R4, LR\} 37 | MOV R4, R0 38 | ADD R4, 48 39 | count_loop: 40 | MOV R0, R4 41 | BL debug_print_byte 42 | MOV R0, 0xA 43 | BL debug_print_byte 44 | MOV R1, 1000 45 | MOV R0, 1 46 | BL system_pause 47 | SUB R4, R4, 1 48 | CMP R4, 48 49 | BGE count_loop 50 | LDMFD SP!, {R2-R4, PC\} 51 | 52 | ;printhexint(int i) 53 | printhexint: 54 | STMFD SP!, {R1-R4,LR\} 55 | MOV R4, R0 56 | MOV R3, 0 57 | MOV R0, '0'; 58 | BL debug_print_byte 59 | MOV R0, 'x'; 60 | BL debug_print_byte 61 | UBFX R0, R4, 28, 4 62 | BL printhexchar 63 | UBFX R0, R4, 24, 4 64 | BL printhexchar 65 | UBFX R0, R4, 20, 4 66 | BL printhexchar 67 | UBFX R0, R4, 16, 4 68 | BL printhexchar 69 | UBFX R0, R4, 12, 4 70 | BL printhexchar 71 | UBFX R0, R4, 8, 4 72 | BL printhexchar 73 | UBFX R0, R4, 4, 4 74 | BL printhexchar 75 | UBFX R0, R4, 0, 4 76 | BL printhexchar 77 | LDMFD SP!, {R1-R4,PC\} 78 | 79 | ;printhexchar(4bit c) 80 | printhexchar: 81 | STMFD SP!, {LR\} 82 | CMP R0, 10 83 | ADDCC R0, R0, 48 84 | ADDCS R0, R0, (65-10) 85 | BL debug_print_byte 86 | LDMFD SP!, {PC\} 87 | 88 | debug_print: 89 | STMFD SP!, {R1-R4,LR\} 90 | BL debug_print_irom 91 | LDMFD SP!, {R1-R4,PC\} 92 | 93 | debug_print_byte: 94 | STMFD SP!, {R1-R4,LR\} 95 | BL debug_print_byte_irom 96 | LDMFD SP!, {R1-R4,PC\} 97 | ;void rebell_fillmem(R0 void* ptr, R1 byte fillbyte, R2 int length) 98 | rebell_fillmem: 99 | STMFD SP!, {R3,LR\} 100 | MOV R3, 0 101 | rebell_fillmem_loop: 102 | CMP R3, R2 103 | BGE rebell_fillmem_ret 104 | STRB R1, [R0, R3] 105 | ADD R3, R3, 1 106 | B rebell_fillmem_loop 107 | rebell_fillmem_ret: 108 | LDMFD SP!, {R3,PC\} 109 | ;be aware of code below, need someone to check and fix it 110 | ;it is 100% copy->paste from PBL with commented out 0x40 mapping 111 | configure_ram: 112 | STMFD SP!, {R0-R5,LR\} 113 | LDR R0, [APLL_LOCK] 114 | ORR R0, R0, #0x6200 115 | ORR R0, R0, #8 116 | MOV R1, #0 117 | STR R1, [R0] 118 | LDR R0, [RST_STAT] 119 | LDR R3, [R0] 120 | AND R3, R3, #0x10000 121 | LDR R0, [ASYNC_MSYS_DMC0] 122 | MOV R1, #0 123 | STR R1, [R0] 124 | MOV R1, #0 125 | STR R1, [R0,#0xC] 126 | LDR R0, [DMC0_REG] 127 | LDR R1, [conf_0x101000] 128 | STR R1, [R0,#0x18] 129 | MOV R1, #0x84 130 | STR R1, [R0,#0x1C] 131 | LDR R1, [conf_0x101000] 132 | ADD R1, R1, 2 133 | STR R1, [R0,#0x18] 134 | LDR R1, [conf_0x101000] 135 | ADD R1, R1, 3 136 | STR R1, [R0,#0x18] 137 | MOV R2, #0x4000 138 | loopconfram: 139 | SUBS R2, R2, #1 140 | CMP R2, #0 141 | BNE loopconfram 142 | LDR R1, [conf_0x60101003] 143 | STR R1, [R0,#0x18] 144 | CMP R3, #0x10000 145 | BNE configram2 146 | LDR R1, [conf_0x60101001] 147 | STR R1, [R0,#0x18] 148 | configram2: 149 | LDR R1, [conf_0xFFF1010] 150 | STR R1, [R0] 151 | LDR R1, [conf_0x212100] 152 | STR R1, [R0,#4] 153 | LDR R1, [conf_0x30F82222] 154 | STR R1, [R0,#8] 155 | LDR R1, [conf_0x40F02222] 156 | STR R1, [R0,#0xC] 157 | MOV R1, #0xFF000000 158 | STR R1, [R0,#0x14] 159 | MOV R1, 0x50E 160 | STR R1, [R0,#0x30] 161 | LDR R1, [conf_0x14233287] 162 | STR R1, [R0,#0x34] 163 | LDR R1, [conf_0x12130005] 164 | STR R1, [R0,#0x38] 165 | LDR R1, [conf_0xE140222] 166 | STR R1, [R0,#0x3C] 167 | MOV R1, #0x7000000 168 | STR R1, [R0,#0x10] 169 | MOV R1, #0x1000000 170 | STR R1, [R0,#0x10] 171 | MOV R1, #0x5000000 172 | STR R1, [R0,#0x10] 173 | MOV R1, #0x5000000 174 | STR R1, [R0,#0x10] 175 | MOV R1, #0x32 176 | STR R1, [R0,#0x10] 177 | LDR R1, [conf_0x20020] 178 | STR R1, [R0,#0x10] 179 | MOV R1, #0x7100000 180 | STR R1, [R0,#0x10] 181 | MOV R1, #0x1100000 182 | STR R1, [R0,#0x10] 183 | MOV R1, #0x5100000 184 | STR R1, [R0,#0x10] 185 | MOV R1, #0x5100000 186 | STR R1, [R0,#0x10] 187 | LDR R1, [conf_0x100032] 188 | STR R1, [R0,#0x10] 189 | LDR R1, [conf_0x120020] 190 | STR R1, [R0,#0x10] 191 | LDR R1, [conf_0xFFF10B0] 192 | STR R1, [R0] 193 | MOV R1, 0xFFFF00FF 194 | STR R1, [R0,#0x28] 195 | LDR R1, [conf_0x212113] 196 | STR R1, [R0,#4] 197 | LDR R0, [DMC1_REG] ; DMC1_config 198 | LDR R1, [conf_0x101000] 199 | STR R1, [R0,#0x18] 200 | MOV R1, #0x84 201 | STR R1, [R0,#0x1C] 202 | LDR R1, [conf_0x101000] 203 | ADD R1, R1, 2 204 | STR R1, [R0,#0x18] 205 | LDR R1, [conf_0x101000] 206 | ADD R1, R1, 3 207 | STR R1, [R0,#0x18] 208 | MOV R2, #0x4000 209 | loopconfram2: 210 | SUBS R2, R2, #1 211 | CMP R2, #0 212 | BNE loopconfram2 213 | LDR R1, [conf_0x50101003] 214 | STR R1, [R0,#0x18] 215 | CMP R3, #0x10000 216 | BNE configram3 217 | LDR R1, [conf_0x50101001] 218 | STR R1, [R0,#0x18] 219 | configram3: 220 | ;LDR R0, [DMC1_REG] 221 | ;LDR R1, [conf_0xFFF1010] 222 | ;STR R1, [R0] 223 | ;LDR R1, [conf_0x212100] 224 | ;MOV R5, R0 225 | ;MOV R0, 9999 226 | ;BL int_debugprint 227 | ; MOV R0, R5 228 | ;STR R1, [R0,#4] 229 | 230 | ;MOV R0, 9999 231 | ;BL int_debugprint 232 | LDMFD SP!, {R0-R5,PC\} 233 | ;endproc 234 | 235 | conf_0xE2700000 dw 0xE2700000 236 | conf_0xE2900C00 dw 0xE2900C00 237 | conf_0x120020 dw 0x120020 238 | conf_0xFFF10B0 dw 0xFFF10B0 239 | conf_0x212113 dw 0x212113 240 | conf_0x50101003 dw 0x50101003 241 | conf_0x50101001 dw 0x50101001 242 | conf_0xFFF1010 dw 0xFFF1010 243 | APLL_LOCK dw 0xE0100000 244 | RST_STAT dw 0xE010A000 245 | ASYNC_MSYS_DMC0 dw 0xF1E00000 246 | DMC0_REG dw 0xF0000000 247 | conf_0x60101003 dw 0x60101003 248 | conf_0x60101001 dw 0x60101001 249 | conf_0x101000 dw 0x101000 250 | DMC1_REG dw 0xF1400000 251 | conf_0x40F02222 dw 0x40F02222 252 | conf_0x212100 dw 0x212100 253 | conf_0x30F82222 dw 0x30F82222 254 | conf_0x14233287 dw 0x14233287 255 | conf_0x12130005 dw 0x12130005 256 | conf_0xE140222 dw 0xE140222 257 | conf_0x20020 dw 0x20020 258 | conf_0x100032 dw 0x100032 259 | 260 | ;void rebell_memcpy(int source(r0), int target(r1), int size(r2)) 261 | ;returns num of bytes copied (always equal to size or just hangs on mem access violation) 262 | rebell_memcpy: 263 | STMFD SP!, {R3-R6,LR\} 264 | 265 | MOV R3, R2 266 | MOV R2, R1 267 | MOV R1, R0 268 | 269 | MOV R0, R1 270 | MOV R1, R2 271 | MOV R2, R3 272 | 273 | MOV R3, 0 274 | rebell_memcpy_copyloop: 275 | ldrb r4, [r0,r3] ;src 276 | strb r4, [r1,r3] ;dst 277 | add r3, r3, 1 278 | cmp r3, r2 279 | BLT rebell_memcpy_copyloop 280 | MOV R0, R2 281 | LDMFD SP!, {R3-R6,PC\} 282 | 283 | 284 | ;;Rewritten SBL functions to configure platform and CPU like SBL does 285 | configure_uart: 286 | LDR R4, [UART2_PTR] 287 | MOV R3, #0x23 288 | STRH R3, [SP,#8] 289 | MOV R3, #0x80 290 | STRH R3, [SP,#6] 291 | LDR R3, [R4, #4] 292 | BIC R3, R3, #0xF 293 | STR R3, [R4, #4] 294 | MOV R3, #0 295 | STR R3, [R4, #8] 296 | MOV R3, #0 297 | STR R3, [R4, #0xC] 298 | MOV R3, #3 299 | STR R3, [R4] 300 | MOV R3, #0x240 301 | STR R3, [R4, 4] 302 | LDRH R3, [SP,#8] 303 | STR R3, [R4, 0x28] 304 | LDRH R3, [SP,#6] 305 | STR R3, [R4, 0x2C] 306 | LDR R3, [R4, 4] 307 | ORR R3, R3, #5 308 | STR R3, [R4, 4] 309 | BX LR 310 | configure_clocks: 311 | LDR R3, [CLK_DIV1] 312 | LDR R3, [R3] 313 | BIC R3, R3, #0xF00000 314 | ORR R3, R3, #0x300000 315 | LDR R2, [CLK_DIV1] 316 | STR R3, [R2] 317 | LDR R3, [CLK_DIV0] 318 | LDR R3, [R3] 319 | AND R3, R3, #0x80000000 320 | MOV R2, R3 321 | LDR R3, [clk_div_mask] 322 | ORR R3, R2, R3 323 | LDR R2, [CLK_DIV0] 324 | STR R3, [R2] 325 | 326 | wait_for_stable_div: 327 | LDR R3, [CLK_DIV_STAT0] 328 | LDR R3, [R3] 329 | AND R3, R3, #1 330 | CMP R3, #0 331 | BNE wait_for_stable_div 332 | 333 | LDR R3, [DMC0_REG] 334 | LDR R3, [R3, 0x18] 335 | BIC R3, R3, #2 336 | LDR R2, [DMC0_REG] 337 | STR R3, [R2, 0x18] 338 | LDR R3, [DMC1_REG] 339 | LDR R3, [R3, 0x18] 340 | BIC R3, R3, #2 341 | LDR R2, [DMC1_REG] 342 | STR R3, [R2, 0x18] 343 | 344 | 345 | LDR R2, [CLK_GATE_IP0] 346 | LDR R3, [CLK_GATE_IP0] 347 | LDR R3, [R3] 348 | BIC R3, R3, #0x80000000 349 | STR R3, [R2] 350 | LDR R2, [CLK_GATE_IP1] 351 | LDR R3, [CLK_GATE_IP1] 352 | LDR R3, [R3] 353 | BIC R3, R3, #0x10000000 354 | STR R3, [R2] 355 | LDR R2, [CLK_GATE_IP2] 356 | LDR R3, [CLK_GATE_IP2] 357 | LDR R3, [R3] 358 | BIC R3, R3, #0x200 359 | BIC R3, R3, #2 360 | STR R3, [R2] 361 | LDR R2, [CLK_GATE_IP3] 362 | LDR R3, [CLK_GATE_IP3] 363 | LDR R3, [R3] 364 | BIC R3, R3, #3 365 | STR R3, [R2] 366 | LDR R2, [CLK_GATE_IP4] 367 | LDR R3, [CLK_GATE_IP4] 368 | LDR R3, [R3] 369 | BIC R3, R3, #6 370 | STR R3, [R2] 371 | BX LR 372 | 373 | UART2_PTR dw 0xE2900800 374 | clk_div_mask dw 0x14131330 375 | CLK_DIV0 dw 0xE0100300 376 | CLK_DIV1 dw 0xE0100304 377 | CLK_DIV2 dw 0xE0100308 378 | CLK_DIV3 dw 0xE010030C 379 | CLK_DIV4 dw 0xE0100310 380 | CLK_DIV5 dw 0xE0100314 381 | CLK_DIV6 dw 0xE0100318 382 | CLK_DIV7 dw 0xE010031C 383 | CLK_GATE_IP0 dw 0xE0100460 384 | CLK_GATE_IP1 dw 0xE0100464 385 | CLK_GATE_IP2 dw 0xE0100468 386 | CLK_GATE_IP3 dw 0xE010046C 387 | CLK_GATE_IP4 dw 0xE0100470 388 | CLK_DIV_STAT0 dw 0xE0101000 389 | 390 | timer_driver: 391 | var_18= -0x18 392 | var_4= -4 393 | STR R11, [SP,#var_4]! 394 | ADD R11, SP, #4+var_4 395 | SUB SP, SP, #0xC 396 | LDR R2, [TCFG0] 397 | MOV R3, #0xF00 398 | STR R3, [R2] 399 | LDR R3, [TCFG1] 400 | LDR R3, [R3] 401 | BIC R3, R3, #0xF0000 402 | STR R3, [R11,#0x10+var_18] 403 | LDR R2, [TCFG1] 404 | LDR R3, [R11,#0x10+var_18] 405 | ORR R3, R3, #0x10000 406 | STR R3, [R2] 407 | LDR R2, [TCNTB4] 408 | MOV R3, 0xFFFFFFFF 409 | STR R3, [R2] 410 | LDR R2, [TCON] 411 | LDR R3, [TCON] 412 | LDR R3, [R3] 413 | BIC R3, R3, #0x700000 414 | ORR R3, R3, #0x600000 415 | STR R3, [R2] 416 | LDR R2, [TCON] 417 | LDR R3, [TCON] 418 | LDR R3, [R3] 419 | BIC R3, R3, #0x700000 420 | ORR R3, R3, #0x500000 421 | STR R3, [R2] 422 | MOV SP, R11 423 | LDMFD SP!, {R11\} 424 | BX LR 425 | 426 | TCFG0 dw 0xE2500000 427 | TCFG1 dw 0xE2500004 428 | TCON dw 0xE2500008 429 | 430 | TCNTB4 dw 0xE250003C 431 | 432 | 433 | 434 | 435 | } -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/infuse.inc: -------------------------------------------------------------------------------- 1 | ; Hummingbird Interceptor Boot Loader (HIBL) 2 | ; 3 | ; Copyright 2011 Dominik Marszk 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | 18 | @@: 19 | db 'iROM rev 2.0 (Infuse 4G)' 20 | db 32 - ($-@r) dup 0 21 | 22 | dw 0xD000DF80 ;mirror_copy_start 23 | dw 0xB4 ;init_vars_size 24 | dw 0xD0035514 ;upload_ep_ptr 25 | dw 0xD0035400 ;init_vars_start 26 | dw 0xD0035458 ;uart_reg 27 | dw 0xD00354B4 ;otg_info 28 | 29 | dw 0xD0007E14 ;init_system 30 | dw 0xD0007EE0 ;start_usb_booting 31 | dw 0xD000546C ;system_pause 32 | dw 0xD0005648 ;debug_print_irom 33 | dw 0xD00055DC ;debug_print_byte_irom 34 | -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/init_by_rebell.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmarszk/hummingbird-hibl/65a935a1ce076297c0e569afffe207e6285b1a95/HummingBirdInterceptorBootloader/init_by_rebell.bin -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/sgs.inc: -------------------------------------------------------------------------------- 1 | ; Hummingbird Interceptor Boot Loader (HIBL) 2 | ; 3 | ; Copyright 2011 Dominik Marszk 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | @@: 18 | db 'iROM rev 1.0' 19 | db 32 - ($-@r) dup 0 20 | 21 | dw 0xD000C90C ;mirror_copy_start 22 | dw 0x70 ;init_vars_size 23 | dw 0xD00354D0 ;upload_ep_ptr 24 | dw 0xD0035400 ;init_vars_start 25 | dw 0xD0035458 ;uart_reg 26 | dw 0xD0035470 ;otg_info 27 | 28 | dw 0xD0007CAC ;init_system 29 | dw 0xD0007D78 ;start_usb_booting 30 | dw 0xD0005444 ;system_pause 31 | dw 0xD0005620 ;debug_print_irom 32 | dw 0xD00055B4 ;debug_print_byte_irom 33 | 34 | IRQ_enable equ 0xD000C694 35 | get_irq_status equ 0xD0003CFC 36 | SD_boot equ 0xD000728C 37 | USB_Init equ 0xD0000340 38 | calculate_checksum equ 0xD0004EF8 39 | check_OTG equ 0xD0000224 40 | check_seckey equ 0xD0007EB8 41 | clear_VicAddress equ 0xD0003BCC 42 | complicate_math equ 0xD000C66C 43 | config_USB equ 0xD00001D0 44 | config_USBOTG equ 0xD00001B0 45 | configure_oneNAND equ 0xD0003E70 46 | copy_sign_to_secboot_stack equ 0xD0004E44 47 | debug_mode_boot equ 0xD00087F4 48 | disableVIC equ 0xD0003AC8 49 | enableVIC equ 0xD0003A34 50 | fill_mem_with_FF equ 0xD000590C 51 | fillmem equ 0xD000AFAC 52 | generate_hmac_xor_efuse_hash equ 0xD000ACCC 53 | handle_usb_interrupt equ 0xD0001C4C 54 | init_debug_uart equ 0xD0005810 55 | init_sha1_values_for_chunk equ 0xD000AA64 56 | is_otg_on equ 0xD0002020 57 | load_sign_info equ 0xD0004E90 58 | memcpy equ 0xD000AEB8 59 | oneNAND_read1 equ 0xD0004194 60 | oneNAND_read2 equ 0xD0004AD4 61 | onenand_Boot equ 0xD0007A8C 62 | prepare_boot_uart equ 0xD000843C 63 | print_error equ 0xD0007EF4 64 | receive_byte equ 0xD0008594 65 | receive_usb_buffer equ 0xD000206C 66 | send_ping_recv_pong equ 0xD00085D0 67 | setVIC_handler equ 0xD0003B68 68 | set_timer equ 0xD0006138 69 | set_timer_interrupt equ 0xD0005164 70 | setup_boot_uart equ 0xD00083C8 71 | setup_otg_controller equ 0xD00020B8 72 | start_uart_booting equ 0xD0008640 73 | store_magics equ 0xD0004DF4 74 | timer_interrupt_handler equ 0xD0006100 75 | timers_control equ 0xD0005134 76 | usb_dload_code equ 0xD0007CF4 77 | usb_interrupt_handler equ 0xD0007CD0 78 | validate_code equ 0xD000A924 79 | validate_public_rsa equ 0xD000A7B4 80 | validate_sign equ 0xD0007E6C 81 | xor_hmac_with_efuse equ 0xD000B020 82 | zero_usb_stack equ 0xD0002054 -------------------------------------------------------------------------------- /HummingBirdInterceptorBootloader/uart_test.ASM: -------------------------------------------------------------------------------- 1 | ; Hummingbird Interceptor Boot Loader (HIBL) v1.0 2 | ; 3 | ; Copyright 2011 Dominik Marszk 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | format binary as 'bin' 18 | include 'functions.inc' 19 | include 'irom_addresses.inc' 20 | processor 0x2FFFFFE 21 | coprocessor 0x30F8 22 | 23 | org 0xD0020000 24 | align 4 25 | c_start: 26 | file 'BL1_stage1.bin' ; must be signed for secure boot 27 | fillup1: 28 | db 0x2000 - (fillup1-c_start) dup 0 ; here starts our BL1_stage1 0xD0022000 29 | 30 | dw 0x0 ; secure boot header - we are out of secure boot already, thanks to Samsung for signing BL1_stage1 which drops secure boot 31 | dw 0x0 32 | dw 0x0 33 | dw 0x0 34 | 35 | B StartUp 36 | ;ARM core jump vector table 37 | _undefined_instruction: 38 | b _undefined_instruction 39 | _software_interrupt: 40 | b _software_interrupt 41 | _prefetch_abort: 42 | b _prefetch_abort 43 | _data_abort: 44 | b _data_abort 45 | _not_used: 46 | b _not_used 47 | _irq: 48 | b _irq 49 | _fiq: 50 | b _fiq 51 | ;endof ARM core handlers 52 | 53 | StartUp: 54 | 55 | ldr R1, [UART2] 56 | ADR R0, s_test1 57 | LDRb R0, [R0] 58 | STRb R0, [R1, 0x20] 59 | ADR R0, s_test2 60 | LDRb R0, [R0] 61 | STRb R0, [R1, 0x20] 62 | bl pause 63 | 64 | ldr R1, [UART0] 65 | ADR R0, s_test1 66 | LDRb R0, [R0] 67 | STRb R0, [R1, 0x20] 68 | ADR R0, s_test2 69 | LDRb R0, [R0] 70 | STRb R0, [R1, 0x20] 71 | bl pause 72 | ldr R1, [UART1] 73 | ADR R0, s_test1 74 | LDRb R0, [R0] 75 | STRb R0, [R1, 0x20] 76 | ADR R0, s_test2 77 | LDRb R0, [R0] 78 | STRb R0, [R1, 0x20] 79 | bl pause 80 | 81 | 82 | b StartUp 83 | 84 | pause: 85 | mov r0, 0 86 | pause_loop: 87 | add r0, r0, 1 88 | cmp r0, 0x1000 89 | BCC pause_loop 90 | MOV PC, LR 91 | 92 | UART0 dw 0xE2900000 93 | UART1 dw 0xE2900400 94 | UART2 dw 0xE2900800 95 | 96 | s_test1 db 'h',0 97 | align 4 98 | s_test2 db 'y',0 99 | align 4 100 | 101 | 102 | 103 | 104 | jump_to_sgs_ibl: 105 | STMFD SP!, {LR} 106 | B sgs_ibl_stage2 107 | FUNCTIONS 108 | 109 | 110 | align 4 111 | 112 | fillup2: 113 | db 0x4000 - (fillup2-c_start) dup 0 114 | sgs_ibl_stage2: 115 | file 'init_by_rebell.bin' 116 | 117 | 118 | fillup4: 119 | db 0x6000 - (fillup4-c_start) dup 0 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hummingbird-hibl 2 | 3 | Prerequisites: 4 | * Linux machine (e.g. Ubuntu) 5 | * gksudo (Get it on Debian/Ubuntu systems with `sudo apt-get install gksu`) 6 | --------------------------------------------------------------------------------