/*
* mknbi.h - mknbi constants and type definitions
*
* Copyright (C) 1995-2003 Gero Kuhlmann <gero@gkminix.han.de>
* Copyright (C) 1996-2003 Gero Kuhlmann <gero@gkminix.han.de>
* and Markus Gutschke <gutschk@math.uni-muenster.de>
*
* 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
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: mknbi.h,v 1.8 2003/01/25 23:29:44 gkminix Exp $
*/
#ifndef _MKNBI_H_LINUX_
#define _MKNBI_H_LINUX_
/*
* Include version information
*/
#include <version.h>
/*
* Everything in this file has to be in packed structures.
*/
#ifdef USE_PRAGMA_PACK
#pragma pack(1)
#endif
#ifdef USE_PRAGMA_ALIGN
#pragma options align=packed
#endif
/*
* The RAM looks like this after the boot image has been loaded by the
* Boot-ROM:
*
* 0x030000-0x0301FF 0.5kB linux boot sector (aka INITSEG)
* 0x030200-0x0341FF 16kB linux kernel setup (aka SETUPSEG)
* 0x034200-0x0349FF 2kB default command line
* 0x034A00-0x034BFF 0.5kB load header
* 0x034C00-0x038BFF 16kB primary boot loader
* 0x100000-0xxxxxxx xkB linux kernel (aka SYSSEG)
*
* Note that the kernel has to start at 0x100000, as the kernel decompression
* routine depends on this.
*/
#define DEF_HEADERSEG 0x034A0L /* boot header load segment */
#define DEF_SYSSEG 0x10000L /* kernel load segment */
#define DEF_INITSEG 0x03000L /* boot sector load segment */
#define INITLSIZE 512L /* max load size of boot sector */
#define INITMSIZE 512L /* max memory size of boot sector */
#define DEF_SETUPSEG 0x03020L /* kernel setup load segment */
#define SETUPLSIZE 12288L /* max load size of kernel setup */
#define SETUPMSIZE 16384L /* max memory size of kernel setup */
#define DEF_CMDLSEG 0x03420L /* command line load segment */
#define CMDLLSIZE 2048L /* max load size of command line */
#define CMDLMSIZE 2048L /* max memory size of command line */
#define DEF_BOOTLSEG 0x034C0L /* primary loader load segment */
#define BOOTLLSIZE 8192L /* max load size of primary loader */
#define BOOTLMSIZE 16384L /* max memory size of primary loader */
/*
* Default values for command line etc.
*/
#define SECTSIZE 512L /* Size of one sector */
#define BOOT_SIGNATURE 0xaa55 /* boot signature */
#define BOOT_SIG_OFF 510 /* boot signature offset */
#define BOOT_SETUP_SEGS 497 /* offset to setup sect num */
#define MAX_ADDR_SIZE 15 /* Max size of addr strings */
#define DFLT_CMDL "auto rw" /* Default kernel cmd line */
#define DFLT_IMAGE "/vmlinuz" /* Name of default krnl image */
#define DFLT_DIR "kernel" /* Name of default NFS dir */
#define DFLT_ADDRS "kernel" /* Default address resolution */
#define DFLT_DEV "root=/dev/nfs" /* root device for kernel */
#define KERNEL_ADDRS "::::::any" /* Default kernel addresses */
#define NFS_ROOT "nfsroot=" /* nfsroot option for kernel */
#define NFS_ADDRS "nfsaddrs=" /* nfsaddrs option for kernel */
#define NFS_IP "ip=" /* ip option for kernel */
#define VGA_ARG "vga=" /* VGA mode argument */
/*
* The boot image has the following header in it's first sector
*/
struct load_header {
struct i_long magic PACKED; /* magic number */
__u8 hlength PACKED; /* length of header */
__u8 hflags1 PACKED; /* header flags */
__u8 hflags2 PACKED;
__u8 hflags3 PACKED;
struct i_addr locn PACKED; /* location of this header */
struct i_addr execute PACKED; /* execution address */
__u8 dummy[494]; /* up to full sector */
__u16 bootsig PACKED; /* boot signature */
};
#define HEADER_MAGIC 0x1B031336 /* Magic no for load header */
/*
* In the header sector the load records are located, which actually tell
* which part of the following image has to go where in memory
*/
union vendor_data {
__u8 rdflags PACKED; /* flags for rd loading */
__u8 krnflags PACKED; /* kernel flags */
};
struct load_record {
__u8 rlength PACKED; /* length of record */
__u8 rtag1 PACKED; /* record tags */
__u8 rtag2 PACKED;
__u8 rflags PACKED; /* record flags */
struct i_long address PACKED; /* abs addr for part in mem */
struct i_long ilength PACKED; /* len of part in boot image */
struct i_long mlength PACKED; /* memory needed for part */
union vendor_data vendor_data PACKED; /* optional vendor data */
};
#define FLAG_B0 1
#define FLAG_B1 2
#define FLAG_EOF 4
/*
* Number of each load record. Don't change the loading order of the
* modules by changing these numbers, because the whole kernel gets
* loaded in one big chunk, while the records really split the kernel
* image in memory. These values have to be identical with those in
* the include file of the boot loader assembler module.
*
* These numbers must be in the same order that the respective "initrec"
* calls happen!
*/
#define BOOTLNUM 0 /* primary boot loader */
#define CMDLNUM 1 /* command line */
#define INITNUM 2 /* floppy boot sector */
#define SETUPNUM 3 /* kernel setup */
#define KERNELNUM 4 /* kernel image */
#define RAMDISKNUM 5 /* ramdisk image */
#define NUM_RECORDS 6
#define VENDOR_ID "GK-mknbi-linux" /* Vendor ID */
#define VENDOR_OFF 16 /* Offset for vendor tags */
/*
* We need to take a look at the kernel setup header in order to determine
* whether the kernel image needs to be loaded into high memory.
*/
struct setup_header {
__u8 jump[2] PACKED;
__u8 magic[4] PACKED; /* "HdrS" */
__u16 version PACKED; /* >= 0x0201 for initrd */
__u8 realmode_swtch[4] PACKED;
__u16 start_sys_seg PACKED;
__u16 kernel_version PACKED;
__u8 type_of_loader PACKED;
__u8 loadflags PACKED;
__u16 setup_move_size PACKED;
struct i_long code32_start PACKED;
struct i_long ramdisk_image PACKED;
struct i_long ramdisk_size PACKED;
struct i_long bootsect_kludge PACKED;
__u16 heap_end_ptr PACKED;
__u16 pad1 PACKED;
struct i_long cmd_line_ptr PACKED;
struct i_long initrd_addr_max PACKED;
};
#define SETUP_MAGIC "HdrS"
#define SETUP_VERSION 0x0201
#define SETUP_LILO 0x00
#define SETUP_LOADLIN 0x10
#define SETUP_BOOTSECT 0x20
#define SETUP_SYSLX 0x30
#define SETUP_NETBOOT 0x41
#define SETUP_HIGH 0x01
#define SETUP_USEHEAP 0x80
/*
* Ramdisk images can be loaded in three different ways:
*
* RD_AUTO -- The ramdisk image is loaded at either 0x100000 or right
* behind the kernel image; at run-time it will be moved
* to the end of physical memory or right before 0x1000000.
* This technique guarantees maximum compatibility with
* broken BIOS versions without making assumptions on the
* way, the BOOT-Prom determined the end of memory. The
* drawback is, that moving the image costs some extra time.
* RD_EOM -- The ramdisk image is loaded right before the end of
* physical memory. It is the BOOT-Proms responsibility to do
* this reliably. This might cause problems with some ancient
* BIOS versions, if the computer is equipped with more then
* 16M of main memory.
* RD_FIXED -- The user provided a fixed load address for the ramdisk
* image. This entails possible compatibility restrictions
* when moving the image from one client to another. OTOH,
* it could be the final solution if everything else fails...
*/
#define RD_AUTO 0
#define RD_EOM 1
#define RD_FIXED 2
/*
* Flags for the protected mode kernel:
*
* KRN_USE_IP -- Newer kernels (above 2.2.x) use "ip=" instead of
* "nfsaddrs=" on the command line. They should also
* never remove this option if "kernel" is given as
* the argument. We use this flag to tell the boot
* loader.
* KRN_NFS_IP -- Kernel versions 2.4.x and above need the address
* of the NFS server at the beginning of the nfsroot
* command line option
* KRN_LOW -- Flag for loading the kernel into low memory
*/
#define KRN_USE_IP 0x01
#define KRN_NFS_IP 0x02
#define KRN_LOW 0x04
/*
* Special VGA mode values
*/
#define VGA_NORMAL -1
#define VGA_EXTENDED -2
#define VGA_ASK -3
#define VGA_DEFAULT -4
#define VGA_MIN -3 /* Minimum value */
#define VGA_MAX 0x7FFF /* Maximum value */
/*
* Turnoff structure packing and return to normal data alignment.
*/
#ifdef USE_PRAGMA
#pragma pack()
#endif
#ifdef USE_PRAGMA_ALIGN
#pragma options align=reset
#endif
/*
* Data area which contains the boot loader module
*/
extern __u8 first_data[];
extern unsigned int first_data_size;
extern __u8 firstd_data[];
extern unsigned int firstd_data_size;
#endif
syntax highlighted by Code2HTML, v. 0.9.1