]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mxs: mxsboot: Move sdcard BCB header to 4 sectors offset
authorOtavio Salvador <otavio@ossystems.com.br>
Wed, 24 Apr 2013 11:23:27 +0000 (11:23 +0000)
committerStefano Babic <sbabic@denx.de>
Fri, 26 Apr 2013 07:16:48 +0000 (09:16 +0200)
The MX23 Boot ROM does blindly load from 2048 offset while the MX28
does parse the BCB header to known where to load the image from. We
move the BCB header to 4 sectors offset so same code can be used by
both SoCs avoiding code duplication.

This idea was given by Marek Vasut <marex@denx.de>

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Marek Vasut <marex@denx.de>
tools/mxsboot.c

index 6c05aa479d4360c0c14cd0f989c250ecf119126d..d92c39fec667448e0963c14dccbd72e8e5b572ce 100644 (file)
@@ -551,7 +551,7 @@ static int mx28_create_sd_image(int infd, int outfd)
 
        fsize = lseek(infd, 0, SEEK_END);
        lseek(infd, 0, SEEK_SET);
-       size = fsize + 512;
+       size = fsize + 4 * 512;
 
        buf = malloc(size);
        if (!buf) {
@@ -559,7 +559,7 @@ static int mx28_create_sd_image(int infd, int outfd)
                goto err0;
        }
 
-       ret = read(infd, (uint8_t *)buf + 512, fsize);
+       ret = read(infd, (uint8_t *)buf + 4 * 512, fsize);
        if (ret != fsize) {
                ret = -1;
                goto err1;
@@ -574,8 +574,8 @@ static int mx28_create_sd_image(int infd, int outfd)
        cb->drv_info[0].chip_num = 0x0;
        cb->drv_info[0].drive_type = 0x0;
        cb->drv_info[0].tag = 0x1;
-       cb->drv_info[0].first_sector_number = sd_sector + 1;
-       cb->drv_info[0].sector_count = (size - 1) / 512;
+       cb->drv_info[0].first_sector_number = sd_sector + 4;
+       cb->drv_info[0].sector_count = (size - 4) / 512;
 
        wr_size = write(outfd, buf, size);
        if (wr_size != size) {