bootimage.c File Reference

#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <errno.h>
#include <a.out.h>
#include <minix/config.h>
#include <minix/const.h>
#include <minix/type.h>
#include <minix/syslib.h>
#include <kernel/const.h>
#include <kernel/type.h>
#include <ibm/partition.h>
#include "rawfs.h"
#include "image.h"
#include "boot.h"

Include dependency graph for bootimage.c:

Go to the source code of this file.

Data Structures

struct  process

Defines

#define BIOS   1
#define nil   0
#define _POSIX_SOURCE   1
#define _MINIX   1
#define click_shift   clck_shft
#define K_I386   0x0001
#define K_CLAIM   0x0002
#define K_CHMEM   0x0004
#define K_HIGH   0x0008
#define K_HDR   0x0010
#define K_RET   0x0020
#define K_INT86   0x0040
#define K_MEML   0x0080
#define K_BRET   0x0100
#define K_ALL   0x01FF
#define PROCESS_MAX   16
#define KERNEL   0
#define FS   2
#define MAGIC_OFF   0
#define CLICK_OFF   2
#define FLAGS_OFF   4
#define KERNEL_D_MAGIC   0x526F
#define P_SIZ_OFF   0
#define P_INIT_OFF   4
#define between(a, c, z)   ((unsigned) ((c) - (a)) <= ((z) - (a)))
#define align(a, n)   (((u32_t)(a) + ((u32_t)(n) - 1)) & ~((u32_t)(n) - 1))
#define SECBUFS   16

Functions

void pretty_image (char *image)
void raw_clear (u32_t addr, u32_t count)
int params2params (char *params, size_t psize)
void patch_sizes (void)
int selected (char *name)
u32_t proc_size (struct image_header *hdr)
u32_t file_vir2sec (u32_t vsec)
u32_t flat_vir2sec (u32_t vsec)
char * get_sector (u32_t vsec)
int get_clickshift (u32_t ksec, struct image_header *hdr)
int get_segment (u32_t *vsec, long *size, u32_t *addr, u32_t limit)
void exec_image (char *image)
ino_t latest_version (char *version, struct stat *stp)
char * select_image (char *image)
void bootminix (void)

Variables

static int block_size = 0
int n_procs
unsigned click_shift
unsigned click_size
unsigned k_flags
u32_t reboot_code
off_t image_off
off_t image_size
u32_t(* vir2sec )(u32_t vsec)


Define Documentation

#define _MINIX   1
 

Definition at line 7 of file bootimage.c.

#define _POSIX_SOURCE   1
 

Definition at line 6 of file bootimage.c.

#define align a,
n   )     (((u32_t)(a) + ((u32_t)(n) - 1)) & ~((u32_t)(n) - 1))
 

Definition at line 120 of file bootimage.c.

Referenced by calloc(), copyexec(), get_segment(), malloc(), proc_size(), and realloc().

#define between a,
c,
z   )     ((unsigned) ((c) - (a)) <= ((z) - (a)))
 

Definition at line 71 of file bootimage.c.

#define BIOS   1
 

Definition at line 4 of file bootimage.c.

#define CLICK_OFF   2
 

Definition at line 62 of file bootimage.c.

Referenced by get_clickshift().

#define click_shift   clck_shft
 

Definition at line 30 of file bootimage.c.

Referenced by get_clickshift(), and patch_sizes().

#define FLAGS_OFF   4
 

Definition at line 63 of file bootimage.c.

Referenced by get_clickshift().

#define FS   2
 

Definition at line 49 of file bootimage.c.

Referenced by access(), chdir(), chmod(), chown(), chroot(), close(), creat(), devctl(), fchdir(), fcntl(), fstat(), fstatfs(), fsync(), ftruncate(), init(), ioctl(), link(), lseek(), lstat(), main(), make_bootable(), mkdir(), mknod(), mount(), open(), pipe(), r_mkfld(), read(), readlink(), rename(), rmdir(), select(), Split(), stat(), Subst(), svrctl(), symlink(), sync(), truncate(), umask(), umount(), unlink(), utime(), and write().

#define K_ALL   0x01FF
 

Definition at line 42 of file bootimage.c.

Referenced by get_clickshift().

#define K_BRET   0x0100
 

Definition at line 41 of file bootimage.c.

#define K_CHMEM   0x0004
 

Definition at line 35 of file bootimage.c.

#define K_CLAIM   0x0002
 

Definition at line 34 of file bootimage.c.

#define K_HDR   0x0010
 

Definition at line 37 of file bootimage.c.

Referenced by patch_sizes().

#define K_HIGH   0x0008
 

Definition at line 36 of file bootimage.c.

#define K_I386   0x0001
 

Definition at line 33 of file bootimage.c.

#define K_INT86   0x0040
 

Definition at line 39 of file bootimage.c.

#define K_MEML   0x0080
 

Definition at line 40 of file bootimage.c.

#define K_RET   0x0020
 

Definition at line 38 of file bootimage.c.

#define KERNEL   0
 

Definition at line 48 of file bootimage.c.

Referenced by patch_sizes().

#define KERNEL_D_MAGIC   0x526F
 

Definition at line 64 of file bootimage.c.

#define MAGIC_OFF   0
 

Definition at line 61 of file bootimage.c.

Referenced by main().

#define nil   0
 

Definition at line 5 of file bootimage.c.

#define P_INIT_OFF   4
 

