Intel Houdini 又叫 intel bridge technology。
https://www.intel.com/content/www/us/en/developer/topic-technology/bridge-technology.html
用于chromebook/wsa上的x86设备运行Android的动态二进制转译器(dynamic binary translator)
翻译效率非常高,不仅仅可以用于Android平台,也可以用于Linux平台上运行。
声明:仅用作学习交流,不用于任何商业项目获利。
获取houdini的二进制文件。下面的项目都可以。
最新的来自https://github.com/supremegamers/vendor_intel_proprietary_houdini/tree/wsa-13/prebuilts/
部署参考:https://github.com/woachk/houdini
patch 二进制修改动态库链接
#https://github.com/woachk/houdini/blob/master/patch.sh
source patch.sh
patch_strings_in_file houdini64 "/system/lib64/arm64/cpuinfo" "/usr/lib/houdini/cpu64"
patch_strings_in_file houdini64 "/system/lib64/arm64/linker64" "/lib/ld-linux-aarch64.so.1"
patch_strings_in_file houdini64 "/system/lib64/arm64/libaeabi_map.so" ""
binfmt
新建一个houdini.conf
#
### Intel ARM JIT
:arm64_exe:M::\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7::/usr/libexec/houdini64:POC
:arm64_exe_2:M::\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\xb7::/usr/libexec/houdini64:POC
:arm64_exe_3:M::\x7f\x45\x4c\x46\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7::/usr/libexec/houdini64:POC
:arm64_exe_4:M::\x7f\x45\x4c\x46\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\xb7::/usr/libexec/houdini64:POC
部署houdini
# Run this as root.
mkdir -p /usr/libexec
install -m 755 houdini64 /usr/libexec/houdini64
mkdir -p /usr/lib/houdini
install -m 644 cpuinfo /usr/lib/houdini/cpu64
# 部署binfmt配置
mkdir -p etc/binfmt.d
install -m 644 houdini.conf /etc/binfmt.d/houdini.conf
重启binfmt服务
sudo systemctl restart systemd-binfmt
此时houdini已经运行静态编译(编译参数加上-static)的程序
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
gcc main.cpp -static -o hello_static
安装动态库(ft.ubuntu24.04)
修改/etc/apt/source.list.d/ubuntu.source
原文件只有amd64
Types: deb
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports noble-proposed
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: amd64
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: amd64
增加arm64
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: arm64
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: arm64
Types: deb
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports noble-proposed
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: amd64
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Architectures: amd64
然后告诉dpkg需要增加arm64
sudo dpkg --add-architecture arm64
增加arm64
然后sudo apt update
同步最新库
然后安装curl:arm64测试
sudo apt install curl:arm64
安装成功后,file /usr/bin/curl查看是否是arm架构
yh0@yh0-VMware-Virtual-Platform:~/Downloads$ file /usr/bin/curl
/usr/bin/curl: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=4e5fb87866c7f9a5efc51210ce1bfe63f51b843a, for GNU/Linux 3.7.0, stripped
配置完成
测试效率
https://browser.geekbench.com/v5/cpu/compare/23073424?baseline=23073437
大概有40%的翻译效率,比qemu-user-static强上太多了。下图是qemu的翻译效率
教程视频:https://www.bilibili.com/video/BV1PgUWYNE3X/