app: aboot: Use pagesize from device attributes
Change-Id: I91414253acddb8c9b9b91de33d3b0f27e9c93c63
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 74c0fb9..7cc2e20 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1195,6 +1195,7 @@
unsigned long long ptn = 0;
unsigned long long size;
int index = INVALID_PTN;
+ uint32_t blocksize;
index = partition_get_index("aboot");
ptn = partition_get_offset(index);
@@ -1207,7 +1208,9 @@
memcpy(info, dev, sizeof(device_info));
- if(mmc_write((ptn + size - 512), 512, (void *)info_buf))
+ blocksize = mmc_get_device_blocksize();
+
+ if(mmc_write((ptn + size - blocksize), blocksize, (void *)info_buf))
{
dprintf(CRITICAL, "ERROR: Cannot write device info\n");
return;
@@ -1220,6 +1223,7 @@
unsigned long long ptn = 0;
unsigned long long size;
int index = INVALID_PTN;
+ uint32_t blocksize;
index = partition_get_index("aboot");
ptn = partition_get_offset(index);
@@ -1230,7 +1234,9 @@
size = partition_get_size(index);
- if(mmc_read((ptn + size - 512), (void *)info_buf, 512))
+ blocksize = mmc_get_device_blocksize();
+
+ if(mmc_read((ptn + size - blocksize), (void *)info_buf, blocksize))
{
dprintf(CRITICAL, "ERROR: Cannot read device info\n");
return;
@@ -2210,10 +2216,10 @@
unsigned reboot_mode = 0;
bool boot_into_fastboot = false;
- /* Setup page size information for nand/emmc reads */
+ /* Setup page size information for nv storage */
if (target_is_emmc_boot())
{
- page_size = 2048;
+ page_size = mmc_page_size();
page_mask = page_size - 1;
}
else