Rockchip固件分区排列

更新时间:2023-06-12 01:28:58 阅读: 评论:0

小孩夜里咳嗽
郑少秋Rockchip固件分区排列⼀、介绍
在开放源代码⽀持中,Rockchip使⽤ 作为其主要分区表。我们将GPT存储在LBA0〜LBA63中。
⼆、U-boot中的GPT分区表
U-boot⽀持标准的 。
三、默认存储图
Partition Start Sector Number of
Sectors
Partition Size
快乐习字PartNum
in GPT
Requirements
MBR0000000001000000015120.5KB Primary GPT100000001630000003F3225631.5KB
loader16400000040710400001bc04096000  2.5MB1preloader (miniloader or U-Boot SPL)
Vendor Storage716800001c0051200000200262144256KB SN, MAC and etc. Rerved Space768000001e0038400000180196608192KB Not ud rerved1806400001f80128000000806553664KB legacy DRM key U-Boot ENV812800001fc064000000403276832KB
rerved281920000200081920000200041943044MB legacy parameter loader2163840000400081920000200041943044MB2U-Boot or UEFI
trust245760000600081920000200041943044MB3trusted-os like ATF, OP-TEE
boot(bootable must be t)327680000800022937600038000117440512112MB4
kernel, dtb,
rootfs26214400040000----MB5Linux system
Secondary GPT1677718300FFFFDF33000000211689616.5KB
注1:如果preloader是miniloader,则loader2分区可⽤于uboot.img,trust分区可⽤于trust.img; 如果preloader是不带trust⽀持的
SPL,则loader2分区可⽤于u-boot.bin,⽽trust分区不可⽤;如果preloader是具有trust⽀持的SPL(ATF或OPTEE),则loader2可
⽤于u-boot.itb(包括u-boot.bin和trust⼆进制⽂件),⽽trust分区不可⽤。
四、通过rkdeveloptool编写GPT分区表
rkdeveloptool db rkxx_bin
传统四喜丸子rkdeveloptool gpt
其中包含分区信息:
CMDLINE: mtdparts=rk29xxnand:0x00001f40@0x00000040(loader1),0x00000080@0x00001f80(rerved1),0x00002000@0x00002000(rerved2),0x00002000
五、通过U-boot写⼊GPT分区表
在u-boot console中,“ gpt”命令可⽤于写⼊gpt分区表:
gpt - GUID Partition Table
Usage:
gpt <command> <interface> <dev> <partitions_list>
- GUID partition table restoration and validity check
Restore or verify GPT information on a device connected
to interface
师说韩愈
Example usage:
gpt write mmc 0 $partitions
gpt verify mmc 0 $partitions</code>
例如:
=> env t partitions name=rootfs,size=-,type=system
=> gpt write mmc 0 $partitions
Writing GPT: success!
注意:可以在u-boot console(使⽤“ env t”命令)或在u-boot的源代码中设置分区env,例如:
include/configs/kylin_rk3036.h
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
...
#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS \
"partitions=" PARTS_DEFAULT \
六、通过U-Boot的fastboot写⼊GPT分区表
当前的上游u-boot包含fastboot协议⽀持。此版本的fastboot⽀持2种修改gpt分区表的⽅法:(1)fastboot oem格式
它与u-boot控制台中的“ gpt write mmc 0 $ partitions”相同:
#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
if (strncmp("format", cmd + 4, 6) == 0) {
char cmdbuf[32];
sprintf(cmdbuf, "gpt write mmc %x $partitions",
CONFIG_FASTBOOT_FLASH_MMC_DEV);
if (run_command(cmdbuf, 0))
fastboot_tx_write_str("FAIL");
el
fastboot_tx_write_str("OKAY");
} el
#endif
PC命令:
$ fastboot oem format -i 0x2207
...
OKAY [  0.015s]
finished. total time: 0.015s
(2)fastboot flash gpt <gpt分区映像>
if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
printf("%s: updating MBR, Primary and Backup GPT(s)\n",
__func__);
if (is_valid_gpt_buf(dev_desc, download_buffer)) {
printf("%s: invalid GPT - refusing to write to flash\n",
__func__);
fastboot_fail(respon_str, "invalid GPT partition");
return;
}
if (write_mbr_and_gpt_partitions(dev_desc, download_buffer)) {                        printf("%s: writing GPT partitions failed\n", __func__);
fastboot_fail(respon_str,
"writing GPT partitions failed");
return;
}
printf("........ success\n");
fastboot_okay(respon_str, "");
return;
gpt分区映像可以由PC的gdisk⼯具⽣成,
例如:
$ dd if=/dev/zero of=disk.img bs=1M count=256
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 0.151867 s, 1.8 GB/s
$ gdisk disk.img
GPT fdisk (gdisk) version 0.8.1
Partition table scan:
MBR: not prent
BSD: not prent
APM: not prent
GPT: not prent
Creating new GPT entries.
礼貌的近义词
Command (? for help): n
Partition number (1-128, default 1):
First ctor (34-524254, default = 34) or {+-}size{KMGTP}:
Information: Moved requested ctor from 34 to 2048 in
order to align on 2048-ctor boundaries.
U 'l' on the experts' menu to adjust alignment
怎样交朋友Last ctor (2048-524254, default = 524254) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
廉洁自律方面Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT).
Warning: The kernel is still using the old partition table.
The new table will be ud at the next reboot.
The operation has completed successfully.
$ dd if=disk.img of=gpt.img count=64
64+0 records in
64+0 records out
32768 bytes (33 kB) copied, 0.00075438 s, 43.4 MB/s
PC命令:
$ fastboot flash gpt gpt.img
target reported max download size of 117440512 bytes
nding 'gpt' (32 KB)...
OKAY [  0.006s]
writing 'gpt'...
OKAY [  0.025s]
finished. total time: 0.030s

本文发布于:2023-06-12 01:28:58,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/933699.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:分区   分区表   源代码   包含
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图