Home | History | Annotate | Line # | Download | only in loadbsd
      1  1.6     phx #	$NetBSD: README,v 1.6 2023/05/14 16:13:05 phx Exp $
      2  1.2   perry 
      3  1.3     phx BUILD INSTRUCTIONS
      4  1.1      is 
      5  1.3     phx Building LoadBSD isn't easy since several sources from the NetBSD repository
      6  1.3     phx are required. Compiling these sources under AmigaOS without clashes with the
      7  1.3     phx native GCC headers requires some knowledge. This document tries to describe
      8  1.6     phx the steps necessary to rebuild LoadBSD with a modern AmigaOS gcc, or vbcc
      9  1.6     phx with PosixLib.
     10  1.6     phx These instructions do only apply for LoadBSD versions using the loadfile()
     11  1.6     phx interface. Previous version do only require getopt.c and reboot.h.
     12  1.3     phx 
     13  1.5     phx Note: It is not possible to build LoadBSD with the native NetBSD compiler!
     14  1.3     phx       LoadBSD is an *AmigaOS* program and must be built with an AmigaOS
     15  1.3     phx       compiler. Of course, a properly setup cross-compiler does work.
     16  1.3     phx 
     17  1.3     phx Required sources from NetBSD (either HEAD or from a release branch)
     18  1.3     phx 
     19  1.3     phx    From src/sys/lib/libsa: loadfile.h,loadfile.c,loadfile_elf32.c,loadfile_aout.c
     20  1.3     phx 
     21  1.3     phx       place these files in the directory where you have loadbsd.c
     22  1.3     phx 
     23  1.3     phx    From src/sys/arch/m68k/include: aout_machdep.h,elf_machdep.h
     24  1.3     phx 
     25  1.3     phx       place these files in: <loadbsd directory>/include/m68k
     26  1.3     phx 
     27  1.3     phx    From src/sys/arch/amiga/include: aout_machdep.h,elf_machdep.h,loadfile_machdep.h
     28  1.3     phx 
     29  1.3     phx       place these files in: <loadbsd directory>/include/machine
     30  1.3     phx 
     31  1.6     phx    From src/sys/sys: exec.h,exec_elf.h,exec_aout.h,aout_mids.h,reboot.h
     32  1.3     phx 
     33  1.3     phx       place these files in: <loadbsd directory>/include/sys
     34  1.3     phx 
     35  1.3     phx    Additional headers (see below): inttypes.h,namespace.h,lib/libsa/stand.h,lib/libkern/libkern.h
     36  1.3     phx 
     37  1.3     phx       place these files in: <loadbsd directory>/include
     38  1.3     phx 
     39  1.3     phx If all the mentioned files are placed at the correct place, loadfile_machdep.h
     40  1.4  andvar must be modified. The patch is included below. Another small patch to
     41  1.3     phx loadfile_aout.c must be applied to fix an incompatibility for LoadBSD.
     42  1.3     phx However, that patch breaks loadfile() for other architectures using a.out!
     43  1.3     phx Note: This patch is required to be able to suppress loaded symbols when
     44  1.3     phx       booting ancient a.out kernels that don't support them. Without the
     45  1.3     phx       patch symbol suppressing doesn't work! That also means ELF isn't
     46  1.3     phx       affected and LoadBSD could handle it differently but then it could
     47  1.3     phx       probably break in other unpredictable ways...
     48  1.3     phx 
     49  1.6     phx The headers inttypes.h, namespace.h, include/lib/libsa/stand.h and
     50  1.6     phx lib/libkern/libkern.h are listed completely below.
     51  1.6     phx 
     52  1.6     phx Then it should be possible to recompile LoadBSD with gcc6 or newer by
     53  1.6     phx typing "make" (or "make -f vmakefile" with vbcc). If make fails, fix the
     54  1.6     phx problem and try again :-P
     55  1.3     phx 
     56  1.3     phx Good luck!
     57  1.3     phx 
     58  1.3     phx --- Missing files/patches ---
     59  1.3     phx 
     60  1.6     phx       include/machine/loadfile_machdep.h modification:
     61  1.6     phx --cut--
     62  1.6     phx --- include/machine/loadfile_machdep.h~     Sun Mar 26 15:46:55 2023
     63  1.6     phx +++ include/machine/loadfile_machdep.h  Sun Mar 26 15:47:17 2023
     64  1.6     phx @@ -38,7 +38,7 @@
     65  1.6     phx  #define	LOAD_KERNEL		LOAD_ALL
     66  1.6     phx  #define	COUNT_KERNEL		COUNT_ALL
     67  1.6     phx  
     68  1.6     phx -#ifdef _STANDALONE
     69  1.6     phx +#if 0
     70  1.6     phx  
     71  1.6     phx  #define LOADADDR(a)		((a) + offset)
     72  1.6     phx  #define ALIGNENTRY(a)		0
     73  1.6     phx --cut--
     74  1.6     phx 
     75  1.3     phx       loadfile_aout.c modification:
     76  1.3     phx --cut--
     77  1.3     phx --- loadfile_aout.c~	Mon Feb 11 21:25:56 2002
     78  1.3     phx +++ loadfile_aout.c	Thu Jan 23 10:43:27 2003
     79  1.3     phx @@ -217,8 +217,8 @@ loadfile_aout(fd, x, marks, flags)
     80  1.3     phx  		BCOPY(&x->a_syms, maxp, sizeof(x->a_syms));
     81  1.3     phx  
     82  1.3     phx  	if (flags & (LOAD_SYM|COUNT_SYM)) {
     83  1.3     phx -		maxp += sizeof(x->a_syms);
     84  1.3     phx  		aoutp = maxp;
     85  1.3     phx +		maxp += sizeof(x->a_syms);
     86  1.3     phx  	}
     87  1.3     phx  
     88  1.3     phx  	if (x->a_syms > 0) {
     89  1.3     phx --cut--
     90  1.3     phx 
     91  1.3     phx       include/inttypes.h:
     92  1.3     phx --cut--
     93  1.3     phx #ifndef _INTTYPES_H
     94  1.3     phx #define _INTTYPES_H
     95  1.3     phx 
     96  1.3     phx #include <sys/types.h>
     97  1.6     phx #include <sys/cdefs.h>
     98  1.6     phx 
     99  1.6     phx #ifndef be32toh
    100  1.6     phx #define be32toh(x) (x)
    101  1.6     phx #endif
    102  1.6     phx 
    103  1.6     phx #ifndef roundup
    104  1.6     phx #define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
    105  1.6     phx #endif
    106  1.3     phx 
    107  1.3     phx typedef unsigned long vaddr_t;
    108  1.3     phx typedef unsigned long paddr_t;
    109  1.3     phx 
    110  1.3     phx #endif /* !_INTTYPES_H */
    111  1.3     phx --cut--
    112  1.3     phx 
    113  1.3     phx     include/namespace.h
    114  1.3     phx --cut--
    115  1.3     phx #define _DIAGASSERT(x) /**/
    116  1.3     phx 
    117  1.3     phx extern char *program_name;
    118  1.3     phx #define getprogname() program_name
    119  1.6     phx 
    120  1.6     phx #ifndef __UNCONST
    121  1.6     phx #define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))
    122  1.6     phx #endif
    123  1.3     phx --cut--
    124  1.3     phx 
    125  1.3     phx       include/lib/libsa/stand.h
    126  1.3     phx --cut--
    127  1.3     phx #include <stdio.h>
    128  1.3     phx #include <string.h>
    129  1.3     phx #include <errno.h>
    130  1.3     phx #include <stdlib.h>
    131  1.3     phx #include <unistd.h>
    132  1.3     phx #include <fcntl.h>
    133  1.3     phx #include "inttypes.h"
    134  1.3     phx --cut--
    135  1.3     phx 
    136  1.3     phx       include/lib/libkern/libkern.h
    137  1.3     phx --cut--
    138  1.3     phx /* nothing, must only exist! */
    139  1.3     phx --cut--
    140