Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amiga/stand/loadbsd Build instructions and Makefile...



details:   https://anonhg.NetBSD.org/src/rev/60b48a548921
branches:  trunk
changeset: 341560:60b48a548921
user:      phx <phx%NetBSD.org@localhost>
date:      Wed Nov 11 16:08:52 2015 +0000

description:
Build instructions and Makefile for loadbsd 3.0.
Submitted by Gunther Nikl.

diffstat:

 sys/arch/amiga/stand/loadbsd/Makefile |   18 +-
 sys/arch/amiga/stand/loadbsd/README   |  177 ++++++++++++++++++++++++++++++---
 2 files changed, 170 insertions(+), 25 deletions(-)

diffs (213 lines):

diff -r 728be5edab6b -r 60b48a548921 sys/arch/amiga/stand/loadbsd/Makefile
--- a/sys/arch/amiga/stand/loadbsd/Makefile     Wed Nov 11 14:50:08 2015 +0000
+++ b/sys/arch/amiga/stand/loadbsd/Makefile     Wed Nov 11 16:08:52 2015 +0000
@@ -1,13 +1,13 @@
-#      $NetBSD: Makefile,v 1.2 1998/01/05 20:51:30 perry Exp $
+#      $NetBSD: Makefile,v 1.3 2015/11/11 16:08:52 phx Exp $
 #
-CC = gcc
-CFLAGS = -m68030 -O2 -D__progname=program_name -noixemul
+TARGET = loadbsd
 
-OBJS = loadbsd.o getopt.o
-LIBS = -lamiga
+CC     = gcc
+CFLAGS = -D_STANDALONE -I./include -O -fomit-frame-pointer -msmall-code
+LDFLAGS        = -noixemul
+LDLIBS =
 
-loadbsd: $(OBJS)
-       $(CC) $(CFLAGS) $(LDFLAGS) -o loadbsd $(OBJS) $(LIBS)
+OBJS   = loadbsd.o loadfile.o loadfile_aout.o loadfile_elf32.o getopt.o
 
-clean:
-       delete $(OBJS) loadbsd
+$(TARGET): $(OBJS)
+       $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
diff -r 728be5edab6b -r 60b48a548921 sys/arch/amiga/stand/loadbsd/README
--- a/sys/arch/amiga/stand/loadbsd/README       Wed Nov 11 14:50:08 2015 +0000
+++ b/sys/arch/amiga/stand/loadbsd/README       Wed Nov 11 16:08:52 2015 +0000
@@ -1,22 +1,167 @@
-#      $NetBSD: README,v 1.2 1998/01/05 20:51:31 perry Exp $
+#      $NetBSD: README,v 1.3 2015/11/11 16:08:52 phx Exp $
+
+BUILD INSTRUCTIONS
+
+Building LoadBSD isn't easy since several sources from the NetBSD repository
+are required. Compiling these sources under AmigaOS without clashes with the
+native GCC headers requires some knowledge. This document tries to describe
+the steps necessary to rebuild LoadBSD with an AmigaOS gcc. These instructions
+do only apply for LoadBSD versions using the loadfile() interface. Previous
+version do only require getopt.c and reboot.h.
+
+Note: Its not possible to build LoadBSD with the native NetBSD compiler!
+      LoadBSD is an *AmigaOS* program and must be built with an AmigaOS
+      compiler. Of course, a properly setup cross-compiler does work.
+
+Required sources from NetBSD (either HEAD or from a release branch)
+
+   From src/sys/lib/libsa: loadfile.h,loadfile.c,loadfile_elf32.c,loadfile_aout.c
+   From src/lib/libc/stdlib: getopt.c
+
+      place these files in the directory where you have loadbsd.c
+
+   From src/sys/arch/m68k/include: aout_machdep.h,elf_machdep.h
+
+      place these files in: <loadbsd directory>/include/m68k
+
+   From src/sys/arch/amiga/include: aout_machdep.h,elf_machdep.h,loadfile_machdep.h
+
+      place these files in: <loadbsd directory>/include/machine
+
+   From src/sys/sys: exec.h,exec_elf.h,exec_aout.h,reboot.h
+
+      place these files in: <loadbsd directory>/include/sys
 
-This was prepared to compile with gcc 2.7.0 for AmigaOS and 
-libnix 1.0. You don't need ixemul or special directories to run the
-binary, if compiled that way.
+   Additional headers (see below): inttypes.h,namespace.h,lib/libsa/stand.h,lib/libkern/libkern.h
+
+      place these files in: <loadbsd directory>/include
+
+If all the mentioned files are placed at the correct place, loadfile_machdep.h
+must be modfied. The patch is included below. Another small patch to
+loadfile_aout.c must be applied to fix an incompatibility for LoadBSD.
+However, that patch breaks loadfile() for other architectures using a.out!
+Note: This patch is required to be able to suppress loaded symbols when
+      booting ancient a.out kernels that don't support them. Without the
+      patch symbol suppressing doesn't work! That also means ELF isn't
+      affected and LoadBSD could handle it differently but then it could
+      probably break in other unpredictable ways...
+
+Then it should be possible to recompile LoadBSD by typing "make". If make
+fails, fix the problem and try again :-P
 
