mirror of
				https://github.com/topjohnwu/Magisk
				synced 2025-10-31 10:40:52 +01:00 
			
		
		
		
	Compare commits
	
		
			527 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 4fd61345af | ||
|   | 66cca24453 | ||
|   | e733484fab | ||
|   | e5c3183025 | ||
|   | 930c82316a | ||
|   | 3dc22db265 | ||
|   | d8c51cb286 | ||
|   | 2f79d0c3b3 | ||
|   | d8bb3af06b | ||
|   | e139e8777b | ||
|   | d52d7cfbd9 | ||
|   | 4f74a259e3 | ||
|   | 74da6e1dc0 | ||
|   | 84ffdf0ed5 | ||
|   | 022b18c8ce | ||
|   | b92b1dcddb | ||
|   | 1472dbb291 | ||
|   | d58a8dc868 | ||
|   | e94be0b70e | ||
|   | f6ae7e1bf1 | ||
|   | f7b4935677 | ||
|   | a3c49de6a5 | ||
|   | e8dd1b292f | ||
|   | d21264d01b | ||
|   | b0567eadfd | ||
|   | 5fc2058336 | ||
|   | d0567d29d2 | ||
|   | 4db0ad32f0 | ||
|   | d065040321 | ||
|   | 17f0fea3fc | ||
|   | 8ca1e43533 | ||
|   | bd01c314dc | ||
|   | e404476609 | ||
|   | 942c870981 | ||
|   | baff9256c5 | ||
|   | b4c0a255fc | ||
|   | 9f6a27c20d | ||
|   | 742dc137ed | ||
|   | 39a6bd33ce | ||
|   | 4672a5fad6 | ||
|   | e649b0a2df | ||
|   | fd8dbe3eff | ||
|   | bb97cc594d | ||
|   | 70a322263e | ||
|   | c6f144d482 | ||
|   | 3709489b3a | ||
|   | 145ef32e28 | ||
|   | 2212800a23 | ||
|   | 2e25431bb6 | ||
|   | 32c8e7522f | ||
|   | a5e4f3cc6b | ||
|   | a30777bd9f | ||
|   | e989195a68 | ||
|   | 997d58932e | ||
|   | b4015f877f | ||
|   | d15fff95b9 | ||
|   | 687e3b13ea | ||
|   | 8c6bb383b7 | ||
|   | bc592c1d13 | ||
|   | 968bd8be67 | ||
|   | d8b8adb88c | ||
|   | f42d820891 | ||
|   | bc21a1fb71 | ||
|   | 3bc31374ac | ||
|   | 858e7bae2b | ||
|   | 8c02d120a2 | ||
|   | 07e353f4ff | ||
|   | bb33d9e600 | ||
|   | 68eb0bdec9 | ||
|   | 32ee8e462c | ||
|   | e79aa54b70 | ||
|   | 9a95652034 | ||
|   | 912c188b53 | ||
|   | e9d0f615ba | ||
|   | 9136573596 | ||
|   | 2487ec94e6 | ||
|   | 811489f157 | ||
|   | b438cc9335 | ||
|   | 1d3d30fa45 | ||
|   | 72b5985398 | ||
|   | 2db60e0a6b | ||
|   | e710848345 | ||
|   | 8d6f3c2450 | ||
|   | f863d127e7 | ||
|   | a831110816 | ||
|   | e97bdb53f4 | ||
|   | fe1439fbac | ||
|   | 2bc30e5c22 | ||
|   | 7244c02a0d | ||
|   | 6c229ffa68 | ||
|   | cdc5d983f3 | ||
|   | 96688e4dac | ||
|   | 28a945fee9 | ||
|   | c7e777255a | ||
|   | 2dd4cf040e | ||
|   | d1b9eca5eb | ||
|   | 594a67fe28 | ||
|   | cddeaffada | ||
|   | 2a8898e7c3 | ||
|   | ce3f3b09b4 | ||
|   | fe4b3df7e9 | ||
|   | 25bdbcf526 | ||
|   | df7eaa5598 | ||
|   | bb7099376b | ||
|   | 0327fd9710 | ||
|   | e645c6e465 | ||
|   | 78a3d36ccc | ||
|   | 3942858ccd | ||
|   | 03c8d716cc | ||
|   | 60181c4fcb | ||
|   | c215447405 | ||
|   | 89330b89d8 | ||
|   | a8f3718ed0 | ||
|   | a78ba44709 | ||
|   | ff110e3513 | ||
|   | cfae6c63b5 | ||
|   | dbfe49c56f | ||
|   | 98e21f9f5b | ||
|   | 83af0497e4 | ||
|   | 6ce37b44db | ||
|   | 9cb1cf756f | ||
|   | ffa005e4ab | ||
|   | af102e47f1 | ||
|   | 73064a816d | ||
|   | 9b4ae8fcc5 | ||
|   | a1a2c52409 | ||
|   | 9a0b26e0b0 | ||
|   | b805b96e16 | ||
|   | 590e7f7724 | ||
|   | 4d61e5e319 | ||
|   | 8c8a63ebfb | ||
|   | e5e34797a8 | ||
|   | 8516ebe6f5 | ||
|   | 9f6205f47f | ||
|   | 8b2ec23a89 | ||
|   | 1816ca6b02 | ||
|   | 7394ff9346 | ||
|   | bb5a6a1c28 | ||
|   | b614b06736 | ||
|   | 7a376c9efc | ||
|   | 518f3d229f | ||
|   | 46c91f923d | ||
|   | 3a2262dfb3 | ||
|   | ff7c38f8e9 | ||
|   | 4229ba364f | ||
|   | ba8e7a211a | ||
|   | 6b41653a32 | ||
|   | 59c1125e72 | ||
|   | b536046720 | ||
|   | 619b805894 | ||
|   | 8662537883 | ||
|   | 717890395b | ||
|   | b7b4164f4f | ||
|   | 7e65296470 | ||
|   | cd5f5d702f | ||
|   | 44b93e7cc4 | ||
|   | 0eb79e5acd | ||
|   | eceba26894 | ||
|   | 0bf404f75e | ||
|   | cd8dd65a65 | ||
|   | 50c56f8b50 | ||
|   | 9e9f8ca8f3 | ||
|   | f63af0601c | ||
|   | 189c671ce2 | ||
|   | bb39a01361 | ||
|   | 764999704a | ||
|   | ecfa4aafc1 | ||
|   | a1e33c4d2f | ||
|   | 7f8ba74dac | ||
|   | e3df62d812 | ||
|   | 1913125881 | ||
|   | e8e58f3fed | ||
|   | 1ca9ec384b | ||
|   | 9522255e3a | ||
|   | 2a22fa694e | ||
|   | 1591f5a0ca | ||
|   | 3bc4e9a724 | ||
|   | f7a6bb0723 | ||
|   | e9c17a3ef7 | ||
|   | 29bb5840b5 | ||
|   | c9d8d860f6 | ||
|   | cc18096882 | ||
|   | 15f2a664d1 | ||
|   | 70b4f62ddc | ||
|   | e1023fdfaf | ||
|   | 5e9648387a | ||
|   | 2ba8b4df67 | ||
|   | 3a084c5d7b | ||
|   | f7200e39c3 | ||
|   | a7dfc20967 | ||
|   | 6eb7c0b5d6 | ||
|   | 0b3c078aeb | ||
|   | 750872cc37 | ||
|   | 29895ff474 | ||
|   | 44adccc147 | ||
|   | 2a7e2c70b5 | ||
|   | 8d431b6762 | ||
|   | 273849c0c8 | ||
|   | 5cc14405c7 | ||
|   | f0cfd60e62 | ||
|   | d6547f0701 | ||
|   | 3b68905037 | ||
|   | eae611c54d | ||
|   | b37bad35c2 | ||
|   | 5fab15fee5 | ||
|   | 10c8ea17aa | ||
|   | 7058c8ff5a | ||
|   | 64e85da59f | ||
|   | f79fad64aa | ||
|   | cb70eebb08 | ||
|   | edaf8787d1 | ||
|   | 24164c8580 | ||
|   | 9fca7011aa | ||
|   | b13eb3fd40 | ||
|   | b7986a351c | ||
|   | ce87591c62 | ||
|   | 25c289ad3e | ||
|   | 8c5f11b7dd | ||
|   | 7f7dda9ec2 | ||
|   | 9c1005ff0c | ||
|   | 5b36b4472c | ||
|   | a3fcc64aaa | ||
|   | f3078bc903 | ||
|   | 6072744f7e | ||
|   | a87ad35a50 | ||
|   | cf56d7e4ed | ||
|   | e33a5eb307 | ||
|   | e5b704eb32 | ||
|   | 56457bd325 | ||
|   | bdbb3c6657 | ||
|   | c4d7001489 | ||
|   | c07bac9a63 | ||
|   | d27d04783f | ||
|   | 58de5a7ec7 | ||
|   | 504a9b4746 | ||
|   | cccb5a3e08 | ||
|   | d75fa62cab | ||
|   | 3d43c3c5bc | ||
|   | b570b363d9 | ||
|   | b9968aa1e6 | ||
|   | c0d77808f6 | ||
|   | 9679492c28 | ||
|   | f3b68e6543 | ||
|   | 0dcfaaf5ff | ||
|   | ba513dcb9a | ||
|   | ebabc60477 | ||
|   | cf565d0145 | ||
|   | 52a23e7904 | ||
|   | 9e22b80714 | ||
|   | 7eed9c4a6d | ||
|   | bf42fce17e | ||
|   | 9d421226a7 | ||
|   | 7b9be8369e | ||
|   | 7cf4b819ae | ||
|   | 9e1aea33c3 | ||
|   | 8767a88854 | ||
|   | 47c0084641 | ||
|   | 54e6a790cf | ||
|   | 2a86bc8695 | ||
|   | 04538372c6 | ||
|   | 9430ed66cd | ||
|   | 96f8efc27a | ||
|   | a90e8b6112 | ||
|   | 561c1fb798 | ||
|   | 806fec7017 | ||
|   | b3da28eade | ||
|   | 166f6412c2 | ||
|   | 1e877808bc | ||
|   | 1777d9f751 | ||
|   | 309b99eac0 | ||
|   | a5aa1b3917 | ||
|   | aced0632ec | ||
|   | 4e801788d7 | ||
|   | 0b4baad78b | ||
|   | 201e32d4c4 | ||
|   | 0980cb6eb5 | ||
|   | f75d23363b | ||
|   | 6c0ba66f17 | ||
|   | f32ce7392e | ||
|   | 8bf382adad | ||
|   | 541ba357bb | ||
|   | b6578b52e3 | ||
|   | fb01c43ece | ||
|   | b9a012c6e3 | ||
|   | 17684ed8a8 | ||
|   | 1b6b3b2cd5 | ||
|   | acd8567586 | ||
|   | e780c76c93 | ||
|   | 532c6caddf | ||
|   | ef8d9be633 | ||
|   | 2cdbcc5666 | ||
|   | c282a8f328 | ||
|   | b9eab39541 | ||
|   | 20903784a4 | ||
|   | 3ec9ff7467 | ||
|   | 17d3a87b1f | ||
|   | 14c5c60863 | ||
|   | 70a80090c4 | ||
|   | b6cb5d09cb | ||
|   | 69cfde4516 | ||
|   | bdc83da098 | ||
|   | f872a122a9 | ||
|   | aa92e4cbd0 | ||
|   | e603877a17 | ||
|   | bb96477779 | ||
|   | 543ee79720 | ||
|   | ea8cd98361 | ||
|   | 58849f28a8 | ||
|   | d66c284bed | ||
|   | 693848280b | ||
|   | 396afaa181 | ||
|   | 05ed29133b | ||
|   | a31c1e8084 | ||
|   | 21891230f2 | ||
|   | 47da76c5a5 | ||
|   | 6017ff2318 | ||
|   | e16d604d0d | ||
|   | d3d5703f3f | ||
|   | 62fe92d922 | ||
|   | 512e7be74f | ||
|   | 727abbea8f | ||
|   | 76f81ece62 | ||
|   | 495654f9ff | ||
|   | 95fec2100e | ||
|   | 623a879797 | ||
|   | 4c96d23f48 | ||
|   | 9bc8f6e9d7 | ||
|   | e00e6509ee | ||
|   | be5739508b | ||
|   | 38c867ea94 | ||
|   | 2a985ce6c0 | ||
|   | e4f3fb36f3 | ||
|   | b2f8792873 | ||
|   | 2065133e2d | ||
|   | 86da87f254 | ||
|   | 102a7f8723 | ||
|   | e9afc15719 | ||
|   | 08527dde9b | ||
|   | d9c3a3c9a9 | ||
|   | fe89f9e55e | ||
|   | 73802aabac | ||
|   | bc66733289 | ||
|   | f4c93b2251 | ||
|   | c079c598f2 | ||
|   | 8a2f0063d4 | ||
|   | dfe4b33f2f | ||
|   | 2f7cfa7ab2 | ||
|   | bdcb813ee6 | ||
|   | f0751007f3 | ||
|   | 6ad993704c | ||
|   | 796c3009c7 | ||
|   | 144ff5e716 | ||
|   | 054a1e5ea4 | ||
|   | a223f6056e | ||
|   | a1fd7704e0 | ||
|   | b94227efc9 | ||
|   | 3a7e782c07 | ||
|   | 8f6b33d790 | ||
|   | f476daa041 | ||
|   | acfde9458d | ||
|   | 82e969627a | ||
|   | 40766b3375 | ||
|   | d274e45587 | ||
|   | 0a0eb3f710 | ||
|   | 81d054a525 | ||
|   | 2e185f4ec9 | ||
|   | 67f347f880 | ||
|   | 81542fc6a8 | ||
|   | 5aced279d6 | ||
|   | 3f016f785f | ||
|   | a6427d081e | ||
|   | 8c7fbe20f9 | ||
|   | 469aba8ed0 | ||
|   | 6e8e4ad5da | ||
|   | 2f33d654e4 | ||
|   | 760b6385f1 | ||
|   | 91527500f9 | ||
|   | e87d989ca3 | ||
|   | 64d61bae08 | ||
|   | 9862265465 | ||
|   | 624b7616d0 | ||
|   | d53f33bed8 | ||
|   | 02e039d792 | ||
|   | 9f9333315e | ||
|   | 0d10b812fe | ||
|   | b4fe4f3d10 | ||
|   | ba93fcbda0 | ||
|   | 88d19a4ca4 | ||
|   | af7b9ea898 | ||
|   | 09cd0468cf | ||
|   | 529aa754f5 | ||
|   | 3c7e865555 | ||
|   | 7877ac0c3b | ||
|   | 1442e29d0e | ||
|   | 9a7e9b736e | ||
|   | c421e45fa0 | ||
|   | 8833d21ac3 | ||
|   | 1a3c522c94 | ||
|   | c55aa92d4f | ||
|   | 212a303347 | ||
|   | 3f3568d8af | ||
|   | 1e3bcfc8cd | ||
|   | a4ce9f6f05 | ||
|   | 65dc99744e | ||
|   | c6d4740b0c | ||
|   | 9f91c8b59d | ||
|   | 2b3b087c29 | ||
|   | e08d46aa76 | ||
|   | feccc97a14 | ||
|   | 77eec3d21d | ||
|   | ecaafd1b70 | ||
|   | 0d51997e46 | ||
|   | 463cbceb07 | ||
|   | 1437c5c63f | ||
|   | 52f1d50902 | ||
|   | a839cb787e | ||
|   | f621fb2060 | ||
|   | 2ccd8b8838 | ||
|   | 7ef0746c52 | ||
|   | 6f609f0dd7 | ||
|   | ee2a30470a | ||
|   | e11fb2c09e | ||
|   | c6e9270590 | ||
|   | 3e2e171407 | ||
|   | 332f531a10 | ||
|   | bae2c9bc63 | ||
|   | 5ac68f8df8 | ||
|   | 06d3b94804 | ||
|   | e7c314fefc | ||
|   | faab79b41a | ||
|   | 14204c9bfc | ||
|   | 45dbd4464b | ||
|   | 472255924a | ||
|   | 6d3ac2aa55 | ||
|   | 9ad03994d1 | ||
|   | 35228f80b8 | ||
|   | 69ded881c6 | ||
|   | d9bce45db4 | ||
|   | 5e92b4faa9 | ||
|   | db501822ef | ||
|   | ef9948a967 | ||
|   | 298f09402f | ||
|   | d4149d4b7a | ||
|   | 3315228a90 | ||
|   | f72205c401 | ||
|   | 11862bbaee | ||
|   | 8d846993ee | ||
|   | 1f84626278 | ||
|   | b4cfe6e9c0 | ||
|   | 94a861e318 | ||
|   | 1421e775d2 | ||
|   | f8eab72c7a | ||
|   | 2afd2f0d3b | ||
|   | 2b72f40cec | ||
|   | ff5c0d6361 | ||
|   | 198b14e5fc | ||
|   | f9fea265cf | ||
|   | 668601ca23 | ||
|   | 99406f2099 | ||
|   | 632b3cb9ae | ||
|   | 0bf04c04f9 | ||
|   | dc29018ec0 | ||
|   | b6412afe96 | ||
|   | 4e88186903 | ||
|   | f387378b69 | ||
|   | f894e6b4ea | ||
|   | e33f5996f3 | ||
|   | 8f7f1ff7dd | ||
|   | 54a0e52e05 | ||
|   | b2431b982f | ||
|   | 8d6d619eed | ||
|   | 70e332b9e8 | ||
|   | 0a53c42a8a | ||
|   | 0ccc92dc1e | ||
|   | c9157cc13b | ||
|   | 2b1270381d | ||
|   | cdb8ee3946 | ||
|   | 1e3586621b | ||
|   | c07e9ac29d | ||
|   | 6e3bb48574 | ||
|   | 16d7ae62bd | ||
|   | eea3cb32a5 | ||
|   | 670fe8590c | ||
|   | 30c048723c | ||
|   | 85dc669ddf | ||
|   | 397c1a1c2b | ||
|   | f1d3e35aac | ||
|   | 0e69201f05 | ||
|   | f8fdaf5c1f | ||
|   | 1f3b81338c | ||
|   | 5921d3a42a | ||
|   | dbbc85719e | ||
|   | 0ddb6c3f10 | ||
|   | e13281726c | ||
|   | 0ddf4355a1 | ||
|   | 7c8a3ca1a8 | ||
|   | 3068738a70 | ||
|   | cfa0d8b7c0 | ||
|   | 7ac41652f7 | ||
|   | 24a510bc2e | ||
|   | 0498540439 | ||
|   | da94c2e1e5 | ||
|   | bcdd74514f | ||
|   | 1d0c36a0ab | ||
|   | a34ea8f131 | ||
|   | 7fbfa6a52b | ||
|   | 799ef3380d | ||
|   | d5087858ca | ||
|   | d9fc5650b8 | ||
|   | 9ea028f5ab | ||
|   | aa309087fd | ||
|   | 57bdd9d3bf | ||
|   | dc9871fe5b | ||
|   | 3255ca3ea4 | ||
|   | a06ef6fe25 | ||
|   | 696d256fa0 | ||
|   | 70e8ad7104 | ||
|   | f785dcac3d | ||
|   | aa54ef10ae | ||
|   | 14946da163 | ||
|   | 5f9bcfbefe | ||
|   | aa2eed2c38 | ||
|   | 6bff6e9cff | ||
|   | 023d369b74 | ||
|   | c9d4241afe | ||
|   | e1279c29c2 | ||
|   | 2d6fb1c45e | 
							
								
								
									
										18
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| # Set the default behavior, in case people don't have core.autocrlf set. | ||||
| * text eol=lf | ||||
|  | ||||
| # Explicitly declare text files you want to always be normalized and converted | ||||
| # to native line endings on checkout. | ||||
| # *.c text | ||||
| # *.h text | ||||
|  | ||||
| # Declare files that will always have CRLF line endings on checkout. | ||||
| *.cmd text eol=crlf | ||||
| *.bat text eol=crlf | ||||
|  | ||||
| # Denote all files that are truly binary and should not be modified. | ||||
| chromeos/** binary | ||||
| *.jar binary | ||||
| *.exe binary | ||||
| *.apk binary | ||||
| *.png binary | ||||
							
								
								
									
										18
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +1,16 @@ | ||||
| obj | ||||
| libs | ||||
| out | ||||
| *.zip | ||||
| *.jks | ||||
| *.apk | ||||
|  | ||||
| # Built binaries | ||||
| ziptools/zipadjust | ||||
|  | ||||
| # Android Studio / Gradle | ||||
| *.iml | ||||
| .gradle | ||||
| /local.properties | ||||
| /.idea | ||||
| /build | ||||
| /captures | ||||
| .externalNativeBuild | ||||
|   | ||||
							
								
								
									
										33
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,27 @@ | ||||
| [submodule "selinux"] | ||||
| 	path = selinux | ||||
| 	url = https://github.com/topjohnwu/selinux | ||||
| [submodule "jni/sepolicy-inject"] | ||||
| 	path = jni/sepolicy-inject | ||||
| 	url = https://github.com/topjohnwu/sepolicy-inject | ||||
| [submodule "jni/selinux"] | ||||
| 	path = core/jni/external/selinux | ||||
| 	url = https://github.com/topjohnwu/selinux.git | ||||
| [submodule "jni/su"] | ||||
| 	path = core/jni/su | ||||
| 	url = https://github.com/topjohnwu/MagiskSU.git | ||||
| [submodule "jni/magiskpolicy"] | ||||
| 	path = core/jni/magiskpolicy | ||||
| 	url = https://github.com/topjohnwu/magiskpolicy.git | ||||
| [submodule "MagiskManager"] | ||||
| 	path = app | ||||
| 	url = https://github.com/topjohnwu/MagiskManager.git | ||||
| [submodule "jni/busybox"] | ||||
| 	path = core/jni/external/busybox | ||||
| 	url = https://github.com/topjohnwu/ndk-busybox.git | ||||
| [submodule "jni/external/dtc"] | ||||
| 	path = core/jni/external/dtc | ||||
| 	url = https://github.com/dgibson/dtc | ||||
| [submodule "jni/external/lz4"] | ||||
| 	path = core/jni/external/lz4 | ||||
| 	url = https://github.com/lz4/lz4.git | ||||
| [submodule "jni/external/bzip2"] | ||||
| 	path = core/jni/external/bzip2 | ||||
| 	url = https://github.com/nemequ/bzip2.git | ||||
| [submodule "jni/external/xz"] | ||||
| 	path = core/jni/external/xz | ||||
| 	url = https://github.com/xz-mirror/xz.git | ||||
|   | ||||
							
								
								
									
										83
									
								
								README.MD
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								README.MD
									
									
									
									
									
								
							| @@ -1,4 +1,81 @@ | ||||
| # Magisk | ||||
| Static binaries included: | ||||
| * Busybox: http://forum.xda-developers.com/android/software-hacking/tool-busybox-flashable-archs-t3348543 | ||||
| * Open source su binary: https://github.com/seSuperuser/Superuser | ||||
|  | ||||
| ## How to build Magisk | ||||
|  | ||||
| #### Building has been tested on 3 major platforms: macOS, Ubuntu, Windows 10 | ||||
|  | ||||
| ### Environment Requirements | ||||
|  | ||||
| 1. A 64-bit machine: `cmake` for Android is only available in 64-bit | ||||
| 2. Python 3.5+: run `build.py` script | ||||
| 3. Java Development Kit (JDK) 8: Compile Magisk Manager and sign zips | ||||
| 4. Latest Android SDK: `ANDROID_HOME` environment variable should point to the Android SDK folder | ||||
| 5. Android NDK: Install NDK along with SDK (`$ANDROID_HOME/ndk-bundle`), or specify custom path `ANDROID_NDK` | ||||
| 6. (Windows Only) Python package Colorama: Install with `pip install colorama`, used for ANSI color codes | ||||
| 7. (Unix only) C compiler: Build `zipadjust`. Windows users can use the pre-built `zipadjust.exe` | ||||
|  | ||||
| ### Instructions and Notes | ||||
| 1. Magisk can be built with the latest NDK (r16 as of writing), however binaries released officially will be built with NDK r10e due to ELF incompatibilities with the binaries built from the newer NDKs. | ||||
| 2. The easiest way to setup the environment is by importing this folder as an Android Studio project. The IDE will download required components and construct the environment for you. You still have to set the `ANDROID_HOME` environment variable to point to the SDK path. | ||||
| 3. Run `build.py` with argument `-h` to see the built-in help message. The `-h` option also works for each supported actions, e.g. `./build.py binary -h` | ||||
| 4. Build everything with `build.py`, don't directly call `gradlew` or `ndk-build`, since most requires special setup / dependencies. | ||||
| 5. By default, `build.py` will build binaries and Magisk Manager in debug mode. If you want to build Magisk Manager in release mode (through the flag `--release`), you will need to place a Java Keystore file at `release_signature.jks` to sign Magisk Manager's APK. For more information, check out [Google's Official Documentation](https://developer.android.com/studio/publish/app-signing.html#signing-manually). | ||||
|  | ||||
|  | ||||
| ## License | ||||
|  | ||||
| ``` | ||||
| Magisk, including all git submodules are free software: | ||||
| you can redistribute it and/or modify it under the terms of the  | ||||
| GNU General Public License as published by the Free Software Foundation,  | ||||
| either version 3 of the License, or (at your option) any later version. | ||||
|  | ||||
| This program is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| GNU General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU General Public License | ||||
| along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
| ``` | ||||
|  | ||||
| ## Credits | ||||
|  | ||||
| **MagiskManager** (`app`) | ||||
|  | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * All contributors and translators on Github | ||||
|  | ||||
| **MagiskSU** (`core/jni/su`) | ||||
|  | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2015, Pierre-Hugues Husson (phh@phh.me) | ||||
| * Copyright 2013, Koushik Dutta (@koush) | ||||
| * Copyright 2010, Adam Shanks (@ChainsDD) | ||||
| * Copyright 2008, Zinx Verituse (@zinxv) | ||||
|  | ||||
| **MagiskPolicy** (`core/jni/magiskpolicy`) | ||||
|  | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2015, Pierre-Hugues Husson (phh@phh.me) | ||||
| * Copyright 2015, Joshua Brindle (@joshua_brindle) | ||||
|  | ||||
| **MagiskHide** (`core/jni/magiskhide`) | ||||
|  | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
| * Copyright 2016, Pierre-Hugues Husson (phh@phh.me) | ||||
|  | ||||
| **resetprop** (`core/jni/resetprop`) | ||||
|  | ||||
|  * Copyright 2016-2018 John Wu (@topjohnwu) | ||||
|  * Copyright 2016 nkk71 (nkk71x@gmail.com) | ||||
|  | ||||
| **External Dependencies** (`core/jni/external`) | ||||
|  | ||||
| * Makefile for busybox, generated by [ndk-busybox-kitchen](https://github.com/topjohnwu/ndk-busybox-kitchen) | ||||
| * Each dependencies has its own license/copyright information in each subdirectory.   | ||||
| All of them are either GPL or GPL compatible. | ||||
|  | ||||
| **Others Not Mentioned** | ||||
|  | ||||
| * Copyright 2016-2018, John Wu (@topjohnwu) | ||||
|   | ||||
							
								
								
									
										1
									
								
								app
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								app
									
									
									
									
									
										Submodule
									
								
							 Submodule app added at 2e02af994e
									
								
							
							
								
								
									
										27
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								build.gradle
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||
|  | ||||
| buildscript { | ||||
|      | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath 'com.android.tools.build:gradle:3.0.1' | ||||
|          | ||||
|  | ||||
|         // NOTE: Do not place your application dependencies here; they belong | ||||
|         // in the individual module build.gradle files | ||||
|     } | ||||
| } | ||||
|  | ||||
| allprojects { | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|     } | ||||
| } | ||||
|  | ||||
| task clean(type: Delete) { | ||||
|     delete rootProject.buildDir | ||||
| } | ||||
							
								
								
									
										3
									
								
								core/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								core/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| /build | ||||
| obj | ||||
| libs | ||||
							
								
								
									
										20
									
								
								core/build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								core/build.gradle
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| apply plugin: 'com.android.library' | ||||
|  | ||||
| android { | ||||
|     compileSdkVersion 27 | ||||
|  | ||||
|     externalNativeBuild { | ||||
|         ndkBuild { | ||||
|             path 'jni/Android.mk' | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     defaultConfig { | ||||
|         externalNativeBuild { | ||||
|             ndkBuild { | ||||
|                 // Passes an optional argument to ndk-build. | ||||
|                 arguments "GRADLE=true" | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										138
									
								
								core/jni/Android.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								core/jni/Android.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,138 @@ | ||||
| LOCAL_PATH := $(call my-dir) | ||||
|  | ||||
| # Some handy paths | ||||
| EXT_PATH := jni/external | ||||
| SE_PATH := $(EXT_PATH)/selinux | ||||
| LIBSELINUX := $(SE_PATH)/libselinux/include | ||||
| LIBSEPOL := $(SE_PATH)/libsepol/include $(SE_PATH)/libsepol/cil/include | ||||
| LIBLZMA := $(EXT_PATH)/xz/src/liblzma/api | ||||
| LIBLZ4 := $(EXT_PATH)/lz4/lib | ||||
| LIBBZ2 := $(EXT_PATH)/bzip2 | ||||
| LIBFDT := $(EXT_PATH)/dtc/libfdt | ||||
| UTIL_SRC := utils/cpio.c \ | ||||
|             utils/file.c \ | ||||
|             utils/img.c \ | ||||
|             utils/list.c \ | ||||
|             utils/misc.c \ | ||||
|             utils/pattern.c \ | ||||
|             utils/vector.c \ | ||||
|             utils/xwrap.c | ||||
|  | ||||
| ######################## | ||||
| # Binaries | ||||
| ######################## | ||||
|  | ||||
| ifneq "$(or $(PRECOMPILE), $(GRADLE))" "" | ||||
|  | ||||
| # magisk main binary | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magisk | ||||
| LOCAL_SHARED_LIBRARIES := libsqlite libselinux | ||||
|  | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	jni/external/include \ | ||||
| 	$(LIBSELINUX) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	core/magisk.c \ | ||||
| 	core/daemon.c \ | ||||
| 	core/log_monitor.c \ | ||||
| 	core/bootstages.c \ | ||||
| 	core/socket.c \ | ||||
| 	magiskhide/magiskhide.c \ | ||||
| 	magiskhide/proc_monitor.c \ | ||||
| 	magiskhide/hide_utils.c \ | ||||
| 	resetprop/resetprop.cpp \ | ||||
| 	resetprop/system_properties.cpp \ | ||||
| 	su/su.c \ | ||||
| 	su/activity.c \ | ||||
| 	su/db.c \ | ||||
| 	su/pts.c \ | ||||
| 	su/su_daemon.c \ | ||||
| 	su/su_socket.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| LOCAL_CFLAGS := -DIS_DAEMON -DSELINUX | ||||
| LOCAL_LDLIBS := -llog | ||||
| include $(BUILD_EXECUTABLE) | ||||
|  | ||||
| endif | ||||
|  | ||||
| ifndef PRECOMPILE | ||||
|  | ||||
| # magiskinit | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magiskinit | ||||
| LOCAL_STATIC_LIBRARIES := libsepol liblzma | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	jni/magiskpolicy \ | ||||
| 	../out/$(TARGET_ARCH_ABI) \ | ||||
| 	$(LIBSEPOL) \ | ||||
| 	$(LIBLZMA) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	core/magiskinit.c \ | ||||
| 	core/socket.c \ | ||||
| 	magiskpolicy/api.c \ | ||||
| 	magiskpolicy/magiskpolicy.c \ | ||||
| 	magiskpolicy/rules.c \ | ||||
| 	magiskpolicy/sepolicy.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| LOCAL_LDFLAGS := -static | ||||
| include $(BUILD_EXECUTABLE) | ||||
|  | ||||
| # magiskboot | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := magiskboot | ||||
| LOCAL_STATIC_LIBRARIES := liblzma liblz4 libbz2 libfdt | ||||
| LOCAL_C_INCLUDES := \ | ||||
| 	jni/include \ | ||||
| 	jni/external/include \ | ||||
| 	$(LIBLZMA) \ | ||||
| 	$(LIBLZ4) \ | ||||
| 	$(LIBBZ2) \ | ||||
| 	$(LIBFDT) | ||||
|  | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	external/sha1/sha1.c \ | ||||
| 	magiskboot/main.c \ | ||||
| 	magiskboot/bootimg.c \ | ||||
| 	magiskboot/hexpatch.c \ | ||||
| 	magiskboot/compress.c \ | ||||
| 	magiskboot/types.c \ | ||||
| 	magiskboot/dtb.c \ | ||||
| 	magiskboot/ramdisk.c \ | ||||
| 	$(UTIL_SRC) | ||||
|  | ||||
| LOCAL_CFLAGS := -DXWRAP_EXIT | ||||
| LOCAL_LDLIBS := -lz | ||||
| include $(BUILD_EXECUTABLE) | ||||
|  | ||||
| # 32-bit static binaries | ||||
| ifndef GRADLE  # Do not run gradle sync on these binaries | ||||
| ifneq ($(TARGET_ARCH_ABI), x86_64) | ||||
| ifneq ($(TARGET_ARCH_ABI), arm64-v8a) | ||||
| # b64xz | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := b64xz | ||||
| LOCAL_STATIC_LIBRARIES := liblzma | ||||
| LOCAL_C_INCLUDES := $(LIBLZMA) | ||||
| LOCAL_SRC_FILES := b64xz.c | ||||
| LOCAL_LDFLAGS := -static | ||||
| include $(BUILD_EXECUTABLE) | ||||
| # Busybox | ||||
| include jni/external/busybox/Android.mk | ||||
| endif | ||||
| endif | ||||
| endif | ||||
|  | ||||
| # Precompile | ||||
| endif | ||||
|  | ||||
| ######################## | ||||
| # Externals | ||||
| ######################## | ||||
| include jni/external/Android.mk | ||||
							
								
								
									
										4
									
								
								core/jni/Application.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								core/jni/Application.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a | ||||
| APP_PLATFORM := android-21 | ||||
| APP_CFLAGS := $(MAGISK_FLAGS) -std=gnu99 | ||||
| APP_CPPFLAGS := -std=c++11 | ||||
							
								
								
									
										83
									
								
								core/jni/b64xz.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								core/jni/b64xz.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| /* b64xz.c - Base64-XZ Extractor | ||||
|  * | ||||
|  * This program expects data from stdin. The data should be compressed with xz and | ||||
|  * then encoded into base64 format. What b64xz does is basically the reverse of the | ||||
|  * mentioned process: decode base64 to uint8_ts, decompress xz, then dump to stdout | ||||
|  * | ||||
|  * The compiled binary will be hex-dumped into update-binary | ||||
|  * Busybox will be xz-compressed, base64 encoded and dumped into update-binary | ||||
|  * This program is to recover busybox for Magisk installation environment | ||||
|  * | ||||
|  * I intentionally removed stdio. This will result in a smaller binary size because | ||||
|  * all I/O are handled by system calls (read/write) instead of libc wrappers | ||||
|  */ | ||||
|  | ||||
| #include <unistd.h> | ||||
| #include <lzma.h> | ||||
|  | ||||
| #define BUFSIZE 8192 | ||||
|  | ||||
| static const char trans_tbl[] = | ||||
| 		"|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; | ||||
|  | ||||
| static void decodeblock(uint8_t* in, uint8_t* out) { | ||||
| 	out[0] = (uint8_t)(in[0] << 2 | in[1] >> 4); | ||||
| 	out[1] = (uint8_t)(in[1] << 4 | in[2] >> 2); | ||||
| 	out[2] = (uint8_t)(((in[2] << 6) & 0xc0) | in[3]); | ||||
| } | ||||
|  | ||||
| static int unxz(lzma_stream *strm, void *buf, size_t size) { | ||||
| 	lzma_ret ret = 0; | ||||
| 	uint8_t out[BUFSIZE]; | ||||
| 	strm->next_in = buf; | ||||
| 	strm->avail_in = size; | ||||
| 	do { | ||||
| 		strm->next_out = out; | ||||
| 		strm->avail_out = sizeof(out); | ||||
| 		ret = lzma_code(strm, LZMA_RUN); | ||||
| 		write(STDOUT_FILENO, out, sizeof(out) - strm->avail_out); | ||||
| 	} while (strm->avail_out == 0 && ret == LZMA_OK); | ||||
|  | ||||
| 	if (ret != LZMA_OK && ret != LZMA_STREAM_END) | ||||
| 		write(STDERR_FILENO, "LZMA error!\n", 13); | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| int main(int argc, char const* argv[]) { | ||||
| 	if (argc > 1) | ||||
| 		return 0; | ||||
|  | ||||
| 	uint8_t in[4], buf[BUFSIZE]; | ||||
| 	int len = 0, pos = 0; | ||||
| 	char c; | ||||
|  | ||||
| 	// Setup lzma stream | ||||
| 	lzma_stream strm = LZMA_STREAM_INIT; | ||||
| 	if (lzma_auto_decoder(&strm, UINT64_MAX, 0) != LZMA_OK) { | ||||
| 		write(STDERR_FILENO, "Unable to init lzma stream\n", 28); | ||||
| 		return 1; | ||||
| 	} | ||||
|  | ||||
| 	while (read(STDIN_FILENO, &c, sizeof(c)) == 1) { | ||||
| 		c = ((c < 43 || c > 122) ? -1 : (trans_tbl[c - 43] == '$' ? -1 : trans_tbl[c - 43] - 62)); | ||||
| 		if (c >= 0) | ||||
| 			in[len++] = c; | ||||
| 		if (len < 4) | ||||
| 			continue; | ||||
| 		len = 0; | ||||
| 		decodeblock(in, buf + pos); | ||||
| 		pos += 3; | ||||
| 		if (pos > sizeof(buf) - 3) { | ||||
| 			// Buffer is full, unxz | ||||
| 			if (unxz(&strm, buf, pos)) | ||||
| 				return 1; | ||||
| 			pos = 0; | ||||
| 		} | ||||
| 	} | ||||
| 	if (pos) { | ||||
| 		if (unxz(&strm, buf, pos)) | ||||
| 			return 1; | ||||
| 	} | ||||
| 	lzma_end(&strm); | ||||
| 	return 0; | ||||
| } | ||||
							
								
								
									
										676
									
								
								core/jni/core/bootstages.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										676
									
								
								core/jni/core/bootstages.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										313
									
								
								core/jni/core/daemon.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										313
									
								
								core/jni/core/daemon.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										178
									
								
								core/jni/core/log_monitor.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								core/jni/core/log_monitor.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,178 @@ | ||||
| /* log_monitor.c - New thread to monitor logcat | ||||
|  * | ||||
|  * A universal logcat monitor for many usages. Add listeners to the list, | ||||
|  * and the pointer of the new log line will be sent through pipes to trigger | ||||
|  * asynchronous events without polling | ||||
|  */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <pthread.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/wait.h> | ||||
|  | ||||
| #include "magisk.h" | ||||
| #include "utils.h" | ||||
|  | ||||
| extern int is_daemon_init; | ||||
|  | ||||
| static int am_proc_start_filter(const char *log) { | ||||
| 	return strstr(log, "am_proc_start") != NULL; | ||||
| } | ||||
|  | ||||
| static int magisk_log_filter(const char *log) { | ||||
| 	char *ss; | ||||
| 	return (ss = strstr(log, " Magisk")) && (ss[-1] != 'D') && (ss[-1] != 'V'); | ||||
| } | ||||
|  | ||||
| static int magisk_debug_log_filter(const char *log) { | ||||
| 	return strstr(log, "Magisk") != NULL; | ||||
| } | ||||
|  | ||||
| struct log_listener log_events[] = { | ||||
| 	{	/* HIDE_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = am_proc_start_filter | ||||
| 	}, | ||||
| 	{	/* LOG_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = magisk_log_filter | ||||
| 	}, | ||||
| 	{	/* DEBUG_EVENT */ | ||||
| 		.fd = -1, | ||||
| 		.filter = magisk_debug_log_filter | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| #ifdef MAGISK_DEBUG | ||||
| static int debug_log_pid, debug_log_fd; | ||||
| #endif | ||||
|  | ||||
| static void *logger_thread(void *args) { | ||||
| 	int log_fd = -1, log_pid; | ||||
| 	char line[4096]; | ||||
|  | ||||
| 	LOGD("log_monitor: logger start"); | ||||
|  | ||||
| 	while (1) { | ||||
| 		// Start logcat | ||||
| 		log_pid = exec_command(0, &log_fd, NULL, "logcat", "-b", "events", "-b", "main", "-v", "threadtime", "-s", "am_proc_start", "-s", "Magisk", NULL); | ||||
| 		while (fdgets(line, sizeof(line), log_fd)) { | ||||
| 			for (int i = 0; i < (sizeof(log_events) / sizeof(struct log_listener)); ++i) { | ||||
| 				if (log_events[i].fd > 0 && log_events[i].filter(line)) { | ||||
| 					char *s = strdup(line); | ||||
| 					xwrite(log_events[i].fd, &s, sizeof(s)); | ||||
| 				} | ||||
| 			} | ||||
| 			if (kill(log_pid, 0)) | ||||
| 				break; | ||||
| 		} | ||||
|  | ||||
| 		// Cleanup | ||||
| 		close(log_fd); | ||||
| 		log_fd = -1; | ||||
| 		kill(log_pid, SIGTERM); | ||||
| 		waitpid(log_pid, NULL, 0); | ||||
|  | ||||
| 		// Clear buffer before restart | ||||
| 		exec_command_sync("logcat", "-b", "events", "-b", "main", "-c", NULL); | ||||
| 	} | ||||
|  | ||||
| 	// Should never be here, but well... | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| static void *magisk_log_thread(void *args) { | ||||
| 	// Buffer logs before we have data access | ||||
| 	struct vector logs; | ||||
| 	vec_init(&logs); | ||||
|  | ||||
| 	int pipefd[2]; | ||||
| 	if (xpipe2(pipefd, O_CLOEXEC) == -1) | ||||
| 		return NULL; | ||||
|  | ||||
| 	// Register our listener | ||||
| 	log_events[LOG_EVENT].fd = pipefd[1]; | ||||
|  | ||||
| 	LOGD("log_monitor: magisk log dumper start"); | ||||
|  | ||||
| 	FILE *log = NULL; | ||||
| 	for (char *line; xxread(pipefd[0], &line, sizeof(line)) > 0; free(line)) { | ||||
| 		if (!is_daemon_init) { | ||||
| 			vec_push_back(&logs, strdup(line)); | ||||
| 		} else { | ||||
| 			if (log == NULL) { | ||||
| 				// Dump buffered logs to file | ||||
| 				log = xfopen(LOGFILE, "w"); | ||||
| 				setbuf(log, NULL); | ||||
| 				char *tmp; | ||||
| 				vec_for_each(&logs, tmp) { | ||||
| 					fprintf(log, "%s", tmp); | ||||
| 					free(tmp); | ||||
| 				} | ||||
| 				vec_destroy(&logs); | ||||
| 			} | ||||
| 			fprintf(log, "%s", line); | ||||
| 		} | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| static void *debug_magisk_log_thread(void *args) { | ||||
| 	FILE *log = xfopen(DEBUG_LOG, "a"); | ||||
| 	setbuf(log, NULL); | ||||
| 	int pipefd[2]; | ||||
| 	if (xpipe2(pipefd, O_CLOEXEC) == -1) | ||||
| 		return NULL; | ||||
|  | ||||
| 	LOGD("log_monitor: debug log dumper start"); | ||||
|  | ||||
| 	// Register our listener | ||||
| 	log_events[DEBUG_EVENT].fd = pipefd[1]; | ||||
|  | ||||
| 	for (char *line; xxread(pipefd[0], &line, sizeof(line)) > 0; free(line)) | ||||
| 		fprintf(log, "%s", line); | ||||
|  | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| /* Start new threads to monitor logcat and dump to logfile */ | ||||
| void monitor_logs() { | ||||
| 	pthread_t thread; | ||||
|  | ||||
| 	// Start log file dumper before monitor | ||||
| 	xpthread_create(&thread, NULL, magisk_log_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
|  | ||||
| 	// Start logcat monitor | ||||
| 	xpthread_create(&thread, NULL, logger_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
|  | ||||
| } | ||||
|  | ||||
| void start_debug_full_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	// Log everything initially | ||||
| 	debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644); | ||||
| 	debug_log_pid = exec_command(0, &debug_log_fd, NULL, "logcat", "-v", "threadtime", NULL); | ||||
| 	close(debug_log_fd); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void stop_debug_full_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	// Stop recording the boot logcat after every boot task is done | ||||
| 	kill(debug_log_pid, SIGTERM); | ||||
| 	waitpid(debug_log_pid, NULL, 0); | ||||
| 	// Start debug thread | ||||
| 	start_debug_log(); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void start_debug_log() { | ||||
| #ifdef MAGISK_DEBUG | ||||
| 	pthread_t thread; | ||||
| 	// Start debug thread | ||||
| 	xpthread_create(&thread, NULL, debug_magisk_log_thread, NULL); | ||||
| 	pthread_detach(thread); | ||||
| #endif | ||||
| } | ||||
							
								
								
									
										177
									
								
								core/jni/core/magisk.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								core/jni/core/magisk.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | ||||
| /* main.c - The multicall entry point | ||||
|  */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| #include <libgen.h> | ||||
|  | ||||
| #include "utils.h" | ||||
| #include "magisk.h" | ||||
| #include "daemon.h" | ||||
|  | ||||
| char *argv0; | ||||
|  | ||||
| int (*applet_main[]) (int, char *[]) = { su_client_main, resetprop_main, magiskhide_main, NULL }; | ||||
|  | ||||
| int create_links(const char *bin, const char *path) { | ||||
| 	char self[PATH_MAX], linkpath[PATH_MAX]; | ||||
| 	if (bin == NULL) { | ||||
| 		xreadlink("/proc/self/exe", self, sizeof(self)); | ||||
| 		bin = self; | ||||
| 	} | ||||
| 	int ret = 0; | ||||
| 	for (int i = 0; applet[i]; ++i) { | ||||
| 		snprintf(linkpath, sizeof(linkpath), "%s/%s", path, applet[i]); | ||||
| 		unlink(linkpath); | ||||
| 		ret |= symlink(bin, linkpath); | ||||
| 	} | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| static void usage() { | ||||
| 	fprintf(stderr, | ||||
| 		"Magisk v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") (by topjohnwu) multi-call binary\n" | ||||
| 		"\n" | ||||
| 		"Usage: %s [applet [arguments]...]\n" | ||||
| 		"   or: %s [options]...\n" | ||||
| 		"\n" | ||||
| 		"Options:\n" | ||||
| 		"   -c                        print current binary version\n" | ||||
| 		"   -v                        print running daemon version\n" | ||||
| 		"   -V                        print running daemon version code\n" | ||||
| 		"   --list                    list all available applets\n" | ||||
| 		"   --install [SOURCE] DIR    symlink all applets to DIR. SOURCE is optional\n" | ||||
| 		"   --createimg IMG SIZE      create ext4 image. SIZE is interpreted in MB\n" | ||||
| 		"   --imgsize IMG             report ext4 image used/total size\n" | ||||
| 		"   --resizeimg IMG SIZE      resize ext4 image. SIZE is interpreted in MB\n" | ||||
| 		"   --mountimg IMG PATH       mount IMG to PATH and prints the loop device\n" | ||||
| 		"   --umountimg PATH LOOP     unmount PATH and delete LOOP device\n" | ||||
| 		"   --[init service]          start init service\n" | ||||
| 		"   --unlock-blocks           set BLKROSET flag to OFF for all block devices\n" | ||||
| 		"   --restorecon              fix selinux context on Magisk files and folders\n" | ||||
| 		"   --clone-attr SRC DEST     clone permission, owner, and selinux context\n" | ||||
| 		"\n" | ||||
| 		"Supported init services:\n" | ||||
| 		"   daemon, post-fs, post-fs-data, service\n" | ||||
| 		"\n" | ||||
| 		"Supported applets:\n" | ||||
| 	, argv0, argv0); | ||||
|  | ||||
| 	for (int i = 0; applet[i]; ++i) | ||||
| 		fprintf(stderr, i ? ", %s" : "    %s", applet[i]); | ||||
| 	fprintf(stderr, "\n\n"); | ||||
| 	exit(1); | ||||
| } | ||||
|  | ||||
| int main(int argc, char *argv[]) { | ||||
| 	argv0 = argv[0]; | ||||
| 	if (strcmp(basename(argv[0]), "magisk") == 0) { | ||||
| 		if (argc < 2) usage(); | ||||
| 		if (strcmp(argv[1], "-c") == 0) { | ||||
| 			printf("%s (%d)\n", MAGISK_VER_STR, MAGISK_VER_CODE); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "-v") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, CHECK_VERSION); | ||||
| 			char *v = read_string(fd); | ||||
| 			printf("%s\n", v); | ||||
| 			free(v); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "-V") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, CHECK_VERSION_CODE); | ||||
| 			printf("%d\n", read_int(fd)); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--install") == 0) { | ||||
| 			if (argc < 3) usage(); | ||||
| 			if (argc == 3) return create_links(NULL, argv[2]); | ||||
| 			else return create_links(argv[2], argv[3]); | ||||
| 		} else if (strcmp(argv[1], "--list") == 0) { | ||||
| 			for (int i = 0; applet[i]; ++i) | ||||
| 				printf("%s\n", applet[i]); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--createimg") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			int size; | ||||
| 			sscanf(argv[3], "%d", &size); | ||||
| 			return create_img(argv[2], size); | ||||
| 		} else if (strcmp(argv[1], "--imgsize") == 0) { | ||||
| 			if (argc < 3) usage(); | ||||
| 			int used, total; | ||||
| 			if (get_img_size(argv[2], &used, &total)) { | ||||
| 				fprintf(stderr, "Cannot check %s size\n", argv[2]); | ||||
| 				return 1; | ||||
| 			} | ||||
| 			printf("%d %d\n", used, total); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--resizeimg") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			int used, total, size; | ||||
| 			sscanf(argv[3], "%d", &size); | ||||
| 			if (get_img_size(argv[2], &used, &total)) { | ||||
| 				fprintf(stderr, "Cannot check %s size\n", argv[2]); | ||||
| 				return 1; | ||||
| 			} | ||||
| 			if (size <= used) { | ||||
| 				fprintf(stderr, "Cannot resize smaller than %dM\n", used); | ||||
| 				return 1; | ||||
| 			} | ||||
| 			return resize_img(argv[2], size); | ||||
| 		} else if (strcmp(argv[1], "--mountimg") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			char *loop = mount_image(argv[2], argv[3]); | ||||
| 			if (loop == NULL) { | ||||
| 				fprintf(stderr, "Cannot mount image!\n"); | ||||
| 				return 1; | ||||
| 			} else { | ||||
| 				printf("%s\n", loop); | ||||
| 				free(loop); | ||||
| 				return 0; | ||||
| 			} | ||||
| 		} else if (strcmp(argv[1], "--umountimg") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			umount_image(argv[2], argv[3]); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--unlock-blocks") == 0) { | ||||
| 			unlock_blocks(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--restorecon") == 0) { | ||||
| 			fix_filecon(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--clone-attr") == 0) { | ||||
| 			if (argc < 4) usage(); | ||||
| 			clone_attr(argv[2], argv[3]); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--daemon") == 0) { | ||||
| 			if (xfork() == 0) | ||||
| 				start_daemon(); | ||||
| 			return 0; | ||||
| 		} else if (strcmp(argv[1], "--post-fs") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, POST_FS); | ||||
| 			return read_int(fd); | ||||
| 		} else if (strcmp(argv[1], "--post-fs-data") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, POST_FS_DATA); | ||||
| 			return read_int(fd); | ||||
| 		} else if (strcmp(argv[1], "--service") == 0) { | ||||
| 			int fd = connect_daemon(); | ||||
| 			write_int(fd, LATE_START); | ||||
| 			return read_int(fd); | ||||
| 		} else { | ||||
| 			// It's calling applets | ||||
| 			--argc; | ||||
| 			++argv; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Applets | ||||
| 	for (int i = 0; applet[i]; ++i) { | ||||
| 		if (strcmp(basename(argv[0]), applet[i]) == 0) | ||||
| 			return (*applet_main[i])(argc, argv); | ||||
| 	} | ||||
|  | ||||
| 	fprintf(stderr, "%s: applet not found\n", basename(argv[0])); | ||||
| 	return 1; | ||||
| } | ||||
							
								
								
									
										547
									
								
								core/jni/core/magiskinit.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										547
									
								
								core/jni/core/magiskinit.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										152
									
								
								core/jni/core/socket.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								core/jni/core/socket.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,152 @@ | ||||
| /* socket.c - All socket related operations | ||||
|  */ | ||||
|  | ||||
| #include <fcntl.h> | ||||
|  | ||||
| #include "daemon.h" | ||||
| #include "logging.h" | ||||
| #include "utils.h" | ||||
| #include "magisk.h" | ||||
|  | ||||
| /* Setup the address and return socket fd */ | ||||
| int setup_socket(struct sockaddr_un *sun) { | ||||
|     int fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); | ||||
|     memset(sun, 0, sizeof(*sun)); | ||||
|     sun->sun_family = AF_LOCAL; | ||||
|     memcpy(sun->sun_path, REQUESTOR_DAEMON_PATH, sizeof(REQUESTOR_DAEMON_PATH) - 1); | ||||
|     return fd; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Receive a file descriptor from a Unix socket. | ||||
|  * Contributed by @mkasick | ||||
|  * | ||||
|  * Returns the file descriptor on success, or -1 if a file | ||||
|  * descriptor was not actually included in the message | ||||
|  * | ||||
|  * On error the function terminates by calling exit(-1) | ||||
|  */ | ||||
| int recv_fd(int sockfd) { | ||||
|     // Need to receive data from the message, otherwise don't care about it. | ||||
|     char iovbuf; | ||||
|  | ||||
|     struct iovec iov = { | ||||
|         .iov_base = &iovbuf, | ||||
|         .iov_len  = 1, | ||||
|     }; | ||||
|  | ||||
|     char cmsgbuf[CMSG_SPACE(sizeof(int))]; | ||||
|  | ||||
|     struct msghdr msg = { | ||||
|         .msg_iov        = &iov, | ||||
|         .msg_iovlen     = 1, | ||||
|         .msg_control    = cmsgbuf, | ||||
|         .msg_controllen = sizeof(cmsgbuf), | ||||
|     }; | ||||
|  | ||||
|     xrecvmsg(sockfd, &msg, MSG_WAITALL); | ||||
|  | ||||
|     // Was a control message actually sent? | ||||
|     switch (msg.msg_controllen) { | ||||
|     case 0: | ||||
|         // No, so the file descriptor was closed and won't be used. | ||||
|         return -1; | ||||
|     case sizeof(cmsgbuf): | ||||
|         // Yes, grab the file descriptor from it. | ||||
|         break; | ||||
|     default: | ||||
|         goto error; | ||||
|     } | ||||
|  | ||||
|     struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); | ||||
|  | ||||
|     if (cmsg             == NULL                  || | ||||
|         cmsg->cmsg_len   != CMSG_LEN(sizeof(int)) || | ||||
|         cmsg->cmsg_level != SOL_SOCKET            || | ||||
|         cmsg->cmsg_type  != SCM_RIGHTS) { | ||||
| error: | ||||
|         LOGE("unable to read fd"); | ||||
|         exit(-1); | ||||
|     } | ||||
|  | ||||
|     return *(int *)CMSG_DATA(cmsg); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Send a file descriptor through a Unix socket. | ||||
|  * Contributed by @mkasick | ||||
|  * | ||||
|  * On error the function terminates by calling exit(-1) | ||||
|  * | ||||
|  * fd may be -1, in which case the dummy data is sent, | ||||
|  * but no control message with the FD is sent. | ||||
|  */ | ||||
| void send_fd(int sockfd, int fd) { | ||||
|     // Need to send some data in the message, this will do. | ||||
|     struct iovec iov = { | ||||
|         .iov_base = "", | ||||
|         .iov_len  = 1, | ||||
|     }; | ||||
|  | ||||
|     struct msghdr msg = { | ||||
|         .msg_iov        = &iov, | ||||
|         .msg_iovlen     = 1, | ||||
|     }; | ||||
|  | ||||
|     char cmsgbuf[CMSG_SPACE(sizeof(int))]; | ||||
|  | ||||
|     if (fd != -1) { | ||||
|         // Is the file descriptor actually open? | ||||
|         if (fcntl(fd, F_GETFD) == -1) { | ||||
|             if (errno != EBADF) { | ||||
|                 PLOGE("unable to send fd"); | ||||
|             } | ||||
|             // It's closed, don't send a control message or sendmsg will EBADF. | ||||
|         } else { | ||||
|             // It's open, send the file descriptor in a control message. | ||||
|             msg.msg_control    = cmsgbuf; | ||||
|             msg.msg_controllen = sizeof(cmsgbuf); | ||||
|  | ||||
|             struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); | ||||
|  | ||||
|             cmsg->cmsg_len   = CMSG_LEN(sizeof(int)); | ||||
|             cmsg->cmsg_level = SOL_SOCKET; | ||||
|             cmsg->cmsg_type  = SCM_RIGHTS; | ||||
|  | ||||
|             *(int *)CMSG_DATA(cmsg) = fd; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     xsendmsg(sockfd, &msg, 0); | ||||
| } | ||||
|  | ||||
| int read_int(int fd) { | ||||
|     int val; | ||||
|     xxread(fd, &val, sizeof(int)); | ||||
|     return val; | ||||
| } | ||||
|  | ||||
| void write_int(int fd, int val) { | ||||
|     if (fd < 0) return; | ||||
|     xwrite(fd, &val, sizeof(int)); | ||||
| } | ||||
|  | ||||
| char* read_string(int fd) { | ||||
|     int len = read_int(fd); | ||||
|     if (len > PATH_MAX || len < 0) { | ||||
|         LOGE("invalid string length %d", len); | ||||
|         exit(1); | ||||
|     } | ||||
|     char* val = xmalloc(sizeof(char) * (len + 1)); | ||||
|     xxread(fd, val, len); | ||||
|     val[len] = '\0'; | ||||
|     return val; | ||||
| } | ||||
|  | ||||
| void write_string(int fd, const char* val) { | ||||
|     if (fd < 0) return; | ||||
|     int len = strlen(val); | ||||
|     write_int(fd, len); | ||||
|     xwrite(fd, val, len); | ||||
| } | ||||
							
								
								
									
										158
									
								
								core/jni/external/Android.mk
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								core/jni/external/Android.mk
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,158 @@ | ||||
| LOCAL_PATH:= $(call my-dir) | ||||
|  | ||||
| # libsqlite.so (stub) | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libsqlite | ||||
| LOCAL_C_INCLUDES := jni/external/include | ||||
| LOCAL_SRC_FILES := stubs/sqlite3_stub.c | ||||
| include $(BUILD_SHARED_LIBRARY) | ||||
|  | ||||
| # libselinux.so (stub) | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libselinux | ||||
| LOCAL_C_INCLUDES := $(LIBSELINUX) | ||||
| LOCAL_SRC_FILES := stubs/selinux_stub.c | ||||
| include $(BUILD_SHARED_LIBRARY) | ||||
|  | ||||
| # libfdt.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE:= libfdt | ||||
| LOCAL_C_INCLUDES := $(LIBFDT) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	dtc/libfdt/fdt.c \ | ||||
| 	dtc/libfdt/fdt_addresses.c \ | ||||
| 	dtc/libfdt/fdt_empty_tree.c \ | ||||
| 	dtc/libfdt/fdt_overlay.c \ | ||||
| 	dtc/libfdt/fdt_ro.c \ | ||||
| 	dtc/libfdt/fdt_rw.c \ | ||||
| 	dtc/libfdt/fdt_strerror.c \ | ||||
| 	dtc/libfdt/fdt_sw.c \ | ||||
| 	dtc/libfdt/fdt_wip.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # liblz4.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := liblz4 | ||||
| LOCAL_C_INCLUDES += $(LIBLZ4) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	lz4/lib/lz4.c \ | ||||
| 	lz4/lib/lz4frame.c \ | ||||
| 	lz4/lib/lz4hc.c \ | ||||
| 	lz4/lib/xxhash.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # libbz2.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := libbz2 | ||||
| LOCAL_C_INCLUDES += $(LIBBZ2) | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	bzip2/blocksort.c  \ | ||||
| 	bzip2/huffman.c    \ | ||||
| 	bzip2/crctable.c   \ | ||||
| 	bzip2/randtable.c  \ | ||||
| 	bzip2/compress.c   \ | ||||
| 	bzip2/decompress.c \ | ||||
| 	bzip2/bzlib.c | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # liblzma.a | ||||
| include $(CLEAR_VARS) | ||||
| LOCAL_MODULE := liblzma | ||||
| LOCAL_C_INCLUDES += \ | ||||
| 	$(EXT_PATH)/include/xz_config \ | ||||
| 	$(EXT_PATH)/xz/src/common \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/api \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/check \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/common \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/delta \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/lz \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/lzma \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/rangecoder \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma/simple \ | ||||
| 	$(EXT_PATH)/xz/src/liblzma | ||||
| LOCAL_SRC_FILES := \ | ||||
| 	xz/src/common/tuklib_cpucores.c \ | ||||
| 	xz/src/common/tuklib_exit.c \ | ||||
| 	xz/src/common/tuklib_mbstr_fw.c \ | ||||
| 	xz/src/common/tuklib_mbstr_width.c \ | ||||
| 	xz/src/common/tuklib_open_stdxxx.c \ | ||||
| 	xz/src/common/tuklib_physmem.c \ | ||||
| 	xz/src/common/tuklib_progname.c \ | ||||
| 	xz/src/liblzma/check/check.c \ | ||||
| 	xz/src/liblzma/check/crc32_fast.c \ | ||||
| 	xz/src/liblzma/check/crc32_table.c \ | ||||
| 	xz/src/liblzma/check/crc64_fast.c \ | ||||
| 	xz/src/liblzma/check/crc64_table.c \ | ||||
| 	xz/src/liblzma/check/sha256.c \ | ||||
| 	xz/src/liblzma/common/alone_decoder.c \ | ||||
| 	xz/src/liblzma/common/alone_encoder.c \ | ||||
| 	xz/src/liblzma/common/auto_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_header_decoder.c \ | ||||
| 	xz/src/liblzma/common/block_header_encoder.c \ | ||||
| 	xz/src/liblzma/common/block_util.c \ | ||||
| 	xz/src/liblzma/common/common.c \ | ||||
| 	xz/src/liblzma/common/easy_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/easy_decoder_memusage.c \ | ||||
| 	xz/src/liblzma/common/easy_encoder.c \ | ||||
| 	xz/src/liblzma/common/easy_encoder_memusage.c \ | ||||
| 	xz/src/liblzma/common/easy_preset.c \ | ||||
| 	xz/src/liblzma/common/filter_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/filter_common.c \ | ||||
| 	xz/src/liblzma/common/filter_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_encoder.c \ | ||||
| 	xz/src/liblzma/common/filter_flags_decoder.c \ | ||||
| 	xz/src/liblzma/common/filter_flags_encoder.c \ | ||||
| 	xz/src/liblzma/common/hardware_cputhreads.c \ | ||||
| 	xz/src/liblzma/common/hardware_physmem.c \ | ||||
| 	xz/src/liblzma/common/index.c \ | ||||
| 	xz/src/liblzma/common/index_decoder.c \ | ||||
| 	xz/src/liblzma/common/index_encoder.c \ | ||||
| 	xz/src/liblzma/common/index_hash.c \ | ||||
| 	xz/src/liblzma/common/outqueue.c \ | ||||
| 	xz/src/liblzma/common/stream_buffer_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_buffer_encoder.c \ | ||||
| 	xz/src/liblzma/common/stream_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_encoder.c \ | ||||
| 	xz/src/liblzma/common/stream_encoder_mt.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_common.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_decoder.c \ | ||||
| 	xz/src/liblzma/common/stream_flags_encoder.c \ | ||||
| 	xz/src/liblzma/common/vli_decoder.c \ | ||||
| 	xz/src/liblzma/common/vli_encoder.c \ | ||||
| 	xz/src/liblzma/common/vli_size.c \ | ||||
| 	xz/src/liblzma/delta/delta_common.c \ | ||||
| 	xz/src/liblzma/delta/delta_decoder.c \ | ||||
| 	xz/src/liblzma/delta/delta_encoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_decoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_encoder.c \ | ||||
| 	xz/src/liblzma/lz/lz_encoder_mf.c \ | ||||
| 	xz/src/liblzma/lzma/fastpos_table.c \ | ||||
| 	xz/src/liblzma/lzma/fastpos_tablegen.c \ | ||||
| 	xz/src/liblzma/lzma/lzma2_decoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma2_encoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_decoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c \ | ||||
| 	xz/src/liblzma/lzma/lzma_encoder_presets.c \ | ||||
| 	xz/src/liblzma/rangecoder/price_table.c \ | ||||
| 	xz/src/liblzma/rangecoder/price_tablegen.c \ | ||||
| 	xz/src/liblzma/simple/arm.c \ | ||||
| 	xz/src/liblzma/simple/armthumb.c \ | ||||
| 	xz/src/liblzma/simple/ia64.c \ | ||||
| 	xz/src/liblzma/simple/powerpc.c \ | ||||
| 	xz/src/liblzma/simple/simple_coder.c \ | ||||
| 	xz/src/liblzma/simple/simple_decoder.c \ | ||||
| 	xz/src/liblzma/simple/simple_encoder.c \ | ||||
| 	xz/src/liblzma/simple/sparc.c \ | ||||
| 	xz/src/liblzma/simple/x86.c | ||||
| LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=c99 | ||||
| include $(BUILD_STATIC_LIBRARY) | ||||
|  | ||||
| # libsepol.a | ||||
| include $(SE_PATH)/libsepol/Android.mk | ||||
							
								
								
									
										1
									
								
								core/jni/external/busybox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/busybox
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/busybox added at e3a1a4d91f
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/bzip2
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/bzip2
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/bzip2 added at 67d818584d
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/dtc
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/dtc
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/dtc added at 22a65c5331
									
								
							
							
								
								
									
										44
									
								
								core/jni/external/include/sha1.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								core/jni/external/include/sha1.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| #ifndef SHA1_H | ||||
| #define SHA1_H | ||||
|  | ||||
| /* | ||||
|    SHA-1 in C | ||||
|    By Steve Reid <steve@edmweb.com> | ||||
|    100% Public Domain | ||||
|  */ | ||||
|  | ||||
| #include "stdint.h" | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
|     uint32_t state[5]; | ||||
|     uint32_t count[2]; | ||||
|     unsigned char buffer[64]; | ||||
| } SHA1_CTX; | ||||
|  | ||||
| void SHA1Transform( | ||||
|     uint32_t state[5], | ||||
|     const unsigned char buffer[64] | ||||
|     ); | ||||
|  | ||||
| void SHA1Init( | ||||
|     SHA1_CTX * context | ||||
|     ); | ||||
|  | ||||
| void SHA1Update( | ||||
|     SHA1_CTX * context, | ||||
|     const unsigned char *data, | ||||
|     uint32_t len | ||||
|     ); | ||||
|  | ||||
| void SHA1Final( | ||||
|     unsigned char digest[20], | ||||
|     SHA1_CTX * context | ||||
|     ); | ||||
|  | ||||
| void SHA1( | ||||
|     char *hash_out, | ||||
|     const char *str, | ||||
|     int len); | ||||
|  | ||||
| #endif /* SHA1_H */ | ||||
							
								
								
									
										10491
									
								
								core/jni/external/include/sqlite3.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10491
									
								
								core/jni/external/include/sqlite3.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										498
									
								
								core/jni/external/include/xz_config/config.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										498
									
								
								core/jni/external/include/xz_config/config.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/lz4
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/lz4
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/lz4 added at c10863b98e
									
								
							
							
								
								
									
										1
									
								
								core/jni/external/selinux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								core/jni/external/selinux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule core/jni/external/selinux added at 8e849a5639
									
								
							
							
								
								
									
										295
									
								
								core/jni/external/sha1/sha1.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										295
									
								
								core/jni/external/sha1/sha1.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user