-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIPS: Unify the suffix of compressed vmlinux.bin
The compressed vmlinux.bin is only a temp file so it's ok to use the same suffix .z for them (.gz,.lzo,.lzma...) to remove several lines and simpify the maintenance (no need to add the "suffix_$(xxx) := suffix" line). Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> To: linux-mips <linux-mips@linux-mips.org> Cc: Alexander Clouter <alex@digriz.org.uk> Cc: Manuel Lauss <manuel.lauss@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Patchwork: https://patchwork.linux-mips.org/patch/1323/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> ---
- Loading branch information
Wu Zhangjin
authored and
Ralf Baechle
committed
Aug 5, 2010
1 parent
51f1336
commit c853d94
Showing
2 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2010 "Wu Zhangjin" <wuzhangjin@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <errno.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
struct stat sb; | ||
uint64_t vmlinux_size, vmlinux_load_addr, vmlinuz_load_addr; | ||
|
||
if (argc != 3) { | ||
fprintf(stderr, "Usage: %s <pathname> <vmlinux_load_addr>\n", | ||
argv[0]); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (stat(argv[1], &sb) == -1) { | ||
perror("stat"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Convert hex characters to dec number */ | ||
errno = 0; | ||
if (sscanf(argv[2], "%llx", &vmlinux_load_addr) != 1) { | ||
if (errno != 0) | ||
perror("sscanf"); | ||
else | ||
fprintf(stderr, "No matching characters\n"); | ||
|
||
return EXIT_FAILURE; | ||
} | ||
|
||
vmlinux_size = (uint64_t)sb.st_size; | ||
vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size; | ||
|
||
/* | ||
* Align with 16 bytes: "greater than that used for any standard data | ||
* types by a MIPS compiler." -- See MIPS Run Linux (Second Edition). | ||
*/ | ||
|
||
vmlinuz_load_addr += (16 - vmlinux_size % 16); | ||
|
||
printf("0x%llx\n", vmlinuz_load_addr); | ||
|
||
return EXIT_SUCCESS; | ||
} |