2020-02-17 03:43:33 +01:00
|
|
|
UMKa -- User-Mode KolibriOS developer tools
|
|
|
|
===========================================
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
This is a common project for a set of KolibriOS developer tools which are based
|
2020-10-12 05:02:02 +02:00
|
|
|
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
|
2022-06-28 10:23:14 +02:00
|
|
|
much unchanged KolibriOS kernel source as possible to run, test and debug
|
2020-10-12 05:02:02 +02:00
|
|
|
architecture-independent parts of the kernel in your favorite developer
|
|
|
|
environment.
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
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.
|
|
|
|
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
umka_shell
|
|
|
|
----------
|
2019-12-02 23:53:22 +01:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
is an interactive shell with commands that are wrappers around KolibriOS kernel
|
2022-06-28 10:23:14 +02:00
|
|
|
syscalls and other internal functions. It can also be used for automated testing
|
|
|
|
by feeding it a file of commands instead of typing them.
|
2020-10-12 05:02:02 +02:00
|
|
|
|
|
|
|
Example:
|
2022-06-28 10:23:14 +02:00
|
|
|
$ umka_shell < mytest.t
|
2019-12-02 23:53:22 +01:00
|
|
|
|
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
umka_fuse
|
|
|
|
---------
|
2019-12-02 23:53:22 +01:00
|
|
|
|
2020-05-05 17:55:49 +02:00
|
|
|
is like umka_shell above but commands are translated from FUSE calls, not
|
2020-10-12 05:02:02 +02:00
|
|
|
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
|
|
|
|
-----
|
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
mkdirrange - make directories with names in range
|
2020-10-12 05:02:02 +02:00
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
mkfilepattern - make a file with contents of specific pattern
|
2020-10-12 05:02:02 +02:00
|
|
|
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2018-05-09 23:08:52 +02:00
|
|
|
BUILD
|
2019-12-02 23:53:22 +01:00
|
|
|
-----
|
2018-05-09 23:08:52 +02:00
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
Linux:
|
|
|
|
|
|
|
|
$ KOLIBRIOS=/path/to/kolibrios HOST=linux CC=gcc make
|
2019-12-02 23:53:22 +01:00
|
|
|
|
2020-10-14 19:56:28 +02:00
|
|
|
/path/to/kolibrios is where you checked out 'svn co svn://kolibrios.org'.
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
Windows:
|
|
|
|
|
|
|
|
Same but specify HOST=windows and your favourite C compiler.
|
|
|
|
|
2018-05-07 17:31:42 +02:00
|
|
|
|
2019-12-02 23:53:22 +01:00
|
|
|
Architecture
|
|
|
|
------------
|
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
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.
|
2018-05-07 17:31:42 +02:00
|
|
|
|
|
|
|
|
2020-05-20 13:17:31 +02:00
|
|
|
Testing
|
|
|
|
-------
|
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
# Run all the tests
|
|
|
|
|
|
|
|
$ HOST=linux make -B
|
|
|
|
|
|
|
|
# Copy ACPI tables and PCI configs
|
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
# cp --parents /sys/firmware/acpi/tables/?SDT* /sys/bus/pci/devices/*/config .
|
2022-06-28 10:23:14 +02:00
|
|
|
|
|
|
|
# Manage tap device
|
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
# 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
|
2020-05-20 13:17:31 +02:00
|
|
|
|
|
|
|
|
2020-02-08 04:13:04 +01:00
|
|
|
Troubleshooting
|
|
|
|
---------------
|
|
|
|
|
2020-10-14 19:56:28 +02:00
|
|
|
# umka_os
|
|
|
|
|
|
|
|
To create tap devices.
|
|
|
|
|
2023-01-09 04:54:00 +01:00
|
|
|
# setcap cap_net_admin+ep umka_os
|
2020-10-14 19:56:28 +02:00
|
|
|
|
2022-06-28 10:23:14 +02:00
|
|
|
To load apps at 0 address.
|
2020-10-14 19:56:28 +02:00
|
|
|
|
|
|
|
# sysctl -w vm.mmap_min_addr=0
|
2020-02-08 04:13:04 +01:00
|
|
|
|
2023-01-30 07:24:23 +01:00
|
|
|
Allow reading process_vm_readv syscall.
|
|
|
|
|
|
|
|
# sysctl -w kernel.yama.ptrace_scope=0
|
|
|
|
|
2020-02-08 04:13:04 +01:00
|
|
|
|
2020-02-19 01:27:18 +01:00
|
|
|
Links & Acknowledgements
|
|
|
|
------------------------
|
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[1] Filesystem in Userspace
|
|
|
|
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fuse
|
2020-02-08 04:13:04 +01:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[2] Filesystem in Userspace library
|
|
|
|
https://github.com/libfuse/libfuse
|
2022-05-29 17:17:00 +02:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[3] LodePNG by Lode Vandevenne
|
|
|
|
https://lodev.org/lodepng/
|
2022-05-29 17:17:00 +02:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[4] Optparse by Christopher Wellons
|
|
|
|
https://github.com/skeeto/optparse
|
2022-05-29 17:17:00 +02:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[5] Universal TUN/TAP device driver by Maxim Krasnyansky and others
|
|
|
|
https://www.kernel.org/doc/html/v5.12/networking/tuntap.html
|
2023-01-04 01:15:40 +01:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[6] Isocline by Daan Leijen
|
|
|
|
https://github.com/daanx/isocline
|
2023-01-05 06:20:40 +01:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[7] em_inflate by Emmanuel Marty
|
|
|
|
https://github.com/emmanuel-marty/em_inflate
|
2023-01-18 04:04:02 +01:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[8] qemu-nbd by Anthony Liguori and others
|
|
|
|
https://www.qemu.org/docs/master/tools/qemu-nbd.html
|
2023-01-18 04:04:02 +01:00
|
|
|
|
2023-02-07 05:54:41 +01:00
|
|
|
[9] Simple DirectMedia Layer library aka SDL2
|
|
|
|
https://libsdl.org
|