Second pass of the bootloader reworking. Everything works from the

TOS/MiNT side now.
This commit is contained in:
leo 2001-10-11 07:07:41 +00:00
parent c3e7e8005a
commit 13a1055e2f
11 changed files with 91 additions and 35 deletions

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1 1996/01/07 22:05:41 leo Exp $
# $NetBSD: Makefile.inc,v 1.2 2001/10/11 07:07:41 leo Exp $
#
# Configurable stuff.
@ -32,9 +32,9 @@ STRIP =
HEADERS := ${HEADERS} ../libtos/libtos.h
LDADD := ${LDADD} ../libtos/libtos.a
LDADD := ${LDADD} ../libtos/libtos.a -lz
INCL := ${INCL} -I. -I../libtos
DEFS := ${DEFS} -DTOSTOOLS
DEFS := ${DEFS} -DTOSTOOLS -DCOMPRESSED_READ
CFLAGS := ${CFLAGS} -Wall ${DEBUG} ${BASREL} ${OPTIM} ${INCL}
LDFLAGS := ${LDFLAGS} ${DEBUG} ${BASREL} ${STRIP}
@ -61,4 +61,4 @@ ${OBJS}: ${HEADERS}
${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
.s.o:
${CPP} ${CPPFLAGS} $< | ${AS} ${ASFLAGS} -o $@
${CPP} ${CPPFLAGS} $< | sed -e 's/%//g' | ${AS} ${ASFLAGS} -o $@

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.2 2001/10/10 14:19:49 leo Exp $
# $NetBSD: Makefile,v 1.3 2001/10/11 07:07:42 leo Exp $
#
LIB = libtos.a
OBJS = aout.o bsdstart.o elf.o eprintf.o error.o sysinfo.o xalloc.o \
xexit.o keywait.o
OBJS = aout.o bsdstart.o cread.o elf.o eprintf.o error.o sysinfo.o \
xalloc.o xexit.o keywait.o
HEADERS = kparamb.h libtos.h

@ -1,4 +1,4 @@
/* $NetBSD: aout.c,v 1.1 2001/10/10 14:19:50 leo Exp $ */
/* $NetBSD: aout.c,v 1.2 2001/10/11 07:07:42 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -35,8 +35,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -49,6 +49,8 @@
#include "tosdefs.h"
#include "kparamb.h"
#include "libtos.h"
#include "cread.h"
#ifdef TOSTOOLS
/*

@ -1,4 +1,4 @@
/* $NetBSD: cread.c,v 1.1 1999/06/23 19:26:13 leo Exp $ */
/* $NetBSD: cread.c,v 1.1 2001/10/11 07:07:42 leo Exp $ */
/*
* Copyright (c) 1996
@ -47,6 +47,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include <unistd.h>
#include <string.h>
#include <memory.h>
#include <fcntl.h>

@ -0,0 +1,57 @@
/* $NetBSD: cread.h,v 1.1 2001/10/11 07:07:42 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Leo Weppelman.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LIBTOS_CREAD_H
#define _LIBTOS_CREAD_H
#include <libtos.h>
#ifdef COMPRESSED_READ
#define close cclose
#define lseek clseek
#define open copen
#define read cread
EXTERN int cclose PROTO((int));
EXTERN off_t clseek PROTO((int, off_t, int));
EXTERN int copen PROTO((const char *, int));
EXTERN int cread PROTO((int, void *, size_t));
#endif /* COMPRESSED_READ */
#endif /* !_LIBTOS_CREAD_H */

@ -1,4 +1,4 @@
/* $NetBSD: elf.c,v 1.1 2001/10/10 14:19:51 leo Exp $ */
/* $NetBSD: elf.c,v 1.2 2001/10/11 07:07:42 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -50,6 +50,7 @@
#include "tosdefs.h"
#include "kparamb.h"
#include "libtos.h"
#include "cread.h"
/*
* Load an elf image.

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf.h,v 1.1 2001/10/10 14:19:51 leo Exp $ */
/* $NetBSD: exec_elf.h,v 1.2 2001/10/11 07:07:42 leo Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -36,8 +36,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_EXEC_ELF_H_
#define _SYS_EXEC_ELF_H_
#ifndef _LIBTOS_EXEC_ELF_H_
#define _LIBTOS_EXEC_ELF_H_
/*
* The current ELF ABI specification is available at:
@ -669,4 +669,4 @@ struct elf_args {
#endif /* _KERNEL */
#endif /* !_SYS_EXEC_ELF_H_ */
#endif /* !_LIBTOS_EXEC_ELF_H_ */

@ -1,4 +1,4 @@
/* $NetBSD: kparamb.h,v 1.6 2001/10/10 14:19:52 leo Exp $ */
/* $NetBSD: kparamb.h,v 1.7 2001/10/11 07:07:42 leo Exp $ */
/*
* Copyright (c) 1995 L. Weppelman
@ -83,4 +83,4 @@ struct kparamb {
#define RB_KDB 0x40
#endif /* TOSTOOLS */
#endif /* _LIBTOS_KPARAMB_H */
#endif /* !_LIBTOS_KPARAMB_H */

@ -1,4 +1,4 @@
/* $NetBSD: libtos.h,v 1.2 2001/10/10 14:19:52 leo Exp $ */
/* $NetBSD: libtos.h,v 1.3 2001/10/11 07:07:42 leo Exp $ */
/*
* Copyright (c) 1995 Waldi Ravens.
@ -30,8 +30,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBTOS_H
#define LIBTOS_H
#ifndef _LIBTOS_H
#define _LIBTOS_H
#ifdef __STDC__
#define PROTO(x) x
@ -72,4 +72,4 @@ EXTERN void xexit PROTO((int)) NORETURN;
EXTERN void * xmalloc PROTO((size_t));
EXTERN void * xrealloc PROTO((void *, size_t));
#endif /* LIBTOS_H */
#endif /* !_LIBTOS_H */

@ -1,4 +1,4 @@
/* $NetBSD: tosdefs.h,v 1.1 2001/10/10 14:19:53 leo Exp $ */
/* $NetBSD: tosdefs.h,v 1.2 2001/10/11 07:07:42 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -36,6 +36,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LIBTOS_TOSDEFS_H
#define _LIBTOS_TOSDEFS_H
#include <sys/types.h>
#ifndef int8_t
@ -105,3 +108,5 @@ typedef struct osdsc {
#define ttmem_start kp.ttmem_start
#define cputype kp.bootflags
#define boothowto kp.boothowto
#endif /* !_LIBTOS_TOSDEFS_H */

@ -1,4 +1,4 @@
/* $NetBSD: loadbsd.c,v 1.17 2001/10/10 14:24:48 leo Exp $ */
/* $NetBSD: loadbsd.c,v 1.18 2001/10/11 07:07:43 leo Exp $ */
/*
* Copyright (c) 1995 L. Weppelman
@ -34,8 +34,6 @@
* NetBSD loader for the Atari-TT.
*/
#include "exec_elf.h"
#include <a_out.h>
#include <fcntl.h>
#include <stdio.h>
#include <osbind.h>
@ -45,13 +43,7 @@
#include <unistd.h>
#include "libtos.h"
#include "tosdefs.h"
#ifdef COMPRESSED_READ
#define open copen
#define read cread
#define lseek clseek
#define close cclose
#endif /* COMPRESSED_READ */
#include "cread.h"
char *Progname; /* How are we called */
int d_flag = 0; /* Output debugging output? */
@ -61,7 +53,7 @@ int s_flag = 0; /* St-ram only */
int t_flag = 0; /* Just test, do not execute */
int v_flag = 0; /* show version */
const char version[] = "$Revision: 1.17 $";
const char version[] = "$Revision: 1.18 $";
/*
* Default name of kernel to boot, large enough to patch
@ -75,8 +67,6 @@ void usage PROTO((void));
void get_sys_info PROTO((osdsc_t *));
void start_kernel PROTO((osdsc_t *));
#define ELFMAGIC ((ELFMAG0 << 24) | (ELFMAG1 << 16) | \
(ELFMAG2 << 8) | ELFMAG3)
int
main(argc, argv)
int argc;