Настройка окружения и инструментов для компиляции программ на C для Kolibri в GNU Linux с исп. toolchain'а от Serge.

High-level languages programming questions
  • to infinity and beyond
  • punk_joker wrote:Может поможет https://habrahabr.ru/company/kolibrios/blog/229231/
    Уже читал. Там, не всё было понятно, так как, статья не для начинающего, вроде меня и нацелена на разработку в среде Windows. К тому же, makefile и пример из данной стати, у меня в Linux, не работают. Но, тем не менее, статья всё же помогла разобраться в некоторых вопросах. :)
    The Glass is Always Half Full! :mrgreen:
  • 10. Непонятно, почему папка с Linux'овыми инструментами для Kolibri, называется "win32". Поэтому, переименуем в "kos32".
    Закон Мерфи бессмертен.
    Ставится все в /home/autobuild/tools.
    Q. Почему такой путь?
    A. Потому что такой путь используется на сервере автосборки.
    Q. Почему папка называется win32?
    A. Чтобы make файлы работали в Linux и Windows без переделок.
  • Serge wrote:
    10. Непонятно, почему папка с Linux'овыми инструментами для Kolibri, называется "win32". Поэтому, переименуем в "kos32".
    Закон Мерфи бессмертен.
    Ставится все в /home/autobuild/tools.
    Q. Почему такой путь?
    A. Потому что такой путь используется на сервере автосборки.
    Q. Почему папка называется win32?
    A. Чтобы make файлы работали в Linux и Windows без переделок.
    Ясно.
    The Glass is Always Half Full! :mrgreen:
  • Setting up the environment for compiling programs in C, for Kolibri in Ubuntu 16.04.

    The tools we will use:
    1. GCC v5.4.0 from Toolchain'a от Serge (x86_64-linux-kos32-5.4.0.7z).
    2. SDK from Toolchain'a от Serge (sdk-28-10-16.7z).
    3. SDK из SVN с libgcc.a и Newlib.
    4. VirtualBox and USB Flash Drive (USB Stick).
    5. ISO image of the Kolibri is night build.

    Installing the necessary tools.

    Download and install all the necessary tools. All commands are executing in the terminal.

    Order of actions:
    1. Just in case, we update the system.

    Code: Select all

    sudo apt update & sudo apt dist-upgrade
    2. Go to the Downloads folder. There we will download all our instruments.

    Code: Select all

    cd ~/Downloads
    3. Download "GCC" and "SDK" from "Toolchain" from Serge.

    Code: Select all

    wget ftp://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z && wget ftp://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z
    4. We installing "7zip" to unpack the archives, if not installed.

    Code: Select all

    sudo apt install p7zip-full
    5. Unpack all the above downloaded archives.

    Code: Select all

    7z x x86_64-linux-kos32-5.4.0.7z && 7z x sdk-28-10-16.7z
    6. Copy everything from the "lib" folder to the "win32/lib" folder.

    Code: Select all

    cp -R ./lib/* ./win32/lib
    7. We install "subversion" for downloading "SDK" with "SVN".

    Code: Select all

    sudo apt install subversion
    8. Download the "SDK" folder from "SVN".

    Code: Select all

    svn co svn://kolibrios.org/contrib/sdk sdk
    9. We move the folder "SDK" to the folder "win32".

    Code: Select all

    mv ./sdk ./win32
    10. Rename the win32 folder to "kos32".

    Code: Select all

    mv ./win32 ./kos32
    11. We move the folder "kos32" in the directory "/usr/local".

    Code: Select all

    sudo mv -R ./kos32 /usr/local
    12. We put the rights for the folder "kos32".

    Code: Select all

    sudo chmod -R u+rwx /usr/local/kos32 && chmod -R go-w /usr/local/kos32 && sudo chmod -R go+rx /usr/local/kos32
    13. In order to be able to use the tools from the folder "kos32/bin", you need to register the path to the folder with the tools "/usr/local/kos32/bin", into the environment variable "PATH ", followed by a colon in the file" /etc/environment ".

    Code: Select all

    sudo nano /etc/environment
    Image

    Let's check if the terminal sees the tools in the folder "kos32/bin". Enter the following line in the terminal:

    Code: Select all

    kos32-gcc --version
    Image

    And if you see also that in the picture above, then the tools are available, and you can use them.

    14. In order that "kos32-gcc" can compile, download, unpack and put the library "libisl.so.10.2.2".

    Code: Select all

    wget http://board.kolibrios.org/download/file.php?id=8301libisl.so.10.2.2.7z && 7z x file.php?id=8301libisl.so.10.2.2.7z
    sudo mv libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu && sudo ln -s /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10
    sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10 && sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
    15. Download and install VirtualBox, if not already installed.

    Code: Select all

    wget http://download.virtualbox.org/virtualbox/5.1.22/virtualbox-5.1_5.1.22-115126~Ubuntu~xenial_amd64.deb
    sudo dpkg -i virtualbox-5.1_5.1.22-115126~Ubuntu~xenial_amd64.deb

    16. Download and install addition to VirtualBox, if not already installed.

    Code: Select all

    wget http://download.virtualbox.org/virtualbox/5.1.22/Oracle_VM_VirtualBox_Extension_Pack-5.1.22-115126.vbox-extpack
    virtualbox Oracle_VM_VirtualBox_Extension_Pack-5.1.22-115126.vbox-extpack
    17. That's all. The tools are installed.

    Configuring VirtualBox.

    Now go on to configure the VirtualBox. All commands are executing in the terminal.

    Order of actions:
    1. To be able to see the USB flash drive in VirtualBox, we add ourselves to the group "vboxusers". The list of available groups can be found in "/etc/groups".

    Code: Select all

    sudo usermod -a -G vboxusers $USER
    2. Next, you need to reboot.

    Code: Select all

    sudo reboot
    3. Go to the folder "Downloads". There we will download the ISO image of Kolibri.

    Code: Select all

    cd ~/Downloads
    4. Download the archive ISO image Kolibri. On the server, at the time of this writing, was Kolibri "svn6912-iso.7z".

    Code: Select all

    wget http://builds.kolibrios.org/rus/svn6912-iso.7z
    5. Unpack the archive with ISO image Kolibri.

    Code: Select all

    7z x svn6912-iso.7z
    8. We create a virtual machine for VirtualBox.

    a) Create a new virtual machine called "KolibriOS".

    Code: Select all

    VBoxManage createvm --name KolibriOS --ostype WindowsXP --register
    b) We expose the basic parameters.

    Code: Select all

    VBoxManage modifyvm KolibriOS --memory 256 --vram 128 --cpus 1 --firmware bios --boot1 dvd --usb on --usbehci on --usbcardreader on
    VBoxManage modifyvm KolibriOS --clipboard bidirectional --draganddrop bidirectional
    c) We create the device "IDE".

    Code: Select all

    VBoxManage storagectl KolibriOS --name IDE --add ide --bootable on
    d) Copy "kolibri.iso" to the "VirtualBox VMs" folder.

    Code: Select all

    cp ./kolibri.iso ~/'VirtualBox VMs'/KolibriOS
    e) We attach to our device "IDE" our image "kolibri.iso".

    Code: Select all

    VBoxManage storageattach KolibriOS --storagectl IDE --port 0 --device 0 --type dvddrive --medium ~/'VirtualBox VMs'/KolibriOS/kolibri.iso
    9. Run VirtualBox in graphical mode and in the settings "Settings" ...
    Image
    select the item "USB" and choose "USB 2.0 Controller" radio button.

    Image
    Next, click on the small button with a flash drive, with a plus, which is located on the right side.