背景
因项目需求,需要在Android(7.1.2)中内嵌web服务器(lighttpd+PHP环境)
硬件平台: RK3399
方案选择
最终选择用方案3, 采用buildroot+chroot自己构建
过程
buildroot构建最小文件系统
具体过程可参考博文:
文件系统中需填加lighttpd和PHP的packet
编译Busybox(可选)
rk3399官方提供的/system/bin/busybox为32位的,路径在:(vendor/rockchip/common/bin/arm64/)
可自己编译64位的busybox,需要用Android的编译链(aarch64-linux-android),编译过程比较麻烦
初始化编译环境
主要是修改.config
最后根据报错屏蔽掉那些报错且不用的包
【参考】:
编译 Android 系统的 arm64 架构版 busybox:
https://www.veryarm.com/116053.html
在android系统命令行中执行arm linux程序,出现/system/bin/sh: .xxx No such file or directory问题:
https://blog.csdn.net/zmc1216/article/details/46777897
配置Chroot
run_linux.sh脚本里面主要是启动lighttpd:
/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
android5.1是在system/core/include/private/android_filesystem_config.h
添加自启动服务
在init文件中添加启动chroot的自启动服务