summaryrefslogtreecommitdiff
path: root/common/image.c
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-01-31 13:20:07 +0100
committerWolfgang Denk <wd@denx.de>2008-02-07 01:12:58 +0100
commit42b73e8ee00d48004791dea64b8093fb974c57e1 (patch)
treeaeda842054f028643b9a0fc3321cc7a78bb44c9f /common/image.c
parente99c26694a384221d336f6448c06a57479c0baa4 (diff)
downloadu-boot-imx-42b73e8ee00d48004791dea64b8093fb974c57e1.zip
u-boot-imx-42b73e8ee00d48004791dea64b8093fb974c57e1.tar.gz
u-boot-imx-42b73e8ee00d48004791dea64b8093fb974c57e1.tar.bz2
[new uImage] Factor out common routines for getting os/arch/type/comp names
Move numeric-id to name translation for image os/arch/type/comp header fields to a helper routines: image_get_os_name(), image_get_arch_name(), image_get_type_name(), image_get_comp_name(). Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common/image.c')
-rw-r--r--common/image.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c
index 6eee83d..6726f03 100644
--- a/common/image.c
+++ b/common/image.c
@@ -193,3 +193,91 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
*data = 0;
}
}
+
+#ifndef USE_HOSTCC
+const char* image_get_os_name (uint8_t os)
+{
+ const char *name;
+
+ switch (os) {
+ case IH_OS_INVALID: name = "Invalid OS"; break;
+ case IH_OS_NETBSD: name = "NetBSD"; break;
+ case IH_OS_LINUX: name = "Linux"; break;
+ case IH_OS_VXWORKS: name = "VxWorks"; break;
+ case IH_OS_QNX: name = "QNX"; break;
+ case IH_OS_U_BOOT: name = "U-Boot"; break;
+ case IH_OS_RTEMS: name = "RTEMS"; break;
+#ifdef CONFIG_ARTOS
+ case IH_OS_ARTOS: name = "ARTOS"; break;
+#endif
+#ifdef CONFIG_LYNXKDI
+ case IH_OS_LYNXOS: name = "LynxOS"; break;
+#endif
+ default: name = "Unknown OS"; break;
+ }
+
+ return name;
+}
+
+const char* image_get_arch_name (uint8_t arch)
+{
+ const char *name;
+
+ switch (arch) {
+ case IH_ARCH_INVALID: name = "Invalid Architecture"; break;
+ case IH_ARCH_ALPHA: name = "Alpha"; break;
+ case IH_ARCH_ARM: name = "ARM"; break;
+ case IH_ARCH_AVR32: name = "AVR32"; break;
+ case IH_ARCH_BLACKFIN: name = "Blackfin"; break;
+ case IH_ARCH_I386: name = "Intel x86"; break;
+ case IH_ARCH_IA64: name = "IA64"; break;
+ case IH_ARCH_M68K: name = "M68K"; break;
+ case IH_ARCH_MICROBLAZE:name = "Microblaze"; break;
+ case IH_ARCH_MIPS64: name = "MIPS 64 Bit"; break;
+ case IH_ARCH_MIPS: name = "MIPS"; break;
+ case IH_ARCH_NIOS2: name = "Nios-II"; break;
+ case IH_ARCH_NIOS: name = "Nios"; break;
+ case IH_ARCH_PPC: name = "PowerPC"; break;
+ case IH_ARCH_S390: name = "IBM S390"; break;
+ case IH_ARCH_SH: name = "SuperH"; break;
+ case IH_ARCH_SPARC64: name = "SPARC 64 Bit"; break;
+ case IH_ARCH_SPARC: name = "SPARC"; break;
+ default: name = "Unknown Architecture"; break;
+ }
+
+ return name;
+}
+
+const char* image_get_type_name (uint8_t type)
+{
+ const char *name;
+
+ switch (type) {
+ case IH_TYPE_INVALID: name = "Invalid Image"; break;
+ case IH_TYPE_STANDALONE:name = "Standalone Program"; break;
+ case IH_TYPE_KERNEL: name = "Kernel Image"; break;
+ case IH_TYPE_RAMDISK: name = "RAMDisk Image"; break;
+ case IH_TYPE_MULTI: name = "Multi-File Image"; break;
+ case IH_TYPE_FIRMWARE: name = "Firmware"; break;
+ case IH_TYPE_SCRIPT: name = "Script"; break;
+ case IH_TYPE_FLATDT: name = "Flat Device Tree"; break;
+ default: name = "Unknown Image"; break;
+ }
+
+ return name;
+}
+
+const char* image_get_comp_name (uint8_t comp)
+{
+ const char *name;
+
+ switch (comp) {
+ case IH_COMP_NONE: name = "uncompressed"; break;
+ case IH_COMP_GZIP: name = "gzip compressed"; break;
+ case IH_COMP_BZIP2: name = "bzip2 compressed"; break;
+ default: name = "unknown compression"; break;
+ }
+
+ return name;
+}
+#endif