bsdport.txt 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. $Id$
  2. Comments, mistakes and suggestions to [email protected]
  3. 1 FreeBSD status and notes. (kept on CVS because I work on several places)
  4. -----------------------------------------------------------------------------
  5. Please read these before running a FreeBSD snapshot.
  6. - Supported are FreeBSD 3.x (3.2, 3.4 and 4.0-release (quickly) tested. I never
  7. tested on 3.0). NON-ELF (2.x) versions are not supported.
  8. - This is alpha software. I didn't have data-loss using it, but you
  9. use this on your own responsability. Use a scratch, or well backup'ed
  10. system.
  11. - The FreeBSD/FPC port is now in its second stage. Some more stuff then what
  12. is required to recompile is now implemented (Clone, Sockets, Signals).
  13. Plans to create an (Alpha) release distribution are being made.
  14. (linking to external libs worked in the 16 april version already, even
  15. though the bsdport.txt of that date said it didn't)
  16. - IMPORTANT:
  17. !!! An explicite warning: Not all procedures and structures in Linux are
  18. checked, so even if they are not commented out, they can be not implemented!!!
  19. This specially applies to linux specific stuff. In case of doubt, use a
  20. scratch system, view the source, or mail the maintainer.
  21. - The pre alpha version's READDIR problem is fixed with a "hack", which
  22. means that searchpath (-Fx) and FindFirst/FindNext are more or less
  23. working.
  24. I don't know how good that hack is,I hope to replace it later this week
  25. by a port of freebsd's libc opendir/readdir/closedir/telldir/seekdir code,
  26. just to make sure.( Libc does some complex scanning and sorting for
  27. duplicate names, but I don't know if that is something archaic or not.
  28. Probably related to hardlinks, so don't use findfirst in /dev for now)
  29. These packages have more or less been tested with ncurses:
  30. - RTL, (NOT the Crt unit. Use ncrt for now!)
  31. - compiler can rebuild (see below)
  32. - packages/inet,
  33. - packages/zlib
  34. - packages/x11
  35. - fcl/
  36. - ncurses/panel.
  37. - (reported by somebody else) XForms.
  38. - fpgui's "hello world" demo (the other ones needed a FPC 1.1 compiler, I
  39. only tested 1.0.1 with FreeBSD)
  40. 2 Syscalls.
  41. -----------
  42. The bulk of the linux syscalls are implemented.
  43. Some that aren't implemented:
  44. NI = not implemented yet
  45. req = required for compiler
  46. noreq? = not required, but not checked.
  47. Ever? (y/n)
  48. syscall status Ever? comment
  49. ------------------------------------------------------------------------
  50. Readdir I req implemented from scratch, working. (this
  51. call doesn't exist on FreeBSD and FindFirst is
  52. based on it)
  53. ioperm NI noreq n IO via port access impossible under FreeBSD
  54. (so: no ports unit, port[] support)
  55. (got some reports that port access is possible under
  56. FreeBSD. Probably the same way it slipped into Linux;
  57. dos emulation)
  58. ipc NI ? The IPC is System V thingy, and only supported
  59. under FreeBSD with certain kernel parameters.
  60. Clone() I noreq Not implemented as syscall, based on linuxthread
  61. assembler routine. Untested. Somebody has a good
  62. test program? Or that tests the FCL threading
  63. routines based on it?
  64. sysinfo NI noreq Not supported under BSD, not even by emulator
  65. uname NI noreq " " " " " " " "
  66. (procedures based on this call are also commented
  67. (get* procs))
  68. signal I noreq A *lot* of emulation code.
  69. alarm NI noreq? Could be possible to port. (crt.delay?)
  70. pause NI noreq? Also possible I think. Uses process information
  71. in linux-emu, that is why I didn't port directly.
  72. 3 How to build a FreeBSD compiler/RTL ?
  73. -----------------------------------------------------------------------------
  74. (You'll probably need CVS sources dated after April 16th for basic support, or
  75. after the major updates on 10 september for signals and sockets.)
  76. To rebuild the compiler, you need a starting compiler.
  77. - Start compiler on other OS? (tested is Linux) -> check 3a
  78. - Already a 1.0.x startcompiler on FreeBSD (e.g. from a snapshot) -> 3b is much
  79. easier.
  80. 3a How to build a FreeBSD system starting on Linux or using the Linux emu of
  81. FreeBSD? (Bootstrapping)
  82. The FreeBSD port is experimental atm, though valid native binaries can be
  83. obtained.
  84. The procedure here is verbose, and for the most akward case.
  85. If you have linux support on on your FreeBSD machine, or operate on NFS or Samba
  86. share (so that copying and using the sources in two systems is easier)
  87. some steps can be omitted or simplified. Just play with it.
  88. STEP A: create the RTL assembler files.
  89. 1. Copy all linux files to a new directory. (here called BSDBUILD), and
  90. 2. Copy all bsd files over them.
  91. 2b. Run fpcmake if you can. This will eliminate problems with Makefile being
  92. out of sync or containing dos lfns.
  93. 3. Execute make OPT='-Tlinux -dBSD -a -s -OG3p3' (with any i386 FPC
  94. compiler) in directory BSDBUILD. This failed with some go32v2 versions
  95. (which wanted to assemble anyway), but worked with several win32 and
  96. linux' snapshots. On go32v2 you can try to add -Aas.
  97. You now have .ppu's and .s 's for the RTL hopefully. Don't forget
  98. i386/prt0.as (which is in fact a .s file)!
  99. STEP B: Create the compiler assembler (.s) sources;
  100. 4. Compile with
  101. ./bsdcompile -Fu/full_path_to_BSDBUILD -a -s
  102. (steps 5 and 6 are only needed for the very first FreeBSD snapshot, which
  103. is no longer available)
  104. STEP C: Building the binary
  105. 7. Copy all necessary files
  106. (- all *.s *.ppu files, both from compiler and BSDBUILD dir,
  107. - compiler/link.res and
  108. - compiler/ppas.sh
  109. - Cut and paste of the DO_S script at the end of this document to file
  110. - rtl/bsd/i386/*.as files.
  111. )
  112. to a directory on the BSD machine.
  113. 8a. Change to the directory on the BSD machine, and run the script DO_S to
  114. assemble all .s files to .o files.
  115. 8b. Assemble the stub with as prt0.as -o prt0.o
  116. 9. Adapt link.res so that all paths are right.
  117. (remove all paths in front of all .o files, remove the -l lines and their
  118. parentheses)
  119. 10a. Edit ppas.sh, and keep only #!/bin/sh and the line starting with ld.
  120. b Remove any -l=ld-linux.so.1 (or similar) option from the ld line.
  121. c run ppas.sh to build the compiler
  122. 11. Have fun :-) The compiler is called "pp"
  123. 12. If you have a heavy machine (pentium 100 and 32MB+) execute 3b to make
  124. sure everything is up to date.
  125. ------------
  126. 3b How to update FPC compiler on FreeBSD from fresh CVS sources with a snapshot
  127. installed.
  128. (To create a compiler for the 1.0 branch, you need a 1.0.x compiler, and to
  129. create a 1.1 (development branch) compiler you need a 1.1.x snapshot.
  130. You can check the version of your snapshot with ppc386 -i)
  131. (assuming ppc386 in the PATH, and a rtl/ and compiler/ directory obtained
  132. from snapshot zips, with non mangled makefiles)
  133. 1a Rename the rtl/linux to something else. (here: rtl/linuxorg)
  134. 1b create a new rtl/linux dir
  135. 1c copy rtl/linuxorg/* to rtl/linux
  136. 1d copy rtl/bsd/* to rtl/linux RECURSIVELY
  137. 1e (optionally) Run fpcmake if you have it installed. This is a good
  138. habit!
  139. 2 switch to compiler/
  140. 3 gmake cycle OPT='-OG3p3 -dBSD' will generate a new compiler.
  141. Be patient! FreeBSD has slower disk-io than Linux :-)
  142. Rest is like Linux, except that I strongly advise to create the fpc
  143. directory always in /usr/local/lib/ instead of /usr/lib.
  144. This habit is still fashionable on FreeBSD.
  145. The same with other packages. Like Linux :-)
  146. 4 Linking to external libraries
  147. -----------------------------------------------------------------------------
  148. Same as on Linux, except use the
  149. ------------------
  150. The DO_S script. (C) El Znorro
  151. ------------------
  152. #!/bin/sh
  153. for i in *.s; do
  154. flup=`basename $i .s`
  155. as $i -o $flup.o
  156. echo $i
  157. echo $flup
  158. done
  159. {
  160. $Log$
  161. Revision 1.2 2000-09-18 13:42:35 marco
  162. * FreeBSD support into 1.1
  163. Revision 1.3 2000/09/11 14:38:09 marco
  164. * 14 april version killed, and replaced by newer fixes branch version
  165. Revision 1.1.2.1 2000/09/10 16:12:14 marco
  166. Initial signals, sockets and clone
  167. Revision 1.1 2000/07/13 06:30:32 michael
  168. + Initial import
  169. Revision 1.3 2000/04/16 16:11:33 marco
  170. * Severe updates for now *working* status
  171. Revision 1.2 2000/04/10 15:46:51 marco
  172. * worked all day. probably a lot changed
  173. }