{"id":535,"date":"2024-01-19T08:00:11","date_gmt":"2024-01-19T00:00:11","guid":{"rendered":"https:\/\/www.zhoubin.asia\/?p=535"},"modified":"2024-06-04T10:36:39","modified_gmt":"2024-06-04T02:36:39","slug":"hailort_android","status":"publish","type":"post","link":"https:\/\/www.zhoubin.asia\/index.php\/2024\/01\/19\/hailort_android\/","title":{"rendered":"[HailoRT]\u5982\u4f55\u5728android\u7cfb\u7edf\u4e0a\u7f16\u8bd1\u5e76\u652f\u6301hailort(\u4ee5RK3588\u4e3a\u4f8b)"},"content":{"rendered":"<h2>\u7f16\u8bd1\u5177\u4f53\u6b65\u9aa4:<\/h2>\n<ol>\n<li>\u4e0b\u8f7dRockchip SDK\u5e76\u786e\u8ba4\u5185\u6838\u7f16\u8bd1\u6210\u529f:\n<pre># \u4e0b\u8f7d\u5e76\u786e\u8ba4Rockchip SDK\u5185\u6838\u6e90\u4ee3\u7801\r\n# \u786e\u4fdd\u5185\u6838\u6e90\u4ee3\u7801\u5728\u7f16\u8bd1\u540e\u53ef\u7528<\/pre>\n<\/li>\n<li>\u4e0b\u8f7dAndroid NDK (\u4ee5Linux\u7248\u672c\u4e3a\u4f8b):\n<pre># \u4e0b\u8f7dAndroid NDK\r\n<a href=\"https:\/\/developer.android.com\/ndk\/downloads\" target=\"_blank\" rel=\"noopener\">https:\/\/developer.android.com\/ndk\/downloads<\/a><\/pre>\n<\/li>\n<li>\u4e0b\u8f7dHailort-driver\u6e90\u7801:\n<pre>git clone <a href=\"https:\/\/github.com\/hailo-ai\/hailort-drivers.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/hailo-ai\/hailort-drivers.git<\/a>\r\n# \u6216\u6307\u5b9a\u8981\u4e0b\u8f7d\u7684\u7248\u672c\r\ngit clone --depth 1 -b v4.xx.x <a href=\"https:\/\/github.com\/hailo-ai\/hailort-drivers.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/hailo-ai\/hailort-drivers.git<\/a>\r\ngit -C hailort-drivers\/ log -1  # \u786e\u8ba4\u4e0b\u8f7d\u7684Hailort-Driver\u7248\u672c<\/pre>\n<\/li>\n<li>\u8bbe\u7f6eNDK\u73af\u5883\u53d8\u91cf\u5e76\u4ea4\u53c9\u7f16\u8bd1HailoRT PCI\u9a71\u52a8:\n<pre>export NDK=\/opt\/android-ndk-r26b\r\nexport PATH=$NDK\/toolchains\/llvm\/prebuilt\/linux-x86_64\/bin:$PATH\r\nexport KERNEL_DIR=\/opt\/RK3588_Android12.0\/kernel-5.10\r\n\r\n# \u5728hailort-driver\u6e90\u7801\u76ee\u5f55hailort-drivers\/linux\/pcie \u7f16\u8bd1\u9a71\u52a8\u7a0b\u5e8f\r\n$NDK\/prebuilt\/linux-x86_64\/bin\/make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 LLVM_IAS=1 all\r\n\r\n# \u68c0\u67e5\u662f\u5426\u6784\u5efa\u4e86 hailo_pci.ko\r\nfile hailo_pci.ko\r\n\r\n# \u4e0b\u8f7d Hailo8 \u56fa\u4ef6\r\n..\/..\/download_firmware.sh<\/pre>\n<\/li>\n<li>\u5728RK\u8bbe\u5907\u4e0a\u5b89\u88c5Hailort\u9a71\u52a8:\n<pre># \u5c06\u6587\u4ef6\u590d\u5236\u5230\u8bbe\u5907\u4e0a\r\nadb root\r\nadb remount\r\nadb shell \"mkdir -p \/vendor\/etc\/firmware\/hailo\/\"\r\nadb push hailo8_fw.4.xx.0.bin \/vendor\/etc\/firmware\/hailo\/hailo8_fw.bin\r\nadb push hailo_pci.ko \/vendor\/lib\/modules\/\r\n\r\n# \u786e\u4fdd init.insmod.cfg \u5305\u542b hailo_pci \u7684 insmod\r\nadb shell \"echo 'insmod \/vendor\/lib\/modules\/hailo_pci.ko' &gt;&gt; \/vendor\/etc\/init.insmod.cfg\"<\/pre>\n<\/li>\n<li>\u4ea4\u53c9\u7f16\u8bd1\u5e76\u9a8c\u8bc1Hailort:\n<pre># \u4e0b\u8f7d HailoRT \u6e90\u4ee3\u7801\r\ngit clone <a href=\"https:\/\/github.com\/hailo-ai\/hailort.git\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/hailo-ai\/hailort.git<\/a>\r\n\r\n# \u4fee\u6539hailort\u76ee\u5f55\u4e2d\u7684CMakeLists.txt \u4ee5\u8fdb\u884c\u4ea4\u53c9\u7f16\u8bd1\r\n# \u4fee\u6539\u5185\u5bb9\u89c1\u6700\u540e\u90e8\u5206...\r\n\r\n# \u7f16\u8bd1 Hailort\r\ncmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release\r\ncmake --build build --config release<\/pre>\n<\/li>\n<li>\u9a8c\u8bc1Hailort:\n<pre># \u5c06\u7f16\u8bd1\u7684\u6587\u4ef6\u590d\u5236\u5230\u8bbe\u5907\u4e0a\r\nadb push libhailort.so \/vendor\/lib64\/\r\nadb push hailortcli \/vendor\/bin\/\r\n\r\n# \u5728\u8bbe\u5907\u4e0a\u8fd0\u884c\u547d\u4ee4\u4ee5\u9a8c\u8bc1 Hailort\r\nadb root\r\nadb remount\r\nadb shell\r\nhailortcli scan\r\nhailortcli fw-control identify\r\nhailortcli run resnet_v1_18.hef<\/pre>\n<\/li>\n<\/ol>\n<h3>CMakeLists.txt \u4fee\u6539\u5185\u5bb9:<\/h3>\n<pre># \u8bbe\u7f6eAndroid\u5e73\u53f0\u4fe1\u606f\r\nset(ANDROID_PLATFORM android-21)  # \u6839\u636e\u9700\u8981\u8c03\u6574API\u7ea7\u522b\r\nset(ANDROID_ABI arm64-v8a)       # \u76ee\u6807ARM\u67b6\u6784\uff0c\u6839\u636e\u9700\u8981\u8c03\u6574\r\n\r\n# \u6307\u5b9aAndroid NDK\u8def\u5f84\r\nset(ANDROID_NDK \/opt\/android-ndk-r26b)  # \u6839\u636e\u5b9e\u9645NDK\u8def\u5f84\u8c03\u6574\r\n\r\n# \u8bbe\u7f6e\u7528\u4e8eAndroid\u7684\u5de5\u5177\u94fe\u6587\u4ef6\r\nset(CMAKE_TOOLCHAIN_FILE ${ANDROID_NDK}\/build\/cmake\/android.toolchain.cmake)\r\n\r\n# \u6307\u5b9aAndroid\u67b6\u6784\r\nset(CMAKE_ANDROID_ARCH_ABI ${ANDROID_ABI})\r\n\r\n# \u6307\u5b9aAndroid\u5e73\u53f0\u7248\u672c\r\nset(ANDROID_PLATFORM_VERSION ${ANDROID_PLATFORM})\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7f16\u8bd1\u5177\u4f53\u6b65\u9aa4: \u4e0b\u8f7dRockchip SDK\u5e76\u786e\u8ba4\u5185\u6838\u7f16\u8bd1\u6210\u529f: # \u4e0b\u8f7d\u5e76\u786e\u8ba4Rockchip SDK\u5185\u6838\u6e90 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5,1],"tags":[],"class_list":["post-535","post","type-post","status-publish","format-standard","hentry","category-hailort","category-tech"],"_links":{"self":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":2,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/535\/revisions"}],"predecessor-version":[{"id":721,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/535\/revisions\/721"}],"wp:attachment":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/media?parent=535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/categories?post=535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/tags?post=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}