开始一个AndroidOS 在debian里面

官方的debian系统,未开启ashmem_linux,binder_linux和PSI
所以我们需要手动开启,
如下,是我使用的方法
安装编译工具
sudo apt-get update
sudo apt-get install -y git device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools bison flex rsync u-boot-tools

拉取源码

mkdir ~/rk3588-sdk && cd ~/rk3588-sdk

git clone -b linux-5.10-gen-rkr3.4 https://github.com/radxa/kernel.git --depth=1

git clone -b master https://github.com/radxa/rkbin.git --depth=1

git clone -b debian https://github.com/radxa/build.git --depth=1

配置编译选项,

cd ~/rk3588-sdk
cd kernel
make rockchip_linux_defconfig
make menuconfig

接下来就会弹出一个会话框,

Device Drivers -> Android -> Android Drivers勾上,弹出来binder ipc driver勾上,binderfs filesystem也勾上,这样binder模块就编译进去了。然后回到上一级,去Staging Drivers里面,进入Android,把Enable the Anonymous Shared Memory Subsystem也勾上,这样ashmem也搞定了。

回到最上一级,General Setup -> CPU/Task time and stats accounting -> Pressure stall information tracking,也勾上

选好之后,按TAB切换最下面的选项,先save然后exit就可以执行下一步命令了,保存配置

make savedefconfig
cp defconfig arch/arm64/configs/rockchip_linux_defconfig
接下来就是编译内核,

cd ~/rk3588-sdk
sudo ./build/mk-kernel.sh rk3588-rock-5b

打包内核(请注意,下面命令的一个参数,代表的是小版本号)

sudo ./build/pack-kernel.sh -d rockchip_linux_defconfig -r 39

cd ~/rk3588-sdk/out/packages

sudo dpkg -i linux-image-5.10.110-39-rockchip-g0a544b8c7_5.10.110-39-rockchip_arm64.deb
sudo dpkg -i linux-image-5.10.110-39-rockchip-g0a544b8c7-dbg_5.10.110-39-rockchip_arm64.deb

重启

docker run -itd --rm --privileged \
  --pull always \
  -v /mmc/zcg1:/data \
  -v /dev/net/tun:/dev/tun \
  -v /dev/mali0:/dev/mali0 \
  -p 5555:5555 \
  --name dobox1 \
  registry.cn-hangzhou.aliyuncs.com/whsyf/dobox:rk3588-202303011
2 Likes

Great work. Thanks for the sharing. This is really helpful to run Android on Linux.

康师傅请帮帮我。 我想获得游戏手柄支持来玩 Android 游戏。 我不知道是什么让它起作用…是否有任何技巧可以让游戏手柄在这些 Android 系统中被识别?

简而言之…如何添加共享蓝牙以及与 wifi 相同的方式。

git clone -b linux-5.10-gen-rkr3.4 https://github.com/radxa/kernel.git  --depth=1
git clone -b master https://github.com/radxa/rkbin.git  --depth=1
git clone -b debian https://github.com/radxa/build.git  --depth=1

康师傅,无能为力,康师傅不是硬件方面的工程师,

:joy: Fine me neither. Anyway good tutorial.

Thanks so much from r this guide, but any help regarding how to enable binderfs on rock 5a,
I tried your guide, and changed the final build command for 5a instead of 5b, and I get an error
Board ‘rk3588-rock-5a’ not supported, any help regarding this please

Went through mk-kernel.sh
Found that in order to build for 5a,
We should use rk3588s-rock-5a and the building went through thanks for the awesome guide will be back if I am struck somwwhere

Use armbian and just do armbian-config u will then access the armbian kernel framework and allows you to enable it save it and then compile it. (or something like this).