11.6Sphx# $NetBSD: README,v 1.6 2023/05/14 16:13:05 phx Exp $ 21.2Sperry 31.3SphxBUILD INSTRUCTIONS 41.1Sis 51.3SphxBuilding LoadBSD isn't easy since several sources from the NetBSD repository 61.3Sphxare required. Compiling these sources under AmigaOS without clashes with the 71.3Sphxnative GCC headers requires some knowledge. This document tries to describe 81.6Sphxthe steps necessary to rebuild LoadBSD with a modern AmigaOS gcc, or vbcc 91.6Sphxwith PosixLib. 101.6SphxThese instructions do only apply for LoadBSD versions using the loadfile() 111.6Sphxinterface. Previous version do only require getopt.c and reboot.h. 121.3Sphx 131.5SphxNote: It is not possible to build LoadBSD with the native NetBSD compiler! 141.3Sphx LoadBSD is an *AmigaOS* program and must be built with an AmigaOS 151.3Sphx compiler. Of course, a properly setup cross-compiler does work. 161.3Sphx 171.3SphxRequired sources from NetBSD (either HEAD or from a release branch) 181.3Sphx 191.3Sphx From src/sys/lib/libsa: loadfile.h,loadfile.c,loadfile_elf32.c,loadfile_aout.c 201.3Sphx 211.3Sphx place these files in the directory where you have loadbsd.c 221.3Sphx 231.3Sphx From src/sys/arch/m68k/include: aout_machdep.h,elf_machdep.h 241.3Sphx 251.3Sphx place these files in: <loadbsd directory>/include/m68k 261.3Sphx 271.3Sphx From src/sys/arch/amiga/include: aout_machdep.h,elf_machdep.h,loadfile_machdep.h 281.3Sphx 291.3Sphx place these files in: <loadbsd directory>/include/machine 301.3Sphx 311.6Sphx From src/sys/sys: exec.h,exec_elf.h,exec_aout.h,aout_mids.h,reboot.h 321.3Sphx 331.3Sphx place these files in: <loadbsd directory>/include/sys 341.3Sphx 351.3Sphx Additional headers (see below): inttypes.h,namespace.h,lib/libsa/stand.h,lib/libkern/libkern.h 361.3Sphx 371.3Sphx place these files in: <loadbsd directory>/include 381.3Sphx 391.3SphxIf all the mentioned files are placed at the correct place, loadfile_machdep.h 401.4Sandvarmust be modified. The patch is included below. Another small patch to 411.3Sphxloadfile_aout.c must be applied to fix an incompatibility for LoadBSD. 421.3SphxHowever, that patch breaks loadfile() for other architectures using a.out! 431.3SphxNote: This patch is required to be able to suppress loaded symbols when 441.3Sphx booting ancient a.out kernels that don't support them. Without the 451.3Sphx patch symbol suppressing doesn't work! That also means ELF isn't 461.3Sphx affected and LoadBSD could handle it differently but then it could 471.3Sphx probably break in other unpredictable ways... 481.3Sphx 491.6SphxThe headers inttypes.h, namespace.h, include/lib/libsa/stand.h and 501.6Sphxlib/libkern/libkern.h are listed completely below. 511.6Sphx 521.6SphxThen it should be possible to recompile LoadBSD with gcc6 or newer by 531.6Sphxtyping "make" (or "make -f vmakefile" with vbcc). If make fails, fix the 541.6Sphxproblem and try again :-P 551.3Sphx 561.3SphxGood luck! 571.3Sphx 581.3Sphx--- Missing files/patches --- 591.3Sphx 601.6Sphx include/machine/loadfile_machdep.h modification: 611.6Sphx--cut-- 621.6Sphx--- include/machine/loadfile_machdep.h~ Sun Mar 26 15:46:55 2023 631.6Sphx+++ include/machine/loadfile_machdep.h Sun Mar 26 15:47:17 2023 641.6Sphx@@ -38,7 +38,7 @@ 651.6Sphx #define LOAD_KERNEL LOAD_ALL 661.6Sphx #define COUNT_KERNEL COUNT_ALL 671.6Sphx 681.6Sphx-#ifdef _STANDALONE 691.6Sphx+#if 0 701.6Sphx 711.6Sphx #define LOADADDR(a) ((a) + offset) 721.6Sphx #define ALIGNENTRY(a) 0 731.6Sphx--cut-- 741.6Sphx 751.3Sphx loadfile_aout.c modification: 761.3Sphx--cut-- 771.3Sphx--- loadfile_aout.c~ Mon Feb 11 21:25:56 2002 781.3Sphx+++ loadfile_aout.c Thu Jan 23 10:43:27 2003 791.3Sphx@@ -217,8 +217,8 @@ loadfile_aout(fd, x, marks, flags) 801.3Sphx BCOPY(&x->a_syms, maxp, sizeof(x->a_syms)); 811.3Sphx 821.3Sphx if (flags & (LOAD_SYM|COUNT_SYM)) { 831.3Sphx- maxp += sizeof(x->a_syms); 841.3Sphx aoutp = maxp; 851.3Sphx+ maxp += sizeof(x->a_syms); 861.3Sphx } 871.3Sphx 881.3Sphx if (x->a_syms > 0) { 891.3Sphx--cut-- 901.3Sphx 911.3Sphx include/inttypes.h: 921.3Sphx--cut-- 931.3Sphx#ifndef _INTTYPES_H 941.3Sphx#define _INTTYPES_H 951.3Sphx 961.3Sphx#include <sys/types.h> 971.6Sphx#include <sys/cdefs.h> 981.6Sphx 991.6Sphx#ifndef be32toh 1001.6Sphx#define be32toh(x) (x) 1011.6Sphx#endif 1021.6Sphx 1031.6Sphx#ifndef roundup 1041.6Sphx#define roundup(x,y) ((((x)+((y)-1))/(y))*(y)) 1051.6Sphx#endif 1061.3Sphx 1071.3Sphxtypedef unsigned long vaddr_t; 1081.3Sphxtypedef unsigned long paddr_t; 1091.3Sphx 1101.3Sphx#endif /* !_INTTYPES_H */ 1111.3Sphx--cut-- 1121.3Sphx 1131.3Sphx include/namespace.h 1141.3Sphx--cut-- 1151.3Sphx#define _DIAGASSERT(x) /**/ 1161.3Sphx 1171.3Sphxextern char *program_name; 1181.3Sphx#define getprogname() program_name 1191.6Sphx 1201.6Sphx#ifndef __UNCONST 1211.6Sphx#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) 1221.6Sphx#endif 1231.3Sphx--cut-- 1241.3Sphx 1251.3Sphx include/lib/libsa/stand.h 1261.3Sphx--cut-- 1271.3Sphx#include <stdio.h> 1281.3Sphx#include <string.h> 1291.3Sphx#include <errno.h> 1301.3Sphx#include <stdlib.h> 1311.3Sphx#include <unistd.h> 1321.3Sphx#include <fcntl.h> 1331.3Sphx#include "inttypes.h" 1341.3Sphx--cut-- 1351.3Sphx 1361.3Sphx include/lib/libkern/libkern.h 1371.3Sphx--cut-- 1381.3Sphx/* nothing, must only exist! */ 1391.3Sphx--cut-- 140