1Installing hosted Inferno from source 2 3Overview 4 5 Like the native kernels emu relies on several auxil- 6iary libraries (the source of which it often shares with the 7native kernels). Emu itself is built by the mkfile in the 8emu subdirectory containing the platform-specific source for 9the host platform. Each library has its own mkfile; the 10various components are made in the right order by the 11mkfile at the root of the Inferno tree. The mkfile for 12each platform will also invoke mk recursively to make the 13appropriate libraries for a given configuration. 14 15 The Unix emu variant generally is covered by `POSIX' 16(with common extensions) but each Unix port has one file 17that differs considerably for each port, namely 18emu/platform/os.c, the differences corresponding to the dif- 19ferent ways under Unix of implementing kernel-scheduled 20threads efficiently. 21 22 There are working emu versions for FreeBSD/386, 23Irix/mips, Linux/386, NetBSD/386, MacOSX/386, MacOSX/power, 24Plan 9, Solaris/sparc, and Windows (NT, 2000 and Explorer 25plug-in). Each platform typically uses mechanisms specific 26to the host operating system to implement Inferno's internal 27thread/process structure. POSIX threads have often been 28found to be insufficient (poorly implemented) on some plat- 29forms, and if so are avoided. See kproc in emu/*/os.c. 30 31 Source is included for ports to HP/UX (S800 architec- 32ture), Solaris/386, and Unixware, in case someone wishes to 33take them up now, but we have not determined their fitness. 34 35 The Plan 9 hosted implementation is unusual in that it 36supports several processor types: 386, mips, power (Power 37PC) and sparc. Furthermore, all versions of emu can be 38built on any processor type, in the usual way for Plan 9. 39 40 Otherwise, as distributed, emu for a platform can only 41be built when running on that platform. 42 43Build steps 44 45 All the libraries and executables can be built in a 46tree containing only the source code. To do that for a sup- 47ported variant of hosted Inferno, on Unix or Plan 9, do the 48following in the root of the Inferno tree: 49 501 Edit mkconfig to reflect your host environment, 51 specifically ROOT (which must be an absolute path 52 name), SYSHOST and OBJTYPE. The comments in the file 53 should help you choose. 54 552 Run makemk.sh to rebuild the mk command, which is 56 used to build everything else. 57 583 Set PATH (or path on Plan 9) to include the bin 59 directory for the platform, which will now contain the 60 mk binary just built. On Unix, export PATH. 61 624 Then mk nuke to remove any extraneous object files. 63 645 Finally, mk install to create and install the 65 libraries, limbo compiler, emu for hosted Inferno, 66 and auxiliary commands. The rules do that in an order 67 that ensures that the commands or libraries needed by a 68 later stage are built and installed first. (Note that 69 a plain mk will not suffice, because it does not put 70 the results in the search path.) 71 72Doing something similar on Windows or Plan 9 currently 73requires the executable for mk to be available in the 74search path, since there is no equivalent of makemk.sh. 75Otherwise the procedure is the same. On Plan 9, of course, 76the host system's normal version of mk should be adequate. 77