Auto-build boot KolibriOS images in Linux on a single machine

    We bring to your attention an article written by righthearted , one of our four students on Google Summer of Code this year . The article talks about how he set up KolibriOS auto- build in Linux on his computer. The task is not entirely trivial.

    image
    This post will be useful for those who want to check the possibility of adding their program to the official KolibriOS auto assembly , without breaking the server. A clear example of this is the author of this article . When trying to pass the qualification task for Google Summer of Code , the Italian version of the auto assembly repeatedly broke, and even once the server hangs, on which the source codes of the entire system are stored. To prevent this from happening again, this article provides instructions on how to configure auto-assembly of KolibriOS boot images . Everything described was tested on a 64-bit version of Ubuntu. For the rest of the distributions, the procedure should not be much different. If possible, I will paint every step so as not to miss anything important.


    Source preparation


    So, for starters, we will need to install the Subversion version control system . This is done with a simple command in the terminal:
    apt-get install subversion
    Next, you can prepare the folder where we will download all the sources. In my case, I decided to create a folder along the path / home / user / kolibrios :
    mkdir ~/kolibrios
    Going to the freshly baked folder, we tell subversion to download the system sources to this folder. This step may take some time, depending on the speed of your Internet connection:
    cd ~/kolibrios
    svn co svn://kolibrios.org
    After all the files have been downloaded, you can try to go to the kolibrios / data / rus folder and say make , maybe 0_o will gather. And if not, read on.

    Everything for Assembler


    Hummingbirds are developed mainly in assembly language, so we will need fasm , nasm and fasmdep .
    Fasm can be downloaded from the official site and installed with pens in the / usr / bin folder.
    If in order, then unpacking the downloaded archive into the fasm folder, go to it and copy the binary to / usr / bin / fasm You
    cd ~/Downloads/fasm
    cp fasm /usr/bin
    may have to enable the ability to run this binary:
    chmod +x /usr/bin/fasm
    Administrator privileges may also be required for copying, so you can use sudo (in the terminal ), or gksu and kdesudo (in GTK and KDE, respectively). Caution, be very careful when working with superuser privileges.
    NasmInstall is much easier. Just install using apt-get
    apt-get install nasm
    Fasmdep will have to be collected from source using fasm
    cd ~/kolibrios/data/common/fasmdep
    fasm fasmdep.asm
    After that, the finished fasmdep also needs to be copied to / usr / bin
    cp ~/kolibrios/data/common/fasmdep/fasmdep /usr/bin/

    Dancing with a tambourine and linking


    Although KolibriOS is developed mainly in assembly language, it is possible to write programs in high-level languages.
    To cross-compile a large part of the C code, we have to install mingw32 (or Serge’s toolchain). For one install the archiver utility kpack and kerpack.
    Mingw32 is installed in the same way as nasm:
    apt-get install mingw32
    After installation, we need to create aliases win32-ar, win32-as, win32-gcc, win32-g ++, win32-ld, win32-objcopy. This is done as follows:
    ln -s /usr/i586-mingw32msvc/bin/ar /usr/bin/win32-ar
    ln -s /usr/i586-mingw32msvc/bin/as /usr/bin/win32-as
    ln -s /usr/i586-mingw32msvc/bin/gcc /usr/bin/win32-gcc
    ln -s /usr/i586-mingw32msvc/bin/g++ /usr/bin/win32-g++
    ln -s /usr/i586-mingw32msvc/bin/ld /usr/bin/win32-ld
    ln -s /usr/i586-mingw32msvc/bin/objcopy /usr/bin/win32-objcopy
    If you want to use ready-made cross-compilation tools, you first have to download it and then unzip it to the / home / autobuild / tools folder. After that, you will need to add / home / autobuild / tools / win32 / bin to $ PATH:
    export PATH=$PATH:/home/autobuild/tools/win32/bin"
    In order not to write the same thing every time you start the system and terminal, you can add this command to the .bashrc file. In the case of the nano text editor, this is done as follows:
    nano ~/.bashrc
    You can use any other text editor. At the end of the file, just add the above command.

    Kpack is assembled from source in ~ / kolibri / programs / other / kpack / linux, but before that we will need to download and install the build-essential package (unless, of course, you installed this package in advance):
    apt-get install build-essential
    After that, we go to the necessary folder and run the scripts: kerpack
    cd ~/kolibri/programs/other/kpack/linux
    sh ./build.sh
    cp ./kpack /usr/bin/
    sourcesare in ~ / kolibri / programs / other / outdated / kerpack. But before you build it, correct the path in the kerpack.asm file. Namely, the line “include '../../../macros.inc'” on “include '../../../../macros.inc'”
    sh ./build.sh
    cp ./kerpack /usr/bin/

    You can install msvc and c--, but you can not install, but simply update the compiled binaries downloaded from the builds.kolibrios.org server using the touch command. For example:
    touch kolibrios/data/ru/shell
    Personally, I went the second way, but if you have time and nerves, then you will need to install wine:
    apt-get install wine
    export WINEARCH=win32
    In wine, you should install msvc 2010 using winetricks. Run winetricks, select the install an app section. In the list that appears, select vc2010express and click OK. In the same way, dxsdk_nov2006 must be installed. Basically, the installation is automatic, except that from time to time you have to "click" with the mouse: "Next", "Next", "Finish". After the installation is complete, you need to create a script that will run win32-cl and win32-link.
    Launch nano or any other text editor:
    nano /usr/bin/win32-cl
    and paste the script below.

    #!/bin/sh
    WINE=${WINE:-wine}
    WINEPREFIX=${WINEPREFIX:-$HOME/.local/share/wineprefixes/vc2010express}
    export WINEPREFIX
    PROGRAMFILES="c:\Program Files"
    WSDK="$PROGRAMFILES\Microsoft Visual Studio 10.0"
    WPSDK="$PROGRAMFILES\Microsoft SDKs\Windows\v7.0A"
    WDXSDK="$PROGRAMFILES\Microsoft DirectX SDK (August 2006)"
    export WINEPATH="c:\windows;c:\windows\system32;$WSDK\Common7\IDE;$WSDK\VC\bin"
    export INCLUDE="$WSDK\VC\include;$WPSDK\Include;$WDXSDK\Include"
    export LIB="$WSDK\VC\lib;$WPSDK\Lib;$WDXSDK\Lib\x86"
    $WINE cl.exe $@
    


    In the same way, we create a script for win32-link
    nano /usr/bin/win32-link

    #!/bin/sh
    WINE=${WINE:-wine}
    WINEPREFIX=${WINEPREFIX:-$HOME/.local/share/wineprefixes/vc2010express}
    export WINEPREFIX
    PROGRAMFILES="c:\Program Files"
    WSDK="$PROGRAMFILES\Microsoft Visual Studio 10.0"
    WPSDK="$PROGRAMFILES\Microsoft SDKs\Windows\v7.0A"
    WDXSDK="$PROGRAMFILES\Microsoft DirectX SDK (August 2006)"
    export WINEPATH="c:\windows;c:\windows\system32;$WSDK\Common7\IDE;$WSDK\VC\bin"
    export INCLUDE="$WSDK\VC\include;$WPSDK\Include;$WDXSDK\Include"
    export LIB="$WSDK\VC\lib;$WPSDK\Lib;$WDXSDK\Lib\x86"
    $WINE link.exe $@
    


    The paths may vary slightly, so I recommend checking everything carefully a couple of times.
    Hummingbirds use the version of C-- Sphinx . After installation, you should create a script that runs c -. Exe and name it win32-c--.

    There is a third, lazy way. You can simply remove some programs that are built using C-- and MSVC from the Makefile in the auto assembly.

    Now all we had to do was install mtools and mkisofs.
    apt-get install mtools
    apt-get install mkisofs

    Assembly


    The assembly itself is carried out by a simple make command in the kolibrios / data / 'system language' folder.
    For example,
    cd ~/kolibrios/data/rus
    make
    if everything is installed correctly, you should get a full boot KolibriOS image - in iso and img formats. You can check the health of the image, for example, by mounting iso or img in virtualbox or any other virtual machine.

    Also popular now: