refactor: move the native devkit from 0:/usr to 0:/sdk (Montauk SDK)

0:/usr was a Unix transplant in an otherwise Montauk-native layout.
The SDK now lives at 0:/sdk/{bin,include,lib} (+ ldscripts under
0:/sdk/x86_64-montauk): Montauk-flavored, and a clean unit for a
future per-component installer tickbox. Native binutils is rebuilt
with --prefix=/sdk so ld's compiled-in search paths follow; future
ports configure with --prefix=/sdk.

Also add pathconf() with _PC_* names to the libc: now that realpath
exists, libiberty's lrealpath.c compiles its pathconf fallback path
unconditionally.

Shell command resolution and tab completion updated to 0:/sdk/bin.
Boot-verified in QEMU: setup, login, desktop on the new image with
zero usr/ remnants in the ramdisk.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-15 09:11:05 +02:00
co-authored by Claude Fable 5
parent 1f271b3ba8
commit 54c0584b85
11 changed files with 53 additions and 29 deletions
+17 -16
View File
@@ -377,30 +377,31 @@ $(BINDIR)/os/%.elf: src/%/main.cpp link.ld GNUmakefile
$(CXX) $(CXXFLAGS) $(LDFLAGS) obj/$*/main.o lib/libc/liblibc.a -o $@
# ============================================================================
# Native development kit: binutils built for MontaukOS plus a target
# sysroot (headers, libc.a, crt objects) under 0:/usr. Skipped when the
# native tools have not been built; see toolchain/README.md.
# Native development kit (Montauk SDK): binutils built for MontaukOS
# plus a target sysroot (headers, libc.a, crt objects) under 0:/sdk.
# Skipped when the native tools have not been built; see
# toolchain/README.md.
# ============================================================================
NATIVE_BIN := ../toolchain/native/usr/bin
NATIVE_BIN := ../toolchain/native/sdk/bin
DEVKIT_TOOLS := as ld ar nm objcopy objdump readelf ranlib strip size strings addr2line c++filt elfedit
.PHONY: devkit
devkit: libc
ifneq ($(wildcard $(NATIVE_BIN)/as),)
rm -rf $(BINDIR)/usr
mkdir -p $(BINDIR)/usr/bin $(BINDIR)/usr/lib $(BINDIR)/usr/include
rm -rf $(BINDIR)/sdk
mkdir -p $(BINDIR)/sdk/bin $(BINDIR)/sdk/lib $(BINDIR)/sdk/include
for t in $(DEVKIT_TOOLS); do \
cp $(NATIVE_BIN)/$$t $(BINDIR)/usr/bin/$$t.elf || exit 1; \
cp $(NATIVE_BIN)/$$t $(BINDIR)/sdk/bin/$$t.elf || exit 1; \
done
cp -r ../toolchain/native/usr/x86_64-montauk $(BINDIR)/usr/x86_64-montauk
cp -r include/libc/. $(BINDIR)/usr/include/
cp -r include/montauk $(BINDIR)/usr/include/montauk
cp -r include/Api $(BINDIR)/usr/include/Api
cp -r ../kernel/freestnd-cxx-hdrs/x86_64/include/. $(BINDIR)/usr/include/
cp lib/libc/liblibc.a $(BINDIR)/usr/lib/libc.a
cp lib/libc/crt1.o lib/libc/crti.o lib/libc/crtn.o $(BINDIR)/usr/lib/
ar rcs $(BINDIR)/usr/lib/libm.a
ar rcs $(BINDIR)/usr/lib/libstdc++.a
cp -r ../toolchain/native/sdk/x86_64-montauk $(BINDIR)/sdk/x86_64-montauk
cp -r include/libc/. $(BINDIR)/sdk/include/
cp -r include/montauk $(BINDIR)/sdk/include/montauk
cp -r include/Api $(BINDIR)/sdk/include/Api
cp -r ../kernel/freestnd-cxx-hdrs/x86_64/include/. $(BINDIR)/sdk/include/
cp lib/libc/liblibc.a $(BINDIR)/sdk/lib/libc.a
cp lib/libc/crt1.o lib/libc/crti.o lib/libc/crtn.o $(BINDIR)/sdk/lib/
ar rcs $(BINDIR)/sdk/lib/libm.a
ar rcs $(BINDIR)/sdk/lib/libstdc++.a
else
@echo "devkit: toolchain/native/ not built; skipping native dev tools"
endif