text android x86 / system / bin / enable_nativebridge

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text android x86 / system / bin / enable_nativebridge相关的知识,希望对你有一定的参考价值。

#!/system/bin/sh

PATH=/system/bin:/system/xbin

houdini_bin=0
dest_dir=/system/lib$1/arm$1
binfmt_misc_dir=/proc/sys/fs/binfmt_misc

if [ -z "$1" ]; then
	if [ "`uname -m`" = "x86_64" ]; then
		v=7_y
		url=http://goo.gl/SBU3is
	else
		v=7_x
		url=http://goo.gl/0IJs40
	fi
else
	v=7_z
	url=http://goo.gl/FDrxVN
fi

if [ -s /system/lib$1/libhoudini.so ]; then
	log -pi -thoudini "found /system/lib$1/libhoudini.so"
elif [ -e /system/etc/houdini$v.sfs ]; then
	mount /system/etc/houdini$v.sfs $dest_dir
else
	if mountpoint -q $dest_dir; then
		kill -9 `fuser -m $dest_dir`
		umount -f $dest_dir
	fi
	mkdir -p /data/arm
	cd /data/arm
	while ! mount houdini$v.sfs $dest_dir; do
		while [ "$(getprop net.dns1)" = "" ]; do
			sleep 10
		done
		wget $url -cO houdini$v.sfs && continue
		rm -f houdini$v.sfs
		sleep 30
	done
fi

[ -s /system/lib$1/libhoudini.so ] || mount --bind $dest_dir/libhoudini.so /system/lib$1/libhoudini.so

# this is to add the supported binary formats via binfmt_misc

if [ ! -e $binfmt_misc_dir/register ]; then
	mount -t binfmt_misc none $binfmt_misc_dir
fi

cd $binfmt_misc_dir
if [ -e register ]; then
	[ -e /system/bin/houdini$1 ] && dest_dir=/system/bin
	# register Houdini for arm binaries
	if [ -z "$1" ]; then
		echo ':arm_exe:M::\\x7f\\x45\\x4c\\x46\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28::'"$dest_dir/houdini:P" > register
		echo ':arm_dyn:M::\\x7f\\x45\\x4c\\x46\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x28::'"$dest_dir/houdini:P" > register
	else
		echo ':arm64_exe:M::\\x7f\\x45\\x4c\\x46\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7::'"$dest_dir/houdini64:P" > register
		echo ':arm64_dyn:M::\\x7f\\x45\\x4c\\x46\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\xb7::'"$dest_dir/houdini64:P" > register
	fi
	if [ -e arm${1}_exe ]; then
		houdini_bin=1
	fi
else
	log -pe -thoudini "No binfmt_misc support"
fi

if [ $houdini_bin -eq 0 ]; then
	log -pe -thoudini "houdini$1 enabling failed!"
else
	log -pi -thoudini "houdini$1 enabled"
fi

[ "$(getprop ro.zygote)" = "zygote64_32" -a -z "$1" ] && exec $0 64

exit 0

以上是关于text android x86 / system / bin / enable_nativebridge的主要内容,如果未能解决你的问题,请参考以下文章

Android 分析Native库的加载过程及x86系统运行arm库的原理

ARM、MIPS、x86 的 Android os.arch 输出?

Android 逆向Android 进程注入工具开发 ( 远程调用 | x86 架构的返回值获取 | arm 架构远程调用 )

Lunix Android X86 启动闪屏+ =号,debug模式提示 如下,求高手解决,本人全小白

x86 system address

从AnyCPU更改为x86会导致System.BadImageFormatException错误