]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: Correct ifdtool microcode calculation
authorSimon Glass <sjg@chromium.org>
Thu, 1 Jan 2015 23:17:56 +0000 (16:17 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 13 Jan 2015 15:24:58 +0000 (07:24 -0800)
This currently assumes that U-Boot resides at the start of ROM. Update
it to remove this assumption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
tools/ifdtool.c

index fe8366ba4f6fb16a871676356817e4bcb75862c2..590ccc914b064ec639b1dd79bc22b7ccd2a9edf7 100644 (file)
@@ -788,9 +788,9 @@ static int write_uboot(char *image, int size, struct input_file *uboot,
                              fdt_strerror(data_size));
                        return -ENOENT;
                }
-               offset = ucode_ptr - uboot->addr;
+               offset = (uint32_t)(ucode_ptr + size);
                ptr = (void *)image + offset;
-               ptr[0] = uboot->addr + (data - image);
+               ptr[0] = (data - image) - size;
                ptr[1] = data_size;
                debug("Wrote microcode pointer at %x: addr=%x, size=%x\n",
                      ucode_ptr, ptr[0], ptr[1]);