feat: D4 DKM colored log prefixes - every driver has its own temper

- log.c: color context (log_set_color / log_color_enable); ANSI only goes to serial, BOOTLOG.TXT buffer stays clean plain text
- kernel_api.c: dkm_log_set_driver() — driver-name FNV-1a hash into an 8-color bright ANSI palette, deterministic per driver
- load sites (dkm_core builtin + boot_modules external) set color around driver_init and clear after
- FUCK [debug] color_log gate (dev=1, release=0)
- QEMU verified: 1150 colored lines, per-driver stable colors (.build_tmp/qemu_serial_d4color.log)
This commit is contained in:
Linehu
2026-10-02 19:48:54 +08:00
parent 068e0e37c3
commit 3aa15e7b21
22 changed files with 130 additions and 9 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ Deshab 最标志性的疯点——给空气上锁。
| D1 | DKM 热卸载(基础) | 从"焊死"到"可拔" | ⬜ | 仅有 `DKM_F_NO_UNLOAD` 标志与状态机文档;需引用计数+资源回收,load/unload 循环 100 次不崩 |
| D2 | 裸机器码加载器 | 真·无限自由 | ⬜ | 任意 elf/裸码塞地址即执行;能打印、能崩内核 |
| D3 | 内核 API 导出表 | 自由也要有地图 | ⬜ | 当前为固定偏移 struct ABI(`CODE/sdk/include/deshab/kernel_api.h`);需按名导出表 kapi() |
| D4 | DKM 彩色日志前缀 | 每个驱动有自己的脾气 | ⬜ | 加载时自选颜色;日志一眼看出是谁在骂 |
| D4 | DKM 彩色日志前缀 | 每个驱动有自己的脾气 | ✅ | 驱动名 FNV hash → 8 色 ANSI(确定性可复现);init 期着色,仅串口;FUCK `color_log` 开关 |
| D5 | 最小 REPL/shell | 自由的交互面 | ✅ | shell.elf:ls/cat/cp/mv/rm/run/probe/test/pci 等 25+ 命令 |
三期做完:用户能真在系统里"为所欲为",疯得可上手。
+1 -1
View File
@@ -45,7 +45,7 @@
| virtio_net | 🔶 | PCI/capability 枚举,无 virtqueue | — |
| 热卸载(D1) | ⬜ | 仅有 NO_UNLOAD 标志与状态机文档 | — |
| 按名 API 导出表(D3) | ⬜ | 固定偏移 struct ABI | `CODE/sdk/include/deshab/kernel_api.h` |
| 彩色日志(D4) | ⬜ | 仅 info/warn/error/panic | — |
| 彩色日志(D4) | ✅ | `dkm_log_set_driver`(驱动名 FNV hash → 8 色调色板,确定可复现);init 期间驱动日志带 ANSI 色(仅串口,BOOTLOG 纯文本);FUCK `[debug] color_log` 总开关 | `.build_tmp/qemu_serial_d4color.log`(1150 彩色行) |
## DSK 主内核 / 用户态
+1 -1
View File
@@ -25,7 +25,7 @@
- [ ] D1 DKM 热卸载(引用计数 + 资源回收,循环 100 次不崩)
- [ ] D2 裸机器码加载器
- [ ] D3 内核 API 按名导出表(kapi())
- [ ] D4 DKM 彩色日志前缀
- [x] D4 DKM 彩色日志前缀(驱动名 hash → 8 色 ANSI,init 期着色,BOOTLOG 保持纯文本)
## ⏪ 四期:落款(DRR/PCQ)