小さなLinux互換カーネルのTilckというものを知ったので少し触ってみました.その後Wikiを見ながらbuild_toolchain script を利用していくつかのユーザスペースアプリケーションを試してみました.
fbDOOM
まずは楽しげなfbDOOMを導入
fbDOOM
$ ./scripts/build_toolchain -s build_fbdoom $ ./scripts/cmake_run -DEXTRA_FBDOOM=1 $ make rem
マウスデバイスがないのでキーボードでの操作のみですがそこそこ遊べます.
FrameBuffer
次はFrameBufferのアプリを
framebuffer
./scripts/build_toolchain -s build_tfblib $ ./scripts/cmake_run -DEXTRA_FBDOOM=1 $ make rem
以下のコマンドが使えるようになります.
fb_drawing fb_keyinput fb_text fbtest fb_hello_world fb_tetris
マンデルブロ集合いいですよね.fb_drawing の中に有ります.
TinyCC
TinyCC も使えます.
$ ./scripts/build_toolchain -s tcc $ ./scripts/cmake_run -DEXTRA_TCC=1 $ make rem
ただし,現時点では静的リンクが必須です.
root@tilck:/# cat lib/tcc-examples/ex1.c
#!/usr/local/bin/tcc -run
#include <tcclib.h>
int main()
{
printf("Hello World\n");
return 0;
}
root@tilck:/# tcc lib/tcc-examples/ex1.c -o ex1
root@tilck:/# ./ex1
Killed
root@tilck:/# tcc -static lib/tcc-examples/ex1.c -o ex1
root@tilck:/# ./ex1
Hello WorldTip | こういう操作時はqemuのGUIコンソールちょっと使いづらいので $ qemu-system-i386 -rtc base=localtime -device sb16 -drive id=img1,format=raw,if=none,file=/home/matoken/src/tilck/build/tilck.img -device ide-hd,drive=img1,cyls=74,heads=16,secs=63 -serial stdio |
他にもいくつかのアプリケーションが動きます.WIkiをチェックしてみましょう.
build_toolchain script に色々加えると楽しそうです.
環境
[ 0.111] Hello from Tilck 0.1.4, commit: 5835b80f
[ 0.111] Build type: Debug, compiler: gcc 8.4.0
[ 0.115] timer_hz: 250; time_slice: 40 ms; in_hypervisor: yes
▒▒▒▒▒▒▒▒┐ ▒▒┐ ▒▒┐ ▒▒▒▒▒▒┐ ▒▒┐ ▒▒┐
└──▒▒┌──┘ ▒▒│ ▒▒│ ▒▒┌────┘ ▒▒│ ▒▒┌┘
▒▒│ ▒▒│ ▒▒│ ▒▒│ ▒▒▒▒▒┌┘
▒▒│ ▒▒│ ▒▒│ ▒▒│ ▒▒┌─▒▒┐
▒▒│ ▒▒│ ▒▒▒▒▒▒▒┐ └▒▒▒▒▒▒┐ ▒▒│ ▒▒┐
└─┘ └─┘ └──────┘ └─────┘ └─┘ └─┘
$ dpkg-query -W qemu-system-x86
qemu-system-x86 1:7.2+dfsg-1+b2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux bookworm/sid
Release: n/a
Codename: bookworm
$ arch
x86_64