📜 ⬆️ ⬇️

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

We bring to your attention an article written by righthearted , by one of our four students on Google Summer of Code this year . The article talks about how he set up KolibriOS Linux autobuild on his computer. The task is not quite 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 good 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 auto-assembly broke down many times, and once even the server storing the source system of the entire system hung. To prevent this from happening again, this article provides instructions on how to configure the KolibriOS boot image auto-assembly. Everything described was tested on a 64-bit version of Ubuntu. For other distributions, the procedure should not differ much. If possible, I will paint every step so as not to miss anything important.


Source preparation


So, first we need to install a Subversion version control system. This is done by a simple command in the terminal:
apt-get install subversion
Then you can prepare a 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
Turning to the newly-baked folder, we say subversion to download the source of the system in 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 are downloaded, you can try to go to the folder kolibrios / data / rus and say make , maybe it will gather 0_o. And if not, read on.
')

All for the Assembler


Hummingbirds are developed mainly in assembler, so we will need fasm , nasm and fasmdep .
Fasm can be downloaded from the official site and installed 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
cd ~/Downloads/fasm
cp fasm /usr/bin
You may have to enable the ability to run this binary:
chmod +x /usr/bin/fasm
You may also need administrator rights to copy, so you can use sudo (in the terminal), or gksu and kdesudo (in GTK and KDE, respectively). Attention, be very careful when acting with the rights of the superuser.
Nasm is much easier to install. Just install using apt-get
apt-get install nasm
Fasmdep will have to be collected from source with the help of 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/

Dances with a tambourine and linkovka


Although KolibriOS is developed mainly in assembly language, it is possible to write programs in high-level languages.
In order to cross-compile a significant part of the C code, we will have to install mingw32 (or toolchain from Serge). For one, install the kpack and kerpack archiver utilities.
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 a ready-made cross-compilation toolkit, you first have to download it , and then unpack it into 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 the terminal, you can add this command to the .bashrc file. In the case of the text editor, nano does it like this:
nano ~/.bashrc
You can use any other text editor. At the end of the file simply add the above command.

Kpack is built from source in ~ / kolibri / programs / other / kpack / linux, but before that we will need to download and install the build-essential package (if you haven’t installed this package in advance):
apt-get install build-essential
After that, go to the desired folder and run the scripts:
cd ~/kolibri/programs/other/kpack/linux
sh ./build.sh
cp ./kpack /usr/bin/
The kerpack sources are in ~ / kolibri / programs / other / outdated / kerpack. But before collecting it, correct the path in the kerpack.asm file. Namely, the string “include '../../../macros.inc'” to “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 with winetricks. Run winetricks, select the install an app section. In the list that appears, select vc2010express and click OK. In the same way it is necessary to install dxsdk_nov2006. 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 completed, you need to create a script that will run win32-cl and win32-link.
Run 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 differ slightly, so I recommend checking everything carefully a couple of times.
Kolibri uses the C-- Sphinx version. After installation, create a script that runs c -. Exe, and name it win32-c--.

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

Now we only need to 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 KolibriOS boot image - in iso and img formats. You can check the performance of the image, for example, by mounting iso or img in virtualbox or any other virtual machine.

Source: https://habr.com/ru/post/227803/


All Articles