kernel trace for debugging.
Update to latest flat.h.
* ELF format file handling. Extended relocation support for all of
* text and data.
*
- * (c) 2003, H8 support <davidm@snapgear.com>
+ * (c) 2003, H8 support, ktrace <davidm@snapgear.com>
* (c) 2001-2003, arm/arm-pic/arm-big-endian support <davidm@snapgear.com>
* (c) 2001, v850 changes, Mile Bader <miles@lsi.nec.co.jp>
* (c) 2003, SuperH support, Paul Mundt <lethal@linux-sh.org>
int verbose = 0; /* extra output when running */
int pic_with_got = 0; /* do elf/got processing with PIC code */
int load_to_ram = 0; /* instruct loader to allocate everything into RAM */
+int ktrace = 0; /* instruct loader output kernel trace on load */
int compress = 0; /* 1 = compress everything, 2 = compress data only */
int use_resolved = 0; /* If true, get the value of symbol references from */
/* the program contents, not from the relocation table. */
"[-o <output-file>] <elf-file>\n\n"
" -v : verbose operation\n"
" -r : force load to RAM\n"
+ " -k : enable kernel trace on load (for debug)\n"
" -z : compress code/data/relocs\n"
" -d : compress data/relocs\n"
" -a : use existing symbol references\n"
stack = 4096;
- while ((opt = getopt(argc, argv, "avzdrp:s:o:R:")) != -1) {
+ while ((opt = getopt(argc, argv, "avzdrkp:s:o:R:")) != -1) {
switch (opt) {
case 'v':
verbose++;
case 'r':
load_to_ram++;
break;
+ case 'k':
+ ktrace++;
+ break;
case 'z':
compress = 1;
break;
hdr.reloc_count = htonl(reloc_len);
hdr.flags = htonl(0
| (load_to_ram ? FLAT_FLAG_RAM : 0)
+ | (ktrace ? FLAT_FLAG_KTRACE : 0)
| (pic_with_got ? FLAT_FLAG_GOTPIC : 0)
| (compress ? (compress == 2 ? FLAT_FLAG_GZDATA : FLAT_FLAG_GZIP) : 0)
);
-
-/* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
- * The Silver Hammer Group, Ltd.
+/*
+ * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com>
+ * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
+ * The Silver Hammer Group, Ltd.
*
+ * This file provides the definitions and structures needed to
+ * support uClinux flat-format executables.
*/
#ifndef _LINUX_FLAT_H
#define _LINUX_FLAT_H
+#ifdef __KERNEL__
+#include <asm/flat.h>
+#endif
+
#define FLAT_VERSION 0x00000004L
+#ifdef CONFIG_BINFMT_SHARED_FLAT
+#define MAX_SHARED_LIBS (4)
+#else
+#define MAX_SHARED_LIBS (1)
+#endif
+
/*
* To make everything easier to port and manage cross platform
* development, all fields are in network byte order.
#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
+#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
#ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
} reloc;
} flat_v2_reloc_t;
-#endif
+#endif /* __KERNEL__ */
#endif /* _LINUX_FLAT_H */
/*
* A simple program to manipulate flat files
*
- * Copyright (C) 2001,2002 SnapGear Inc, davidm@snapgear.com
+ * Copyright (C) 2001-2003 SnapGear Inc, davidm@snapgear.com
* Copyright (C) 2001 Lineo, davidm@lineo.com
*/
/****************************************************************************/
char *program_name;
static char cmd[1024];
-static int print = 0, compress = 0, ramload = 0, stacksize = 0;
+static int print = 0, compress = 0, ramload = 0, stacksize = 0, ktrace = 0;
static int short_format = 0;
/****************************************************************************/
else if (ramload < 0)
new_flags &= ~FLAT_FLAG_RAM;
+ if (ktrace > 0)
+ new_flags |= FLAT_FLAG_KTRACE;
+ else if (ktrace < 0)
+ new_flags &= ~FLAT_FLAG_KTRACE;
+
if (stacksize)
new_stack = stacksize;
printf("Gzip-Compressed ");
if (old_flags & FLAT_FLAG_GZDATA)
printf("Gzip-Data-Compressed ");
+ if (old_flags & FLAT_FLAG_KTRACE)
+ printf("Kernel-Traced-Load ");
printf(")\n");
}
} else if (print > 1) {
first = 0;
}
*tfile = '\0';
+ strcat(tfile, (old_flags & FLAT_FLAG_KTRACE) ? "k" : "");
strcat(tfile, (old_flags & FLAT_FLAG_RAM) ? "r" : "");
strcat(tfile, (old_flags & FLAT_FLAG_GOTPIC) ? "p" : "");
strcat(tfile, (old_flags & FLAT_FLAG_GZIP) ? "z" :
fprintf(stderr, " -Z : un-compressed flat file\n");
fprintf(stderr, " -r : ram load\n");
fprintf(stderr, " -R : do not RAM load\n");
+ fprintf(stderr, " -k : kernel traced load (for debug)\n");
+ fprintf(stderr, " -K : normal non-kernel traced load\n");
fprintf(stderr, " -s size : stack size\n");
fprintf(stderr, " -o file : output-file\n"
" (default is to modify input file)\n");
program_name = argv[0];
- while ((c = getopt(argc, argv, "pdzZrRs:o:")) != EOF) {
+ while ((c = getopt(argc, argv, "pdzZrRkKs:o:")) != EOF) {
switch (c) {
case 'p': print = 1; break;
case 'z': compress = 1; break;
case 'Z': compress = -1; break;
case 'r': ramload = 1; break;
case 'R': ramload = -1; break;
+ case 'k': ktrace = 1; break;
+ case 'K': ktrace = -1; break;
case 's': stacksize = atoi(optarg); break;
case 'o': ofile = optarg; break;
default: