Compare commits

...

3 Commits

Author SHA1 Message Date
f8a4bed8d9 Docs: Added minimal build instruction
Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
2025-03-23 18:16:13 +03:00
b16bb3c49e Build: Added run-kos.sh script
Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
2025-03-23 18:16:07 +03:00
4c92c11668 Tests: Added hello (prints a message to the debug board)
Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
2025-03-23 18:14:41 +03:00
8 changed files with 59 additions and 1 deletions

4
.gitignore vendored
View File

@@ -36,3 +36,7 @@ build
# SDK dir
sdk
# Downloaded KolibriOS artifacts
kolibrios-img.7z
kolibri.img

View File

@@ -26,3 +26,4 @@ message(STATUS "SDK_SYSROOT_DIR=${SDK_SYSROOT_DIR}")
add_subdirectory(toolchain)
add_subdirectory(libraries)
add_subdirectory(tests)

View File

@@ -1,2 +1,16 @@
# kolibrios-sdk
This is a C/C++ SDK for porting software to KolibriOS
## Build
At the project root:
```sh
source activate-env
cmake -B build
cmake --build build
```
## Testing
Launch KolibriOS with the mounted `SDK_TOOLCHAIN_DIR` directory:
```sh
./run-kos.sh
```

View File

@@ -17,5 +17,4 @@ ExternalProject_Add(
-DCMAKE_C_COMPILER=i586-kolibrios-gcc
-DCMAKE_C_COMPILER_WORKS=1
-DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR}
DEPENDS copy-kos-app-lds
)

15
run-kos.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -eu
download_kolibrios()
{
wget -O "kolibrios-img.7z" https://builds.kolibrios.org/en_US/latest-img.7z
7z e kolibrios-img.7z kolibri.img
}
if [ ! -f "kolibri.img" ]; then
download_kolibrios
fi
qemu-system-i386 -boot a -fda kolibri.img -m 512 -drive file=fat:rw:"$SDK_SYSROOT_DIR" -usbdevice tablet

12
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,12 @@
# Rules for building tests
# Pseudo libc (kos-crt-stub)
ExternalProject_Add(
test-hello
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hello
CMAKE_ARGS
-DCMAKE_C_COMPILER=i586-kolibrios-gcc
-DCMAKE_C_COMPILER_WORKS=1
-DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR}
BUILD_ALWAYS TRUE
)

13
tests/hello/hello.c Normal file
View File

@@ -0,0 +1,13 @@
/*
* SPDX-License-Identifier: GPL-2.0
* Copyright (C) 2025 KolibriOS team
*/
int main()
{
char *hello = "I: Hello KolibriOS from GCC!\n";
while(*hello) {
__asm__ __inline__("int $0x40" ::"a"(63), "b"(1), "c"(*hello));
hello++;
}
}