Skip to content

Commit

Permalink
在《一些与全志D1启动相关的东西.md》中添加mbr相关内容
Browse files Browse the repository at this point in the history
  • Loading branch information
wxjstz committed Jul 31, 2021
1 parent e0ffb0d commit 5b7080e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 一些与全志D1启动相关的东西.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@

首先SD启动镜像是一个GPT分区的硬盘镜像,在第一个分区之前存放了一些固件。

### 奇怪的MBR

尽管磁盘镜像是GPT,但依然有一份传统的MBR(分区表)。我的SD镜像来自[伟东山的buildroot](https://gitee.com/weidongshan/neza-d1-buildroot)

```shell
➜ /tmp xxd -s 446 -l 64 disk.img
000001be: 8032 1102 0c46 2006 e089 0000 0000 0100 .2...F .........
000001ce: 0046 2106 8304 1e46 e089 0100 00a0 0f00 .F!....F........
000001de: 0000 0200 ee21 0100 0100 0000 1f08 0000 .....!..........
000001ee: 0000 0000 0000 0000 0000 0000 0000 0000 ................
```

我尝试清除了sd卡中的MBR,发现不能从sd卡启动了。从sd卡启动是会卡在uboot,日志如下:

```
[00.442][mmc]: get sdc_type fail and use default host:tm1.
[00.449][mmc]: can't find node "mmc0",will add new node
[00.453][mmc]: fdt err returned <no error>
[00.457][mmc]: Using default timing para
[00.461][mmc]: SUNXI SDMMC Controller Version:0x50310
[00.489][mmc]: card_caps:0x3000000a
[00.492][mmc]: host_caps:0x3000003f
[00.509]set disp.dev2_output_type fail. using defval=0
[00.533]Get bootloader and boot-resource partition number fail!
[00.562]out of usb burn from boot: not need burn key
```

### boot0

这个程序存放在磁盘镜像8K字节偏移量的位置,被称为boot0。它的代码位于官方SDK的`lichee/brandy-2.0/spl`目录。它被CPU内部的代码自动加载执行。它有一个头部用于记录一些参数,以及用于让CPU内部代码识别它是否为一个有效的boot0。这个头部比较复杂,相关代码参考官方SDK的`lichee/brandy-2.0/spl/include/private_boot0.h`。此程序的主体代码位于`lichee/brandy-2.0/spl/nboot/main/boot0_main.c`。它的主要工作为:初始化时钟、内存,并加载下一阶段的程序。
Expand Down

0 comments on commit 5b7080e

Please sign in to comment.