-With very old versions of gcc, you might need to add +2-. to relative
-offsets in the assembler part, but honestly, I suggest you upgrade your
-assembler (and compiler) instead, even if you know what I'm talking about 
-and how to identify the lines.
+Good luck!
+
+--- Missing files/patches ---
+
+      loadfile_aout.c modification:
+--cut--
+--- loadfile_aout.c~   Mon Feb 11 21:25:56 2002
++++ loadfile_aout.c    Thu Jan 23 10:43:27 2003
+@@ -217,8 +217,8 @@ loadfile_aout(fd, x, marks, flags)
+               BCOPY(&x->a_syms, maxp, sizeof(x->a_syms));
+ 
+       if (flags & (LOAD_SYM|COUNT_SYM)) {
+-              maxp += sizeof(x->a_syms);
+               aoutp = maxp;
++              maxp += sizeof(x->a_syms);
+       }
+ 
+       if (x->a_syms > 0) {
+--cut--
 
-You'll need the (unchanged) getopt.c from src/lib/libc/stdlib, too.
+      loadfile_machdep.h modification:
+--cut--
+--- loadfile_machdep.h~        Wed Oct 31 18:20:45 2001
++++ loadfile_machdep.h Thu Jan 16 14:02:39 2003
+@@ -42,6 +42,21 @@
+ #define       BOOT_AOUT
+ #define       BOOT_ELF32
+ 
++#if 1
++
++#define LOADADDR(a)           (((u_long)(a)) + offset)
++#define ALIGNENTRY(a)         0
++#define READ(f, b, c)         read((f), (void *)LOADADDR(b), (c))
++#define BCOPY(s, d, c)                memcpy((void *)LOADADDR(d), (void *)(s), (c))
++#define BZERO(d, c)           memset((void *)LOADADDR(d), 0, (c))
++#define WARN(a)                       warn a
++#define PROGRESS(a)           /* nothing */
++#define ALLOC(a)              malloc(a)
++#define FREE(a, b)            free(a)
++#define OKMAGIC(a)            ((a) == NMAGIC)
++
++#else /* ! true, false */
++
+ #define       LOAD_KERNEL             LOAD_ALL
+ #define       COUNT_KERNEL            COUNT_ALL
+ 
+@@ -83,4 +98,7 @@ void vcopy __P((u_long, u_long, u_long *
+ void vzero __P((u_long, u_long *, size_t));
+ 
+ #endif
++
++#endif /* ! false */
++
+ #endif /* ! _AMIGA_LOADFILE_MACHDEP_H_ */
+--cut--
+
+      Makefile:
+--cut--
+TARGET = loadbsd
+
+CC     = gcc -m68020 -Wa,-m68030 -fbaserel
+CFLAGS = -D_STANDALONE -I./include -O -fomit-frame-pointer -msmall-code
+LDFLAGS        = -noixemul
+LDLIBS =
+
+OBJS   = loadbsd.o loadfile.o loadfile_aout.o loadfile_elf32.o getopt.o
 
-With newer libnix or the ADE version of gcc, or when removing the
--noixemul option from CFLAGS, you might need (or want) to delete the 
-sleep() function at the bottom of loadbsd, or getopt.o from the 
-"OBJS =" line of Makefile.
+$(TARGET): $(OBJS)
+       $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
+--cut--
+
+      include/inttypes.h:
+--cut--
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <sys/types.h>
+
+typedef        unsigned char      uint8_t;
+typedef        unsigned short     uint16_t;
+typedef        unsigned int       uint32_t;
+typedef        unsigned long long uint64_t;
+/*
+typedef                 int       int32_t;
+typedef                 long long int64_t;
+*/
+typedef unsigned long vaddr_t;
+typedef unsigned long paddr_t;
+
+#endif /* !_INTTYPES_H */
+--cut--
 
-[Sorry, but I didn't dare to risk my gcc installation a few weeks 
- before the release by trying to install ADE]
+    include/namespace.h
+--cut--
+#define _DIAGASSERT(x) /**/
+
+extern char *program_name;
+#define getprogname() program_name
+--cut--
 
-       Ignatios Souvatzis
+      include/lib/libsa/stand.h
+--cut--
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <err.h>
+#include "inttypes.h"
+--cut--
+
+      include/lib/libkern/libkern.h
+--cut--
+/* nothing, must only exist! */
+--cut--



Home | Main Index | Thread Index | Old Index