~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 256a5a76f963d6434a98a22daef4549d71c0ac21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Reversing Amlogic BL2

*Efforts to reverse-engineer Amlogic's proprietary BL2*

Check <https://moin.vitali64.duckdns.org/AmlogicBL2> for notes.

This repository contains the following files for each SoC family being 
reverse-engineered:

* `bl2.txt`: Disassembly of bl2.bin
* `bl2.c`: Decompiled bl2.bin

You can import either ones to Ghidra, it's up to you.

## Progress

**Support for all SoCs in [U-Boot SPL](https://git.vitali64.duckdns.org/misc/u-boot-kii-pro.git/tree/?h=wip/spl)
is still very much a work-in-progress!** This is especially true for anything 
newer than GXBB/S905. [Detailed progress](https://moin.vitali64.duckdns.org/AmlogicBL2)

* GXBB: **Done**
* GXL: **Mostly**
* AXG: **TODO** (no AXG board, but very similar to GXL)
* G12B: **WIP**
* SM1: **TODO**

## Why are there lots of unnamed functions?

These functions could be unnamed because:

* I'm not interested in them; or
* I haven't figured out yet what they do.

I'm mostly interested in DDR init, so look for functions starting with `ddr_`.
Those, along with all functions they make use of, will most likely have names 
and comments.

## Naming scheme

This is mostly specific to `bl2.c`. Names of functions/variables are kept as 
close to old sources as possible, but there are some exceptions:

* Functions ending with `_new` are new functions added after Amlogic's 
  obfuscation;
* Functions ending with `__notsure` are functions where I'm not sure about the 
  name;
* `ddrs` is `__ddr_setting`;
* `ddrt` is `__ddr_timming`;
* `plls` is `__pll_setting`;
* Variables declared in functions may not have the name they have in the old 
  sources.

## Legal

I think it's perfectly legal to host a disassembly of `bl2.bin`; it's not 
mentionned in the license that I don't have the right to do that, but if you 
think otherwise/would like to take this down please [contact me first](https://vitali64.duckdns.org/).