diff options
Diffstat (limited to 'riemann.fmi.uni-sofia.bg/ninit/install.html')
| -rw-r--r-- | riemann.fmi.uni-sofia.bg/ninit/install.html | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/riemann.fmi.uni-sofia.bg/ninit/install.html b/riemann.fmi.uni-sofia.bg/ninit/install.html new file mode 100644 index 0000000..3676c55 --- /dev/null +++ b/riemann.fmi.uni-sofia.bg/ninit/install.html @@ -0,0 +1,115 @@ +<html> +<link rel="stylesheet" type="text/css" href="style.css"> +<title>install instructions</title> +<body> + +<div class="top"> +<ul class="nav"> + <li><a href="all.html">All files</a> +</ul> + +<h1>ninit - install instructions</h1> +<div class="endtop"></div> +</div> + +It's possible to install ninit using glibc and system commands +included here. On my box the executable are smaller than these +compiled with dietlibc. I prepared the directories +<pre> + system/i386 + system/x64_86 +</pre> + +In each make program builds the file system.a. Using this library +and ninit.a the linker create executable in bin-$(ARCH) dir. +It don't use any other functions. If one have dietlibc installed +already the linker uses it instead of +<tt>system/$(ARCH)/system.a</tt> + +<p> Try this with: +<pre> + $ make clean + $ make i386 + $ make tests + + $ cp bin-i386/* . + $ make tests +</pre> + +On x86_64 replace i386 with x86_64 above. On my box +ninit compiled with above command uses only 12K RAM. There +are 3 pages = text + data + stack. + +<p> +The ".data + .bss" page is very small. It is less than 120 bytes. +One can merge it with ".text" and then ninit will run with 8K only. +Test this with + +<pre> + $ rm bin-i386/* + $ make i386 TINY_LDFLAGS=-Wl,-N + + $ cp bin-i386/* . + $ make tests +</pre> +The option <tt>-Wl,-N</tt> is for the linker. It is possible to use +also other flags. For example <tt>-Wl,-znoexecstack</tt>. +Last is coded in Makefile. Simple try +<pre> + $ make x86_64 +</pre> +to see the results. + +<pre> +vladov@riemann:0 ~/public_html/ninit$ ps axuw | head -3 + USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND + root 1 0.0 0.0 8 8 ? S Oct08 0:03 /sbin/ninit + root 2 0.0 0.0 0 0 ? S Oct08 0:02 [keventd] +</pre> + +<p> +On the other architectures you need to use dietlibs, or prepare +subdirs in system. + +<a name="HowItWorks"> +<h2><a name="Warning">Warning</a></h2> +Some distros make precompiled binaries. +Let we assume the following scenario. The OS process no 1 is +<i>/sbin/ninit</i>. The install instructions overwrite +<i>/sbin/ninit</i>. The old +<a href=man/ninit.man>ninit</a> continues to work, +<a href=man/nsvc.man>nsvc</a> is updated already. +It is even <b>impossible</b> to halt clean, since +<pre> + /bin/mount -o remount,ro / +</pre> +fails (device busy). It is better to use somethinig like: +<pre> + #!/bin/sh + data=/tmp/ninit-$$.data + grep ninit /proc/1/cmdline + ninit=$? + + if test $ninit -eq 0 ; then + rm -f $data + /sbin/ninit-reload -d > $data + fi + + # apply the distro install instructions here + # they <b>should</b> overwrite /sbin/ninit, /sbin/ninit-reload + + if test $ninit -eq 0 ; then + /sbin/ninit-reload -f $data -v -u /sbin/ninit + rm -f $data + fi +</pre> +See also <b>scripts/update.sh</b> in the source. + +<br> +Some shell related questions are discussed +<a href=files.html#Gbin>here</a>. + +<p> +Last updated: 17 Jan 2010 +</body> +</html> |
