Go to file
Ivan Baravy 78db00fef9 Fix coverage collection 2024-03-02 14:28:47 +00:00
apps Add shell commands wait_for_os_idle, wait_for_window 2023-02-13 23:48:48 +00:00
contrib Move a helper script (indent_begin_end.py) to contrib dir 2023-02-16 19:24:59 +00:00
deps Move lodepng files to deps/lodepng dir 2023-02-14 14:29:54 +00:00
img Sync with upstream 2024-01-15 02:35:06 +00:00
linux Implement vnet_null device 2023-02-07 04:32:32 +00:00
test Remove test/makefile (use runtests now) 2023-09-03 06:11:07 +01:00
tools Convert tests to the new format 2023-02-17 02:04:54 +00:00
vdisk [vdisk/qcow2] Handle the return value of open(2) properly 2023-02-16 19:26:31 +00:00
vnet Implement vnet_null device 2023-02-07 04:32:32 +00:00
windows Minor compilation fixes for Windows(R)(TM) 2023-02-05 08:06:14 +00:00
.gitattributes Improve build on Windows via llvm-mingw 2021-12-13 16:57:05 +03:00
.gitignore Sync kernel structures with upstream, update tests 2023-09-01 22:57:11 +01:00
GPL2.txt Collect coverage via LBR profiling. 2019-10-09 02:35:47 +03:00
GPL3.txt Collect coverage via LBR profiling. 2019-10-09 02:35:47 +03:00
LICENSE Collect coverage via LBR profiling. 2019-10-09 02:35:47 +03:00
README Fix coverage collection 2024-03-02 14:28:47 +00:00
TODO Add shell commands wait_for_os_idle, wait_for_window 2023-02-13 23:48:48 +00:00
Tupfile.lua Add tup build stub. 2022-03-12 00:20:40 +04:00
fill.cur Add wrappers/tests for keyboard, mouse and cursors 2022-05-29 01:55:13 +04:00
makefile Fix coverage collection 2024-03-02 14:28:47 +00:00
runtests.c Fix coverage collection 2024-03-02 14:28:47 +00:00
shell.c Fix coverage collection 2024-03-02 14:28:47 +00:00
shell.h Implement vnet_null device 2023-02-07 04:32:32 +00:00
spray.cur Add wrappers/tests for keyboard, mouse and cursors 2022-05-29 01:55:13 +04:00
system.inc Implement common command buffer for the shell and os 2023-01-31 02:38:48 +00:00
trace.c Fix coverage collection 2024-03-02 14:28:47 +00:00
trace.h Fix coverage collection 2024-03-02 14:28:47 +00:00
trace_lbr.c Fix coverage collection 2024-03-02 14:28:47 +00:00
trace_lbr.h Fix coverage collection 2024-03-02 14:28:47 +00:00
tup.config Add tup build stub. 2022-03-12 00:20:40 +04:00
tup.config.template Add tup build stub. 2022-03-12 00:20:40 +04:00
umka.asm Fix coverage collection 2024-03-02 14:28:47 +00:00
umka.h Fix coverage collection 2024-03-02 14:28:47 +00:00
umka.ld Use mem_test from init.inc 2023-02-12 23:13:49 +00:00
umka_fuse.c Initialize default boot vars from umka_init 2023-02-12 19:02:31 +00:00
umka_gen_devices_dat.c Implement vnet_null device 2023-02-07 04:32:32 +00:00
umka_os.c Fix coverage collection 2024-03-02 14:28:47 +00:00
umka_os.us [umka_os] Add a command console in a separate thread 2023-02-10 22:33:22 +00:00
umka_shell.c Fix coverage collection 2024-03-02 14:28:47 +00:00
umkaio.c [umka_os] Add a command console in a separate thread 2023-02-10 22:33:22 +00:00
umkaio.h [umka_os] Add a command console in a separate thread 2023-02-10 22:33:22 +00:00
umkart.c [umka_os] Add a command console in a separate thread 2023-02-10 22:33:22 +00:00
umkart.h [umka_os] Add a command console in a separate thread 2023-02-10 22:33:22 +00:00
vdisk.c Implement vnet_null device 2023-02-07 04:32:32 +00:00
vdisk.h Implement vnet_null device 2023-02-07 04:32:32 +00:00
vnet.c Implement vnet_null device 2023-02-07 04:32:32 +00:00
vnet.h Implement vnet_null device 2023-02-07 04:32:32 +00:00

