Repository navigation
feat(pkcl): POSIX 互換層 pkcl と、Foundation 上で動く BusyBox - #172
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY
src3453
force-pushed
the
claude/project-thread-t59cl1
branch
from
October 25, 2026 10:38
dc687d9 to
c86c585
Compare
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by src3453 · project thread
Closes #165
概要
Fuchsia の fdio のような POSIX のコンパイル時変換レイヤー pkcl(POSIX Kernel Compatibility Layer)の設計と実装、そして最終目標の BusyBox を Foundation 上で動かすところまでです。BusyBox は GPL-2.0 なのでリポジトリには含めず、
--busybox-sourceで外部ソースを指定してビルドします(Newlib も同様に--newlib-source)。doc/spec_pkcl.md: 設計と、BusyBox の取り込み・ビルド・サイズ制約・Newlib 統合の判断foundation/lib/pkcl/: fd 表と POSIX I/O・パス操作(M0)、newlib/に Newlib の OS 層アダプタ、posix/にDIR・termios・poll・ソケット失敗スタブ・プロセス/時刻/シグナルの縮退・ユーザー DB・fnmatchfoundation/include/pkcl-nolibc/,pkcl-posix/: libc なし用と、Newlib に足す POSIX ヘッダtools/pkcl/:busybox.py(ホストのmake V=1でコンパイルコマンドを集め、driver.pyで各ユニットを IR にして一度にリンク)、busybox.config、busybox_stubs.ctools/llvm-src32: Newlib のposixプロファイル(全 libc を一度 IR にして索引から必要分だけリンク)、-Os/-Oz、-std=gnu11、バックエンドにllvm.fshl/fshr・umul.with.overflow.i64・uadd.sat・get.roundingなどを追加foundation/tests/pkcl/test_busybox.py(SRC32_BUSYBOX_SOURCE/SRC32_NEWLIB_SOURCEを渡したときだけ走る)、test_toolchainに命令の単体テストを追加動作の確認
Foundation 上で
busybox echo、printf %d-%s/%5.2f、ls、cat、mkdir、basename、dirname、wc、test、sleepなどが動きます。busybox.waxは 1.04 MB(FND_EXEC_IMAGE_MAXの 1 MiB 未満)。まだ動かないもの
fork/vfork、pipe(G3)、setjmp/longjmp(G7)、環境変数(G2)、pid(G1)、シグナルの配送。ash/hush にはこれらが要るので、シェルは含めていません(doc/spec_pkcl.md§7、§10)。検証
実行した:
foundation/tests/pkcl(BusyBox 含む、Clang 20 / llvmlite 0.46)、tools/llvm-src32のtest_toolchain(50 件)とtest_newlib(外部 Newlib あり)。Rust 全体のテストと Foundation 全体のシェルテストは実行していません。🤖 Generated with Claude Code
https://claude.ai/code/session_01FqgVXKR79fR8rybAwBZ2fY