Definition at line 68 of file bootimage.c.

#define P_SIZ_OFF   0
 

Definition at line 67 of file bootimage.c.

Referenced by patch_sizes().

#define PROCESS_MAX   16
 

Definition at line 47 of file bootimage.c.

Referenced by exec_image().

#define SECBUFS   16
 

Referenced by get_sector().


Function Documentation

void bootminix void   ) 
 

Definition at line 695 of file bootimage.c.

References b_value(), EIO, ENOEXEC, ENOMEM, errno, exec_image(), free, image, nil, printf, and select_image().

void exec_image char *  image  ) 
 

Definition at line 379 of file bootimage.c.

References a2l(), A_MINHDR, addr, aout, b_value(), banner, memory::base, caddr, errno, i, mem, n, params, pretty_image(), printf, PROCESS_MAX, raw_clear(), sbrk, SECTOR_SIZE, and memory::size.

Referenced by bootminix().

u32_t file_vir2sec u32_t  vsec  ) 
 

Definition at line 249 of file bootimage.c.

References blk, block_size, EIO, errno, lowsec, r_vir2abs(), and RATIO.

Referenced by select_image().

u32_t flat_vir2sec u32_t  vsec  ) 
 

Definition at line 263 of file bootimage.c.

References lowsec.

Referenced by select_image().

int get_clickshift u32_t  ksec,
struct image_header hdr
 

Definition at line 321 of file bootimage.c.

References exec::a_flags, exec::a_hdrlen, A_PAL, CLICK_OFF, click_shift, click_size, errno, FLAGS_OFF, get_sector(), K_ALL, k_flags, image_header::name, nil, printf, and image_header::process.

char* get_sector u32_t  vsec  ) 
 

Definition at line 269 of file bootimage.c.

References count, dev_boundary(), errno, memset(), mon2abs(), nil, r, readerr(), readsectors(), SECBUFS, SECTOR_SHIFT, SECTOR_SIZE, and vir2sec.

Referenced by get_clickshift(), and get_segment().

int get_segment u32_t vsec,
long *  size,
u32_t addr,
u32_t  limit
 

Definition at line 349 of file bootimage.c.

References align, click_size, cnt, ENOMEM, errno, get_sector(), mon2abs(), n, nil, raw_clear(), raw_copy(), and SECTOR_SIZE.

ino_t latest_version char *  version,
struct stat stp
 

Definition at line 612 of file bootimage.c.

References mtime, r_readdir(), r_stat(), S_ISREG, stat::st_mode, stat::st_mtime, strcpy(), and time_t.

Referenced by select_image().

int params2params char *  params,
size_t  psize
 

Definition at line 126 of file bootimage.c.

References dev, e, E_DEV, E_VAR, i, if(), n, name2dev(), nil, and ul2a10().

void patch_sizes void   ) 
 

Definition at line 182 of file bootimage.c.

References click_shift, process::cs, doff, process::ds, process::end, i, k_flags, K_HDR, KERNEL, n_procs, P_SIZ_OFF, and put_word().

void pretty_image char *  image  ) 
 

Definition at line 73 of file bootimage.c.

References between, c, printf, and putch.

Referenced by exec_image().

u32_t proc_size struct image_header hdr  ) 
 

Definition at line 234 of file bootimage.c.

References exec::a_data, exec::a_flags, exec::a_hdrlen, A_PAL, A_SEP, exec::a_text, align, image_header::process, SECTOR_SHIFT, and SECTOR_SIZE.

void raw_clear u32_t  addr,
u32_t  count
 

Definition at line 98 of file bootimage.c.

References mon2abs(), and raw_copy().

Referenced by exec_image(), and get_segment().

char* select_image char *  image  ) 
 

Definition at line 636 of file bootimage.c.

References a2l(), bail_out(), block_size, ENOTDIR, errno, file_vir2sec(), flat_vir2sec(), free, fsok, latest_version(), malloc(), nil, numeric(), numprefix(), printf, r_lookup(), r_readdir(), r_stat(), r_super(), ROOT_INO, S_ISDIR, S_ISREG, SECTOR_SHIFT, SECTOR_SIZE, size, st, stat::st_mode, stat::st_size, strcpy(), strlen(), unix_err(), version, and vir2sec.

Referenced by bootminix().

int selected char *  name  ) 
 

Definition at line 219 of file bootimage.c.

References b_value(), cmp, colon, nil, strchr, and strcmp.

Referenced by execute().


Variable Documentation

int block_size = 0 [static]
 

Definition at line 28 of file bootimage.c.

unsigned click_shift
 

Definition at line 121 of file bootimage.c.

unsigned click_size
 

Definition at line 122 of file bootimage.c.

Referenced by get_clickshift(), and get_segment().

off_t image_off
 

Definition at line 246 of file bootimage.c.

off_t image_size
 

Definition at line 246 of file bootimage.c.

unsigned k_flags
 

Definition at line 123 of file bootimage.c.

Referenced by get_clickshift(), and patch_sizes().

int n_procs
 

Definition at line 58 of file bootimage.c.

Referenced by patch_sizes().

u32_t reboot_code
 

Definition at line 124 of file bootimage.c.

u32_t(* vir2sec)(u32_t vsec)
 

Definition at line 247 of file bootimage.c.

Referenced by get_sector(), and select_image().


Generated on Fri Apr 14 22:57:39 2006 for minix by  doxygen 1.4.6