Docker - Android源码编译与烧写

创建源代码 并挂载到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

相关推荐

  1. android 编译android 12

    2023-12-14 18:18:03       49 阅读
  2. android 编译添加日志打印

    2023-12-14 18:18:03       11 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-14 18:18:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-14 18:18:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-14 18:18:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-14 18:18:03       20 阅读

热门阅读

  1. 工作招聘

    2023-12-14 18:18:03       42 阅读
  2. 用php语言写一个自适应新闻单页面

    2023-12-14 18:18:03       42 阅读
  3. SVN优缺点详解及版本控制系统选型建议

    2023-12-14 18:18:03       49 阅读
  4. 安装ingress-nginx

    2023-12-14 18:18:03       43 阅读
  5. 超详细校园网络系统规划设计方案

    2023-12-14 18:18:03       32 阅读
  6. 浅谈时间序列预测中的时间步

    2023-12-14 18:18:03       66 阅读