Since some people disapprove of white space cleanups mixed in regular commits
while others dislike them being extra commits, let's clean them up once and for all for the existing code. If it's ugly, let it only be ugly once :-) Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
committed by
Stefan Reinauer
parent
0e1e8065e3
commit
14e2277962
@@ -39,7 +39,7 @@ SRCS+=$(GENERATED_SRCS)
|
||||
PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS))
|
||||
PSRCS+=./mkelfImage-$(VERSION).spec
|
||||
|
||||
SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
|
||||
SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
|
||||
MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8
|
||||
|
||||
TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS)
|
||||
@@ -56,7 +56,7 @@ include linux-ia64/Makefile
|
||||
clean::
|
||||
@$(RM) -rf objdir
|
||||
@$(RM) -rf rpm
|
||||
@$(RM) -f config.log config.status config.cache
|
||||
@$(RM) -f config.log config.status config.cache
|
||||
@$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS)
|
||||
@$(RM) -f mkelfImage-$(VERSION) $(TARBALL)
|
||||
|
||||
|
@@ -67,9 +67,9 @@
|
||||
Better firmware detection, and stripping excess symbols from the
|
||||
generated object.
|
||||
|
||||
* 1.11 24 January 2002
|
||||
* 1.11 24 January 2002
|
||||
Bug fix to command line processing.
|
||||
|
||||
|
||||
* 1.10 21 January 2002
|
||||
Starting using the PHDRS directive which many versions of ld cannot
|
||||
handle correctly. The symptom is generally a file that is 9MB in
|
||||
@@ -103,7 +103,7 @@
|
||||
Code cleanup in bzImage support.
|
||||
|
||||
* 1.5 1 Febuary 2001
|
||||
Add support for bzImage
|
||||
Add support for bzImage
|
||||
|
||||
* 1.4 ???
|
||||
???
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
* 1.2 18 December 2000
|
||||
Work around for some versions of ld not treating /dev/null and an
|
||||
empty file the same
|
||||
empty file the same
|
||||
|
||||
* 1.1 30 November 2000
|
||||
Fix for ramdisks and large amounts of memory with 2.2 series
|
||||
|
2
util/mkelfImage/config/config.guess
vendored
2
util/mkelfImage/config/config.guess
vendored
@@ -845,7 +845,7 @@ EOF
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0 ;;
|
||||
exit 0 ;;
|
||||
coff-i386)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0 ;;
|
||||
|
@@ -115,7 +115,7 @@ fi
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
@@ -125,7 +125,7 @@ if [ x"$dir_arg" != x ]; then
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
@@ -135,7 +135,7 @@ else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
@@ -163,7 +163,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
@@ -202,17 +202,17 @@ else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
@@ -243,7 +243,7 @@ else
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
dnl
|
||||
dnl
|
||||
dnl configure.ac for mkelfImage
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
dnl
|
||||
|
||||
dnl ---Required
|
||||
AC_INIT(Makefile.conf.in)
|
||||
@@ -16,11 +16,11 @@ AC_CANONICAL_HOST
|
||||
|
||||
|
||||
dnl Compute target cpu
|
||||
case $host_cpu in
|
||||
i?86 )
|
||||
case $host_cpu in
|
||||
i?86 )
|
||||
target_cpu="i386"
|
||||
;;
|
||||
* )
|
||||
* )
|
||||
target_cpu="$host_cpu"
|
||||
;;
|
||||
esac
|
||||
@@ -111,7 +111,7 @@ if test "$with_i386" != "no" ; then
|
||||
fi
|
||||
AC_CHECK_PROG([I386_CC], [$cc], [$cc], [""], [$PATH])
|
||||
if test "$I386_CC" = no; then
|
||||
|
||||
|
||||
AC_MSG_ERROR([$cc not found])
|
||||
fi
|
||||
AC_CHECK_PROG([I386_CPP], [$cpp], [$cpp], [""], [$PATH])
|
||||
@@ -148,7 +148,7 @@ if test "$with_ia64" != "no" ; then
|
||||
fi
|
||||
AC_CHECK_PROG([IA64_CC], [$cc], [$cc], [""], [$PATH])
|
||||
if test "$IA64_CC" = no; then
|
||||
|
||||
|
||||
AC_MSG_ERROR([$cc not found])
|
||||
fi
|
||||
AC_CHECK_PROG([IA64_CPP], [$cpp], [$cpp], [""], [$PATH])
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef ELF_BOOT_H
|
||||
#define ELF_BOOT_H
|
||||
#ifndef ELF_BOOT_H
|
||||
#define ELF_BOOT_H
|
||||
|
||||
|
||||
/* This defines the structure of a table of parameters useful for ELF
|
||||
@@ -35,7 +35,7 @@ typedef struct Elf_Bhdr
|
||||
Elf_Half b_records;
|
||||
} Elf_Bhdr;
|
||||
|
||||
/*
|
||||
/*
|
||||
* ELF Notes.
|
||||
*/
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* is expected to be information that cannot be discovered by
|
||||
* other means, such as quering the hardware directly.
|
||||
*
|
||||
* All of the information should be Position Independent Data.
|
||||
* All of the information should be Position Independent Data.
|
||||
* That is it should be safe to relocated any of the information
|
||||
* without it's meaning/correctnes changing. For table that
|
||||
* can reasonably be used on multiple architectures the data
|
||||
@@ -63,7 +63,7 @@ struct lb_memory_range {
|
||||
uint32_t type;
|
||||
#define LB_MEM_RAM 1
|
||||
#define LB_MEM_RESERVED 2
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct lb_memory {
|
||||
|
@@ -25,7 +25,7 @@ extern struct memelfphdr *add_program_headers(struct memelfheader *ehdr, int cou
|
||||
extern struct memelfnote *add_notes(struct memelfheader *ehdr, int count);
|
||||
|
||||
typedef char *(probe_t)(char *kernel_buf, off_t kernel_size);
|
||||
typedef int (mkelf_t)(int argc, char **argv,
|
||||
typedef int (mkelf_t)(int argc, char **argv,
|
||||
struct memelfheader *hdr, char *kernel_buf, off_t kernel_size);
|
||||
typedef void (usage_t)(void);
|
||||
struct file_type {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
@@ -17,7 +17,7 @@ typedef signed long int64_t;
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
@@ -30,7 +30,7 @@ typedef signed long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned long uint_fast16_t;
|
||||
typedef signed long int_fast16_t;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* These are not normal C functions: instead of the normal
|
||||
* calling sequence, these expect their arguments in registers
|
||||
* $24 and $25, and return the result in $27. Register $28 may
|
||||
* be clobbered (assembly temporary), anything else must be saved.
|
||||
* be clobbered (assembly temporary), anything else must be saved.
|
||||
*
|
||||
* In short: painful.
|
||||
*
|
||||
|
@@ -21,18 +21,18 @@ SECTIONS
|
||||
/* Global data */
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
*(.got)
|
||||
*(.sdata)
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
/* Important align _bss so bss may be zeroed with quadword access */
|
||||
. = ALIGN(BASIC_ALIGN);
|
||||
.bss : {
|
||||
_bss = .;
|
||||
*(.sbss)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
@@ -16,7 +16,7 @@ typedef signed long long int64_t;
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
@@ -29,7 +29,7 @@ typedef signed long long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef signed int int_fast16_t;
|
||||
|
@@ -21,18 +21,18 @@ SECTIONS
|
||||
/* Global data */
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
*(.got)
|
||||
*(.sdata)
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
|
||||
/* Important align _bss so bss may be zeroed with quadword access */
|
||||
. = ALIGN(BASIC_ALIGN);
|
||||
.bss : {
|
||||
_bss = .;
|
||||
*(.sbss)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
|
@@ -33,4 +33,3 @@ jmp_to_program_entry:
|
||||
movl 24+__original_registers, %esp
|
||||
movl 28+__original_registers, %ebp
|
||||
jmp *__entry
|
||||
|
@@ -136,7 +136,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
||||
/* Define va_list, if desired, from __gnuc_va_list. */
|
||||
/* We deliberately do not define va_list when called from
|
||||
stdio.h, because ANSI C says that stdio.h is not supposed to define
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
but must not use that name. It should use the name __gnuc_va_list,
|
||||
which is safe because it is reserved for the implementation. */
|
||||
|
||||
|
@@ -3,23 +3,23 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// yes, linux has fancy ones. We don't care. This stuff gets used
|
||||
// yes, linux has fancy ones. We don't care. This stuff gets used
|
||||
// hardly at all. And the pain of including those files is just too high.
|
||||
|
||||
//extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
|
||||
|
||||
//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
|
||||
|
||||
static inline size_t strnlen(const char *src, size_t max) {
|
||||
int i = 0;
|
||||
static inline size_t strnlen(const char *src, size_t max) {
|
||||
int i = 0;
|
||||
if (max<0) {
|
||||
while (*src++)
|
||||
i++;
|
||||
while (*src++)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
else {
|
||||
while ((*src++) && (i < max))
|
||||
i++;
|
||||
while ((*src++) && (i < max))
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#define DEBG(x)
|
||||
#define DEBG1(x)
|
||||
#define DEBG(x)
|
||||
#define DEBG1(x)
|
||||
/* Taken from /usr/src/linux/lib/inflate.c [unmodified]
|
||||
Used for start32, 1/11/2000
|
||||
James Hendricks, Dale Webster */
|
||||
@@ -7,9 +7,9 @@
|
||||
/* inflate.c -- Not copyrighted 1992 by Mark Adler
|
||||
version c10p1, 10 January 1993 */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Adapted for booting Linux by Hannu Savolainen 1993
|
||||
* based on gzip-1.0.3
|
||||
* based on gzip-1.0.3
|
||||
*
|
||||
* Nicolas Pitre <nico@cam.org>, 1999/04/14 :
|
||||
* Little mods for all variable to reside either into rodata or bss segments
|
||||
@@ -54,7 +54,7 @@
|
||||
chunks), otherwise the dynamic method is used. In the latter case, the
|
||||
codes are customized to the probabilities in the current block, and so
|
||||
can code it much better than the pre-determined fixed codes.
|
||||
|
||||
|
||||
The Huffman codes themselves are decoded using a multi-level table
|
||||
lookup, in order to maximize the speed of decoding plus the speed of
|
||||
building the decoding tables. See the comments below that precede the
|
||||
@@ -121,7 +121,7 @@ static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
|
||||
#include "gzip.h"
|
||||
#define STATIC
|
||||
#endif /* !STATIC */
|
||||
|
||||
|
||||
#define slide window
|
||||
|
||||
/* Huffman code lookup table entry--this entry is four bytes for machines
|
||||
@@ -142,7 +142,7 @@ struct huft {
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
STATIC int huft_build OF((unsigned *, unsigned, unsigned,
|
||||
STATIC int huft_build OF((unsigned *, unsigned, unsigned,
|
||||
const ush *, const ush *, struct huft **, int *));
|
||||
STATIC int huft_free OF((struct huft *));
|
||||
STATIC int inflate_codes OF((struct huft *, struct huft *, int, int));
|
||||
@@ -188,7 +188,7 @@ static const ush cpdext[] = { /* Extra bits for distance codes */
|
||||
|
||||
/* Macros for inflate() bit peeking and grabbing.
|
||||
The usage is:
|
||||
|
||||
|
||||
NEEDBITS(j)
|
||||
x = b & mask_bits[j];
|
||||
DUMPBITS(j)
|
||||
@@ -315,7 +315,7 @@ DEBG("huft1 ");
|
||||
memzero(c, sizeof(c));
|
||||
p = b; i = n;
|
||||
do {
|
||||
Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
|
||||
Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
|
||||
n-i, *p));
|
||||
c[*p]++; /* assume all entries <= BMAX */
|
||||
p++; /* Can't combine with above line (Solaris bug) */
|
||||
@@ -509,7 +509,7 @@ struct huft *t; /* table to free */
|
||||
q = (--p)->v.t;
|
||||
free((char*)p);
|
||||
p = q;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ STATIC int inflate()
|
||||
hufts = 0;
|
||||
malloc_mark(&mark);
|
||||
if ((r = inflate_block(&e)) != 0) {
|
||||
malloc_release(&mark);
|
||||
malloc_release(&mark);
|
||||
return r;
|
||||
}
|
||||
malloc_release(&mark);
|
||||
@@ -1014,7 +1014,7 @@ static ulg crc; /* initialized in makecrc() so it'll reside in bss */
|
||||
#define CRC_VALUE (crc ^ 0xffffffffL)
|
||||
|
||||
/*
|
||||
* Code to compute the CRC-32 table. Borrowed from
|
||||
* Code to compute the CRC-32 table. Borrowed from
|
||||
* gzip-1.0.3/makecrc.c.
|
||||
*/
|
||||
|
||||
@@ -1122,7 +1122,7 @@ int gunzip(void)
|
||||
if ((flags & ORIG_NAME) != 0) {
|
||||
/* Discard the old name */
|
||||
while (get_byte() != 0) /* null */ ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard file comment if any */
|
||||
if ((flags & COMMENT) != 0) {
|
||||
@@ -1148,7 +1148,7 @@ int gunzip(void)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Get the crc and original length */
|
||||
/* crc32 (see algorithm.doc)
|
||||
* uncompressed input size modulo 2^32
|
||||
@@ -1157,12 +1157,12 @@ int gunzip(void)
|
||||
orig_crc |= (ulg) get_byte() << 8;
|
||||
orig_crc |= (ulg) get_byte() << 16;
|
||||
orig_crc |= (ulg) get_byte() << 24;
|
||||
|
||||
|
||||
orig_len = (ulg) get_byte();
|
||||
orig_len |= (ulg) get_byte() << 8;
|
||||
orig_len |= (ulg) get_byte() << 16;
|
||||
orig_len |= (ulg) get_byte() << 24;
|
||||
|
||||
|
||||
/* Validate decompression */
|
||||
if (orig_crc != CRC_VALUE) {
|
||||
error("crc error");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define Trace(x)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
@@ -113,7 +113,7 @@ static void flush_window(void)
|
||||
limit = outcnt;
|
||||
}
|
||||
out = output_ptr;
|
||||
DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n",
|
||||
DBG(("flush 0x%08lx start 0x%08lx limit 0x%08lx\n",
|
||||
(unsigned long) out, (unsigned long)n, limit));
|
||||
for (; n < limit; n++) {
|
||||
ch = *out++ = *in++;
|
||||
|
@@ -11,8 +11,8 @@ SECTIONS
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
} = 0x9090
|
||||
.rodata (.): {
|
||||
*(.rodata)
|
||||
.rodata (.): {
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
}
|
||||
_etext = .; /* End of text section */
|
||||
@@ -28,7 +28,7 @@ SECTIONS
|
||||
}
|
||||
_end = . ;
|
||||
bss_sizex = _end - _bss;
|
||||
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.comment)
|
||||
*(.note)
|
||||
|
@@ -15,9 +15,9 @@ long user_stack [STACK_SIZE] = { 0 };
|
||||
unsigned long * stack_start = & user_stack[STACK_SIZE];
|
||||
|
||||
/* FIXME expand on drive_info_)struct... */
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct sys_desc_table {
|
||||
uint16_t length;
|
||||
uint8_t table[318];
|
||||
@@ -150,7 +150,7 @@ struct parameters {
|
||||
uint16_t ramdisk_flags; /* 0x1f8 */
|
||||
#define RAMDISK_IMAGE_START_MASK 0x07FF
|
||||
#define RAMDISK_PROMPT_FLAG 0x8000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
uint8_t reserved8[2]; /* 0x1fa */
|
||||
uint16_t orig_root_dev; /* 0x1fc */
|
||||
uint8_t reserved9[1]; /* 0x1fe */
|
||||
@@ -292,7 +292,7 @@ static void printf(const char *fmt, ...)
|
||||
continue;
|
||||
}
|
||||
if (*++fmt == 's') {
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
putchar(*p);
|
||||
}
|
||||
else { /* Length of item is bounded */
|
||||
@@ -314,7 +314,7 @@ static void printf(const char *fmt, ...)
|
||||
fmt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Before each format q points to tmp buffer
|
||||
* After each format q points past end of item
|
||||
@@ -376,7 +376,7 @@ static void printf(const char *fmt, ...)
|
||||
}
|
||||
|
||||
/*
|
||||
* String Functions
|
||||
* String Functions
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
@@ -408,7 +408,7 @@ void* memcpy(void *dest, const void *src, size_t len)
|
||||
d = dest;
|
||||
s = src;
|
||||
|
||||
for (i=0; i < len; i++)
|
||||
for (i=0; i < len; i++)
|
||||
d[i] = s[i];
|
||||
|
||||
return dest;
|
||||
@@ -426,7 +426,7 @@ int memcmp(void *src1, void *src2, size_t len)
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -510,7 +510,7 @@ void append_command_line(struct parameters *real_mode, char *arg, int arg_bytes)
|
||||
*dest++ = '\0';
|
||||
}
|
||||
|
||||
static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
{
|
||||
/* ALT_MEM_K maxes out at 4GB */
|
||||
if (mem_k > 0x3fffff) {
|
||||
@@ -527,7 +527,7 @@ static void set_memsize_k(struct parameters *real_mode, unsigned long mem_k)
|
||||
}
|
||||
|
||||
static void add_e820_map(struct parameters *real_mode,
|
||||
unsigned long long addr, unsigned long long size,
|
||||
unsigned long long addr, unsigned long long size,
|
||||
unsigned long type)
|
||||
{
|
||||
unsigned long long high;
|
||||
@@ -628,8 +628,8 @@ static void convert_multiboot_memmap(
|
||||
multi_puts("size: "); multi_put_hex(size); multi_puts("\n");
|
||||
multi_puts("end: "); multi_put_hex((unsigned)end); multi_puts("\n");
|
||||
for(seg = info->mmap_addr; (seg < end); seg = next_seg(seg,size)) {
|
||||
multi_puts("multi-mem: ");
|
||||
multi_put_lhex(seg->size);
|
||||
multi_puts("multi-mem: ");
|
||||
multi_put_lhex(seg->size);
|
||||
multi_puts(" @ ");
|
||||
multi_put_lhex(seg->addr);
|
||||
multi_puts(" (");
|
||||
@@ -662,7 +662,7 @@ static void convert_multiboot(
|
||||
set_memsize_k(info->real_mode, mb_info->mem_upper + (1 << 10));
|
||||
}
|
||||
if (mb_info->flags & MULTIBOOT_CMDLINE_VALID) {
|
||||
append_command_line(info->real_mode, mb_info->command_line,
|
||||
append_command_line(info->real_mode, mb_info->command_line,
|
||||
MULTIBOOT_MAX_COMMAND_LINE);
|
||||
}
|
||||
if (info->need_mem_sizes && (mb_info->flags & MULTIBOOT_MMAP_VALID)) {
|
||||
@@ -699,8 +699,8 @@ static void convert_uniform_boot_memory(
|
||||
entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]);
|
||||
for(i = 0; (i < entries) && (i < E820MAX); i++) {
|
||||
unsigned long type;
|
||||
ube_puts("ube-mem: ");
|
||||
ube_put_lhex(mem->map[i].size);
|
||||
ube_puts("ube-mem: ");
|
||||
ube_put_lhex(mem->map[i].size);
|
||||
ube_puts(" @ ");
|
||||
ube_put_lhex(mem->map[i].start);
|
||||
ube_puts(" (");
|
||||
@@ -724,7 +724,7 @@ static void convert_uniform_boot_memory(
|
||||
break;
|
||||
}
|
||||
ube_puts(")\n");
|
||||
add_e820_map(real_mode,
|
||||
add_e820_map(real_mode,
|
||||
mem->map[i].start, mem->map[i].size, type);
|
||||
}
|
||||
}
|
||||
@@ -762,9 +762,9 @@ static void convert_uniform_boot(struct param_info *info,
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
/* we're getting screwed again and again by this problem of the 8259.
|
||||
* so we're going to leave this lying around for inclusion into
|
||||
* crt0.S on an as-needed basis.
|
||||
/* we're getting screwed again and again by this problem of the 8259.
|
||||
* so we're going to leave this lying around for inclusion into
|
||||
* crt0.S on an as-needed basis.
|
||||
* well, that went ok, I hope. Now we have to reprogram the interrupts :-(
|
||||
* we put them right after the intel-reserved hardware interrupts, at
|
||||
* int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
|
||||
@@ -786,7 +786,7 @@ static void setup_i8259(void)
|
||||
outb(0x02, 0xA1); /*! 8259-2 is slave*/
|
||||
|
||||
outb(0x01, 0x21); /*! 8086 mode for both*/
|
||||
outb(0x01, 0xA1);
|
||||
outb(0x01, 0xA1);
|
||||
|
||||
outb(0xFF, 0xA1); /*! mask off all interrupts for now*/
|
||||
outb(0xFB, 0x21); /*! mask all irq's but irq2 which is cascaded*/
|
||||
@@ -831,11 +831,11 @@ static int count_elf_notes(Elf_Bhdr *bhdr)
|
||||
printf("elf_note = %lx\n", (unsigned long)note);
|
||||
printf("elf_namesz = %x\n", hdr->n_namesz);
|
||||
printf("elf_descsz = %x\n", hdr->n_descsz);
|
||||
printf("elf_type = %x\n", hdr->n_type);
|
||||
printf("elf_type = %x\n", hdr->n_type);
|
||||
printf("elf_name = %lx\n", (unsigned long)n_name);
|
||||
printf("elf_desc = %lx\n", (unsigned long)n_desc);
|
||||
#endif
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
count++;
|
||||
note = next;
|
||||
@@ -843,7 +843,7 @@ static int count_elf_notes(Elf_Bhdr *bhdr)
|
||||
return count;
|
||||
}
|
||||
|
||||
static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
Elf_Word namesz, unsigned char *name, Elf_Word type)
|
||||
{
|
||||
unsigned char *note, *end;
|
||||
@@ -856,7 +856,7 @@ static Elf_Nhdr *find_elf_note(Elf_Bhdr *bhdr,
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
if ((hdr->n_type == type) &&
|
||||
(hdr->n_namesz == namesz) &&
|
||||
@@ -897,7 +897,7 @@ static void convert_elf_boot(struct param_info *info, Elf_Bhdr *bhdr)
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
for(i = 0; i < sizeof(elf_notes)/sizeof(elf_notes[0]); i++) {
|
||||
if ((hdr->n_type == elf_notes[i].type) &&
|
||||
@@ -935,7 +935,7 @@ static unsigned count_lb_records(void *start, unsigned long length)
|
||||
count = 0;
|
||||
end = ((char *)start) + length;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
count++;
|
||||
}
|
||||
@@ -948,7 +948,7 @@ static struct lb_header *__find_lb_table(void *start, void *end)
|
||||
/* For now be stupid.... */
|
||||
for(ptr = start; (void *)ptr < end; ptr += 16) {
|
||||
struct lb_header *head = (void *)ptr;
|
||||
if ((head->signature[0] == 'L') &&
|
||||
if ((head->signature[0] == 'L') &&
|
||||
(head->signature[1] == 'B') &&
|
||||
(head->signature[2] == 'I') &&
|
||||
(head->signature[3] == 'O') &&
|
||||
@@ -1001,10 +1001,10 @@ static void convert_lb_memory(struct param_info *info, struct lb_memory *mem)
|
||||
unsigned long type;
|
||||
unsigned long long end;
|
||||
end = mem->map[i].start + mem->map[i].size;
|
||||
lb_puts("lb-mem: ");
|
||||
lb_puts("lb-mem: ");
|
||||
lb_put_lhex(mem->map[i].start);
|
||||
lb_puts(" - ");
|
||||
lb_put_lhex(end);
|
||||
lb_put_lhex(end);
|
||||
lb_puts(" (");
|
||||
switch(mem->map[i].type) {
|
||||
case LB_MEM_RAM:
|
||||
@@ -1017,12 +1017,12 @@ static void convert_lb_memory(struct param_info *info, struct lb_memory *mem)
|
||||
break;
|
||||
}
|
||||
lb_puts(")\n");
|
||||
add_e820_map(info->real_mode,
|
||||
add_e820_map(info->real_mode,
|
||||
mem->map[i].start, mem->map[i].size, type);
|
||||
}
|
||||
info->need_mem_sizes = 0;
|
||||
}
|
||||
|
||||
|
||||
static void query_lb_values(struct param_info *info)
|
||||
{
|
||||
struct lb_header *head;
|
||||
@@ -1032,17 +1032,17 @@ static void query_lb_values(struct param_info *info)
|
||||
start = ((unsigned char *)head) + sizeof(*head);
|
||||
end = ((char *)start) + head->table_bytes;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
(rec->size <= (unsigned long)(end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
switch(rec->tag) {
|
||||
case LB_TAG_MEMORY:
|
||||
{
|
||||
struct lb_memory *mem;
|
||||
mem = (struct lb_memory *) rec;
|
||||
convert_lb_memory(info, mem);
|
||||
convert_lb_memory(info, mem);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ static void get_meminfo(struct param_info *info)
|
||||
struct e820entry *seg = meminfo.map + i;
|
||||
end = seg->addr + seg->size;
|
||||
pc_puts("BIOS-e820: ");
|
||||
pc_put_lhex(seg->addr);
|
||||
pc_put_lhex(seg->addr);
|
||||
pc_puts(" - ");
|
||||
pc_put_lhex(end);
|
||||
pc_puts(" (");
|
||||
@@ -1108,7 +1108,7 @@ static void get_meminfo(struct param_info *info)
|
||||
break;
|
||||
}
|
||||
pc_puts(")\n");
|
||||
add_e820_map(info->real_mode,
|
||||
add_e820_map(info->real_mode,
|
||||
seg->addr, seg->size, seg->type);
|
||||
}
|
||||
info->real_mode->alt_mem_k = meme801();
|
||||
@@ -1191,7 +1191,7 @@ static void query_bootloader_param_class(struct param_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
static void query_bootloader_values(struct param_info *info)
|
||||
static void query_bootloader_values(struct param_info *info)
|
||||
{
|
||||
if (info->has_multiboot) {
|
||||
convert_multiboot(info, info->data);
|
||||
@@ -1252,7 +1252,7 @@ static int bootloader_query_firmware_class(struct param_info *info)
|
||||
detected_firmware_type = 1;
|
||||
}
|
||||
if (!detected_firmware_type && hdr &&
|
||||
(hdr->n_descsz == 1) &&
|
||||
(hdr->n_descsz == 1) &&
|
||||
(memcmp(n_desc, "", 1) == 0)) {
|
||||
/* No firmware is present */
|
||||
detected_firmware_type = 1;
|
||||
@@ -1305,7 +1305,7 @@ static void query_firmware_values(struct param_info *info)
|
||||
if (info->has_pcbios) {
|
||||
query_pcbios_values(info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1325,59 +1325,59 @@ static void print_offsets(void)
|
||||
printf("orig_video_page =%x\n", (uint32_t)&real_mode->orig_video_page);
|
||||
printf("orig_video_mode =%x\n", (uint32_t)&real_mode->orig_video_mode);
|
||||
printf("orig_video_cols =%x\n", (uint32_t)&real_mode->orig_video_cols);
|
||||
printf("unused2 =%x\n", (uint32_t)&real_mode->unused2);
|
||||
printf("orig_video_ega_bx =%x\n", (uint32_t)&real_mode->orig_video_ega_bx);
|
||||
printf("unused2 =%x\n", (uint32_t)&real_mode->unused2);
|
||||
printf("orig_video_ega_bx =%x\n", (uint32_t)&real_mode->orig_video_ega_bx);
|
||||
printf("unused3 =%x\n", (uint32_t)&real_mode->unused3);
|
||||
printf("orig_video_lines =%x\n", (uint32_t)&real_mode->orig_video_lines);
|
||||
printf("orig_video_isVGA =%x\n", (uint32_t)&real_mode->orig_video_isVGA);
|
||||
printf("orig_video_lines =%x\n", (uint32_t)&real_mode->orig_video_lines);
|
||||
printf("orig_video_isVGA =%x\n", (uint32_t)&real_mode->orig_video_isVGA);
|
||||
printf("orig_video_points =%x\n", (uint32_t)&real_mode->orig_video_points);
|
||||
printf("lfb_width =%x\n", (uint32_t)&real_mode->lfb_width);
|
||||
printf("lfb_height =%x\n", (uint32_t)&real_mode->lfb_height);
|
||||
printf("lfb_depth =%x\n", (uint32_t)&real_mode->lfb_depth);
|
||||
printf("lfb_base =%x\n", (uint32_t)&real_mode->lfb_base);
|
||||
printf("lfb_size =%x\n", (uint32_t)&real_mode->lfb_size);
|
||||
printf("cl_magic =%x\n", (uint32_t)&real_mode->cl_magic);
|
||||
printf("lfb_depth =%x\n", (uint32_t)&real_mode->lfb_depth);
|
||||
printf("lfb_base =%x\n", (uint32_t)&real_mode->lfb_base);
|
||||
printf("lfb_size =%x\n", (uint32_t)&real_mode->lfb_size);
|
||||
printf("cl_magic =%x\n", (uint32_t)&real_mode->cl_magic);
|
||||
printf("cl_offset =%x\n", (uint32_t)&real_mode->cl_offset);
|
||||
printf("lfb_linelength =%x\n", (uint32_t)&real_mode->lfb_linelength);
|
||||
printf("red_size =%x\n", (uint32_t)&real_mode->red_size);
|
||||
printf("red_pos =%x\n", (uint32_t)&real_mode->red_pos);
|
||||
printf("red_pos =%x\n", (uint32_t)&real_mode->red_pos);
|
||||
printf("green_size =%x\n", (uint32_t)&real_mode->green_size);
|
||||
printf("green_pos =%x\n", (uint32_t)&real_mode->green_pos);
|
||||
printf("blue_size =%x\n", (uint32_t)&real_mode->blue_size);
|
||||
printf("blue_pos =%x\n", (uint32_t)&real_mode->blue_pos);
|
||||
printf("green_pos =%x\n", (uint32_t)&real_mode->green_pos);
|
||||
printf("blue_size =%x\n", (uint32_t)&real_mode->blue_size);
|
||||
printf("blue_pos =%x\n", (uint32_t)&real_mode->blue_pos);
|
||||
printf("rsvd_size =%x\n", (uint32_t)&real_mode->rsvd_size);
|
||||
printf("rsvd_pos =%x\n", (uint32_t)&real_mode->rsvd_pos);
|
||||
printf("rsvd_pos =%x\n", (uint32_t)&real_mode->rsvd_pos);
|
||||
printf("vesapm_seg =%x\n", (uint32_t)&real_mode->vesapm_seg);
|
||||
printf("vesapm_off =%x\n", (uint32_t)&real_mode->vesapm_off);
|
||||
printf("pages =%x\n", (uint32_t)&real_mode->pages);
|
||||
printf("reserved4 =%x\n", (uint32_t)&real_mode->reserved4);
|
||||
printf("pages =%x\n", (uint32_t)&real_mode->pages);
|
||||
printf("reserved4 =%x\n", (uint32_t)&real_mode->reserved4);
|
||||
printf("apm_bios_info =%x\n", (uint32_t)&real_mode->apm_bios_info);
|
||||
printf("drive_info =%x\n", (uint32_t)&real_mode->drive_info);
|
||||
printf("drive_info =%x\n", (uint32_t)&real_mode->drive_info);
|
||||
printf("sys_desc_table =%x\n", (uint32_t)&real_mode->sys_desc_table);
|
||||
printf("alt_mem_k =%x\n", (uint32_t)&real_mode->alt_mem_k);
|
||||
printf("reserved5 =%x\n", (uint32_t)&real_mode->reserved5);
|
||||
printf("e820_map_nr =%x\n", (uint32_t)&real_mode->e820_map_nr);
|
||||
printf("reserved6 =%x\n", (uint32_t)&real_mode->reserved6);
|
||||
printf("mount_root_rdonly =%x\n", (uint32_t)&real_mode->mount_root_rdonly);
|
||||
printf("alt_mem_k =%x\n", (uint32_t)&real_mode->alt_mem_k);
|
||||
printf("reserved5 =%x\n", (uint32_t)&real_mode->reserved5);
|
||||
printf("e820_map_nr =%x\n", (uint32_t)&real_mode->e820_map_nr);
|
||||
printf("reserved6 =%x\n", (uint32_t)&real_mode->reserved6);
|
||||
printf("mount_root_rdonly =%x\n", (uint32_t)&real_mode->mount_root_rdonly);
|
||||
printf("reserved7 =%x\n", (uint32_t)&real_mode->reserved7);
|
||||
printf("ramdisk_flags =%x\n", (uint32_t)&real_mode->ramdisk_flags);
|
||||
printf("reserved8 =%x\n", (uint32_t)&real_mode->reserved8);
|
||||
printf("reserved8 =%x\n", (uint32_t)&real_mode->reserved8);
|
||||
printf("orig_root_dev =%x\n", (uint32_t)&real_mode->orig_root_dev);
|
||||
printf("reserved9 =%x\n", (uint32_t)&real_mode->reserved9);
|
||||
printf("reserved9 =%x\n", (uint32_t)&real_mode->reserved9);
|
||||
printf("aux_device_info =%x\n", (uint32_t)&real_mode->aux_device_info);
|
||||
printf("reserved10 =%x\n", (uint32_t)&real_mode->reserved10);
|
||||
printf("reserved10 =%x\n", (uint32_t)&real_mode->reserved10);
|
||||
printf("param_block_signature=%x\n", (uint32_t)&real_mode->param_block_signature);
|
||||
printf("param_block_version =%x\n", (uint32_t)&real_mode->param_block_version);
|
||||
printf("reserved11 =%x\n", (uint32_t)&real_mode->reserved11);
|
||||
printf("param_block_version =%x\n", (uint32_t)&real_mode->param_block_version);
|
||||
printf("reserved11 =%x\n", (uint32_t)&real_mode->reserved11);
|
||||
printf("loader_type =%x\n", (uint32_t)&real_mode->loader_type);
|
||||
printf("loader_flags =%x\n", (uint32_t)&real_mode->loader_flags);
|
||||
printf("reserved12 =%x\n", (uint32_t)&real_mode->reserved12);
|
||||
printf("reserved12 =%x\n", (uint32_t)&real_mode->reserved12);
|
||||
printf("kernel_start =%x\n", (uint32_t)&real_mode->kernel_start);
|
||||
printf("initrd_start =%x\n", (uint32_t)&real_mode->initrd_start);
|
||||
printf("initrd_size =%x\n", (uint32_t)&real_mode->initrd_size);
|
||||
printf("reserved13 =%x\n", (uint32_t)&real_mode->reserved13);
|
||||
printf("e820_map =%x\n", (uint32_t)&real_mode->e820_map);
|
||||
printf("reserved16 =%x\n", (uint32_t)&real_mode->reserved16);
|
||||
printf("e820_map =%x\n", (uint32_t)&real_mode->e820_map);
|
||||
printf("reserved16 =%x\n", (uint32_t)&real_mode->reserved16);
|
||||
printf("command_line =%x\n", (uint32_t)&real_mode->command_line);
|
||||
printf("reserved17 =%x\n", (uint32_t)&real_mode->reserved17);
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ static void print_linux_params(struct param_info *info)
|
||||
printf("orig_video_ega_bx=%x\n", info->real_mode->orig_video_ega_bx);
|
||||
printf("orig_video_isVGA =%x\n", info->real_mode->orig_video_isVGA);
|
||||
printf("orig_video_points=%x\n", info->real_mode->orig_video_points);
|
||||
|
||||
|
||||
|
||||
/* System descriptor table... */
|
||||
printf("sys_dest_table_len=%x\n", info->real_mode->sys_desc_table.length);
|
||||
@@ -1407,27 +1407,27 @@ static void print_linux_params(struct param_info *info)
|
||||
printf("alt_mem_k =%x\n", info->real_mode->alt_mem_k);
|
||||
printf("e820_map_nr =%x\n", info->real_mode->e820_map_nr);
|
||||
for(i = 0; i < E820MAX; i++) {
|
||||
printf("addr[%x] =%Lx\n",
|
||||
printf("addr[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].addr);
|
||||
printf("size[%x] =%Lx\n",
|
||||
printf("size[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].size);
|
||||
printf("type[%x] =%Lx\n",
|
||||
printf("type[%x] =%Lx\n",
|
||||
i, info->real_mode->e820_map[i].type);
|
||||
}
|
||||
printf("mount_root_rdonly=%x\n", info->real_mode->mount_root_rdonly);
|
||||
printf("ramdisk_flags =%x\n", info->real_mode->ramdisk_flags);
|
||||
printf("orig_root_dev =%x\n", info->real_mode->orig_root_dev);
|
||||
printf("aux_device_info =%x\n", info->real_mode->aux_device_info);
|
||||
printf("mount_root_rdonly=%x\n", info->real_mode->mount_root_rdonly);
|
||||
printf("ramdisk_flags =%x\n", info->real_mode->ramdisk_flags);
|
||||
printf("orig_root_dev =%x\n", info->real_mode->orig_root_dev);
|
||||
printf("aux_device_info =%x\n", info->real_mode->aux_device_info);
|
||||
printf("param_block_signature=%x\n", *((uint32_t *)info->real_mode->param_block_signature));
|
||||
printf("loader_type =%x\n", info->real_mode->loader_type);
|
||||
printf("loader_type =%x\n", info->real_mode->loader_type);
|
||||
printf("loader_flags =%x\n", info->real_mode->loader_flags);
|
||||
printf("initrd_start =%x\n", info->real_mode->initrd_start);
|
||||
printf("initrd_size =%x\n", info->real_mode->initrd_size);
|
||||
printf("initrd_size =%x\n", info->real_mode->initrd_size);
|
||||
|
||||
/* Where I'm putting the command line */
|
||||
printf("cl_magic =%x\n", info->real_mode->cl_magic);
|
||||
printf("cl_magic =%x\n", info->real_mode->cl_magic);
|
||||
printf("cl_offset =%x\n", info->real_mode->cl_offset);
|
||||
|
||||
|
||||
/* Now print the command line */
|
||||
printf("command_line =%s\n", info->real_mode->command_line);
|
||||
}
|
||||
@@ -1445,7 +1445,7 @@ void initialize_linux_params(struct param_info *info)
|
||||
int len;
|
||||
/* First the defaults */
|
||||
memset(info->real_mode, 0, PAGE_SIZE);
|
||||
|
||||
|
||||
/* Default screen size */
|
||||
info->real_mode->orig_x = 0;
|
||||
info->real_mode->orig_y = 25;
|
||||
@@ -1456,10 +1456,10 @@ void initialize_linux_params(struct param_info *info)
|
||||
info->real_mode->orig_video_ega_bx = 0;
|
||||
info->real_mode->orig_video_isVGA = 1;
|
||||
info->real_mode->orig_video_points = 16;
|
||||
|
||||
|
||||
/* Fill this in later */
|
||||
info->real_mode->ext_mem_k = 0;
|
||||
|
||||
|
||||
/* Fill in later... */
|
||||
info->real_mode->e820_map_nr = 0;
|
||||
|
||||
@@ -1468,7 +1468,7 @@ void initialize_linux_params(struct param_info *info)
|
||||
info->real_mode->cl_offset = 2048;
|
||||
|
||||
info->real_mode->cmd_line_ptr = info->real_mode->cl_offset + (unsigned long) info->real_mode;
|
||||
|
||||
|
||||
/* Now set the command line */
|
||||
len = strnlen(info->image->cmdline, sizeof(info->real_mode->command_line) -1);
|
||||
memcpy(info->real_mode->command_line, info->image->cmdline, len);
|
||||
@@ -1476,49 +1476,49 @@ void initialize_linux_params(struct param_info *info)
|
||||
|
||||
/* from the bios initially */
|
||||
memset(&info->real_mode->apm_bios_info, 0, sizeof(info->real_mode->apm_bios_info));
|
||||
|
||||
|
||||
memset(&info->real_mode->drive_info, 0, sizeof(info->real_mode->drive_info));
|
||||
|
||||
/* forget it for now... */
|
||||
info->real_mode->sys_desc_table.length = 0;
|
||||
|
||||
info->real_mode->sys_desc_table.length = 0;
|
||||
|
||||
/* Fill this in later */
|
||||
info->real_mode->alt_mem_k = 0;
|
||||
info->real_mode->ext_mem_k = 0;
|
||||
|
||||
|
||||
/* default yes: this can be overridden on the command line */
|
||||
info->real_mode->mount_root_rdonly = 0xFFFF;
|
||||
|
||||
|
||||
/* old ramdisk options, These really should be command line
|
||||
* things...
|
||||
*/
|
||||
info->real_mode->ramdisk_flags = info->image->ramdisk_flags;
|
||||
|
||||
/* default to /dev/hda.
|
||||
* Override this on the command line if necessary
|
||||
* Override this on the command line if necessary
|
||||
*/
|
||||
info->real_mode->orig_root_dev = info->image->root_dev;
|
||||
|
||||
|
||||
/* Originally from the bios? */
|
||||
info->real_mode->aux_device_info = 0;
|
||||
|
||||
|
||||
/* Boot block magic */
|
||||
memcpy(info->real_mode->param_block_signature, "HdrS", 4);
|
||||
info->real_mode->param_block_version = 0x0201;
|
||||
|
||||
|
||||
/* Say I'm a kernel boot loader */
|
||||
info->real_mode->loader_type = (LOADER_TYPE_KERNEL << 4) + 0 /* version */;
|
||||
|
||||
|
||||
/* No loader flags */
|
||||
info->real_mode->loader_flags = 0;
|
||||
|
||||
|
||||
/* Ramdisk address and size ... */
|
||||
info->real_mode->initrd_start = 0;
|
||||
info->real_mode->initrd_size = 0;
|
||||
if (info->image->initrd_size) {
|
||||
info->real_mode->initrd_start = info->image->initrd_start;
|
||||
info->real_mode->initrd_size = info->image->initrd_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now remember those things that I need */
|
||||
info->need_mem_sizes = 1;
|
||||
@@ -1556,7 +1556,7 @@ void *convert_params(unsigned type, void *data, void *param, void *image)
|
||||
#if 0
|
||||
printf("info.real_mode = 0x%x\n", info.real_mode );
|
||||
printf("Jumping to Linux\n");
|
||||
#endif
|
||||
#endif
|
||||
return info.real_mode;
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Other parts were taken from etherboot-5.0.5
|
||||
*/
|
||||
|
||||
|
||||
#define ASSEMBLY 1
|
||||
|
||||
#define RELOC 0x10000
|
||||
@@ -37,7 +37,7 @@ startup_32:
|
||||
jz 1f
|
||||
movl 4(%esp), %eax
|
||||
movl %eax, boot_param
|
||||
1:
|
||||
1:
|
||||
|
||||
movl stack_start, %esp
|
||||
|
||||
@@ -63,7 +63,7 @@ startup_32:
|
||||
# Linux makes stupid assumptions about the segments
|
||||
# that are already setup, so setup a new gdt & ldt
|
||||
# and then reload the segment registers.
|
||||
|
||||
|
||||
lgdt gdt_48
|
||||
lidt idt_48
|
||||
|
||||
@@ -80,17 +80,17 @@ startup_32:
|
||||
pushl boot_data # boot data pointer as second arg
|
||||
pushl boot_type # boot data type as first argument
|
||||
call convert_params
|
||||
|
||||
|
||||
movl %eax, %esi # put the real mode pointer in a safe place
|
||||
addl $16, %esp # pop the arguments
|
||||
|
||||
|
||||
|
||||
# Setup the registers before jumping to linux
|
||||
|
||||
|
||||
# clear eflags
|
||||
pushl $0
|
||||
popfl
|
||||
popfl
|
||||
|
||||
# Flag to indicate we are the bootstrap processor
|
||||
xorl %ebx, %ebx
|
||||
@@ -231,7 +231,7 @@ jmpe820:
|
||||
cmpl $SMAP, %eax
|
||||
jne bail820
|
||||
|
||||
good820:
|
||||
good820:
|
||||
/* If this is useable memory, we save it by simply advancing %di by
|
||||
* sizeof(e820rec)
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ bail820:
|
||||
popl %eax
|
||||
subl %esi, %eax /* Compute how many structure we read */
|
||||
|
||||
/* Restore everything else */
|
||||
/* Restore everything else */
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
@@ -260,7 +260,7 @@ bail820:
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
MEME801 - Determine size of extended memory
|
||||
MEME801 - Determine size of extended memory
|
||||
**************************************************************************/
|
||||
.globl meme801
|
||||
meme801:
|
||||
@@ -270,12 +270,12 @@ meme801:
|
||||
call _prot_to_real
|
||||
.code16
|
||||
|
||||
stc # fix to work around buggy
|
||||
xorw %cx,%cx # BIOSes which dont clear/set
|
||||
xorw %dx,%dx # carry on pass/error of
|
||||
# e801h memory size call
|
||||
# or merely pass cx,dx though
|
||||
# without changing them.
|
||||
stc # fix to work around buggy
|
||||
xorw %cx,%cx # BIOSes which dont clear/set
|
||||
xorw %dx,%dx # carry on pass/error of
|
||||
# e801h memory size call
|
||||
# or merely pass cx,dx though
|
||||
# without changing them.
|
||||
movw $0xe801,%ax
|
||||
int $0x15
|
||||
jc e801absent
|
||||
@@ -284,7 +284,7 @@ meme801:
|
||||
jne e801usecxdx # which report their extended
|
||||
cmpw $0x0, %dx # memory in AX/BX rather than
|
||||
jne e801usecxdx # CX/DX. The spec I have read
|
||||
movw %ax, %cx # seems to indicate AX/BX
|
||||
movw %ax, %cx # seems to indicate AX/BX
|
||||
movw %bx, %dx # are more reasonable anyway...
|
||||
|
||||
e801usecxdx:
|
||||
@@ -298,7 +298,7 @@ e801usecxdx:
|
||||
e801absent:
|
||||
xorl %eax,%eax
|
||||
|
||||
e801out:
|
||||
e801out:
|
||||
data32 call _real_to_prot
|
||||
.code32
|
||||
/* Restore Everything */
|
||||
@@ -308,7 +308,7 @@ e801out:
|
||||
ret
|
||||
|
||||
/**************************************************************************
|
||||
MEM88 - Determine size of extended memory
|
||||
MEM88 - Determine size of extended memory
|
||||
**************************************************************************/
|
||||
.globl mem88
|
||||
mem88:
|
||||
@@ -330,7 +330,7 @@ mem88:
|
||||
popl %esi
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
BASEMEMSIZE - Get size of the conventional (base) memory
|
||||
@@ -375,7 +375,7 @@ _real_to_prot:
|
||||
popl %eax /* Fix up return address */
|
||||
addl $RELOC,%eax
|
||||
pushl %eax
|
||||
|
||||
|
||||
/* switch to protected mode idt */
|
||||
cs
|
||||
lidt idt_48
|
||||
@@ -469,7 +469,7 @@ gdt:
|
||||
.byte (RELOC>>16),0x93,0x00,(RELOC>>24)
|
||||
|
||||
/* For 2.5.x the kernel segments have moved */
|
||||
|
||||
|
||||
/* 0x28 dummy */
|
||||
.quad 0
|
||||
|
||||
@@ -485,7 +485,7 @@ gdt:
|
||||
.quad 0
|
||||
/* 0x58 dummy */
|
||||
.quad 0
|
||||
|
||||
|
||||
|
||||
/* 0x60 */
|
||||
.word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb)
|
||||
@@ -534,7 +534,7 @@ gdt:
|
||||
* 20 - PNPBIOS support
|
||||
* 21 - APM BIOS support
|
||||
* 22 - APM BIOS support
|
||||
* 23 - APM BIOS support
|
||||
* 23 - APM BIOS support
|
||||
*/
|
||||
gdt_end:
|
||||
|
||||
@@ -546,7 +546,7 @@ gdt64:
|
||||
.quad 0x00af9a000000ffff /* __KERNEL_CS */
|
||||
.quad 0x00cf92000000ffff /* __KERNEL_DS */
|
||||
gdt64_end:
|
||||
|
||||
|
||||
.section ".trailer", "a"
|
||||
/* Constants set at build time, these are at the very end of my image */
|
||||
.balign 16
|
||||
|
@@ -228,7 +228,7 @@ static void parse_elf64_kernel(struct kernel_info *info, char *kernel_buf, size_
|
||||
|
||||
if(!phdrs)
|
||||
die("We need at least one phdr\n");
|
||||
|
||||
|
||||
info->phdrs = phdrs;
|
||||
info->entry = le64_to_cpu(ehdr->e_entry);
|
||||
#if 0
|
||||
@@ -296,7 +296,7 @@ void linux_i386_usage(void)
|
||||
|
||||
#define DEFAULT_RAMDISK_BASE (8*1024*1024)
|
||||
|
||||
int linux_i386_mkelf(int argc, char **argv,
|
||||
int linux_i386_mkelf(int argc, char **argv,
|
||||
struct memelfheader *ehdr, char *kernel_buf, off_t kernel_size)
|
||||
{
|
||||
const char *ramdisk, *cmdline;
|
||||
@@ -379,7 +379,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
strncpy(params->cmdline, cmdline, sizeof(params->cmdline));
|
||||
params->cmdline[sizeof(params->cmdline)-1]= '\0';
|
||||
|
||||
|
||||
|
||||
/* Add a program header for the note section */
|
||||
index = 4;
|
||||
index += (kinfo.phdrs - 1);
|
||||
@@ -388,7 +388,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
|
||||
/* Fill in the program headers*/
|
||||
phdr[0].p_type = PT_NOTE;
|
||||
|
||||
|
||||
/* Fill in the converter program headers */
|
||||
phdr[1].p_paddr = CONVERTLOC;
|
||||
phdr[1].p_vaddr = CONVERTLOC;
|
||||
@@ -420,7 +420,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
phdr[index].p_data = kinfo.kernel[i];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
/* Put the ramdisk at ramdisk base.
|
||||
*/
|
||||
params->initrd_start = params->initrd_size = 0;
|
||||
@@ -438,7 +438,7 @@ int linux_i386_mkelf(int argc, char **argv,
|
||||
params->initrd_size = phdr[index].p_filesz;
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
/* Set the start location */
|
||||
params->entry = kinfo.entry;
|
||||
params->switch_64 = kinfo.switch_64;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
#ifndef _LINUX_UNIFORM_BOOT_H
|
||||
#define _LINUX_UNIFORM_BOOT_H
|
||||
|
||||
/* The uniform boot environment information is restricted to
|
||||
/* The uniform boot environment information is restricted to
|
||||
* hardware information. In particular for a simple enough machine
|
||||
* all of the environment information should be able to reside in
|
||||
* a rom and not need to be moved. This information is the
|
||||
* information a trivial boot room can pass to linux to let it
|
||||
* run the hardware.
|
||||
* run the hardware.
|
||||
*
|
||||
* Also all of the information should be Position Independent Data.
|
||||
* Also all of the information should be Position Independent Data.
|
||||
* That is it should be safe to relocated any of the information
|
||||
* without it's meaning/correctnes changing. The exception is the
|
||||
* uniform_boot_header with it's two pointers arg & env.
|
||||
*
|
||||
*
|
||||
* The addresses in the arg & env pointers must be physical
|
||||
* addresses. A physical address is an address you put in the page
|
||||
* table.
|
||||
* table.
|
||||
*
|
||||
* The Command line is for user policy. Things like the default
|
||||
* root device.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
struct uniform_boot_header
|
||||
@@ -55,7 +55,7 @@ struct ube_memory_range {
|
||||
#define UBE_MEM_RESERVED 2
|
||||
#define UBE_MEM_ACPI 3
|
||||
#define UBE_MEM_NVS 4
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct ube_memory {
|
||||
|
@@ -18,9 +18,9 @@ struct e820entry {
|
||||
} __attribute__((packed));
|
||||
|
||||
/* FIXME expand on drive_info_struct... */
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct drive_info_struct {
|
||||
uint8_t dummy[32];
|
||||
};
|
||||
struct sys_desc_table {
|
||||
uint16_t length;
|
||||
uint8_t table[318];
|
||||
@@ -90,7 +90,7 @@ struct x86_linux_param_header {
|
||||
uint16_t ramdisk_flags; /* 0x1f8 */
|
||||
#define RAMDISK_IMAGE_START_MASK 0x07FF
|
||||
#define RAMDISK_PROMPT_FLAG 0x8000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
#define RAMDISK_LOAD_FLAG 0x4000
|
||||
uint16_t vid_mode; /* 0x1fa */
|
||||
uint16_t root_dev; /* 0x1fc */
|
||||
uint8_t reserved9[1]; /* 0x1fe */
|
||||
|
@@ -58,7 +58,7 @@ static void printf(const char *fmt, ...)
|
||||
continue;
|
||||
}
|
||||
if (*++fmt == 's') {
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
for(p = va_arg(args, char *); *p != '\0'; p++)
|
||||
putchar(*p);
|
||||
}
|
||||
else { /* Length of item is bounded */
|
||||
@@ -76,7 +76,7 @@ static void printf(const char *fmt, ...)
|
||||
fmt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Before each format q points to tmp buffer
|
||||
* After each format q points past end of item
|
||||
@@ -150,7 +150,7 @@ int memcmp(void *vs1, void *vs2, size_t size)
|
||||
return *s1 - *s2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void strappend(char *dest, const char *src, size_t max)
|
||||
@@ -229,7 +229,7 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
{
|
||||
unsigned char *note, *end;
|
||||
char *ldr_name, *ldr_version, *firmware;
|
||||
|
||||
|
||||
ldr_name = ldr_version = firmware = 0;
|
||||
|
||||
note = ((char *)bhdr) + sizeof(*bhdr);
|
||||
@@ -241,10 +241,10 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
n_name = note + sizeof(*hdr);
|
||||
n_desc = n_name + ((hdr->n_namesz + 3) & ~3);
|
||||
next = n_desc + ((hdr->n_descsz + 3) & ~3);
|
||||
if (next > end)
|
||||
if (next > end)
|
||||
break;
|
||||
#if 0
|
||||
printf("n_type: %x n_name(%d): n_desc(%d): \n",
|
||||
printf("n_type: %x n_name(%d): n_desc(%d): \n",
|
||||
hdr->n_type, hdr->n_namesz, hdr->n_descsz);
|
||||
#endif
|
||||
|
||||
@@ -302,7 +302,7 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
note = next;
|
||||
}
|
||||
if (ldr_name && ldr_version) {
|
||||
printf("Loader: %s version: %s\n",
|
||||
printf("Loader: %s version: %s\n",
|
||||
ldr_name, ldr_version);
|
||||
}
|
||||
if (firmware) {
|
||||
@@ -311,12 +311,12 @@ static void convert_bhdr_params(Elf_Bhdr *bhdr)
|
||||
}
|
||||
}
|
||||
|
||||
void *convert_params(unsigned long arg1, unsigned long r28,
|
||||
void *convert_params(unsigned long arg1, unsigned long r28,
|
||||
struct image_parameters *params)
|
||||
{
|
||||
struct ia64_boot_param *orig_bp;
|
||||
Elf_Bhdr *bhdr = (Elf_Bhdr*)arg1;
|
||||
|
||||
|
||||
/* handle the options I can easily deal with */
|
||||
bp.command_line = (unsigned long)¶ms->cmdline;
|
||||
bp.initrd_start = params->initrd_start;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#define ASSEMBLY 1
|
||||
|
||||
|
||||
.text
|
||||
|
||||
#include "convert.h"
|
||||
@@ -13,13 +13,13 @@ _start:
|
||||
movl r15=@gprel(_start)
|
||||
;;
|
||||
sub gp=r14,r15 /* gp = _start - @gprel(_start), current value of gp */
|
||||
;;
|
||||
;;
|
||||
mov out0=in0
|
||||
mov out1=r28
|
||||
add out2=@gprel(params),gp
|
||||
br.call.sptk.few rp=convert_params
|
||||
|
||||
|
||||
|
||||
mov r28=r8
|
||||
add r15=@gprel(entry), gp
|
||||
;;
|
||||
@@ -50,7 +50,7 @@ _start:
|
||||
#define UART_FCR 0x02
|
||||
#define UART_LCR 0x03
|
||||
#define UART_MCR 0x04
|
||||
|
||||
|
||||
#define UART_DLL 0x00
|
||||
#define UART_DLM 0x01
|
||||
/* Status */
|
||||
@@ -75,38 +75,38 @@ uart_init:
|
||||
/* set the UART_BASE */
|
||||
movl r31=UART_PHYS_BASE
|
||||
;;
|
||||
|
||||
|
||||
/* disable interrupts */
|
||||
add r30=UART_IER,r31
|
||||
mov r29=0x00
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
/* enable fifos */
|
||||
add r30=UART_FCR,r31
|
||||
mov r29=0x01
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
/* Set Baud Rate Divisor to UART_BAUD */
|
||||
add r30=UART_LCR,r31
|
||||
mov r29=0x83
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
add r30=UART_DLL,r31
|
||||
mov r29=UART_DIV_LO
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
|
||||
add r30=UART_DLM,r31
|
||||
mov r29=UART_DIV_HI
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
add r30=UART_LCR,r31
|
||||
mov r29=0x03
|
||||
;;
|
||||
;;
|
||||
st1 [r30]=r29
|
||||
|
||||
br.ret.sptk.few rp
|
||||
@@ -133,7 +133,7 @@ __uart_tx_byte:
|
||||
;;
|
||||
st1.rel.nta [r30]=r32
|
||||
;;
|
||||
|
||||
|
||||
/* Wait until the UART is empty to be certain the byte is flushed */
|
||||
add r30=UART_LSR,r31
|
||||
;;
|
||||
@@ -153,7 +153,7 @@ __uart_tx_hex_char:
|
||||
(p63) add r32=48,r32 /* digits*/
|
||||
(p62) add r32=55,r32 /* letters */
|
||||
br.cond.sptk.few __uart_tx_byte
|
||||
|
||||
|
||||
uart_tx_hex64:
|
||||
/* set the UART_bASE */
|
||||
movl r31=UART_PHYS_BASE
|
||||
@@ -212,7 +212,7 @@ uart_tx_hex64:
|
||||
;;
|
||||
mov ar.pfs = r26
|
||||
mov rp = r27
|
||||
;;
|
||||
;;
|
||||
br.ret.sptk.few rp
|
||||
#endif
|
||||
|
||||
|
@@ -112,8 +112,8 @@ static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *ph
|
||||
if (paddr > le64_to_cpu(info->phdr[j].p_paddr)) {
|
||||
continue;
|
||||
}
|
||||
if (hdr &&
|
||||
le64_to_cpu(hdr->p_paddr) <
|
||||
if (hdr &&
|
||||
le64_to_cpu(hdr->p_paddr) <
|
||||
le64_to_cpu(info->phdr[j].p_paddr)) {
|
||||
continue;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ static int populate_kernel_phdrs(struct kernel_info *info, struct memelfphdr *ph
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void linux_ia64_usage(void)
|
||||
{
|
||||
@@ -192,7 +192,7 @@ int linux_ia64_mkelf(int argc, char **argv,
|
||||
ehdr->ei_data = ELFDATA2LSB;
|
||||
ehdr->e_type = ET_EXEC;
|
||||
ehdr->e_machine = EM_IA_64;
|
||||
|
||||
|
||||
/* locate the payload buffer */
|
||||
payload_buf = payload;
|
||||
payload_size = sizeof(payload);
|
||||
@@ -221,10 +221,10 @@ int linux_ia64_mkelf(int argc, char **argv,
|
||||
|
||||
/* Fill in the program headers*/
|
||||
phdr[0].p_type = PT_NOTE;
|
||||
|
||||
|
||||
/* Fill in the kernel program headers */
|
||||
index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1);
|
||||
|
||||
index = 1 + populate_kernel_phdrs(&kinfo, phdr + 1);
|
||||
|
||||
/* Fill in the converter program header */
|
||||
phdr[index].p_paddr = roundup(phdr[index -1].p_paddr + phdr[index -1].p_memsz, 16);
|
||||
phdr[index].p_vaddr = phdr[index].p_paddr;
|
||||
|
@@ -71,7 +71,7 @@ uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new)
|
||||
sum = ~sum & 0xFFFF;
|
||||
new = ~new & 0xFFFF;
|
||||
if (offset & 1) {
|
||||
/* byte swap the sum if it came from an odd offset
|
||||
/* byte swap the sum if it came from an odd offset
|
||||
* since the computation is endian independant this
|
||||
* works.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ char *slurp_file(const char *filename, off_t *r_size)
|
||||
off_t size, progress;
|
||||
ssize_t result;
|
||||
struct stat stats;
|
||||
|
||||
|
||||
|
||||
if (!filename) {
|
||||
*r_size = 0;
|
||||
@@ -305,7 +305,7 @@ static void serialize_notes(char *buf, struct memelfheader *ehdr)
|
||||
notes = ehdr->e_notenum;
|
||||
size = sizeof_notes(note, notes);
|
||||
memset(buf, 0, size);
|
||||
|
||||
|
||||
/* Write the Elf Notes */
|
||||
offset = 0;
|
||||
for(i = 0; i < notes; i++) {
|
||||
@@ -317,11 +317,11 @@ static void serialize_notes(char *buf, struct memelfheader *ehdr)
|
||||
hdr.n_type = cpu_to_elf32(ehdr, note[i].n_type);
|
||||
|
||||
/* Copy the note into the buffer */
|
||||
memcpy(buf + offset, &hdr, sizeof(hdr));
|
||||
memcpy(buf + offset, &hdr, sizeof(hdr));
|
||||
offset += sizeof(hdr);
|
||||
memcpy(buf + offset, note[i].n_name, n_namesz);
|
||||
memcpy(buf + offset, note[i].n_name, n_namesz);
|
||||
offset += roundup(n_namesz, 4);
|
||||
memcpy(buf + offset, note[i].n_desc, note[i].n_descsz);
|
||||
memcpy(buf + offset, note[i].n_desc, note[i].n_descsz);
|
||||
offset += roundup(note[i].n_descsz, 4);
|
||||
|
||||
}
|
||||
@@ -382,7 +382,7 @@ static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_si
|
||||
size_t offset, note_offset;
|
||||
if (ehdr->ei_class == ELFCLASS32) {
|
||||
Elf32_Phdr *phdr = (Elf32_Phdr *)buf;
|
||||
note_offset =
|
||||
note_offset =
|
||||
sizeof(Elf32_Ehdr) + (sizeof(Elf32_Phdr)*ehdr->e_phnum);
|
||||
offset = note_offset + note_size;
|
||||
for(i = 0; i < ehdr->e_phnum; i++) {
|
||||
@@ -406,7 +406,7 @@ static void serialize_phdrs(char *buf, struct memelfheader *ehdr, size_t note_si
|
||||
}
|
||||
else if (ehdr->ei_class == ELFCLASS64) {
|
||||
Elf64_Phdr *phdr = (Elf64_Phdr *)buf;
|
||||
note_offset =
|
||||
note_offset =
|
||||
sizeof(Elf64_Ehdr) + (sizeof(Elf64_Phdr)*ehdr->e_phnum);
|
||||
offset = note_offset + note_size;
|
||||
for(i = 0; i < ehdr->e_phnum; i++) {
|
||||
@@ -478,7 +478,7 @@ static void write_elf(struct memelfheader *ehdr, char *output)
|
||||
if (ehdr->ei_class == ELFCLASS32) {
|
||||
ehdr_size = sizeof(Elf32_Ehdr);
|
||||
phdr_size = sizeof(Elf32_Phdr) * ehdr->e_phnum;
|
||||
}
|
||||
}
|
||||
else if (ehdr->ei_class == ELFCLASS64) {
|
||||
ehdr_size = sizeof(Elf64_Ehdr);
|
||||
phdr_size = sizeof(Elf64_Phdr) * ehdr->e_phnum;
|
||||
@@ -505,7 +505,7 @@ static void write_elf(struct memelfheader *ehdr, char *output)
|
||||
|
||||
/* Compute the final form of the notes */
|
||||
serialize_notes(buf + ehdr_size + phdr_size, ehdr);
|
||||
|
||||
|
||||
/* Now write the elf image */
|
||||
fd = open(output, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IRGRP | S_IROTH);
|
||||
if (fd < 0) {
|
||||
@@ -612,7 +612,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
fileind = optind;
|
||||
|
||||
|
||||
/* Reset getopt for the next pass */
|
||||
opterr = 1;
|
||||
optind = 1;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13
|
||||
.\" But now manually maintained
|
||||
.\" But now manually maintained
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
Summary: make an elf network bootable image for linux
|
||||
Name: mkelfImage
|
||||
Version:
|
||||
Version:
|
||||
Release: 0
|
||||
Copyright: GPL
|
||||
Group: Development/Tools
|
||||
@@ -12,8 +12,8 @@ BuildRoot: %{_tmppath}/%{name}
|
||||
mkelfImage is a program that makes a elf boot image for linux kernel images.
|
||||
The image should work with any i386 multiboot compliant boot loader, an ELF boot
|
||||
loader that passes no options, a loader compliant with the linuxBIOS elf booting
|
||||
spec or with the linux kexec kernel patch. A key feature here is that nothing
|
||||
relies upon BIOS calls, but they are made when necessary. This is useful for
|
||||
spec or with the linux kexec kernel patch. A key feature here is that nothing
|
||||
relies upon BIOS calls, but they are made when necessary. This is useful for
|
||||
systems running linuxbios.
|
||||
|
||||
%prep
|
||||
|
Reference in New Issue
Block a user