Docker - Android源码编译与烧写

发布时间:2023年12月17日

创建源代码 并挂载到win目录
docker run -v /mnt/f/android8.0:/data/android8.0 -it --name android8.0 49a981f2b85f /bin/bash

使用 docker update 命令动态调整内存限制:

重新运行一个容器
docker run -m 512m my_container

修改运行中容器
显示运行中容器
docker ps
这将把容器的内存限制设置为 512 兆字节。如果你想增加内存限制,可以将 --memory 参数的值调整为更大的值。
docker update --memory 512m <container_id_or_name>
重启
docker restart <container_id_or_name>

显示容器内存以及 cpu使用情况
docker stats <container_id_or_name>

修改容器核心数量

重新运行一个容器
docker run --cpus 2 my_image

修改运行中容器
显示运行中容器
docker ps
更新容器的 CPU 核心数
docker update --cpus 2 <container_id_or_name>
重启
docker restart <container_id_or_name>

修改WSL的核心数和内存容量
在这里插入图片描述
新建WSL配置文件

# 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=8GB 

# Sets the VM to use two virtual processors
processors=24

# 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

User/bin/bash: rsync: command not found
sudo apt-get update
sudo apt-get install rsync

编译成功 撒花???
在这里插入图片描述

挂载输出目录
docker run -it -v /mnt/f/out:/mnt/f/out --name android-8.0.0_r17_env_v1.0 9d7f84ef799b /bin/bash

导出系统镜像
cp system.img /mnt/f/out/??

同步文件夹
rsync -av /root/android8.0/out/target/product/angler/*.txt /mnt/f/out/????

root@ce0fbb39ab6f:~/android8.0/out/target/product/angler# rsync -av --exclude='*/' /root/android8.0/out/target/product/angler/*.img  /mnt/f/out/
sending incremental file list
boot.img
cache.img
ramdisk-recovery.img
ramdisk.img
recovery.img
system.img
userdata.img
vendor.img

sent 1,375,517,306 bytes  received 168 bytes  119,610,215.13 bytes/sec
total size is 1,375,181,071  speedup is 1.00

烧写
参考Framework入门のPiex 6P源码(下载/编译/刷机)

fastboot erase cache \
fastboot flash boot boot.img \
fastboot flash recovery recovery.img \
fastboot flash system system.img \
fastboot flash userdata userdata.img \
fastboot flash cache cache.img \
fastboot flash vendor vendor.img \
fastboot reboot

验证编译时间

adb shell getprop ro.build.date.utc
#2023-12-12 15:36:25
1702366585 

释放内存
关闭wsl,释放vmmem
wsl --shutdown

完结撒花?🌸🎉

https://lixiaogang03.github.io/2020/11/08/Docker-Android/
https://segmentfault.com/a/1190000039970343

文章来源:https://blog.csdn.net/qq_20330595/article/details/134930599
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。