diff --git a/bootstrap.sh b/bootstrap.sh
index 889b957fb..a59b1af3f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -231,7 +231,7 @@ rm -f config.log
 if test "x$BJAM" = x; then
   $ECHO "Building B2 engine.."
   pwd=`pwd`
-  CXX= CXXFLAGS= "$my_dir/tools/build/src/engine/build.sh" ${TOOLSET}
+  CXX= CXXFLAGS= "$my_dir/tools/build/src/engine/build.sh" ${TOOLSET} --debug
   if [ $? -ne 0 ]; then
       echo
       echo "Failed to build B2 build engine"
diff --git a/tools/build/src/build-system.jam b/tools/build/src/build-system.jam
index 7eb5d1423..1a2f5ff10 100644
--- a/tools/build/src/build-system.jam
+++ b/tools/build/src/build-system.jam
@@ -415,7 +415,7 @@ local rule load-configuration-files
 
     local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ;
     local site-path = /etc $(user-path) ;
-    if [ os.name ] in NT CYGWIN
+    if [ os.name ] in NT CYGWIN OS2
     {
         site-path = [ modules.peek : SystemRoot ] $(user-path) ;
     }
diff --git a/tools/build/src/build/type.jam b/tools/build/src/build/type.jam
index 365aaf8d1..34a319bc6 100644
--- a/tools/build/src/build/type.jam
+++ b/tools/build/src/build/type.jam
@@ -361,7 +361,7 @@ local rule generated-target-ps ( ps : type : property-set )
 #
 rule type ( filename )
 {
-    if [ os.name ] in NT CYGWIN
+    if [ os.name ] in NT CYGWIN OS2
     {
         filename = $(filename:L) ;
     }
diff --git a/tools/build/src/tools/common.jam b/tools/build/src/tools/common.jam
index e2dee93eb..2758b052e 100644
--- a/tools/build/src/tools/common.jam
+++ b/tools/build/src/tools/common.jam
@@ -392,6 +392,8 @@ local rule check-tool-aux ( command )
             # Only NT will run .bat & .cmd files by their unqualified names.
             || ( ( [ os.name ] = NT ) && ( [ path.exists $(command).bat ] ||
                 [ path.exists $(command).cmd ] ) )
+            || ( ( [ os.name ] = OS2 ) && ( [ path.exists $(command).bat ] ||
+                [ path.exists $(command).cmd ] || [ path.exists $(command).exe ] ) )
         {
             return $(command) ;
         }
@@ -560,7 +562,7 @@ rule newline-char ( )
 #
 rule variable-setting-command ( variable : value )
 {
-    if [ os.name ] = NT
+    if [ os.name ] = NT || [ os.name ] = OS2
     {
         return "set $(variable)=$(value)$(nl)" ;
     }
@@ -680,7 +682,7 @@ rule MkDir
         # recurse until root.
 
         local s = $(<:P) ;
-        if [ os.name ] = NT
+        if [ os.name ] = NT || [ os.name ] = OS2
         {
             switch $(s)
             {
@@ -715,7 +717,7 @@ rule MkDir
 # up to the same filesystem target and triggers their build action only once.
 #                                             (todo) (04.07.2008.) (Jurko)
 
-if [ os.name ] = NT
+if [ os.name ] = NT || [ os.name ] = OS2
 {
     actions quietly mkdir
     {
diff --git a/tools/build/src/tools/gcc.jam b/tools/build/src/tools/gcc.jam
index 2b6caed41..9dbe9650a 100644
--- a/tools/build/src/tools/gcc.jam
+++ b/tools/build/src/tools/gcc.jam
@@ -136,6 +136,7 @@ toolset.inherit-rules gcc : unix ;
 type.set-generated-target-suffix OBJ : <toolset>gcc : o ;
 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ;
 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ;
+type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>os2 : o ;
 
 
 # Initializes the gcc toolset for the given version. If necessary, command may
@@ -371,7 +372,7 @@ local rule compile-link-flags ( * )
 
     # On Windows, fPIC is the default, and specifying -fPIC explicitly leads
     # to a warning.
-    local non-windows = [ set.difference $(all-os) : cygwin windows ] ;
+    local non-windows = [ set.difference $(all-os) : cygwin windows os2 ] ;
     compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ;
 }
 
@@ -406,6 +407,7 @@ local rule compile-link-flags ( * )
     threading-flags <target-os>cygwin/<threadapi>pthread : -pthread ;
     threading-flags <target-os>solaris  : -pthreads : rt ;
     threading-flags <target-os>qnx : -pthread ;
+    threading-flags <target-os>os2 : : pthread ;
 
     local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ;
     threading-flags <target-os>$(bsd) : -pthread ;
@@ -748,6 +750,7 @@ class gcc-linking-generator : unix-linking-generator
         {
             case vms : no-static-link = ;
             case windows : no-static-link = ;
+            case os2 : no-static-link = ;
         }
 
         local properties = [ $(property-set).raw ] ;
@@ -895,6 +898,10 @@ toolset.flags gcc.link OPTIONS <coverage>on : --coverage ;
     # See note [1]
     toolset.flags gcc.link OPTIONS <target-os>aix/<runtime-link>static : -static ;
 
+    # on os2 we use native linker
+    toolset.flags gcc.link OPTIONS <target-os>os2 : -Zomf -Zhigh-mem -lcx ;
+    toolset.flags gcc.link.dll OPTIONS <target-os>os2 : -Zdll -Zomf -Zhigh-mem -lcx ;
+
     # darwin
 
     # On Darwin, the -s option to ld does not work unless we pass -static,
@@ -922,7 +929,7 @@ toolset.flags gcc.link OPTIONS <coverage>on : --coverage ;
 
     # default
 
-    local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux iphone appletv ] ;
+    local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux iphone appletv os2 ] ;
     # Strip the binary when no debugging is needed. We use --strip-all flag
     # as opposed to -s since icc (intel's compiler) is generally
     # option-compatible with and inherits from the gcc toolset, but does not
@@ -933,7 +940,7 @@ toolset.flags gcc.link OPTIONS <coverage>on : --coverage ;
         -Wl,--start-group ;
     toolset.flags gcc.link END-GROUP <target-os>$(generic-os) : -Wl,--end-group ;
 
-    local rpath-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux windows ] ;
+    local rpath-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux windows os2 ] ;
     toolset.flags gcc.link RPATH <target-os>$(rpath-os) : <dll-path> ;
     toolset.flags gcc.link RPATH_OPTION <target-os>$(rpath-os) : -rpath ;
     toolset.flags gcc.link RPATH_LINK <target-os>$(rpath-os) : <xdll-path> ;
@@ -980,7 +987,7 @@ toolset.flags gcc.link OPTIONS <coverage>on : --coverage ;
     toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>windows/<runtime-link>static : -Wl,-Bdynamic ;
     toolset.flags gcc.link OPTIONS <target-os>windows/<runtime-link>static : -Wl,-Bstatic ;
 
-    local soname-os = [ set.difference $(generic-os) : windows ] ;
+    local soname-os = [ set.difference $(generic-os) : windows os2 ] ;
     toolset.flags gcc.link HAVE_SONAME <target-os>$(soname-os) : "" ;
     toolset.flags gcc.link SONAME_OPTION <target-os>$(soname-os) : -soname ;
 
diff --git a/tools/build/src/tools/symlink.jam b/tools/build/src/tools/symlink.jam
index b1256d747..8955e2fcc 100644
--- a/tools/build/src/tools/symlink.jam
+++ b/tools/build/src/tools/symlink.jam
@@ -129,6 +129,11 @@ actions ln-UNIX
     ln -f -s '$(>:D=:R=$(PATH_TO_SOURCE))' '$(<)'
 }
 
