diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-12-31 18:47:16 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-12-31 18:47:25 +0100 |
commit | 3a96085b999220c4da0c5ef7d1f7ba26b9ddfb98 (patch) | |
tree | 77f1445aae2e6be5135594e95986b3278bbc061c /package/aboot/src/include | |
parent | cc28479164b8dc8afd4310716da32f16022f5974 (diff) |
dec-multia: make netboot possible, add aboot bootloader
Diffstat (limited to 'package/aboot/src/include')
-rw-r--r-- | package/aboot/src/include/aboot.h | 47 | ||||
-rw-r--r-- | package/aboot/src/include/bootfs.h | 25 | ||||
-rw-r--r-- | package/aboot/src/include/config.h | 12 | ||||
-rw-r--r-- | package/aboot/src/include/cons.h | 47 | ||||
-rw-r--r-- | package/aboot/src/include/disklabel.h | 105 | ||||
-rw-r--r-- | package/aboot/src/include/hwrpb.h | 220 | ||||
-rw-r--r-- | package/aboot/src/include/iso.h | 292 | ||||
-rw-r--r-- | package/aboot/src/include/isolib.h | 30 | ||||
-rw-r--r-- | package/aboot/src/include/linux/ext2_fs.h | 591 | ||||
-rw-r--r-- | package/aboot/src/include/pal.h | 51 | ||||
-rw-r--r-- | package/aboot/src/include/setjmp.h | 68 | ||||
-rw-r--r-- | package/aboot/src/include/string.h | 31 | ||||
-rw-r--r-- | package/aboot/src/include/system.h | 326 | ||||
-rw-r--r-- | package/aboot/src/include/ufs.h | 691 | ||||
-rw-r--r-- | package/aboot/src/include/utils.h | 24 |
15 files changed, 2560 insertions, 0 deletions
diff --git a/package/aboot/src/include/aboot.h b/package/aboot/src/include/aboot.h new file mode 100644 index 000000000..cbec653f8 --- /dev/null +++ b/package/aboot/src/include/aboot.h @@ -0,0 +1,47 @@ +#ifndef aboot_h +#define aboot_h + +#include <stdarg.h> + +#include "hwrpb.h" + +#include <setjmp.h> + +#define SECT_SIZE 512 /* console block size for disk reads */ +#define BOOT_SECTOR 2 /* first sector of 2ndary bootstrap loader */ + +extern struct segment { + unsigned long addr, offset, size; +} *chunks; +extern int nchunks; + +extern struct bootfs * bfs; +extern char * dest_addr; +extern long bytes_to_copy; +extern long text_offset; +extern jmp_buf jump_buffer; + +extern long config_file_partition; + +extern char boot_file[256]; +extern char initrd_file[256]; +extern char kernel_args[256]; +extern unsigned long start_addr; +extern char * bss_start; +extern long bss_size; +extern unsigned long initrd_start, initrd_size; +/* page size is in the INIT_HWRPB */ +extern unsigned long page_offset, page_shift; + +extern long first_block (const char *buf, long blocksize); +extern unsigned long switch_to_osf_pal (unsigned long nr, + struct pcb_struct *pcb_va, + struct pcb_struct *pcb_pa, + unsigned long vptb, + unsigned long *kstk); +extern int uncompress_kernel (int fd); +extern int vsprintf (char *, const char *, va_list); +extern void run_kernel (unsigned long entry, unsigned long stack) + __attribute__((noreturn)); + +#endif /* aboot_h */ diff --git a/package/aboot/src/include/bootfs.h b/package/aboot/src/include/bootfs.h new file mode 100644 index 000000000..cf41e16b4 --- /dev/null +++ b/package/aboot/src/include/bootfs.h @@ -0,0 +1,25 @@ +#ifndef boot_fs_h +#define boot_fs_h + +#include <linux/types.h> +#include <asm/stat.h> + +struct bootfs { + int fs_type; + int blocksize; + + int (*mount)(long dev, long partition_start, long quiet); + + int (*open)(const char *filename); + int (*bread)(int fd, long blkno, long nblks, char *buf); + void (*close)(int fd); + + /* You'll probably want to use this like: + while ((ent = fs->readdir(fd, !rewind++))); + so that it rewinds only on the first access. Also don't + mix it with other I/O or you will die horribly */ + const char * (*readdir)(int fd, int rewind); + int (*fstat)(int fd, struct stat* buf); +} ext2fs; + +#endif /* boot_fs_h */ diff --git a/package/aboot/src/include/config.h b/package/aboot/src/include/config.h new file mode 100644 index 000000000..28def9270 --- /dev/null +++ b/package/aboot/src/include/config.h @@ -0,0 +1,12 @@ +#ifndef config_h +#define config_h + +#define ABOOT_MAJOR 0 +#define ABOOT_MINOR 9 +#define ABOOT_VERSION "1.0_pre20040408" +#define ABOOT_MAGIC 0x30302d746f6f6261 /* "aboot-00" */ + +#define CONFIG_FILE_PARTITION 1 +#define CONFIG_FILE "/etc/aboot.conf" + +#endif /* config_h */ diff --git a/package/aboot/src/include/cons.h b/package/aboot/src/include/cons.h new file mode 100644 index 000000000..a9784246a --- /dev/null +++ b/package/aboot/src/include/cons.h @@ -0,0 +1,47 @@ +#ifndef cons_h +#define cons_h + +extern long cons_dev; /* console device */ + +extern long dispatch(long proc, ...); + +#ifdef TESTING +#define STRINGIFY(sym) #sym +#define cons_init() +#define cons_puts(s,l) puts(s, strlen(s)) +#define cons_open(d) open(d, O_RDONLY) +#define cons_close(d) close(d) +#define cons_read(d,b,c,o) ({ lseek(d, o, 0); read(d,b,c);}) +#define cons_putchar(c) putchar(c) +#define cons_getchar() getchar() +#define cons_open_console() +#define cons_close_console() +#else +extern void cons_init (void); +extern long cons_getenv (long index, char *envval, long maxlen); +extern long cons_puts (const char *str, long len); +extern long cons_open (const char *devname); +extern long cons_close (long dev); +extern long cons_read (long dev, void *buf, long count, long offset); +extern void cons_putchar(char c); +extern int cons_getchar(void); +extern void cons_open_console(void); +extern void cons_close_console(void); +#endif + +/* this isn't in the kernel for some reason */ +#define CTB_TYPE_NONE 0 +#define CTB_TYPE_DETACHED 1 +#define CTB_TYPE_SERIAL 2 +#define CTB_TYPE_GRAPHICS 3 +#define CTB_TYPE_MULTI 4 + +struct ctb_struct { + unsigned long type; + unsigned long id; + unsigned long reserved; + unsigned long dsd_len; + char dsd[0]; +}; + +#endif /* cons_h */ diff --git a/package/aboot/src/include/disklabel.h b/package/aboot/src/include/disklabel.h new file mode 100644 index 000000000..3d0c2d129 --- /dev/null +++ b/package/aboot/src/include/disklabel.h @@ -0,0 +1,105 @@ +#ifndef __disklabel_h__ +#define __disklabel_h__ + +#ifndef __KERNEL_STRICT_NAMES + /* ask kernel to be careful about name-space pollution: */ +# define __KERNEL_STRICT_NAMES +# define fd_set kernel_fd_set +#endif + +#include <linux/types.h> + +#define DISKLABELMAGIC (0x82564557UL) + +#define LABELSECTOR 0 /* sector containing label */ +#define LABELOFFSET 64 /* offset of label in sector */ + +#define MAXPARTITIONS 8 /* max. # of partitions */ + +/* + * Filesystem type and version. Used to interpret other + * filesystem-specific per-partition information. + */ +#define FS_UNUSED 0 /* unused */ +#define FS_SWAP 1 /* swap */ +#define FS_V6 2 /* Sixth Edition */ +#define FS_V7 3 /* Seventh Edition */ +#define FS_SYSV 4 /* System V */ +#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ +#define FS_V8 6 /* Eighth Edition, 4K blocks */ +#define FS_BSDFFS 7 /* 4.2BSD fast file system */ +#define FS_EXT2 8 /* Linux ext2 file system */ +/* OSF will reserve 16--31 for vendor-specific entries */ +#define FS_ADVFS 16 /* Digital Advanced File System */ +#define FS_LSMpubl 17 /* Digital Log Strg public region */ +#define FS_LSMpriv 18 /* Digital Log Strg private region */ +#define FS_LSMsimp 19 /* Digital Log Strg simple disk */ + +struct disklabel { + __u32 d_magic; /* must be DISKLABELMAGIC */ + __u16 d_type, d_subtype; + __u8 d_typename[16]; + __u8 d_packname[16]; + __u32 d_secsize; + __u32 d_nsectors; + __u32 d_ntracks; + __u32 d_ncylinders; + __u32 d_secpercyl; + __u32 d_secprtunit; + __u16 d_sparespertrack; + __u16 d_sparespercyl; + __u32 d_acylinders; + __u16 d_rpm, d_interleave, d_trackskew, d_cylskew; + __u32 d_headswitch, d_trkseek, d_flags; + __u32 d_drivedata[5]; + __u32 d_spare[5]; + __u32 d_magic2; /* must be DISKLABELMAGIC */ + __u16 d_checksum; + __u16 d_npartitions; + __u32 d_bbsize, d_sbsize; + struct d_partition { + __u32 p_size; + __u32 p_offset; + __u32 p_fsize; + __u8 p_fstype; + __u8 p_frag; + __u16 p_cpg; + } d_partitions[MAXPARTITIONS]; +}; + +#define DTYPE_SMD 1 +#define DTYPE_MSCP 2 +#define DTYPE_DEC 3 +#define DTYPE_SCSI 4 +#define DTYPE_ESDI 5 +#define DTYPE_ST506 6 +#define DTYPE_FLOPPY 10 + +#ifdef DKTYPENAMES +static char *fstypenames[] = { + "unused", + "swap", + "Version 6", + "Version 7", + "System V", + "4.1BSD", + "Eighth Edition", + "4.2BSD", + "ext2", /* is this a good choice for ext2?? */ + "resrvd9", + "resrvd10", + "resrvd11", + "resrvd12", + "resrvd13", + "resrvd14", + "resrvd15", + "ADVfs", + "LSMpubl", + "LSMpriv", + "LSMsimp", + 0 +}; +#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) +#endif + +#endif /* __disklabel_h__ */ diff --git a/package/aboot/src/include/hwrpb.h b/package/aboot/src/include/hwrpb.h new file mode 100644 index 000000000..8e8f871af --- /dev/null +++ b/package/aboot/src/include/hwrpb.h @@ -0,0 +1,220 @@ +#ifndef __ALPHA_HWRPB_H +#define __ALPHA_HWRPB_H + +#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000) + +/* + * DEC processor types for Alpha systems. Found in HWRPB. + * These values are architected. + */ + +#define EV3_CPU 1 /* EV3 */ +#define EV4_CPU 2 /* EV4 (21064) */ +#define LCA4_CPU 4 /* LCA4 (21066/21068) */ +#define EV5_CPU 5 /* EV5 (21164) */ +#define EV45_CPU 6 /* EV4.5 (21064/xxx) */ +#define EV56_CPU 7 /* EV5.6 (21164) */ +#define EV6_CPU 8 /* EV6 (21264) */ +#define PCA56_CPU 9 /* PCA56 (21164PC) */ +#define PCA57_CPU 10 /* PCA57 (notyet) */ +#define EV67_CPU 11 /* EV67 (21264A) */ +#define EV68CB_CPU 12 /* EV68CB (21264C) */ +#define EV68AL_CPU 13 /* EV68AL (21264B) */ +#define EV68CX_CPU 14 /* EV68CX (21264D) */ +#define EV7_CPU 15 /* EV7 (21364) */ +#define EV79_CPU 16 /* EV79 (21364??) */ +#define EV69_CPU 17 /* EV69 (21264/EV69A) */ + +/* + * DEC system types for Alpha systems. Found in HWRPB. + * These values are architected. + */ + +#define ST_ADU 1 /* Alpha ADU systype */ +#define ST_DEC_4000 2 /* Cobra systype */ +#define ST_DEC_7000 3 /* Ruby systype */ +#define ST_DEC_3000_500 4 /* Flamingo systype */ +#define ST_DEC_2000_300 6 /* Jensen systype */ +#define ST_DEC_3000_300 7 /* Pelican systype */ +#define ST_DEC_2100_A500 9 /* Sable systype */ +#define ST_DEC_AXPVME_64 10 /* AXPvme system type */ +#define ST_DEC_AXPPCI_33 11 /* NoName system type */ +#define ST_DEC_TLASER 12 /* Turbolaser systype */ +#define ST_DEC_2100_A50 13 /* Avanti systype */ +#define ST_DEC_MUSTANG 14 /* Mustang systype */ +#define ST_DEC_ALCOR 15 /* Alcor (EV5) systype */ +#define ST_DEC_1000 17 /* Mikasa systype */ +#define ST_DEC_EB64 18 /* EB64 systype */ +#define ST_DEC_EB66 19 /* EB66 systype */ +#define ST_DEC_EB64P 20 /* EB64+ systype */ +#define ST_DEC_BURNS 21 /* laptop systype */ +#define ST_DEC_RAWHIDE 22 /* Rawhide systype */ +#define ST_DEC_K2 23 /* K2 systype */ +#define ST_DEC_LYNX 24 /* Lynx systype */ +#define ST_DEC_XL 25 /* Alpha XL systype */ +#define ST_DEC_EB164 26 /* EB164 systype */ +#define ST_DEC_NORITAKE 27 /* Noritake systype */ +#define ST_DEC_CORTEX 28 /* Cortex systype */ +#define ST_DEC_MIATA 30 /* Miata systype */ +#define ST_DEC_XXM 31 /* XXM systype */ +#define ST_DEC_TAKARA 32 /* Takara systype */ +#define ST_DEC_YUKON 33 /* Yukon systype */ +#define ST_DEC_TSUNAMI 34 /* Tsunami systype */ +#define ST_DEC_WILDFIRE 35 /* Wildfire systype */ +#define ST_DEC_CUSCO 36 /* CUSCO systype */ +#define ST_DEC_EIGER 37 /* Eiger systype */ +#define ST_DEC_TITAN 38 /* Titan systype */ +#define ST_DEC_MARVEL 39 /* Marvel systype */ + +/* UNOFFICIAL!!! */ +#define ST_UNOFFICIAL_BIAS 100 +#define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */ + +/* Alpha Processor, Inc. systems */ +#define ST_API_BIAS 200 +#define ST_API_NAUTILUS 201 /* UP1000 systype */ + +struct pcb_struct { + unsigned long ksp; + unsigned long usp; + unsigned long ptbr; + unsigned int pcc; + unsigned int asn; + unsigned long unique; + unsigned long flags; + unsigned long res1, res2; +}; + +struct percpu_struct { + unsigned long hwpcb[16]; + unsigned long flags; + unsigned long pal_mem_size; + unsigned long pal_scratch_size; + unsigned long pal_mem_pa; + unsigned long pal_scratch_pa; + unsigned long pal_revision; + unsigned long type; + unsigned long variation; + unsigned long revision; + unsigned long serial_no[2]; + unsigned long logout_area_pa; + unsigned long logout_area_len; + unsigned long halt_PCBB; + unsigned long halt_PC; + unsigned long halt_PS; + unsigned long halt_arg; + unsigned long halt_ra; + unsigned long halt_pv; + unsigned long halt_reason; + unsigned long res; + unsigned long ipc_buffer[21]; + unsigned long palcode_avail[16]; + unsigned long compatibility; + unsigned long console_data_log_pa; + unsigned long console_data_log_length; + unsigned long bcache_info; +}; + +struct procdesc_struct { + unsigned long weird_vms_stuff; + unsigned long address; +}; + +struct vf_map_struct { + unsigned long va; + unsigned long pa; + unsigned long count; +}; + +struct crb_struct { + struct procdesc_struct * dispatch_va; + struct procdesc_struct * dispatch_pa; + struct procdesc_struct * fixup_va; + struct procdesc_struct * fixup_pa; + /* virtual->physical map */ + unsigned long map_entries; + unsigned long map_pages; + struct vf_map_struct map[1]; +}; + +struct memclust_struct { + unsigned long start_pfn; + unsigned long numpages; + unsigned long numtested; + unsigned long bitmap_va; + unsigned long bitmap_pa; + unsigned long bitmap_chksum; + unsigned long usage; +}; + +struct memdesc_struct { + unsigned long chksum; + unsigned long optional_pa; + unsigned long numclusters; + struct memclust_struct cluster[0]; +}; + +struct dsr_struct { + long smm; /* SMM nubber used by LMF */ + unsigned long lurt_off; /* offset to LURT table */ + unsigned long sysname_off; /* offset to sysname char count */ +}; + +struct hwrpb_struct { + unsigned long phys_addr; /* check: physical address of the hwrpb */ + unsigned long id; /* check: "HWRPB\0\0\0" */ + unsigned long revision; + unsigned long size; /* size of hwrpb */ + unsigned long cpuid; + unsigned long pagesize; /* 8192, I hope */ + unsigned long pa_bits; /* number of physical address bits */ + unsigned long max_asn; + unsigned char ssn[16]; /* system serial number: big bother is watching */ + unsigned long sys_type; + unsigned long sys_variation; + unsigned long sys_revision; + unsigned long intr_freq; /* interval clock frequency * 4096 */ + unsigned long cycle_freq; /* cycle counter frequency */ + unsigned long vptb; /* Virtual Page Table Base address */ + unsigned long res1; + unsigned long tbhb_offset; /* Translation Buffer Hint Block */ + unsigned long nr_processors; + unsigned long processor_size; + unsigned long processor_offset; + unsigned long ctb_nr; + unsigned long ctb_size; /* console terminal block size */ + unsigned long ctbt_offset; /* console terminal block table offset */ + unsigned long crb_offset; /* console callback routine block */ + unsigned long mddt_offset; /* memory data descriptor table */ + unsigned long cdb_offset; /* configuration data block (or NULL) */ + unsigned long frut_offset; /* FRU table (or NULL) */ + void (*save_terminal)(unsigned long); + unsigned long save_terminal_data; + void (*restore_terminal)(unsigned long); + unsigned long restore_terminal_data; + void (*CPU_restart)(unsigned long); + unsigned long CPU_restart_data; + unsigned long res2; + unsigned long res3; + unsigned long chksum; + unsigned long rxrdy; + unsigned long txrdy; + unsigned long dsr_offset; /* "Dynamic System Recognition Data Block Table" */ +}; + +#ifdef __KERNEL__ + +extern struct hwrpb_struct *hwrpb; + +static inline void +hwrpb_update_checksum(struct hwrpb_struct *h) +{ + unsigned long sum = 0, *l; + for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l) + sum += *l; + h->chksum = sum; +} + +#endif /* __KERNEL__ */ + +#endif /* __ALPHA_HWRPB_H */ diff --git a/package/aboot/src/include/iso.h b/package/aboot/src/include/iso.h new file mode 100644 index 000000000..507bce2ee --- /dev/null +++ b/package/aboot/src/include/iso.h @@ -0,0 +1,292 @@ +#ifndef _ISOFS_FS_H +#define _ISOFS_FS_H + +#include <linux/types.h> +/* + * The isofs filesystem constants/structures + */ + +/* This part borrowed from the bsd386 isofs */ +#define ISODCL(from, to) (to - from + 1) + +struct iso_volume_descriptor { + char type[ISODCL(1,1)]; /* 711 */ + char id[ISODCL(2,6)]; + char version[ISODCL(7,7)]; + char data[ISODCL(8,2048)]; +}; + +/* volume descriptor types */ +#define ISO_VD_PRIMARY 1 +#define ISO_VD_END 255 + +#define ISO_STANDARD_ID "CD001" + +struct iso_primary_descriptor { + char type [ISODCL ( 1, 1)]; /* 711 */ + char id [ISODCL ( 2, 6)]; + char version [ISODCL ( 7, 7)]; /* 711 */ + char unused1 [ISODCL ( 8, 8)]; + char system_id [ISODCL ( 9, 40)]; /* achars */ + char volume_id [ISODCL ( 41, 72)]; /* dchars */ + char unused2 [ISODCL ( 73, 80)]; + char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ + char unused3 [ISODCL ( 89, 120)]; + char volume_set_size [ISODCL (121, 124)]; /* 723 */ + char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ + char logical_block_size [ISODCL (129, 132)]; /* 723 */ + char path_table_size [ISODCL (133, 140)]; /* 733 */ + char type_l_path_table [ISODCL (141, 144)]; /* 731 */ + char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ + char type_m_path_table [ISODCL (149, 152)]; /* 732 */ + char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ + char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ + char volume_set_id [ISODCL (191, 318)]; /* dchars */ + char publisher_id [ISODCL (319, 446)]; /* achars */ + char preparer_id [ISODCL (447, 574)]; /* achars */ + char application_id [ISODCL (575, 702)]; /* achars */ + char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ + char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ + char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ + char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ + char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ + char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ + char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ + char file_structure_version [ISODCL (882, 882)]; /* 711 */ + char unused4 [ISODCL (883, 883)]; + char application_data [ISODCL (884, 1395)]; + char unused5 [ISODCL (1396, 2048)]; +}; + + +#define HS_STANDARD_ID "CDROM" + +struct hs_volume_descriptor { + char foo [ISODCL ( 1, 8)]; /* 733 */ + char type [ISODCL ( 9, 9)]; /* 711 */ + char id [ISODCL ( 10, 14)]; + char version [ISODCL ( 15, 15)]; /* 711 */ + char data[ISODCL(16,2048)]; +}; + + +struct hs_primary_descriptor { + char foo [ISODCL ( 1, 8)]; /* 733 */ + char type [ISODCL ( 9, 9)]; /* 711 */ + char id [ISODCL ( 10, 14)]; + char version [ISODCL ( 15, 15)]; /* 711 */ + char unused1 [ISODCL ( 16, 16)]; /* 711 */ + char system_id [ISODCL ( 17, 48)]; /* achars */ + char volume_id [ISODCL ( 49, 80)]; /* dchars */ + char unused2 [ISODCL ( 81, 88)]; /* 733 */ + char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ + char unused3 [ISODCL ( 97, 128)]; /* 733 */ + char volume_set_size [ISODCL (129, 132)]; /* 723 */ + char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ + char logical_block_size [ISODCL (137, 140)]; /* 723 */ + char path_table_size [ISODCL (141, 148)]; /* 733 */ + char type_l_path_table [ISODCL (149, 152)]; /* 731 */ + char unused4 [ISODCL (153, 180)]; /* 733 */ + char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ +}; + +/* We use this to help us look up the parent inode numbers. */ + +struct iso_path_table{ + unsigned char name_len[2]; /* 721 */ + char extent[4]; /* 731 */ + char parent[2]; /* 721 */ + char name[0]; +}; + +/* high sierra is identical to iso, except that the date is only 6 bytes, and + there is an extra reserved byte after the flags */ + +struct iso_directory_record { + char length [ISODCL (1, 1)]; /* 711 */ + char ext_attr_length [ISODCL (2, 2)]; /* 711 */ + char extent [ISODCL (3, 10)]; /* 733 */ + char size [ISODCL (11, 18)]; /* 733 */ + char date [ISODCL (19, 25)]; /* 7 by 711 */ + char flags [ISODCL (26, 26)]; + char file_unit_size [ISODCL (27, 27)]; /* 711 */ + char interleave [ISODCL (28, 28)]; /* 711 */ + char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ + unsigned char name_len [ISODCL (33, 33)]; /* 711 */ + char name [0]; +}; + +#define ISOFS_BLOCK_BITS 11 +#define ISOFS_BLOCK_SIZE 2048 + +#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) +#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) + +#if 0 +#ifdef ISOFS_FIXED_BLOCKSIZE +/* We use these until the buffer cache supports 2048 */ +#define ISOFS_BUFFER_BITS 10 +#define ISOFS_BUFFER_SIZE 1024 + +#define ISOFS_BLOCK_NUMBER(X) (X<<1) +#else +#define ISOFS_BUFFER_BITS 11 +#define ISOFS_BUFFER_SIZE 2048 + +#define ISOFS_BLOCK_NUMBER(X) (X) +#endif +#endif + +#define ISOFS_SUPER_MAGIC 0x9660 +#define ISOFS_FILE_UNKNOWN 0 +#define ISOFS_FILE_TEXT 1 +#define ISOFS_FILE_BINARY 2 +#define ISOFS_FILE_TEXT_M 3 + +struct isofs_super_block { + unsigned long s_ninodes; + unsigned long s_nzones; + unsigned long s_firstdatazone; + unsigned long s_log_zone_size; + unsigned long s_max_size; + + unsigned char s_high_sierra; /* A simple flag */ + unsigned char s_mapping; + unsigned char s_conversion; + unsigned char s_rock; + unsigned char s_cruft; /* Broken disks with high + byte of length containing + junk */ + unsigned int s_blocksize; + unsigned int s_blocksize_bits; + unsigned int s_mounted; + unsigned char s_unhide; + unsigned char s_nosuid; + unsigned char s_nodev; + mode_t s_mode; +}; + +/* + * iso fs inode data in memory + */ +struct iso_inode { + unsigned int i_first_extent; + unsigned int i_backlink; + unsigned char i_file_format; +}; + +/* From fs/isofs/rock.h in Linux, (c) 1995, 1996 Eric Youngdale */ + +/* These structs are used by the system-use-sharing protocol, in which the + Rock Ridge extensions are embedded. It is quite possible that other + extensions are present on the disk, and this is fine as long as they + all use SUSP */ + +struct SU_SP{ + unsigned char magic[2]; + unsigned char skip; +}; + +struct SU_CE{ + char extent[8]; + char offset[8]; + char size[8]; +}; + +struct SU_ER{ + unsigned char len_id; + unsigned char len_des; + unsigned char len_src; + unsigned char ext_ver; + char data[0]; +}; + +struct RR_RR{ + char flags[1]; +}; + +struct RR_PX{ + char mode[8]; + char n_links[8]; + char uid[8]; + char gid[8]; +}; + +struct RR_PN{ + char dev_high[8]; + char dev_low[8]; +}; + + +struct SL_component{ + unsigned char flags; + unsigned char len; + char text[0]; +}; + +struct RR_SL{ + unsigned char flags; + struct SL_component link; +}; + +struct RR_NM{ + unsigned char flags; + char name[0]; +}; + +struct RR_CL{ + char location[8]; +}; + +struct RR_PL{ + char location[8]; +}; + +struct stamp{ + char time[7]; +}; + +struct RR_TF{ + char flags; + struct stamp times[0]; /* Variable number of these beasts */ +}; + +/* These are the bits and their meanings for flags in the TF structure. */ +#define TF_CREATE 1 +#define TF_MODIFY 2 +#define TF_ACCESS 4 +#define TF_ATTRIBUTES 8 +#define TF_BACKUP 16 +#define TF_EXPIRATION 32 +#define TF_EFFECTIVE 64 +#define TF_LONG_FORM 128 + +struct rock_ridge{ + char signature[2]; + unsigned char len; + unsigned char version; + union{ + struct SU_SP SP; + struct SU_CE CE; + struct SU_ER ER; + struct RR_RR RR; + struct RR_PX PX; + struct RR_PN PN; + struct RR_SL SL; + struct RR_NM NM; + struct RR_CL CL; + struct RR_PL PL; + struct RR_TF TF; + } u; +}; + +#define RR_PX 1 /* POSIX attributes */ +#define RR_PN 2 /* POSIX devices */ +#define RR_SL 4 /* Symbolic link */ +#define RR_NM 8 /* Alternate Name */ +#define RR_CL 16 /* Child link */ +#define RR_PL 32 /* Parent link */ +#define RR_RE 64 /* Relocation directory */ +#define RR_TF 128 /* Timestamps */ + +#endif diff --git a/package/aboot/src/include/isolib.h b/package/aboot/src/include/isolib.h new file mode 100644 index 000000000..392327ab7 --- /dev/null +++ b/package/aboot/src/include/isolib.h @@ -0,0 +1,30 @@ +#ifndef isolib_h +#define isolib_h + +#ifndef __KERNEL_STRICT_NAMES + /* ask kernel to be careful about name-space pollution: */ +# define __KERNEL_STRICT_NAMES +# define fd_set kernel_fd_set +#endif + +#include <asm/stat.h> + +extern int iso_read_super (void * data, int quiet); +extern int iso_open (const char * filename); +extern int iso_bread (int fd, long blkno, long nblks, char * buffer); +extern void iso_close (int fd); +extern long iso_map (int fd, long block); +extern int iso_fstat (int fd, struct stat * buf); +extern char *iso_readdir_i(int fd, int rewind); +extern int isonum_711 (char *p); +extern int isonum_712 (char *p); +extern int isonum_721 (char *p); +extern int isonum_722 (char *p); +extern int isonum_723 (char *p); +extern int isonum_731 (char *p); +extern int isonum_732 (char *p); +extern int isonum_733 (char *p); + +#endif /* isolib_h */ + + diff --git a/package/aboot/src/include/linux/ext2_fs.h b/package/aboot/src/include/linux/ext2_fs.h new file mode 100644 index 000000000..ce1b719e8 --- /dev/null +++ b/package/aboot/src/include/linux/ext2_fs.h @@ -0,0 +1,591 @@ +/* + * linux/include/linux/ext2_fs.h + * + * Copyright (C) 1992, 1993, 1994, 1995 + * Remy Card (card@masi.ibp.fr) + * Laboratoire MASI - Institut Blaise Pascal + * Universite Pierre et Marie Curie (Paris VI) + * + * from + * + * linux/include/linux/minix_fs.h + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#ifndef _LINUX_EXT2_FS_H +#define _LINUX_EXT2_FS_H + +#include <linux/types.h> +#include <linux/magic.h> +#include <linux/fs.h> + +/* + * The second extended filesystem constants/structures + */ + +/* + * Define EXT2FS_DEBUG to produce debug messages + */ +#undef EXT2FS_DEBUG + +/* + * Define EXT2_RESERVATION to reserve data blocks for expanding files + */ +#define EXT2_DEFAULT_RESERVE_BLOCKS 8 +/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ +#define EXT2_MAX_RESERVE_BLOCKS 1027 +#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0 +/* + * The second extended file system version + */ +#define EXT2FS_DATE "95/08/09" +#define EXT2FS_VERSION "0.5b" + +/* + * Debug code + */ +#ifdef EXT2FS_DEBUG +# define ext2_debug(f, a...) { \ + printk ("EXT2-fs DEBUG (%s, %d): %s:", \ + __FILE__, __LINE__, __func__); \ + printk (f, ## a); \ + } +#else +# define ext2_debug(f, a...) /**/ +#endif + +/* + * Special inode numbers + */ +#define EXT2_BAD_INO 1 /* Bad blocks inode */ +#define EXT2_ROOT_INO 2 /* Root inode */ +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ + +/* First non-reserved inode for old ext2 filesystems */ +#define EXT2_GOOD_OLD_FIRST_INO 11 + +#ifdef __KERNEL__ +#include <linux/ext2_fs_sb.h> +static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) +{ + return sb->s_fs_info; +} +#else +/* Assume that user mode programs are passing in an ext2fs superblock, not + * a kernel struct super_block. This will allow us to call the feature-test + * macros from user land. */ +#define EXT2_SB(sb) (sb) +#endif + +/* + * Maximal count of links to a file + */ +#define EXT2_LINK_MAX 32000 + +/* + * Macro-instructions used to manage several block sizes + */ +#define EXT2_MIN_BLOCK_SIZE 1024 +#define EXT2_MAX_BLOCK_SIZE 4096 +#define EXT2_MIN_BLOCK_LOG_SIZE 10 +#ifdef __KERNEL__ +# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) +#else +# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) +#endif +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) +#ifdef __KERNEL__ +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) +#else +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) +#endif +#ifdef __KERNEL__ +#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits) +#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) +#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) +#else +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_INODE_SIZE : \ + (s)->s_inode_size) +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_FIRST_INO : \ + (s)->s_first_ino) +#endif + +/* + * Macro-instructions used to manage fragments + */ +#define EXT2_MIN_FRAG_SIZE 1024 +#define EXT2_MAX_FRAG_SIZE 4096 +#define EXT2_MIN_FRAG_LOG_SIZE 10 +#ifdef __KERNEL__ +# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size) +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block) +#else +# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) +#endif + +/* + * Structure of a blocks group descriptor + */ +struct ext2_group_desc +{ + __le32 bg_block_bitmap; /* Blocks bitmap block */ + __le32 bg_inode_bitmap; /* Inodes bitmap block */ + __le32 bg_inode_table; /* Inodes table block */ + __le16 bg_free_blocks_count; /* Free blocks count */ + __le16 bg_free_inodes_count; /* Free inodes count */ + __le16 bg_used_dirs_count; /* Directories count */ + __le16 bg_pad; + __le32 bg_reserved[3]; +}; + +/* + * Macro-instructions used to manage group descriptors + */ +#ifdef __KERNEL__ +# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) +# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) +# define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) +# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) +#else +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) +# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) +#endif + +/* + * Constants relative to the data blocks + */ +#define EXT2_NDIR_BLOCKS 12 +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) + +/* + * Inode flags (GETFLAGS/SETFLAGS) + */ +#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */ +#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */ +#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */ +#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ +#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ +#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ +#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ +#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ +/* Reserved for compre |