abk_fido_key_module is an ABK custom external kernel module that turns an
Android phone build into a composite USB FIDO2 security key.
abk_fido_key_module 是一个 ABK 自定义外部内核模块,用来把 Android
手机侧内核扩展成一个复合 USB FIDO2 Security Key。
Current version / 当前版本: 0.2.0
This module installs an out-of-tree kernel driver, patches the Android USB gadget configfs flow, and auto-attaches an extra FIDO HID interface to the active USB configuration.
这个模块会安装一个外部内核驱动,patch Android USB gadget 的 configfs 流程,并在当前激活的 USB 配置上自动追加一个 FIDO HID 接口。
What it adds / 它会增加这些内容:
common/drivers/abk_fido_keycommon/include/linux/abk_fido_key.hCONFIG_ABK_FIDO_KEYCONFIG_ABK_FIDO_KEY_CTAP2CONFIG_ABK_FIDO_KEY_GADGET_AUTO_ATTACHCONFIG_ABK_FIDO_KEY_PERSIST_METADATACONFIG_ABK_FIDO_KEY_PERSIST_ADB_DATA(compatibility toggle)app/: optional Android companion that mirrors the kernel store blob into a SQLite database persisted on/metadata
setup.sh: external module entrypoint used by the ABK build hook.module.conf: module metadata, version, and supported stages.scripts/: helper shell and Python patch scripts, including the KernelSU SELinux policy patcher used during external-module injection.files/drivers/abk_fido_key/: kernel driver source, Kconfig, and Makefile.files/include/linux/abk_fido_key.h: public kernel header used by the configfs injection point.app/,build.gradle.kts,settings.gradle.kts: minimal Android companion app project for the metadata-backed SQLite mirror.
- An ABK or
new_teststyle kernel build environment withKERNEL_ROOTand acommon/kernel tree. python3available in the build environment.- A
common/drivers/usb/gadget/configfs.clayout compatible with the patch anchors used byscripts/patch_configfs_for_abk_fido.py. - Root access on-device if you want the companion app to mirror the SQLite
database into
/metadata.
Add the module to new_test/.local-build/env.sh:
export USE_CUSTOM_EXTERNAL_MODULES="true"
export CUSTOM_EXTERNAL_MODULES="/abs/path/to/abk_fido_key_module;after_patch|/abs/path/to/abk_fido_key_module;before_build"If your ABK external-module loader supports Git URLs directly, you can also use the public repository address:
如果你的 ABK 外部模块加载器支持直接拉取 Git URL,也可以直接使用公开仓库地址:
export USE_CUSTOM_EXTERNAL_MODULES="true"
export CUSTOM_EXTERNAL_MODULES="https://github.com/xingguangcuican6666/ABK_FIDO_KEY_MODULE.git;after_patch|https://github.com/xingguangcuican6666/ABK_FIDO_KEY_MODULE.git;before_build"export USE_CUSTOM_EXTERNAL_MODULES="true"
export CUSTOM_EXTERNAL_MODULES="/run/media/xingguangcuican/Project/kernelexp/new_test/abk_fido_key_module;after_patch|/run/media/xingguangcuican/Project/kernelexp/new_test/abk_fido_key_module;before_build"Then rebuild:
./rebuild.sh --reseedafter_patch: install kernel files and patchcommon/drivers/usb/gadget/configfs.cpluscommon/drivers/kernelsu/selinux/rules.c.before_build: do everything fromafter_patch, then enable the requiredCONFIG_ABK_FIDO_KEY*symbols inDEFCONFIG, including the metadata persistence toggle.
The patch injects abk_fido_key_prepare_config() into the gadget config bind
flow so the abk_fido function is added automatically when the USB gadget is
assembled.
这个 patch 会把 abk_fido_key_prepare_config() 注入 gadget config bind
流程,在组装 USB gadget 时自动添加 abk_fido function。
- Adds one extra FIDO HID interface on top of the existing Android composite gadget.
- Exposes a misc debug node as
/dev/hidgXwhereXis usually0to3. - Exposes read-only status nodes under
/sys/kernel/abk_fido_key/:enabled,bound,udc,hid_dev,credential_count,last_error,last_trace,store_generation. - Exposes a write-only reload node under
/sys/kernel/abk_fido_key/reload_storeso userspace can force a reload from the metadata blob. - Exposes a write-only restore trigger under
/sys/kernel/abk_fido_key/restore_metadataso userspace can request a strict restore from the persisted store file without streaming the blob through sysfs. - Exposes
/sys/kernel/abk_fido_key/store_blobas a debug-only binary view of the current store; it is not the primary persistence or restore path on Android userspace. - Supports CTAP HID
INIT,PING,WINK,CBOR, andCANCEL. - Implements CTAP2
getInfo,makeCredential,getAssertion,clientPIN(minimal),reset, andselection. - Persists the kernel-side FIDO store blob at
/metadata/abk_fido_store.bin. - During build injection, the module patches KernelSU SELinux policy setup so
the
kerneldomain can access that metadata blob without switching SELinux to permissive mode. - The companion app mirrors the active blob into a SQLite database and keeps
the SQLite mirror in
/metadata/abk_fido.db.
After a successful build and boot, check:
- the driver files were copied into
common/drivers/abk_fido_key CONFIG_ABK_FIDO_KEY=yand related symbols are enabled/sys/kernel/abk_fido_key/hid_devreports ahidgXdevice name/sys/kernel/abk_fido_key/boundbecomes1after the gadget is bound/dev/hidgXexists for packet-level debugging- after a credential or PIN change,
/metadata/abk_fido_store.binexists - writing
1to/sys/kernel/abk_fido_key/restore_metadataincrementsstore_generationand restores the expectedcredential_count /sys/kernel/abk_fido_key/last_erroris empty after a successful restore/sys/kernel/abk_fido_key/last_tracereports the metadata restore path- after the companion app sync runs,
/metadata/abk_fido.dbexists
.github/workflows/build-companion-app.ymlbuilds debug and release APKs on GitHub Actions.- The workflow signs the release APK from GitHub secrets, then uses
gh releaseto create or update the target release and uploadabk-fido-companion-release.apk. - Required repository secrets:
ANDROID_SIGNING_KEYSTORE_BASE64,ANDROID_SIGNING_KEYSTORE_PASSWORD,ANDROID_SIGNING_KEY_ALIAS,ANDROID_SIGNING_KEY_PASSWORD. - Pushes to
mainormasterrefresh the rollinglatestrelease. Pushing av*tag publishes the asset to the matching tagged release.
Public module metadata lives in module.conf and is intended to match the
published repository. Companion-app metadata is also exported there so ABK can
offer the FIDO SQLite mirror APK alongside the kernel module.
公开模块元数据位于 module.conf,并且应与发布后的仓库保持一致。
- Unsupport Windows Hello