RK35XX(3568) Android WSL ubuntu22.04 编译环境配置
前言:装Ubuntu真机操作是很流畅但是没什么软件,装Vmware虚拟机操作卡顿配置也麻烦。那不如试一试wsl吧,命令行操作,流程又快捷
wsl简介:
适用于 Linux 的 Windows 子系统可让开发人员按原样运行 GNU/Linux 环境 - 包括大多数命令行工具、实用工具和应用程序 - 且不会产生传统虚拟机或双启动设置开销。
window版本:10 或11(7不支持)
Ubuntu:16.04~22.04.1
WSL: 1 和2
首先下载:wls2
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
在Microsofe Store下载Ubuntu22.04.1
新建:C:\Users\自己用户名\.wslconfig
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=17GB
# Sets the VM to use two virtual processors
# processors=2
# Specify a custom Linux kernel to use with your installed distros. The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel
# kernel=C:\\temp\\myCustomKernel
# Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6
# kernelCommandLine = vsyscall=emulate
# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=8GB
# Sets swapfile path location, default is %USERPROFILE%\AppData\Local\Temp\swap.vhdx
# swapfile=C:\\temp\\wsl-swap.vhdx
# Disable page reporting so WSL retains all allocated memory claimed from Windows and releases none back when free
# pageReporting=false
# Turn off default connection to bind WSL 2 localhost to Windows localhost
# localhostforwarding=true
# Disables nested virtualization
# nestedVirtualization=false
# Turns on output console showing contents of dmesg when opening a WSL 2 distro for debugging
# debugConsole=true
启动ubuntu22.04按钮(遇到错误自己百度一下),配置好自己用户名和密码。
配置阿里源。
sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
下载各种依赖包(注意:找不到的包自己去掉就行):
sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev lzop \
git-core curl u-boot-tools mtd-utils android-tools-fsutils openjdk-8-jdk device-tree-compiler \
gdisk m4 libz-dev git gnupg flex bison gperf libsdl1.2-dev libesd-java libwxgtk3.0-dev \
squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool \
libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev \
lib32ncurses5-dev lib32readline-dev gcc-multilib libswitch-perl libssl-dev unzip \
zip liblz4-tool repo git ssh make gcc libssl-dev liblz4-tool vim expect \
g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \
unzip device-tree-compiler python-pip libncurses5-dev rsync subversion \
sed make binutils build-essential gcc g++ wget python libncurses5 bzr cvs git mercurial \
patch gzip bzip2 perl tar cpio unzip rsync file bc wget qemu-user-static live-build -y
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install lib32z-dev ccache
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
1.wsl默认安装在C盘,建议迁移至磁盘空间较大的盘
迁移博客:https://blog.csdn.net/m0_37605642/article/details/127812965
2.因为wsl默认空间大小是256G,RK Android12的源码包编译后接近200G,所以要扩展最好有400G;(最好自己玩熟一点再弄)
扩容博客:https://www.jianshu.com/p/2348dc7e9aef
3.默认/mnt/下挂载各种磁盘,需将Android12压缩包拷贝到自己的home目录解压再编译,否则经过windows的磁盘会报错
然后执行
****@DESKTOP-HU3S291:~/RKAndroid12$ source javaenv.sh
****@DESKTOP-HU3S291:~/RKAndroid12$ source build/envsetup.sh
****@DESKTOP-HU3S291:~/RKAndroid12$ lunch rk3568_s-userdebug