//***************************************************************************** // // Purpose: Make a boot-image for EtherBoot // // // Compiler: This source can be compiled with gcc and Watcom C // // // Note: The QNX boot image can be build with any reasonable // start address, e.g. 0x1000 (default) or 0x10000 // (widespread Boot-Rom address) // // // Author: Anders Larsen // // // Copyright: (C) 1999 by // // Anders Larsen // systems engineer // Gutleuthausstr. 3 // D-69469 Weinheim // Germany // phone: +49-6201-961717 // fax: +49-6201-961718 // e-mail: al@alarsen.net // // 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 // (at your option) 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. // //----------------------------------------------------------------------------- // // Change Log: // V0.2: Sun 1999-12-13 Anders Larsen //***************************************************************************** #include #include #include #include #include // max. size of QNX OS boot image is 512K #define MAXSIZE (512*1024) typedef unsigned short ushort_t; typedef unsigned long ulong_t; // global header of tagged image: struct initial_t { ulong_t magic; ulong_t length; ulong_t location; ulong_t start; }; // header of each image: struct header_t { ulong_t flags; ulong_t loadaddr; ulong_t imgsize; ulong_t memsize; }; // global header of the QNX EtherBoot image: struct qnx_loader_t { struct initial_t setup; struct header_t qnx; }; // global header: union { struct qnx_loader_t h; char filler[512]; } header; char buffer[MAXSIZE]; int usage( char* const* argv ) { fprintf( stderr, "%s - make a tagged boot image for EtherBoot\n", *argv ); fprintf( stderr, "\nuse:\n" ); fprintf( stderr, "%s [ -