diff options
author | Xiaojie Zhan <xiaojie.zhan@amlogic.com> | 2017-03-06 18:37:40 +0800 |
---|---|---|
committer | Xiaobo Gu <xiaobo.gu@amlogic.com> | 2017-03-08 13:26:18 +0800 |
commit | cc538c7ce266841c721e5d5f2530a7166bae39d6 (patch) | |
tree | b9fa6732c2a47c7e75cdb07e419366966de55a46 /common/store_interface.c | |
parent | 94bac7380748980c0a44d60aad64a530f60079b9 (diff) | |
download | u-boot-odroid-c1-cc538c7ce266841c721e5d5f2530a7166bae39d6.tar.gz |
PD#136280: emmc: mbr&ebr support
1. construct mbr&ebr base on aml partition
2. without partition name and mask
3. enabled after gxl
4. controlled by CONFIG_PTBL_MBR
5. add cmd "store mbr addr" and write dtb
6. support "fastboot flash mbr dtb.file"
Change-Id: I87848b0e18293a3e860dc399e1a5286ffaa1ffb5
Diffstat (limited to 'common/store_interface.c')
-rw-r--r-- | common/store_interface.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/common/store_interface.c b/common/store_interface.c index 7b549c9089..0e52ea6612 100644 --- a/common/store_interface.c +++ b/common/store_interface.c @@ -256,6 +256,36 @@ static int do_store_dtb_ops(cmd_tbl_t * cmdtp, int flag, int argc, char * const return ret; } +/* + write mbr to emmc only. + store mbr Addr + */ +extern int emmc_update_mbr(unsigned char *buffer); +static int do_store_mbr_ops(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) +{ + int ret = 0; + unsigned char *buffer; + cpu_id_t cpu_id = get_cpu_id(); + + if ((cpu_id.family_id < MESON_CPU_MAJOR_ID_GXL) + || (device_boot_flag != EMMC_BOOT_FLAG)) { + ret = -1; + ErrP("MBR not support, try [store dtb write Addr]\n"); + goto _out; + } + + if (argc < 3) return CMD_RET_USAGE; + + buffer = (unsigned char *)simple_strtoul(argv[2], NULL, 0); + ret = emmc_update_mbr(buffer); + if (ret) { + ErrP("fail to update mbr\n"); + goto _out; + } +_out: + return ret; +} + static int do_store_key_ops(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int ret = 0; @@ -838,7 +868,7 @@ E_SWITCH_BACK: return CMD_RET_USAGE; } #endif - }
+ } } else if (strcmp(area, "dtb") == 0) { if (device_boot_flag == EMMC_BOOT_FLAG) { @@ -857,7 +887,7 @@ E_SWITCH_BACK: return CMD_RET_USAGE; } #endif - }
+ } } else if (strcmp(area, "partition") == 0) { if (device_boot_flag == EMMC_BOOT_FLAG) { int blk_shift; @@ -1393,6 +1423,7 @@ static cmd_tbl_t cmd_store_sub[] = { U_BOOT_CMD_MKENT(rom_write, 5, 0, do_store_rom_write, "", ""), U_BOOT_CMD_MKENT(dtb, 5, 0, do_store_dtb_ops, "", ""), U_BOOT_CMD_MKENT(key, 5, 0, do_store_key_ops, "", ""), + U_BOOT_CMD_MKENT(mbr, 3, 0, do_store_mbr_ops, "", ""), }; static int do_store(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) @@ -1436,5 +1467,7 @@ U_BOOT_CMD(store, CONFIG_SYS_MAXARGS, 1, do_store, " read/write dtb, size is optional \n" "store key read/write addr <size>\n" " read/write key, size is optional \n" + "store mbr addr\n" + " update mbr/partition table by dtb\n" ); |