README

UMKa -- User-Mode KolibriOS developer tools
===========================================

This is a common project for a set of KolibriOS developer tools which are based
on original KolibriOS kernel code wrapped and hacked as to run in the UNIX
programming environment. The idea is to make userspace UNIX tools that use as
much unchanged KolibriOS kernel source as possible to run, test and debug
architecture-independent parts of the kernel in your favorite developer
environment.

What works now:
 * block layer (disk, cache, partition, MBR, GPT),
 * file systems except iso9660 (fat*, exfat, ext*, xfs),
 * UI and graphics (geometric primitives, windows, winmap, cursors),
 * basic network (configuration, ping replies),
 * interrupts (via signals),
 * threads and processes,
 * scheduler,
 * slab allocator,
 * events,
 * synchronization primitives,
 * unpacker,
 * string functions,
 * other minor functions.


umka_shell
----------

is an interactive shell with commands that are wrappers around KolibriOS kernel
syscalls and other internal functions. It can also be used for automated testing
by feeding it a file of commands instead of typing them.

Example:
    $ umka_shell < mytest.t


umka_fuse
---------

is like umka_shell above but commands are translated from FUSE calls, not
entered manually or read from a file. Can *potentially* be used to run xfstests
(cross-fs-tests) and automated tests against reference FS implementation.


umka_os
-------

is KolibriOS kernel running main loop (osloop), scheduler and all the threads
including network stack.


tools
-----

mkdirrange - make directories with names in range

mkfilepattern - make a file with contents of specific pattern


BUILD
-----

Linux:

$ KOLIBRIOS=/path/to/kolibrios HOST=linux CC=gcc make

/path/to/kolibrios is where you checked out 'svn co svn://kolibrios.org'.

Windows:

Same but specify HOST=windows and your favourite C compiler.


Architecture
------------

Kernel services are replaced with stubs, wrappers around userspace
implementation or libc calls. Block devices are emulated with regular files.
Framebuffer can be dumped to disk as image file.


Testing
-------

# Run all the tests

    $ HOST=linux make -B

# Copy ACPI tables and PCI configs

    # cp --parents /sys/firmware/acpi/tables/?SDT* /sys/bus/pci/devices/*/config .

# Manage tap device

    # ip tuntap add dev tap0 mode tap
    # ip link set tap0 address 00:11:00:00:00:00
    # ip addr add 10.50.0.1/24 dev tap0
    # ip link set up dev tap0
    # ip tuntap del dev tap0 mode tap


Troubleshooting
---------------

# umka_os

To create tap devices.

    # setcap cap_net_admin+ep umka_os

To load apps at 0 address.

    # sysctl -w vm.mmap_min_addr=0

Allow reading process_vm_readv syscall.

    # sysctl -w kernel.yama.ptrace_scope=0

Insert msr linux kernel module to collect coverage.

    # modprobe msr


Links & Acknowledgements
------------------------

[1] Filesystem in Userspace
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fuse

[2] Filesystem in Userspace library
    https://github.com/libfuse/libfuse

[3] LodePNG by Lode Vandevenne
    https://lodev.org/lodepng/

[4] Optparse by Christopher Wellons
    https://github.com/skeeto/optparse

[5] Universal TUN/TAP device driver by Maxim Krasnyansky and others
    https://www.kernel.org/doc/html/v5.12/networking/tuntap.html

[6] Isocline by Daan Leijen
    https://github.com/daanx/isocline

[7] em_inflate by Emmanuel Marty
    https://github.com/emmanuel-marty/em_inflate

[8] qemu-nbd by Anthony Liguori and others
    https://www.qemu.org/docs/master/tools/qemu-nbd.html

[9] Simple DirectMedia Layer library aka SDL2
    https://libsdl.org