Android AGP源码下载编译
Andriod AGP下载 & 编译源码安装简单问了下AI,虽然我不知道源码在哪,但是他知道。
https://android.googlesource.com/platform/tools/base/
但是再经过一些文档的查阅,让我发现不完全是这样的。
https://android.googlesource.com/platform/tools/base/+/studio-master-dev/build-system/README.md
最终我还是决定参考官方教程来。不过我这里没有拉官方的master分支,主要考虑是release分支会比较稳定。
12repo init -u https://mirrors.ustc.edu.cn/aosp/platform/manifest.git -b studio-2025.1.3repo sync
SDK软连接下载源码后我们的下一步就是用ide打开源码
The code of the plugin and its dependencies is located in tools/base. You can open ...
AOSP Soong 构建系统调试环境配置
AOSP Soong debug 环境配置前言Soong是一个用Go语言编写的专用于AOSP的构建系统。
近期”突发恶疾”,想着分析下构建流程。
由于网上关于Soong的调试教程较少,因此就有了本文~
流程1.go/dlv安装配置
2.waiting for debugger
3.attach to debugger
dlv安装1.go语言安装
2.安装dlv调试工具工具
wait for debuggersoong_ui的启动代码在如下的脚本中
build/soong/soong_ui.bash
12345678910111213141516171819202122232425262728293031323334353637383940#!/bin/bash -eu## Copyright 2017 Google Inc. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use thi ...
AOSP Microfactory
Microfactory基于Android14.0.0_r73
简单介绍:
Microfactory是aosp的一个go语言编写的构建工具,且主要用于对go编译进行缓存,实现增量编译的效果。
源码microfactory工具通过source build/blueprint/microfactory/microfactory.bash配置。
配置好以后shell中可以通过调用build_go函数触发并使用microfactory进行增量编译。
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162# build/blueprint/microfactory/microfactory.bashfunction build_go{ # Increment when microfactory changes enough that it cannot rebuild itse ...
ARM AAPCS64
Arm64 aapcs解析之寄存器基础概念1.AAPCS (Procedure Call Standard for the Arm® Architecture)
see it
Register
Special
Role in the procedure call standard
SP
The Stack Pointer.堆栈指针
r30
LR
The Link Register.链接寄存器
r29
FP
The Frame Pointer堆栈指针寄存器
r19…r28
Callee-saved registers被调用方保存寄存器。调用方随意使用
r18
The Platform Register, if needed; otherwise a temporary register. See notes.平台寄存器
r17
IP1
The second intra-procedure-call temporary register (can be used by call veneers and PLT code); at other time ...
Android ebpf环境搭建
Android ebpf环境搭建主要用于配置ebpf的运行环境,开发环境不包含在内。
前言
关于本文:
本文主要用于介绍Android中如何搭建ebpf学习环境,难度较大/不断更新完善中。
前置准备:
a.设备最好要有内核源代码,因为涉及到内核重新配置/编译。如果没有则内核必须得是GKI内核。
b.设备需要解锁BL, 因为涉及Boot img刷入
c.设备内核最好在5.10及其以上的版本,因为ebpf的特性和内核版本绑定。
d.需要编译好的Linux rootfs,后续需要在Android上使用chroot运行rootfs
概览
编译自定义内核并刷入
Note:
别怕这里只是简单的改了几个内核参数。
改动不大,就是流程比较长。
安装bpftrace
安装BCC
内核配置准备
BCC内核配置
a.BCC需要的内核配置列表
b.Ftrace内核配置参数——具体过程可见下方[内核开启ftrace](##内核开启Dynamic FTrace)
安装bpftrace1apt install bpftrace
安装bcc
Note:
该过程必须使用源 ...
编译创建Debian rootfs并在Android 上运行
编译创建Debian rootfs并在Android 上运行refs:
博客1
博客2
Debian Wiki
背景
Android ebpf环境搭建
编译构建可在Android上运行的Debian rootfs环境
整体思路其实通过上述的refs很容易能看出来rootfs的安装流程很简单。通过debootstrap,下载安装到制定路径。
下载安装完成以后就可以通过chroot check是否生效。
确认Debian版本
版本的选择是安装过程遇到的第一个问题,由于Debian是和Linux内核版本绑定的,所以我们需要根据内核版本确认Debian的安装版本。
经过和Gpt的深入交流,总结得知Debain的默认内核版本可以通过如下方式查找。(不唯一)
首先我们可以通过release note地址去查看当前release的debian版本。
Debian Release Note
2.点击指定版本的link以后、进入release note,选择关注的架构
搜索Kernel以后可发现,debian 10 ~ debian 11 默认内核从4.19 更新到了5.10
因为目前 ...
N60Pro刷入ImmortalWrt
N60Pro刷入ImmortalWrtpre01.刷机最好使用Windows客户端(作者尝试过Linux, Mac均失败。)
2.本文所有文件均使用的是ImmortalWrt的原装软件包(过程可能比较麻烦,可以使用恩山社区大佬闭源的uboot)
3.请在阅读完全文流程后刷入ImmortalWrt
4.务必做好原装分区的备份!!!务必!务必!务必!
概览1.基础环境配置
根据官方手册配置好网络环境,打开ssh
2.备份
将N60Pro的所有分区进行备份
3,刷入uboot
通过官方镜像下载uboot
4.刷入immortalWrt镜像
基础环境配置see https://mao.fan/article/333
略
备份分区1.查看网关地址(192.168.100.1)
12345678910111213141516171819202122232425262728~ route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifac ...
构建Pixel Kernel
构建Android Kernel
手机设备为Pixel 6
编译主机为Ubuntu 24.04
12345678910111213141516171819 ./+o+- rose@rose yyyyy- -yyyyyy+ OS: Ubuntu 24.04 noble ://+//////-yyyyyyo Kernel: x86_64 Linux 6.11.0-26-generic .++ .:/++++++/-.+sss/` Uptime: 14h 10m .:++o: /++++++++/:--:/- Packages: 2896 o:+o+:++.`..```.-/oo+++++/ Shell: zsh 5.9 .:+o:+o/. `+sssoo+/ Resolution: 3840x2160 .++/+:+oo+o:` ...
Android ClassLoader加载流程解析
Android ClassLoader加载流程
Note:
本文主要是针对于ClassLoader加载逻辑进行分析,并未对Class define逻辑进行分析。
起点
ClassLoader.load
Class.forName
过程Java执行过程1. ClassLoader.loadClass(String name)123public Class<?> loadClass(String name) throws ClassNotFoundException { return loadClass(name, false);}
2. ClassLoader.loadClass(name, false)
加载流程其实比较固定
通过findLoadedClass查看该class是否已经加载过
调用parent.loadClass加载class
如果#2加载失败通过findClass通过自生加载Class
1234567891011121314151617181920212223242526272829/*** name ...
Aosp小tips
关于本文
主要记录在AOSP调试学习过程中遇到的坑~
Android 14_r73userdebug 编译out of space? out of inodes? the tree size XXX
问题:
out of space? out of inodes?XX
这个报错包含有3个原因。
内存耗尽
inodes耗尽
生成的文件超过文件系统的大小限制
这里的报错主要是因为#3导致,原因如下:
img文件生成目前主要有两种方式ex4和f2fs, 图中的报错主要是由于userdata默认采用了f2fs导致大小超过了f2fs的最大限制,需要调整文件类型为ext4并且将文件的大小限制设置为合适的大小
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495[ 10% 54/ ...