+actions ln-OS2
+{
+    ln -f -s '$(>:D=:R=$(PATH_TO_SOURCE))' '$(<)'
+}
+
 # there is a way to do this; we fall back to a copy for now
 actions ln-NT
 {
diff --git a/tools/build/src/tools/types/exe.jam b/tools/build/src/tools/types/exe.jam
index 6b068cacb..79c6d2761 100644
--- a/tools/build/src/tools/types/exe.jam
+++ b/tools/build/src/tools/types/exe.jam
@@ -7,3 +7,4 @@ import type ;
 type.register EXE ;
 type.set-generated-target-suffix EXE : <target-os>windows : "exe" ;
 type.set-generated-target-suffix EXE : <target-os>cygwin : "exe" ;
+type.set-generated-target-suffix EXE : <target-os>os2 : "exe" ;
diff --git a/tools/build/src/tools/types/lib.jam b/tools/build/src/tools/types/lib.jam
index dc16aba4b..3fa9e64af 100644
--- a/tools/build/src/tools/types/lib.jam
+++ b/tools/build/src/tools/types/lib.jam
@@ -26,6 +26,11 @@ import os ;
 #     cygxxx.dll     DLL
 #     libxxx.dll.a   import library
 #
+# On os2:
+#     libxxx.a       static library
+#     xxx.dll        DLL
+#     libxxx_dll.a   import library
+#
 
 type.register LIB ;
 
@@ -41,6 +46,9 @@ type.set-generated-target-suffix STATIC_LIB : <target-os>windows : lib ;
 # Except with gcc.
 type.set-generated-target-suffix STATIC_LIB : <toolset>gcc <target-os>windows : a ;
 
+# Use '.a' suffix for os2
+type.set-generated-target-suffix STATIC_LIB : <target-os>os2 : a ;
+
 # Use xxx.lib for import libs
 type IMPORT_LIB : : STATIC_LIB ;
 type.set-generated-target-prefix IMPORT_LIB : : "" ;
@@ -59,11 +67,14 @@ type.set-generated-target-prefix SHARED_LIB : : lib ;
 type.set-generated-target-prefix SHARED_LIB : <target-os>windows : "" ;
 # But use it again on mingw
 type.set-generated-target-prefix SHARED_LIB : <toolset>gcc <target-os>windows : lib ;
+# But don't use it on os2
+type.set-generated-target-prefix SHARED_LIB : <target-os>os2 : "" ;
 # And use 'cyg' on cygwin
 type.set-generated-target-prefix SHARED_LIB : <target-os>cygwin : cyg ;
 
 
 type.set-generated-target-suffix SHARED_LIB : <target-os>windows : dll ;
+type.set-generated-target-suffix SHARED_LIB : <target-os>os2 : dll ;
 type.set-generated-target-suffix SHARED_LIB : <target-os>cygwin : dll ;
 type.set-generated-target-suffix SHARED_LIB : <target-os>darwin : dylib ;
 
diff --git a/tools/build/src/util/os.jam b/tools/build/src/util/os.jam
index 4d473923a..1e4c422e2 100644
--- a/tools/build/src/util/os.jam
+++ b/tools/build/src/util/os.jam
@@ -82,6 +82,10 @@ if $(.name) = NT
 .expand-variable-prefix-NT = % ;
 .expand-variable-suffix-NT = % ;
 .executable-suffix-NT = .exe ;
+.executable-suffix-OS2 = .exe ;
+.path-separator-OS2 = ";" ;
+.expand-variable-prefix-OS2 = % ;
+.expand-variable-suffix-OS2 = % ;
 
 .shared-library-path-variable-CYGWIN = PATH ;
 
