4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
10 #include <sys/types.h>
17 int main(int argc, char *argv[])
19 unsigned long long vmlinux_size, vmlinux_load_addr, vmlinuz_load_addr;
23 fprintf(stderr, "Usage: %s <pathname> <vmlinux_load_addr>\n",
28 if (stat(argv[1], &sb) == -1) {
33 /* Convert hex characters to dec number */
35 if (sscanf(argv[2], "%llx", &vmlinux_load_addr) != 1) {
39 fprintf(stderr, "No matching characters\n");
44 vmlinux_size = (uint64_t)sb.st_size;
45 vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size;
48 * Align with 16 bytes: "greater than that used for any standard data
49 * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition).
52 vmlinuz_load_addr += (16 - vmlinux_size % 16);
54 printf("0x%llx\n", vmlinuz_load_addr);