User Tools

Site Tools


releases:3.2.0:developersguide:rebuildingsystem

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

releases:3.2.0:developersguide:rebuildingsystem [2014/11/11 08:52]
releases:3.2.0:developersguide:rebuildingsystem [2014/11/11 08:52] (current)
Line 1: Line 1:
 +====== Rebuilding the System ======
 +===== Rebuilding World =====
 +The easiest way is to rebuild "​world"​. It will rebuild and install the operating system, as well as all the utilities.
 +
 +<​code>​
 +$ su
 +# cd /usr/src
 +# make world
 +</​code>​
 +That will create the necessary //.depend// files and library Makefiles; and then, proceed to install the new includes, build and install the new libraries; and then, rebuild the system (servers, drivers, and kernel), install it as a new image, and build and install the commands, with the new libraries.
 +
 +"Make world" does nothing with the 'etc files'​. Sometimes, it might be necessary to get new or updated etc files. There is no automated procedure for that, though. Compare files in //src/etc// and ///etc//, and see if any updates have happened. Especially, an outdated ///​etc/​system.conf//​ (or, ///​etc/​drivers.conf//​) file can cause all sorts of problems.
 +
 +In some instances, commands will have been updated, in order to make the new compiling work. Therefore, if ''​make world''​ fails unexpectedly,​ try going to ///​usr/​src/​commands//,​ and running ''​make install''​ there. Then, go back to ///​usr/​src//,​ and ''​make world'',​ again.
 +
 +===== Rebuilding the OS and Libraries =====
 +This will rebuild the kernel, drivers, servers, etc. It also will rebuild the libraries for the system compiler (ACK), the compiler used for kernel and services.
 +
 +Type:
 +<​code>​
 +$ su
 +# cd /usr/src
 +# make includes depend
 +# make -C lib clean
 +# cd tools
 +# make libraries clean install
 +</​code>​
 +If changes were made to the process tables in the kernel and/or the servers, commands that read the process table directly from memory will fail after installing the new boot image. In particular, //ps// almost certainly will experience segmentation faults after such changes. It is recommended to ''​make install''​ in ///​usr/​src/​commands//​ (or, to ''​make world''​),​ in that case.
 +
 +===== Rebuilding the OS (Kernel and Services) =====
 +<!> In general, you should follow the process in "​Rebuilding the OS and Libraries",​ because you probably will want to rebuild the libraries, as well. If your build breaks when you follow this process, it likely is due to out-of-date libraries.
 +
 +**Backup!** It's a good idea to back up your old (usable) boot image before clobbering it with a new image. A simple method of doing that is going to ///​boot/​image//,​ and copying your old image to //​oldname.stable//​. If your new kernel doesn'​t work, you can boot your old kernel instead, and repair problems.
 +
 +Below is the process to update the MINIX kernel.
 +
 +Note: comments start with # symbols, and stop at the end of the line (but, a # in the left-most column actually is the super-user prompt).\\ Run these commands, in order, to build your modified kernel:
 +
 +<​code>​
 +$ su
 +# cd /​usr/​src/​tools
 +# make clean
 +# make install
 +</​code>​
 +===== Rebuilding the Kernel Only =====
 +<!> In general, you should follow the process in "​Rebuilding the OS and Libraries"​.
 +
 +<​code>​
 +$ su
 +# cd /​usr/​src/​tools ​  # this directory contains tools that make creating and installing the kernel easier
 +# make hdboot ​        # this installs the kernel to your hard disk
 +</​code>​
 +===== Other Build Targets =====
 +Type
 +
 +<​code>​
 +$ cd /​usr/​src/​tools
 +$ make
 +</​code>​
 +to see the various options available.
 +
 +Now, make a new bootable image by typing:
 +
 +<​code>​
 +$ cd /​usr/​src/​tools
 +$ make image
 +</​code>​
 +===== Building with Clang or GCC =====
 +It is possible to rebuild Minix using //clang// or //gcc//, and the NetBSD-derived C library. Please remember this is is not often tested, and can easily break. The process also lasts a bit more than with ACK compiler.
 +
 +<​code>​
 +$ cd /usr/src
 +$ make includes
 +$ make gnu-includes ​       # required for gcc only
 +$ make -C lib clean
 +$ make -C commands clean
 +$ make libraries ​          # build both ACK and ELF libraries
 +$ cd tools
 +$ CC=clang make cleandepend clean depend image
 +</​code>​
 +or alternatively
 +<​code>​
 +$ CC=gcc make cleandepend clean depend image
 +</​code>​
 +
 +Note, that compiler can run out of memory and segfault. GCC segfault is confirmed during imgrd compilation on PC with 256 Mb RAM.
 +
 +===== Building and booting SMP =====
 +To rebuild SMP version of Minix set the following evironment variables and follow the steps for compilation with gcc.
 +
 +<​code>​
 +$ CONFIG_SMP=y CONFIG_MAX_CPUS=N CC=gcc
 +</​code>​
 +where N stands for the number of supported CPUs. If N => than the number of CPUs in your system, all CPUs are booted, if N < the number of available CPUs only N are booted
 +
 +The GCC compiled images do not take command line arguments from the boot monitor since these images are multiboot compliant and the boot procedure is different:
 +
 +<​code>​
 +> mb=1
 +> kernel=boot/​kernel
 +> boot
 +</​code>​
 +
 +At the moment, a SMP configured image will enable ACPI and APIC by default. These are hard requirements for SMP to work. To enable serial console debugging, use the following patch and enable 'ctty 0' in the boot monitor. This is temporary solution and is not required if booting using GRUB.
 +
 +<​code>​
 +diff --git a/​kernel/​arch/​i386/​arch_system.c b/​kernel/​arch/​i386/​arch_system.c
 +index b4f33ab..a9e0242 100644
 +--- a/​kernel/​arch/​i386/​arch_system.c
 ++++ b/​kernel/​arch/​i386/​arch_system.c
 +@@ -661,7 +661,7 @@ PUBLIC int arch_get_params(char *params, int maxsize)
 +                  *
 +                  * '​\0'​ separated list of command line options
 +                  */
 +-       char cmdline[] = "​no_apic=0\0acpi=1";​
 ++       char cmdline[] = "​no_apic=0\0acpi=1\0cttyline=0";​
 + 
 +        if (maxsize < sizeof(cmdline) - 1)
 +                panic("​cmdline (%d) exceeds maxsize (%d)",
 +</​code>​
 +
 +===== Making a Boot Floppy =====
 +If you have a legacy floppy disk drive, and if you trim MINIX enough, you can make a bootable floppy for use later by inserting a formatted floppy, and typing:
 +<​code>​
 +$ su
 +# make fdboot
 +</​code>​
 +When you are asked to complete the path, type:
 +<​code>​
 +fd0
 +</​code>​
 +That approach currently does not work with USB floppies because there is no MINIX 3 USB floppy disk driver yet.
  
releases/3.2.0/developersguide/rebuildingsystem.txt · Last modified: 2014/11/11 08:52 (external edit)